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_RuntimeModelSurface.h
19 * @brief This is the header file for the ModelSurface class.
22 #ifndef _FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_SURFACE_H_
23 #define _FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_SURFACE_H_
26 #include <FUiEffects_PeElementSurface.h>
27 #include "FUiEffects_RuntimeEffectModel.h"
28 #include "FUiEffects_RuntimeRenderDataSurface.h"
30 namespace Tizen { namespace Ui { namespace Effects { namespace _PhysicsEngine
35 } } } } // Tizen::Ui::Effects:_PhysicsEngine
37 namespace Tizen { namespace Ui { namespace Effects { namespace _Runtime
40 class GraphicalSurface;
43 * The list type for storing ElementSurface pointers.
48 typedef std::list<Tizen::Ui::Effects::_PhysicsEngine::ElementSurface*> TypeElemSurfaceCollection;
51 * The list type for storing PointSurface pointers.
56 typedef std::list<Tizen::Ui::Effects::_PhysicsEngine::PointSurface*> TypePointSurfaceCollection;
59 * The list type for storing SpringSurface pointers.
64 typedef std::list<Tizen::Ui::Effects::_PhysicsEngine::SpringSurface*> TypeSpringSurfaceCollection;
67 * The list type for storing RodSurface pointers.
72 typedef std::list<Tizen::Ui::Effects::_PhysicsEngine::RodSurface*> TypeRodSurfaceCollection;
74 struct ElementsSurfaceContainerDeleter
76 void operator()(TypeElemSurfaceCollection* pElemSurfaceCollection);
81 * @brief This class contains one 3D object
86 : public ::Tizen::Ui::Effects::_PhysicsEngine::ElementSurface
90 * ModelSurface class constructor
95 ModelSurface(long objId,
96 unsigned short iterationCount_,
97 unsigned short modelSpeed_,
99 const Tizen::Ui::Effects::_Utils::Vec3f &gravityAccelerationIdentity_,
100 float gravityAccelerationValue_,
104 * ModelSurface class destructor
109 virtual ~ModelSurface(void);
112 * Sends to all element surfaces event Calculate
117 virtual void Calculate(float timeStep);
120 * Returns specified property value of any type (see class PropertyCast)
125 virtual PropertyCast GetProperty(ElementProperty propName) const;
128 * Sets ModelSurface's property which is specified in enumeration ElementProperty
134 virtual bool SetProperty(ElementProperty propName, bool propValue);
137 * Sets ModelSurface's property which is specified in enumeration ElementProperty
138 * of floating point type (float or integer)
143 virtual bool SetProperty(ElementProperty propName, LUA_NUMBER propValue);
146 * Sets ModelSurface's property which is specified in enumeration ElementProperty
152 virtual bool SetProperty(ElementProperty propName, const Tizen::Ui::Effects::_Utils::Vec3f &propValue);
155 * Sets specified property value for group of elements
159 * @remarks Returns true if setting was successful and false otherwise
161 bool SetPropertyGroup(GroupElements group, ElementProperty property, LUA_NUMBER value);
164 * Sends event Initialize to all elements of the surface
169 virtual void Initialize(void);
177 virtual ESurface GetType(void) const;
180 * GraphicalSurface object assigning during register effect file procedure
185 void AddGraphicalSurface(std::unique_ptr<GraphicalSurface> pGraphicalSurface);
188 * ElementSurface object addition during register effect file procedure
193 void AddElementSurface(::Tizen::Ui::Effects::_PhysicsEngine::ElementSurface* pElementSurface);
196 * Constructs the elements map for fast searching object in EffectModel,
197 * constructs RenderDataSurfaceCollection object,
198 * links the ModelSurface and PointSurface instances
202 * @remarks Must be called after parser performing
204 bool Construct(TypeMapElements* pMapElements, TypeMapGSurface* pMapGSurface, RenderDataSurfaceCollection* pRenderDataSurfaceCollection);
207 * Transmits event UpdateGraphicalSurface from EffectModel to GraphicalSurface
211 * @remarks It is called from EffectModel by timer
212 * for building graphical points based on physical points
214 void UpdateGraphicalSurface(void);
217 * Calculates distance from this model surface to its ground level
222 float GetDistanceFromGround(void) const;
226 * Hidden copy constructor
231 ModelSurface(const ModelSurface& rhs);
234 * Hidden assignment operator
239 ModelSurface &operator=(const ModelSurface& rhs);
242 * Sets specified property value for group of elements
246 * @return Returns true if setting was successful and false otherwise
247 * @remarks Is needed for internal use only
249 template<typename T, typename TIter>
250 bool SetPropertyGroup(T* pDataPointer, ElementProperty property, LUA_NUMBER value);
254 std::unique_ptr<TypeElemSurfaceCollection, ElementsSurfaceContainerDeleter> __pElemSurfaceCollection; /**< collection of surface elements (3D object)*/
256 std::unique_ptr<GraphicalSurface> __pGraphicalSurface; /**< pointer to graphical surface*/
258 unsigned short __iterationCount; /**< number of iterations per one calculation event (no speed change, but more stability)*/
259 unsigned short __modelSpeed; /**< model speed as animation multiplier*/
261 float __envResistance; /**< environment resistance (for physics calculation)*/
262 Tizen::Ui::Effects::_Utils::Vec3f __gravityAccelerationIdentity; /**< identity vector (length of vector equals 1) of gravity acceleration (for physics calculation)*/
263 float __gravityAccelerationValue; /**< length of gravity acceleration vector (for physics calculation)*/
264 Tizen::Ui::Effects::_Utils::Vec3f __gravityAccelerationVector; /**< gravity acceleration vector (for physics calculation)*/
267 std::unique_ptr<TypePointSurfaceCollection> __pPointsCollection; /**< pointers collection to model surface points*/
268 std::unique_ptr<TypeSpringSurfaceCollection> __pSpringsCollection; /**< pointers collection to model surface springs*/
269 std::unique_ptr<TypeRodSurfaceCollection> __pRodsCollection; /**< pointers collection to model surface rods*/
273 } } } } // Tizen::Ui::Effects::_Runtime
275 #endif //_FUI_EFFECTS_INTERNAL_RUNTIME_MODEL_SURFACE_H_