1 #ifndef DALI_INTERNAL_RENDERER_H
2 #define DALI_INTERNAL_RENDERER_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/renderer.h> // Dali::Renderer
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/rendering/material-impl.h> // Dali::Internal::Material
29 #include <dali/internal/event/rendering/geometry-impl.h> // Dali::Internal::Geometry
37 class RendererAttachment;
41 typedef IntrusivePtr<Renderer> RendererPtr;
44 * Renderer is an object that can be used to show content by combining a Geometry with a material.
46 class Renderer : public Object, public Connectable
51 * Create a new Renderer.
52 * @return A smart-pointer to the newly allocated Renderer.
54 static RendererPtr New();
57 * @copydoc Dali::Renderer::SetGeometry()
59 void SetGeometry( Geometry& geometry );
62 * @copydoc Dali::Renderer::GetGeometry()
64 Geometry* GetGeometry() const;
67 * @copydoc Dali::Renderer::SetMaterial()
69 void SetMaterial( Material& material );
72 * @copydoc Dali::Renderer::GetMaterial()
74 Material* GetMaterial() const;
77 * @copydoc Dali::Renderer::SetDepthIndex()
79 void SetDepthIndex( int depthIndex );
82 * @copydoc Dali::Renderer::GetDepthIndex()
84 int GetDepthIndex() const;
87 * @brief Get the scene graph object ( the node attachment )
89 * @return the scene object
91 SceneGraph::RendererAttachment* GetRendererSceneObject();
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();
191 private: // implementation
198 * A reference counted object may only be deleted by calling Unreference()
202 private: // unimplemented methods
203 Renderer( const Renderer& );
204 Renderer& operator=( const Renderer& );
207 SceneGraph::RendererAttachment* mSceneObject;
208 ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
209 ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
214 } // namespace Internal
216 // Helpers for public-api forwarding methods
217 inline Internal::Renderer& GetImplementation( Dali::Renderer& handle )
219 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
221 BaseObject& object = handle.GetBaseObject();
223 return static_cast<Internal::Renderer&>(object);
226 inline const Internal::Renderer& GetImplementation( const Dali::Renderer& handle )
228 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
230 const BaseObject& object = handle.GetBaseObject();
232 return static_cast<const Internal::Renderer&>(object);
237 #endif // DALI_INTERNAL_RENDERER_H