1 #ifndef DALI_INTERNAL_GEOMETRY_H
2 #define DALI_INTERNAL_GEOMETRY_H
5 * Copyright (c) 2016 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/public-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
32 #include <dali/internal/render/renderers/render-geometry.h>
44 typedef IntrusivePtr<Geometry> GeometryPtr;
47 * Geometry is an object that contains an array of structures of values that
48 * can be accessed as properties.
50 class Geometry : public BaseObject
55 * Create a new Geometry.
56 * @return A smart-pointer to the newly allocated Geometry.
58 static GeometryPtr New();
61 * @copydoc Dali::Geometry::AddVertexBuffer()
63 std::size_t AddVertexBuffer( PropertyBuffer& vertexBuffer );
66 * @copydoc Dali::Geometry::GetNumberOfVertexBuffers()
68 std::size_t GetNumberOfVertexBuffers() const;
71 * @copydoc Dali::Geometry::RemoveVertexBuffer()
73 void RemoveVertexBuffer( std::size_t index );
76 * @copydoc Dali::Geometry::SetIndexBuffer()
78 void SetIndexBuffer( const unsigned short* indices, size_t count );
81 * @copydoc Dali::Geometry::SetType()
83 void SetType( Dali::Geometry::Type geometryType );
86 * @copydoc Dali::Geometry::GetType()
88 Dali::Geometry::Type GetType() const;
91 * @brief Get the geometry scene object
93 * @return the geometry scene object
95 const Render::Geometry* GetRenderObject() const;
97 private: // implementation
105 * Second stage initialization of the Geometry
112 * A reference counted object may only be deleted by calling Unreference()
116 private: // unimplemented methods
117 Geometry( const Geometry& );
118 Geometry& operator=( const Geometry& );
122 EventThreadServices& mEventThreadServices; ///<Used to send messages to the render thread via update thread
123 Render::Geometry* mRenderObject;
125 std::vector<PropertyBufferPtr> mVertexBuffers; ///< Vector of intrusive pointers to vertex buffers
126 Dali::Geometry::Type mType; ///< Geometry type (cached)
129 } // namespace Internal
131 // Helpers for public-api forwarding methods
132 inline Internal::Geometry& GetImplementation(Dali::Geometry& handle)
134 DALI_ASSERT_ALWAYS(handle && "Geometry handle is empty");
136 BaseObject& object = handle.GetBaseObject();
138 return static_cast<Internal::Geometry&>(object);
141 inline const Internal::Geometry& GetImplementation(const Dali::Geometry& handle)
143 DALI_ASSERT_ALWAYS(handle && "Geometry handle is empty");
145 const BaseObject& object = handle.GetBaseObject();
147 return static_cast<const Internal::Geometry&>(object);
152 #endif // DALI_INTERNAL_GEOMETRY_H