1 #ifndef DALI_INTERNAL_GEOMETRY_H
2 #define DALI_INTERNAL_GEOMETRY_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/vector-wrapper.h> // std::vector
25 #include <dali/public-api/common/dali-common.h> // DALI_ASSERT_ALWAYS
26 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
27 #include <dali/devel-api/rendering/geometry.h> // Dali::Geometry
28 #include <dali/internal/event/common/connectable.h> // Dali::Internal::Connectable
29 #include <dali/internal/event/common/object-connector.h> // Dali::Internal::ObjectConnector
30 #include <dali/internal/event/common/object-impl.h> // Dali::Internal::Object
31 #include <dali/internal/event/common/property-buffer-impl.h> // Dali::Internal::PropertyBuffer
43 typedef IntrusivePtr<Geometry> GeometryPtr;
46 * Geometry is an object that contains an array of structures of values that
47 * can be accessed as properties.
49 class Geometry : public Object, public Connectable
54 * Create a new Geometry.
55 * @return A smart-pointer to the newly allocated Geometry.
57 static GeometryPtr New();
60 * @copydoc Dali::Geometry::AddVertexBuffer()
62 std::size_t AddVertexBuffer( PropertyBuffer& vertexBuffer );
65 * @copydoc Dali::Geometry::GetNumberOfVertexBuffers()
67 std::size_t GetNumberOfVertexBuffers() const;
70 * @copydoc Dali::Geometry::RemoveVertexBuffer()
72 void RemoveVertexBuffer( std::size_t index );
75 * @copydoc Dali::Geometry::SetIndexBuffer()
77 void SetIndexBuffer( PropertyBuffer& indexBuffer );
80 * @copydoc Dali::Geometry::SetGeometryType()
82 void SetGeometryType( Dali::Geometry::GeometryType geometryType );
85 * @copydoc Dali::Geometry::GetGeometryType()
87 Dali::Geometry::GeometryType GetGeometryType() const;
90 * @copydoc Dali::Geometry::SetRequiresDepthTesting()
92 void SetRequiresDepthTesting( bool requiresDepthTest );
95 * @copydoc Dali::Geometry::GetRequiresDepthTesting()
97 bool GetRequiresDepthTesting() const;
100 * @brief Get the geometry scene object
102 * @return the geometry scene object
104 const SceneGraph::Geometry* GetGeometrySceneObject() const;
106 public: // Default property extensions from Object
109 * @copydoc Dali::Internal::Object::GetDefaultPropertyCount()
111 virtual unsigned int GetDefaultPropertyCount() const;
114 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndices()
116 virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
119 * @copydoc Dali::Internal::Object::GetDefaultPropertyName()
121 virtual const char* GetDefaultPropertyName(Property::Index index) const;
124 * @copydoc Dali::Internal::Object::GetDefaultPropertyIndex()
126 virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
129 * @copydoc Dali::Internal::Object::IsDefaultPropertyWritable()
131 virtual bool IsDefaultPropertyWritable(Property::Index index) const;
134 * @copydoc Dali::Internal::Object::IsDefaultPropertyAnimatable()
136 virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
139 * @copydoc Dali::Internal::Object::IsDefaultPropertyAConstraintInput()
141 virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
144 * @copydoc Dali::Internal::Object::GetDefaultPropertyType()
146 virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
149 * @copydoc Dali::Internal::Object::SetDefaultProperty()
151 virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
154 * @copydoc Dali::Internal::Object::SetSceneGraphProperty()
156 virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value );
159 * @copydoc Dali::Internal::Object::GetDefaultProperty()
161 virtual Property::Value GetDefaultProperty( Property::Index index ) const;
164 * @copydoc Dali::Internal::Object::GetPropertyOwner()
166 virtual const SceneGraph::PropertyOwner* GetPropertyOwner() const;
169 * @copydoc Dali::Internal::Object::GetSceneObject()
171 virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
174 * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
176 virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
179 * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
181 virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
184 * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
186 virtual int GetPropertyComponentIndex( Property::Index index ) const;
188 public: // Functions from Connectable
190 * @copydoc Dali::Internal::Connectable::OnStage()
192 virtual bool OnStage() const;
195 * @copydoc Dali::Internal::Connectable::Connect()
197 virtual void Connect();
200 * @copydoc Dali::Internal::Connectable::Disconnect()
202 virtual void Disconnect();
204 private: // implementation
208 * Second stage initialization of the Geometry
214 * A reference counted object may only be deleted by calling Unreference()
218 private: // unimplemented methods
219 Geometry( const Geometry& );
220 Geometry& operator=( const Geometry& );
224 std::vector<PropertyBufferPtr> mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers
225 PropertyBufferPtr mIndexBuffer; ///< Intrusive pointer to index buffer
226 SceneGraph::Geometry* mSceneObject;
230 } // namespace Internal
232 // Helpers for public-api forwarding methods
233 inline Internal::Geometry& GetImplementation(Dali::Geometry& handle)
235 DALI_ASSERT_ALWAYS(handle && "Geometry handle is empty");
237 BaseObject& object = handle.GetBaseObject();
239 return static_cast<Internal::Geometry&>(object);
242 inline const Internal::Geometry& GetImplementation(const Dali::Geometry& handle)
244 DALI_ASSERT_ALWAYS(handle && "Geometry handle is empty");
246 const BaseObject& object = handle.GetBaseObject();
248 return static_cast<const Internal::Geometry&>(object);
253 #endif // DALI_INTERNAL_GEOMETRY_H