1 #ifndef DALI_INTERNAL_SAMPLER_H
2 #define DALI_INTERNAL_SAMPLER_H
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
23 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
24 #include <dali/public-api/shader-effects/sampler.h> // Dali::Sampler
25 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
26 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
27 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
28 #include <dali/internal/event/images/image-connector.h> // Dali::Internal::ImageConnector
40 typedef IntrusivePtr<Sampler> SamplerPtr;
43 * Sampler is an object that contains an array of structures of values that
44 * can be accessed as properties.
46 class Sampler : public Object, public Connectable
51 * Create a new Sampler.
52 * @return A smart-pointer to the newly allocated Sampler.
54 static SamplerPtr New( const std::string& textureUnitUniformName );
57 * @copydoc Dali::Sampler::SetUniformName()
59 void SetUniformName( const std::string& name );
62 * @copydoc Dali::Sampler::SetImage()
64 void SetImage( Image& image );
67 * @copydoc Dali::Sampler::SetFilterMode()
69 void SetFilterMode( Dali::Sampler::FilterMode minFilter, Dali::Sampler::FilterMode magFilter );
72 * @copydoc Dali::Sampler::SetWrapMode()
74 void SetWrapMode( Dali::Sampler::WrapMode uWrap, Dali::Sampler::WrapMode vWrap );
77 * @copydoc Dali::Sampler::SetAffectsTransparency()
79 void SetAffectsTransparency( bool affectsTransparency );
82 * @brief Get the sampler scene object
84 * @return the sampler scene object
86 const SceneGraph::Sampler* GetSamplerSceneObject() const;
88 public: // Default property extensions from Object
91 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
93 virtual unsigned int GetDefaultPropertyCount() const;
96 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
98 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
101 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
103 virtual const char* GetDefaultPropertyName(Property::Index index) const;
106 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
108 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
111 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
113 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
116 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
118 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
121 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
123 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
126 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
128 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
131 * @copydoc Dali::Internal::Object::SetDefaultProperty()
133 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
136 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
138 virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
141 * @copydoc Dali::Internal::Object::GetDefaultProperty()
143 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
146 * @copydoc Dali::Internal::Object::GetPropertyOwner()
148 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
151 * @copydoc Dali::Internal::Object::GetSceneObject()
153 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
156 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
158 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
161 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
163 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
166 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
168 virtual int GetPropertyComponentIndex( Property::Index index ) const;
170 public: // Functions from Connectable
172 * @copydoc Dali::Internal::Connectable::OnStage()
174 virtual bool OnStage() const;
177 * @copydoc Dali::Internal::Connectable::Connect()
179 virtual void Connect();
182 * @copydoc Dali::Internal::Connectable::Disconnect()
184 virtual void Disconnect();
190 * Second stage initialization
192 void Initialize( const std::string& textureUnitUniformName );
196 //TODO: MESH_REWORK : change to ObjectConnector
197 ImageConnector mImageConnector;
198 SceneGraph::Sampler* mSceneObject;
202 } // namespace Internal
204 // Helpers for public-api forwarding methods
205 inline Internal::Sampler& GetImplementation(Dali::Sampler& handle)
207 DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
209 BaseObject& object = handle.GetBaseObject();
211 return static_cast<Internal::Sampler&>(object);
214 inline const Internal::Sampler& GetImplementation(const Dali::Sampler& handle)
216 DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
218 const BaseObject& object = handle.GetBaseObject();
220 return static_cast<const Internal::Sampler&>(object);
225 #endif // DALI_INTERNAL_SAMPLER_H