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/devel-api/rendering/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 SetTextureUnitUniformName( const std::string& name );
62 * @copydoc Dali::Sampler::SetImage()
64 void SetImage( ImagePtr& image );
67 * @copydoc Dali::Sampler::GetImage()
69 ImagePtr GetImage() const;
72 * @copydoc Dali::Sampler::SetFilterMode()
74 void SetFilterMode( Dali::Sampler::FilterMode minFilter, Dali::Sampler::FilterMode magFilter );
77 * @copydoc Dali::Sampler::SetWrapMode()
79 void SetWrapMode( Dali::Sampler::WrapMode uWrap, Dali::Sampler::WrapMode vWrap );
82 * @copydoc Dali::Sampler::SetAffectsTransparency()
84 void SetAffectsTransparency( bool affectsTransparency );
87 * @brief Get the sampler scene object
89 * @return the sampler scene object
91 const SceneGraph::Sampler* GetSamplerSceneObject() const;
93 public: // Default property extensions from Object
96 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
98 virtual unsigned int GetDefaultPropertyCount() const;
101 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
103 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
106 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
108 virtual const char* GetDefaultPropertyName(Property::Index index) const;
111 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
113 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
116 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
118 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
121 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
123 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
126 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
128 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
131 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
133 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
136 * @copydoc Dali::Internal::Object::SetDefaultProperty()
138 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
141 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
143 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
146 * @copydoc Dali::Internal::Object::GetDefaultProperty()
148 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
151 * @copydoc Dali::Internal::Object::GetPropertyOwner()
153 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
156 * @copydoc Dali::Internal::Object::GetSceneObject()
158 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
161 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
163 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
166 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
168 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
171 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
173 virtual int GetPropertyComponentIndex( Property::Index index ) const;
175 public: // Functions from Connectable
177 * @copydoc Dali::Internal::Connectable::OnStage()
179 virtual bool OnStage() const;
182 * @copydoc Dali::Internal::Connectable::Connect()
184 virtual void Connect();
187 * @copydoc Dali::Internal::Connectable::Disconnect()
189 virtual void Disconnect();
195 * Second stage initialization
197 void Initialize( const std::string& textureUnitUniformName );
201 * A reference counted object may only be deleted by calling Unreference()
206 //TODO: MESH_REWORK : change to ObjectConnector
207 ImageConnector mImageConnector;
208 SceneGraph::Sampler* mSceneObject;
212 } // namespace Internal
214 // Helpers for public-api forwarding methods
215 inline Internal::Sampler& GetImplementation(Dali::Sampler& handle)
217 DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
219 BaseObject& object = handle.GetBaseObject();
221 return static_cast<Internal::Sampler&>(object);
224 inline const Internal::Sampler& GetImplementation(const Dali::Sampler& handle)
226 DALI_ASSERT_ALWAYS(handle && "Sampler handle is empty");
228 const BaseObject& object = handle.GetBaseObject();
230 return static_cast<const Internal::Sampler&>(object);
235 #endif // DALI_INTERNAL_SAMPLER_H