Project

General

Profile

SO3Engine
SO3Entity.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OpenSpace3D
4For the latest info, see http://www.openspace3d.com
5
6Copyright (c) 2012 I-maginer
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt
21
22-----------------------------------------------------------------------------
23*/
24
32#ifndef __SO3ENTITY_H__
33#define __SO3ENTITY_H__
34
37#include "SO3Utils/SO3Point.h"
38
39namespace SO3
40{
41
42class SEntity : public SNode, Ogre::Resource::Listener
43{
44public:
51protected:
52 Ogre::Entity* O3Entity;
54private:
55 std::string mGroupName;
56 typedef std::unordered_map<std::string, Ogre::ushort> PoseHandleList;
57 PoseHandleList poseHandleList;
58 bool mReleaseResource;
59 std::string mResourceName;
60 Ogre::MeshPtr mMesh;
61 bool mLoading;
62 int mNumLodLevel;
63
64public:
68 SEntity(SScene* parent, const std::string& groupName, const std::string& entityName, const std::string& meshName, bool loadInBackground = false);
69
73 SEntity(SScene* parent, const std::string& entityName, const std::string& groupName, Ogre::MeshPtr meshPointer);
74
78 SEntity(SScene* parent, const std::string& entityName, const EntityPrefabType& prefabType);
79
83 SEntity(SScene* parent, const std::string& groupName, const std::string& entityName, const SPointFloat& sizev, const SPointInt& seg, const SPointFloat& uv);
84
88 SEntity(SScene* parent, const std::string& groupName, const std::string& entityName, const float& radius, const int& rings, const int& segments);
89
93 SEntity(SScene* parent, const std::string& groupName, const std::string& entityName, const float& radius, const float& height, const int& segments);
94
98 SEntity(SScene* parent, const std::string& groupName, const std::string& entityName, const float& base, const float& bottom, const float& dist);
99
103 SEntity();
104
107 ~SEntity();
108
111 void LoadAsync();
112
115 void FinishAsync();
116
119 Ogre::Entity* getOgreEntityPointer();
120
124
127 std::string GetGroupName();
128
133 virtual void SetCastShadows(const bool& castShadows);
134
139 virtual bool GetCastShadows();
140
145 virtual void SetRenderingDistance(const float& distance);
146
151 virtual float GetRenderingDistance();
152
157 virtual Ogre::Vector3 GetBoundingBoxSize(const bool& childs = false);
158
163 virtual Ogre::Vector3 GetBoundingBoxCenter(const bool& childs = false);
164
169 virtual Ogre::Vector3 GetWorldBoundingBoxSize(const bool& childs = false);
170
175 virtual Ogre::Vector3 GetWorldBoundingBoxCenter(const bool& childs = false);
176
179 unsigned int GetPolygonCount();
180
183 unsigned int GetVerticesCount();
184
187 void SetRenderQueue(const Ogre::RenderQueueGroupID& groupId);
188
191 unsigned int GetNumSubEntities();
192
195 void SetVisibilityFlags(const Ogre::uint32& flags);
196
199 Ogre::uint32 GetVisibilityFlags();
200
203 void SetVisibilityFlagIndexEnable(const Ogre::uint32& flagIndex, bool enable);
204
207 bool GetVisibilityFlagIndexEnable(const Ogre::uint32& flagIndex);
208
212 void _SetSkeleton(SSkeleton* newSkeleton);
213
214 /*
215 */
216 void GenerateLOD(int nbLevels);
217
218 /*
219 */
220 void SetFreeResource(bool state);
221
225 void Reload();
226
227 bool SetMaterial(SMaterial* mat, int subindex);
228
229 void SetMinPixelSize(const float &minsize);
230 float GetMinPixelSize();
231
232 virtual void loadingComplete(Ogre::Resource* res);
233
234protected:
235private:
239 void CommonConstructorsSequence();
240 void BuildMissingComponents();
241};
242
243}
244
245#endif
librairies include
unsigned int GetVerticesCount()
SSkeleton * GetSkeleton()
Ogre::Entity * O3Entity
Definition SO3Entity.h:52
void _SetSkeleton(SSkeleton *newSkeleton)
unsigned int GetPolygonCount()
virtual void SetCastShadows(const bool &castShadows)
virtual void SetRenderingDistance(const float &distance)
bool SetMaterial(SMaterial *mat, int subindex)
void SetVisibilityFlags(const Ogre::uint32 &flags)
void GenerateLOD(int nbLevels)
@ SO3_PREFAB_SPHERE
Definition SO3Entity.h:49
std::string GetGroupName()
virtual Ogre::Vector3 GetWorldBoundingBoxCenter(const bool &childs=false)
void SetFreeResource(bool state)
void SetRenderQueue(const Ogre::RenderQueueGroupID &groupId)
virtual Ogre::Vector3 GetBoundingBoxCenter(const bool &childs=false)
void SetMinPixelSize(const float &minsize)
virtual Ogre::Vector3 GetBoundingBoxSize(const bool &childs=false)
virtual bool GetCastShadows()
SSkeleton * entitySKL
Definition SO3Entity.h:53
float GetMinPixelSize()
virtual Ogre::Vector3 GetWorldBoundingBoxSize(const bool &childs=false)
Ogre::uint32 GetVisibilityFlags()
Ogre::Entity * getOgreEntityPointer()
void LoadAsync()
void FinishAsync()
virtual float GetRenderingDistance()
void SetVisibilityFlagIndexEnable(const Ogre::uint32 &flagIndex, bool enable)
bool GetVisibilityFlagIndexEnable(const Ogre::uint32 &flagIndex)
virtual void loadingComplete(Ogre::Resource *res)
unsigned int GetNumSubEntities()
STBI_EXTERN unsigned long flags
Definition stb_image.h:1182