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/actors/renderer.h> // Dali::Renderer
23 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
24 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
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/effects/material-impl.h> // Dali::Internal::Material
29 #include <dali/internal/event/geometry/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::SetMaterial()
64 void SetMaterial( Material& material );
67 * @copydoc Dali::Renderer::SetDepthIndex()
69 void SetDepthIndex( int depthIndex );
72 * @brief Get the scene graph object ( the node attachment )
74 * @return the scene object
76 SceneGraph::RendererAttachment* GetRendererSceneObject();
78 public: // Default property extensions from Object
81 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
83 virtual unsigned int GetDefaultPropertyCount() const;
86 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
88 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
91 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
93 virtual const char* GetDefaultPropertyName(Property::Index index) const;
96 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
98 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
101 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
103 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
106 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
108 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
111 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
113 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
116 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
118 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
121 * @copydoc Dali::Internal::Object::SetDefaultProperty()
123 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
126 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
128 virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
131 * @copydoc Dali::Internal::Object::GetDefaultProperty()
133 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
136 * @copydoc Dali::Internal::Object::GetPropertyOwner()
138 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
141 * @copydoc Dali::Internal::Object::GetSceneObject()
143 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
146 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
148 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
151 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
153 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
156 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
158 virtual int GetPropertyComponentIndex( Property::Index index ) const;
160 public: // Functions from Connectable
162 * @copydoc Dali::Internal::Connectable::OnStage()
164 virtual bool OnStage() const;
167 * @copydoc Dali::Internal::Connectable::Connect()
169 virtual void Connect();
172 * @copydoc Dali::Internal::Connectable::Disconnect()
174 virtual void Disconnect();
176 private: // implementation
181 private: // unimplemented methods
182 Renderer( const Renderer& );
183 Renderer& operator=( const Renderer& );
186 SceneGraph::RendererAttachment* mSceneObject;
187 ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
188 ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
192 } // namespace Internal
194 // Helpers for public-api forwarding methods
195 inline Internal::Renderer& GetImplementation( Dali::Renderer& handle )
197 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
199 BaseObject& object = handle.GetBaseObject();
201 return static_cast<Internal::Renderer&>(object);
204 inline const Internal::Renderer& GetImplementation( const Dali::Renderer& handle )
206 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
208 const BaseObject& object = handle.GetBaseObject();
210 return static_cast<const Internal::Renderer&>(object);
215 #endif // DALI_INTERNAL_RENDERER_H