diff options
author | David Walter Seikel | 2016-03-28 22:28:34 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-03-28 22:28:34 +1000 |
commit | 7028cbe09c688437910a25623098762bf0fa592d (patch) | |
tree | 10b5af58277d9880380c2251f109325542c4e6eb /libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp | |
parent | Move lemon to the src/others directory. (diff) | |
download | SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.zip SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.gz SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.bz2 SledjHamr-7028cbe09c688437910a25623098762bf0fa592d.tar.xz |
Move Irrlicht to src/others.
Diffstat (limited to 'libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp')
-rw-r--r-- | libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp | 179 |
1 files changed, 0 insertions, 179 deletions
diff --git a/libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp b/libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp deleted file mode 100644 index 942d3cd..0000000 --- a/libraries/irrlicht-1.8.1/source/Irrlicht/CDefaultSceneNodeFactory.cpp +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #include "CDefaultSceneNodeFactory.h" | ||
6 | #include "ISceneManager.h" | ||
7 | #include "ITextSceneNode.h" | ||
8 | #include "ITerrainSceneNode.h" | ||
9 | #include "IDummyTransformationSceneNode.h" | ||
10 | #include "ICameraSceneNode.h" | ||
11 | #include "IBillboardSceneNode.h" | ||
12 | #include "IAnimatedMeshSceneNode.h" | ||
13 | #include "IParticleSystemSceneNode.h" | ||
14 | #include "ILightSceneNode.h" | ||
15 | #include "IMeshSceneNode.h" | ||
16 | |||
17 | namespace irr | ||
18 | { | ||
19 | namespace scene | ||
20 | { | ||
21 | |||
22 | |||
23 | CDefaultSceneNodeFactory::CDefaultSceneNodeFactory(ISceneManager* mgr) | ||
24 | : Manager(mgr) | ||
25 | { | ||
26 | |||
27 | #ifdef _DEBUG | ||
28 | setDebugName("CDefaultSceneNodeFactory"); | ||
29 | #endif | ||
30 | |||
31 | // don't grab the scene manager here to prevent cyclic references | ||
32 | |||
33 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_CUBE, "cube")); | ||
34 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SPHERE, "sphere")); | ||
35 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_TEXT, "text")); | ||
36 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_WATER_SURFACE, "waterSurface")); | ||
37 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_TERRAIN, "terrain")); | ||
38 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_BOX, "skyBox")); | ||
39 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SKY_DOME, "skyDome")); | ||
40 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_SHADOW_VOLUME, "shadowVolume")); | ||
41 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCTREE, "octree")); | ||
42 | // Legacy support | ||
43 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_OCTREE, "octTree")); | ||
44 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MESH, "mesh")); | ||
45 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_LIGHT, "light")); | ||
46 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_EMPTY, "empty")); | ||
47 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_DUMMY_TRANSFORMATION, "dummyTransformation")); | ||
48 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_CAMERA, "camera")); | ||
49 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_BILLBOARD, "billBoard")); | ||
50 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_ANIMATED_MESH, "animatedMesh")); | ||
51 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_PARTICLE_SYSTEM, "particleSystem")); | ||
52 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_VOLUME_LIGHT, "volumeLight")); | ||
53 | // SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_MD3_SCENE_NODE, "md3")); | ||
54 | |||
55 | // legacy, for version <= 1.4.x irr files | ||
56 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_CAMERA_MAYA, "cameraMaya")); | ||
57 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_CAMERA_FPS, "cameraFPS")); | ||
58 | SupportedSceneNodeTypes.push_back(SSceneNodeTypePair(ESNT_Q3SHADER_SCENE_NODE, "quake3Shader")); | ||
59 | } | ||
60 | |||
61 | |||
62 | //! adds a scene node to the scene graph based on its type id | ||
63 | ISceneNode* CDefaultSceneNodeFactory::addSceneNode(ESCENE_NODE_TYPE type, ISceneNode* parent) | ||
64 | { | ||
65 | switch(type) | ||
66 | { | ||
67 | case ESNT_CUBE: | ||
68 | return Manager->addCubeSceneNode(10, parent); | ||
69 | case ESNT_SPHERE: | ||
70 | return Manager->addSphereSceneNode(5, 16, parent); | ||
71 | case ESNT_TEXT: | ||
72 | return Manager->addTextSceneNode(0, L"example"); | ||
73 | case ESNT_WATER_SURFACE: | ||
74 | return Manager->addWaterSurfaceSceneNode(0, 2.0f, 300.0f, 10.0f, parent); | ||
75 | case ESNT_TERRAIN: | ||
76 | return Manager->addTerrainSceneNode("", parent, -1, | ||
77 | core::vector3df(0.0f,0.0f,0.0f), | ||
78 | core::vector3df(0.0f,0.0f,0.0f), | ||
79 | core::vector3df(1.0f,1.0f,1.0f), | ||
80 | video::SColor(255,255,255,255), | ||
81 | 4, ETPS_17, 0, true); | ||
82 | case ESNT_SKY_BOX: | ||
83 | return Manager->addSkyBoxSceneNode(0,0,0,0,0,0, parent); | ||
84 | case ESNT_SKY_DOME: | ||
85 | return Manager->addSkyDomeSceneNode(0, 16, 8, 0.9f, 2.0f, 1000.0f, parent); | ||
86 | case ESNT_SHADOW_VOLUME: | ||
87 | return 0; | ||
88 | case ESNT_OCTREE: | ||
89 | return Manager->addOctreeSceneNode((IMesh*)0, parent, -1, 128, true); | ||
90 | case ESNT_MESH: | ||
91 | return Manager->addMeshSceneNode(0, parent, -1, core::vector3df(), | ||
92 | core::vector3df(), core::vector3df(1,1,1), true); | ||
93 | case ESNT_LIGHT: | ||
94 | return Manager->addLightSceneNode(parent); | ||
95 | case ESNT_EMPTY: | ||
96 | return Manager->addEmptySceneNode(parent); | ||
97 | case ESNT_DUMMY_TRANSFORMATION: | ||
98 | return Manager->addDummyTransformationSceneNode(parent); | ||
99 | case ESNT_CAMERA: | ||
100 | return Manager->addCameraSceneNode(parent); | ||
101 | case ESNT_CAMERA_MAYA: | ||
102 | return Manager->addCameraSceneNodeMaya(parent); | ||
103 | case ESNT_CAMERA_FPS: | ||
104 | return Manager->addCameraSceneNodeFPS(parent); | ||
105 | case ESNT_BILLBOARD: | ||
106 | return Manager->addBillboardSceneNode(parent); | ||
107 | case ESNT_ANIMATED_MESH: | ||
108 | return Manager->addAnimatedMeshSceneNode(0, parent, -1, core::vector3df(), | ||
109 | core::vector3df(), core::vector3df(1,1,1), true); | ||
110 | case ESNT_PARTICLE_SYSTEM: | ||
111 | return Manager->addParticleSystemSceneNode(true, parent); | ||
112 | case ESNT_VOLUME_LIGHT: | ||
113 | return (ISceneNode*)Manager->addVolumeLightSceneNode(parent); | ||
114 | default: | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | |||
122 | //! adds a scene node to the scene graph based on its type name | ||
123 | ISceneNode* CDefaultSceneNodeFactory::addSceneNode(const c8* typeName, ISceneNode* parent) | ||
124 | { | ||
125 | return addSceneNode( getTypeFromName(typeName), parent ); | ||
126 | } | ||
127 | |||
128 | |||
129 | //! returns amount of scene node types this factory is able to create | ||
130 | u32 CDefaultSceneNodeFactory::getCreatableSceneNodeTypeCount() const | ||
131 | { | ||
132 | return SupportedSceneNodeTypes.size(); | ||
133 | } | ||
134 | |||
135 | |||
136 | //! returns type of a createable scene node type | ||
137 | ESCENE_NODE_TYPE CDefaultSceneNodeFactory::getCreateableSceneNodeType(u32 idx) const | ||
138 | { | ||
139 | if (idx<SupportedSceneNodeTypes.size()) | ||
140 | return SupportedSceneNodeTypes[idx].Type; | ||
141 | else | ||
142 | return ESNT_UNKNOWN; | ||
143 | } | ||
144 | |||
145 | |||
146 | //! returns type name of a createable scene node type | ||
147 | const c8* CDefaultSceneNodeFactory::getCreateableSceneNodeTypeName(u32 idx) const | ||
148 | { | ||
149 | if (idx<SupportedSceneNodeTypes.size()) | ||
150 | return SupportedSceneNodeTypes[idx].TypeName.c_str(); | ||
151 | else | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | |||
156 | //! returns type name of a createable scene node type | ||
157 | const c8* CDefaultSceneNodeFactory::getCreateableSceneNodeTypeName(ESCENE_NODE_TYPE type) const | ||
158 | { | ||
159 | for (u32 i=0; i<SupportedSceneNodeTypes.size(); ++i) | ||
160 | if (SupportedSceneNodeTypes[i].Type == type) | ||
161 | return SupportedSceneNodeTypes[i].TypeName.c_str(); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | |||
167 | ESCENE_NODE_TYPE CDefaultSceneNodeFactory::getTypeFromName(const c8* name) const | ||
168 | { | ||
169 | for (u32 i=0; i<SupportedSceneNodeTypes.size(); ++i) | ||
170 | if (SupportedSceneNodeTypes[i].TypeName == name) | ||
171 | return SupportedSceneNodeTypes[i].Type; | ||
172 | |||
173 | return ESNT_UNKNOWN; | ||
174 | } | ||
175 | |||
176 | |||
177 | } // end namespace scene | ||
178 | } // end namespace irr | ||
179 | |||