Neo  0.5.0
Developer Documentation
NeoEngine.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 #ifndef __ENGINE_H
26 #define __ENGINE_H
27 
28 #ifdef WIN32
29  #if defined(NEO_ENGINE_DLL)
30  #define NEO_ENGINE_EXPORT __declspec( dllexport )
31  #elif defined(NEO_ENGINE_STATIC)
32  #define NEO_ENGINE_EXPORT
33  #else
34  #define NEO_ENGINE_EXPORT __declspec( dllimport )
35  #endif
36 #else
37  #define NEO_ENGINE_EXPORT
38 #endif
39 
40 
41 // object3d type
43 {
44  OBJECT3D = 0,
51 };
52 
53 // dataRef type
54 #define M_REF_MESH 0
55 #define M_REF_TEXTURE 1
56 #define M_REF_SOUND 2
57 #define M_REF_ARMATURE_ANIM 3
58 #define M_REF_MATERIALS_ANIM 4
59 #define M_REF_TEXTURES_ANIM 5
60 #define M_REF_SHADER 6
61 #define M_REF_FONT 7
62 
63 // classes
64 namespace Neo
65 {
66 class Scene;
67 class Level;
68 class NeoGame;
69 
70 class Object3d;
71 class OBone;
72 class OLight;
73 class OCamera;
74 class OEntity;
75 class OSound;
76 class OText;
77 
78 class FontRef;
79 class ShaderRef;
80 class SoundRef;
81 class MeshRef;
82 class TextureRef;
83 class ArmatureAnimRef;
84 class TexturesAnimRef;
85 class MaterialsAnimRef;
86 class Messenger;
87 }
88 
89 #include <NeoCore.h>
90 
91 #include "Log.h"
92 
93 #include "PackageManager.h"
94 
95 #include "Key.h"
96 #include "Object3dAnim.h"
97 #include "TextureAnim.h"
98 #include "MaterialAnim.h"
99 
100 #include "ArmatureAnim.h"
101 #include "TexturesAnim.h"
102 #include "MaterialsAnim.h"
103 
104 #include "FXManager.h"
105 #include "PostProcessor.h"
106 
107 #include "PointerVariable.h"
108 #include "Behavior.h"
109 #include "BehaviorCreator.h"
110 #include "BehaviorManager.h"
111 
112 #include "Renderer.h"
113 #include "RendererCreator.h"
114 #include "RendererManager.h"
115 
116 #include "Box3d.h"
117 #include "Frustum.h"
118 
119 #include "Font.h"
120 #include "Texture.h"
121 #include "Material.h"
122 #include "Armature.h"
123 #include "Mesh.h"
124 #include "MeshTools.h"
125 
126 #include "FontRef.h"
127 #include "ShaderRef.h"
128 #include "SoundRef.h"
129 #include "MeshRef.h"
130 #include "TextureRef.h"
131 #include "ArmatureAnimRef.h"
132 #include "TexturesAnimRef.h"
133 #include "MaterialsAnimRef.h"
134 #include "Skybox.h"
135 
136 #include "Object3d.h"
137 #include "OBone.h"
138 #include "OCamera.h"
139 #include "OLight.h"
140 #include "OSound.h"
141 #include "OEntity.h"
142 #include "OText.h"
143 
144 #include "Scene.h"
145 #include "Level.h"
146 #include "NeoGame.h"
147 #include "Messenger.h"
148 
149 namespace Neo
150 {
151 class NEO_ENGINE_EXPORT NeoEngine
152 {
153 public:
154 
155  NeoEngine(void);
156  ~NeoEngine(void);
157 
158  // instance
159  static NeoEngine * getInstance(void);
160 
161 private:
162 
163  // active
164  bool m_isActive;
165 
166  // contexts
167  SoundContext * m_soundContext;
168  RenderingContext * m_renderingContext;
169  PhysicsContext * m_physicsContext;
170  ScriptContext * m_scriptContext;
171  InputContext * m_inputContext;
172  SystemContext * m_systemContext;
173 
174  // data loaders
175  DataLoader<Font> m_fontLoader;
176  DataLoader<Image> m_imageLoader;
177  DataLoader<Sound> m_soundLoader;
178  DataLoader<Mesh> m_meshLoader;
179  DataLoader<ArmatureAnim> m_armatureAnimLoader;
180  DataLoader<TexturesAnim> m_texturesAnimLoader;
181  DataLoader<MaterialsAnim> m_materialsAnimLoader;
182  DataLoader<Level> m_levelLoader;
183 
184  // behavior manager
185  BehaviorManager m_behaviorManager;
186 
187  // renderer manager
188  RendererManager m_rendererManager;
189 
190  // package manager
191  PackageManager * m_packageManager;
192 
193  // level
194  Level * m_level;
195 
196  // game
197  NeoGame * m_game;
198 
199  // renderer
200  Renderer * m_renderer;
201 
202  // stores the name of the level to load when loading is save
203  char * m_requestedLevelToLoad;
204 
205 private:
206 
207  void loadLevelIfRequested(); // Checks if a level was requested to be loaded and loads it
208 
209 public:
210 
211  // active
212  inline void setActive(bool active){ m_isActive = active; }
213  inline bool isActive(void){ return m_isActive; }
214 
215  // contexts
216  void setSoundContext(SoundContext * soundContext);
217  void setRenderingContext(RenderingContext * renderingContext);
218  void setPhysicsContext(PhysicsContext * physicsContext);
219  void setScriptContext(ScriptContext * scriptContext);
220  void setInputContext(InputContext * inputContext);
221  void setSystemContext(SystemContext * systemContext);
222 
223  // get contexts
224  inline SoundContext * getSoundContext(void){ return m_soundContext; }
225  inline RenderingContext * getRenderingContext(void){ return m_renderingContext; }
226  inline PhysicsContext * getPhysicsContext(void){ return m_physicsContext; }
227  inline ScriptContext * getScriptContext(void){ return m_scriptContext; }
228  inline InputContext * getInputContext(void){ return m_inputContext; }
229  inline SystemContext * getSystemContext(void){ return m_systemContext; }
230 
231  // data loaders
232  DataLoader<Font>* getFontLoader(void){ return &m_fontLoader; }
233  DataLoader<Image>* getImageLoader(void){ return &m_imageLoader; }
234  DataLoader<Sound>* getSoundLoader(void){ return &m_soundLoader; }
235  DataLoader<Mesh>* getMeshLoader(void){ return &m_meshLoader; }
236  DataLoader<ArmatureAnim>* getArmatureAnimLoader(void){ return &m_armatureAnimLoader; }
237  DataLoader<TexturesAnim>* getTexturesAnimLoader(void){ return &m_texturesAnimLoader; }
238  DataLoader<MaterialsAnim>* getMaterialsAnimLoader(void){ return &m_materialsAnimLoader; }
239  DataLoader<Level>* getLevelLoader(void){ return &m_levelLoader; }
240 
241  // behavior manager
242  inline BehaviorManager * getBehaviorManager(void){ return &m_behaviorManager; }
243 
244  // renderer manager
245  inline RendererManager * getRendererManager(void){ return &m_rendererManager; }
246 
247  // package manager
248  void setPackageManager(PackageManager * packageManager);
249  inline PackageManager * getPackageManager(void){ return m_packageManager; }
250 
251  // update requests
252  void updateRequests(void);
253 
254  // level
255  void setLevel(Level * level);
256  bool saveLevel(const char* filename);
257  bool loadLevel(const char* filename); // loads level immediately
258  void requestLoadLevel(const char * filename); // send a request to load a level
259  bool doesLevelExist(const char * filename);
260  inline Level * getLevel(void){ return m_level; }
261 
262  // game
263  void setGame(NeoGame * game);
264  inline NeoGame * getGame(void){ return m_game; }
265 
266  // renderer
267  void setRenderer(Renderer * renderer);
268  inline Renderer * getRenderer(void){ return m_renderer; }
269 };
270 }
271 
272 #endif
Definition: NeoEngine.h:151
This class implements a basic interface to the underlying operating system.
Definition: SystemContext.h:40
The RenderingContext class defines an abstraction for the 3D rendering API like OpenGL.
Definition: RenderingContext.h:217
PackageManager * getPackageManager(void)
Definition: NeoEngine.h:249
SystemContext * getSystemContext(void)
Definition: NeoEngine.h:229
Definition: RendererManager.h:31
Definition: InputContext.h:42
Definition: SoundContext.h:41
DataLoader< Sound > * getSoundLoader(void)
Definition: NeoEngine.h:234
DataLoader< Mesh > * getMeshLoader(void)
Definition: NeoEngine.h:235
InputContext * getInputContext(void)
Definition: NeoEngine.h:228
Definition: NeoEngine.h:46
Definition: NeoEngine.h:50
DataLoader< Font > * getFontLoader(void)
Definition: NeoEngine.h:232
DataLoader< Level > * getLevelLoader(void)
Definition: NeoEngine.h:239
BehaviorManager * getBehaviorManager(void)
Definition: NeoEngine.h:242
This class manages all registered behaviors.
Definition: BehaviorManager.h:34
Definition: NeoGame.h:49
Definition: DataLoader.h:35
Definition: NeoEngine.h:44
Definition: PackageManager.h:38
DataLoader< ArmatureAnim > * getArmatureAnimLoader(void)
Definition: NeoEngine.h:236
Definition: NeoEngine.h:49
Level * getLevel(void)
Definition: NeoEngine.h:260
void setActive(bool active)
Definition: NeoEngine.h:212
Definition: NeoEngine.h:47
The Level class contains all scenes and assets that are loaded.
Definition: Level.h:42
bool isActive(void)
Definition: NeoEngine.h:213
Definition: Renderer.h:32
SoundContext * getSoundContext(void)
Definition: NeoEngine.h:224
DataLoader< TexturesAnim > * getTexturesAnimLoader(void)
Definition: NeoEngine.h:237
PhysicsContext * getPhysicsContext(void)
Definition: NeoEngine.h:226
The PhysicsContext class contains abstraction to 3D physics functionality.
Definition: PhysicsContext.h:34
RendererManager * getRendererManager(void)
Definition: NeoEngine.h:245
Renderer * getRenderer(void)
Definition: NeoEngine.h:268
DataLoader< MaterialsAnim > * getMaterialsAnimLoader(void)
Definition: NeoEngine.h:238
DataLoader< Image > * getImageLoader(void)
Definition: NeoEngine.h:233
NeoGame * getGame(void)
Definition: NeoEngine.h:264
RenderingContext * getRenderingContext(void)
Definition: NeoEngine.h:225
Definition: Color.h:29
Class used to manage script functions virtually.
Definition: ScriptContext.h:32
OBJECT3D_TYPE
Definition: NeoEngine.h:42
Definition: NeoEngine.h:45
Definition: NeoEngine.h:48
ScriptContext * getScriptContext(void)
Definition: NeoEngine.h:227