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
30 #include <dali/internal/update/nodes/node.h>
43 typedef IntrusivePtr<Renderer> RendererPtr;
46 * Renderer is an object that can be used to show content by combining a Geometry with a material.
48 class Renderer : public Object
53 * Create a new Renderer.
54 * @return A smart-pointer to the newly allocated Renderer.
56 static RendererPtr New();
59 * @copydoc Dali::Renderer::SetGeometry()
61 void SetGeometry( Geometry& geometry );
64 * @copydoc Dali::Renderer::GetGeometry()
66 Geometry* GetGeometry() const;
69 * @copydoc Dali::Renderer::SetMaterial()
71 void SetMaterial( Material& material );
74 * @copydoc Dali::Renderer::GetMaterial()
76 Material* GetMaterial() const;
79 * @copydoc Dali::Renderer::SetDepthIndex()
81 void SetDepthIndex( int depthIndex );
84 * @copydoc Dali::Renderer::GetDepthIndex()
86 int GetDepthIndex() const;
89 * @brief Get the scene graph object ( the node attachment )
91 * @return the scene object
93 SceneGraph::Renderer* GetRendererSceneObject();
95 public: // Default property extensions from Object
98 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
100 virtual unsigned int GetDefaultPropertyCount() const;
103 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
105 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
108 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
110 virtual const char* GetDefaultPropertyName(Property::Index index) const;
113 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
115 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
118 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
120 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
123 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
125 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
128 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
130 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
133 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
135 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
138 * @copydoc Dali::Internal::Object::SetDefaultProperty()
140 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
143 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
145 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
148 * @copydoc Dali::Internal::Object::GetDefaultProperty()
150 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
153 * @copydoc Dali::Internal::Object::GetPropertyOwner()
155 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
158 * @copydoc Dali::Internal::Object::GetSceneObject()
160 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
163 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
165 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
168 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
170 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
173 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
175 virtual int GetPropertyComponentIndex( Property::Index index ) const;
177 public: // Functions from Connectable
179 * @copydoc Dali::Internal::Connectable::OnStage()
181 virtual bool OnStage() const;
184 * @copydoc Dali::Internal::Connectable::Connect()
186 virtual void Connect();
189 * @copydoc Dali::Internal::Connectable::Disconnect()
191 virtual void Disconnect();
193 private: // implementation
200 * A reference counted object may only be deleted by calling Unreference()
204 private: // unimplemented methods
205 Renderer( const Renderer& );
206 Renderer& operator=( const Renderer& );
209 SceneGraph::Renderer* mSceneObject;
210 ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
211 ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
216 } // namespace Internal
218 // Helpers for public-api forwarding methods
219 inline Internal::Renderer& GetImplementation( Dali::Renderer& handle )
221 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
223 BaseObject& object = handle.GetBaseObject();
225 return static_cast<Internal::Renderer&>(object);
228 inline const Internal::Renderer& GetImplementation( const Dali::Renderer& handle )
230 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
232 const BaseObject& object = handle.GetBaseObject();
234 return static_cast<const Internal::Renderer&>(object);
239 #endif // DALI_INTERNAL_RENDERER_H