2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUiEffects_RendererRendererGeometry.h
19 * @brief This is the header file for the RendererGeometry class
22 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_RENDERERGEOMETRY_H_
23 #define _FUI_EFFECTS_INTERNAL_RENDERER_RENDERERGEOMETRY_H_
25 #include <renderer/engine-model/FUiEffects_RendererEngineModelAabb.h>
26 #include <renderer/system/FUiEffects_RendererSystemData.h>
27 #include <renderer/engine-model/FUiEffects_RendererEngineModelBuffer.h>
28 #include <renderer/engine-model/FUiEffects_RendererEngineModelGeometry.h>
29 #include <renderer/system/FUiEffects_RendererSystemSmartPtr.h>
31 #include <FUiEffects_RuntimeRenderDataSurface.h>
33 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer
37 * @class RendererGeometry
38 * @brief Class for renderer object geometry. Holds pointers to pData locations in memory.
41 class RendererGeometry
42 : public EngineModel::Geometry
49 RendererGeometry(void);
55 ~RendererGeometry(void);
57 EngineModel::BufferPtr GetBuffer(const std::string& aName) const;
59 EngineModel::BufferPtr GetIndexBuffer(void) const
61 return __indexTriangles;
64 EngineModel::IndexBuffer::PrimitiveType::Value GetPrimitiveType(void) const
66 return __indexTriangles->GetPrimitiveType();
69 const EngineModel::Aabb& GetBoundBox(void) const
76 * Set vertex pData pointer
78 * @param [in] newdata Vertex pData
82 void SetVertData(Tizen::Ui::Effects::_Runtime::VertexDataCollection& newdata)
84 __composite->pData = &newdata;
85 InvalidateVertexData();
92 * Set indices pData pointer
94 * @param [in] newdata Indices pData
98 void SetIndices(Tizen::Ui::Effects::_Runtime::IndicesCollection& newdata)
100 __indexTriangles->pData = &newdata;
108 * Invalidates vertex pData
112 void InvalidateVertexData(void)
114 if (__composite->GetCache() != 0)
116 __composite->GetCache()->Invalidate();
124 * Invalidates indices pData
128 void InvalidateIndices(void)
130 if(__indexTriangles->GetCache() != 0)
132 __indexTriangles->GetCache()->Invalidate();
141 * Hidden copy constructor
143 RendererGeometry(const RendererGeometry &rhs);
147 * Hidden assignment operator
149 RendererGeometry& operator=(const RendererGeometry &rhs);
152 class _Buffer_UShortIndex
153 : public EngineModel::IndexBuffer
156 _Buffer_UShortIndex(void)
161 ~_Buffer_UShortIndex(void)
165 EngineModel::TypedBufferStrategy::DataType::Value GetDataType(void) const
167 return EngineModel::TypedBufferStrategy::DataType::UNSIGNED_SHORT;
175 size_t GetSize(void) const
177 return pData->size() * sizeof(Tizen::Ui::Effects::_Runtime::IndicesCollection::value_type);
180 EngineModel::SolidBufferStrategy::BufferUsage::Value GetUsage(void) const
182 return EngineModel::SolidBufferStrategy::BufferUsage::STATIC_DRAW;
185 EngineModel::IndexBuffer::PrimitiveType::Value GetPrimitiveType(void) const
187 return EngineModel::IndexBuffer::PrimitiveType::TRIANGLES;
190 Tizen::Ui::Effects::_Runtime::IndicesCollection* pData;
192 typedef System::SmartPtr<_Buffer_UShortIndex> Buffer_UIntIndexPtr;
194 class _Buffer_CompositeFloatVertex
195 : public EngineModel::CompositeVertexBuffer
198 _Buffer_CompositeFloatVertex(void)
203 ~_Buffer_CompositeFloatVertex(void)
207 EngineModel::TypedBufferStrategy::DataType::Value GetDataType(void) const
209 return EngineModel::TypedBufferStrategy::DataType::FLOAT;
217 size_t GetSize(void) const
219 return pData->size() * sizeof(Tizen::Ui::Effects::_Runtime::VertexData);
222 EngineModel::SolidBufferStrategy::BufferUsage::Value GetUsage(void) const
224 return EngineModel::SolidBufferStrategy::BufferUsage::DYNAMIC_DRAW;
227 Tizen::Ui::Effects::_Runtime::VertexDataCollection* pData;
229 typedef System::SmartPtr<_Buffer_CompositeFloatVertex> Buffer_CompositeFloatVertexPtr;
232 class _Buffer_VertexAttribute
233 : public EngineModel::PartVertexBuffer
236 _Buffer_VertexAttribute(EngineModel::CompositeVertexBufferPtr aBuffer, size_t aComponents, size_t aOffset, size_t aStride):
237 __stride(aStride), __offset(aOffset), __components(aComponents), __buffer(aBuffer)
241 ~_Buffer_VertexAttribute(void)
245 EngineModel::TypedBufferStrategy::DataType::Value GetDataType(void) const
247 return __buffer->GetDataType();
250 size_t GetStride(void) const
255 size_t GetOffset(void) const
260 EngineModel::CompositeVertexBufferPtr GetCompositeBuffer(void) const
265 size_t GetComponentsPerElement(void) const
274 EngineModel::CompositeVertexBufferPtr __buffer;
276 typedef System::SmartPtr<_Buffer_VertexAttribute> Buffer_VertexAttributePtr;
280 Buffer_CompositeFloatVertexPtr __composite;
281 Buffer_VertexAttributePtr __partVertex;
282 Buffer_VertexAttributePtr __partNormal;
283 Buffer_VertexAttributePtr __partTexCoords;
284 Buffer_UIntIndexPtr __indexTriangles;
286 EngineModel::Aabb __bBox;
290 typedef System::SmartPtr<RendererGeometry> RendererGeometryPtr;
292 } } } } // Tizen::Ui::Effects::_EffectRenderer
294 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_RENDERERGEOMETRY_H_