1 #ifndef DALI_GEOMETRY_H
2 #define DALI_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 <cstddef> // std::size_t
25 #include <dali/public-api/object/handle.h> // Dali::Handle
26 #include <dali/public-api/object/property-buffer.h> // Dali::PropertyBuffer
27 #include <dali/public-api/object/property-index-ranges.h> // DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX
32 namespace Internal DALI_INTERNAL
38 * @brief Geometry is handle to an object that can be used to define a geometric elements.
40 class DALI_IMPORT_API Geometry : public Handle
56 * @brief An enumeration of properties belonging to the Geometry class.
62 GEOMETRY_TYPE = DEFAULT_DERIVED_HANDLE_PROPERTY_START_INDEX, ///< name "depth-index", type STRING
63 GEOMETRY_CENTER, ///< name "geometry-center", type VECTOR3
64 GEOMETRY_HALF_EXTENTS, ///< name "geometry-half-extents", type VECTOR3
65 REQUIRES_DEPTH_TEST, ///< name "requires-depth-testing", type BOOLEAN
70 * @brief Creates a new Geometry object
72 * @return An handle to a newly allocated Geometry
74 static Geometry New();
77 * @brief Default constructor, creates an empty handle
87 * @brief Copy constructor, creates a new handle to the same object
89 * @param[in] handle Handle to an object
91 Geometry( const Geometry& handle );
94 * @brief Assignment operator, changes this handle to point at the same object
96 * @param[in] handle Handle to an object
97 * @return Reference to the assigned object
99 Geometry& operator=( const Geometry& handle );
102 * @brief Add a PropertyBuffer to be used as source of geometry vertices
104 * @param[in] vertexBuffer PropertyBuffer to be used as source of geometry vertices
105 * @return Index of the newly added buffer, can be used with RemoveVertexBuffer to remove
106 * this buffer if no longer required
108 std::size_t AddVertexBuffer( PropertyBuffer& vertexBuffer );
111 * @brief Retrieve the number of vertex buffers that have been added to this geometry
113 * @return Number of vertex buffers that have been added to this geometry
115 std::size_t GetNumberOfVertexBuffers() const;
118 * @brief Remove a vertex buffer
120 * The index must be between 0 and GetNumberOfVertexBuffers()
122 * @param[in] index Index to the vertex buffer to remove
124 void RemoveVertexBuffer( std::size_t index );
127 * @brief Set a PropertyBuffer to be used as a source of indices for the geometry
129 * This buffer is required to have exactly one component and it must be of the type Property::INTEGER
131 * By setting this buffer the will case the geometry to be rendered using indices.
132 * To unset call SetIndexBuffer with an empty handle.
134 * @param[in] indexBuffer PropertyBuffer to be used as a source of indices for the geometry
136 void SetIndexBuffer( PropertyBuffer& indexBuffer );
139 * @brief Set the type of primitives this geometry contains
141 * @param[in] geometryType Type of primitives this geometry contains
143 void SetGeometryType( GeometryType geometryType );
146 * @brief Get the type of primitives this geometry contains
148 * Calling this function sets the property GEOMETRY_TYPE
150 * @return Type of primitives this geometry contains
152 GeometryType GetGeometryType() const;
155 * @brief Set if the geometry requires depth testing
157 * Should be set to true if this geometry has overlapping triangles in arbitrary order
159 * Calling this function is equivalent to setting the REQUIRES_DEPTH_TESTING property
161 * @param[in] requiresDepthTest Specifies if the geometry requires depth testing
163 void SetRequiresDepthTesting( bool requiresDepthTest );
166 * @brief Return if the geometry requires depth testing
168 * @return True if the geometry requires depth testing
170 bool GetRequiresDepthTesting() const;
174 * @brief The constructor
176 * @param [in] pointer A pointer to a newly allocated Geometry
178 explicit DALI_INTERNAL Geometry( Internal::Geometry* pointer );
183 #endif // DALI_GEOMETRY_H