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 );
71 public: // Default property extensions from Object
74 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
76 virtual unsigned int GetDefaultPropertyCount() const;
79 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
81 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
84 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
86 virtual const char* GetDefaultPropertyName(Property::Index index) const;
89 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
91 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
94 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
96 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
99 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
101 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
104 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
106 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
109 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
111 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
114 * @copydoc Dali::Internal::Object::SetDefaultProperty()
116 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
119 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
121 virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
124 * @copydoc Dali::Internal::Object::GetDefaultProperty()
126 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
129 * @copydoc Dali::Internal::Object::GetPropertyOwner()
131 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
134 * @copydoc Dali::Internal::Object::GetSceneObject()
136 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
139 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
141 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
144 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
146 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
149 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
151 virtual int GetPropertyComponentIndex( Property::Index index ) const;
153 public: // Functions from Connectable
155 * @copydoc Dali::Internal::Connectable::OnStage()
157 virtual bool OnStage() const;
160 * @copydoc Dali::Internal::Connectable::Connect()
162 virtual void Connect();
165 * @copydoc Dali::Internal::Connectable::Disconnect()
167 virtual void Disconnect();
169 private: // implementation
172 private: // unimplemented methods
173 Renderer( const Renderer& );
174 Renderer& operator=( const Renderer& );
177 SceneGraph::RendererAttachment* mSceneObject;
178 ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
179 ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
183 } // namespace Internal
185 // Helpers for public-api forwarding methods
186 inline Internal::Renderer& GetImplementation( Dali::Renderer& handle )
188 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
190 BaseObject& object = handle.GetBaseObject();
192 return static_cast<Internal::Renderer&>(object);
195 inline const Internal::Renderer& GetImplementation( const Dali::Renderer& handle )
197 DALI_ASSERT_ALWAYS(handle && "Renderer handle is empty");
199 const BaseObject& object = handle.GetBaseObject();
201 return static_cast<const Internal::Renderer&>(object);
206 #endif // DALI_INTERNAL_RENDERER_H