SO3Engine
SO3Prerequisites.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 __SO3_PREREQUISITES_H__
33#define __SO3_PREREQUISITES_H__
34
35#ifdef ANDROID
36 #define _WIN32 0
37 #undef _WIN32
38#endif
39
40// Optionnal Functionality activation / deactivation
41#ifdef SO3_PLUGIN_WEBNAVIGATOR_NON_CLIENT_BUILD
42 #define SO3_WEB_NAVIGATOR_BUILD 1 // Set to 0 in case you won't have compiled Cef on your machine. You'll have to remove "libcef.lib" and "libinclude/cef_dll_wrapper.lib" from link project properties.
43#else
44 #define SO3_WEB_NAVIGATOR_BUILD 0
45#endif
46
47#include <scolPlugin.h>
48
49// Detect platform & compilator
50#include "SO3Platform.h"
51#include "SO3Std.h"
52
53// includes
54#include <assert.h>
55#include <string>
56#include <math.h>
57#include <stdio.h>
58#include <vector>
59#include <map>
60#include <queue>
61#include <unordered_map>
62
63// Ogre includes
64#include "Ogre.h"
65#include <OgreTagPoint.h>
66#include <OgreOverlay.h>
67#include <OgreOverlayManager.h>
68#include <OgreOverlayElement.h>
69#include <OgreOverlayContainer.h>
70#include <OgreTextAreaOverlayElement.h>
71#include <OgreWireBoundingBox.h>
72#include <OgreArchiveFactory.h>
73
74// Those defines are Ogre plugins, statically linked (Developper version) or internally builded (Distributable version).
75#include <OgreParticleFXPlugin.h>
76#include <OgreOctreePlugin.h>
77
78#if !defined(ANDROID) && !defined(APPLE_IOS) && !defined(SO3_USE_METAL) && !defined(RPI)
79 #include "OgreCgPlugin.h"
80#endif
81
82#ifdef SO3_FLASH_ENABLE
83 // External libs
85#endif
86
87// For dev, link renderer statically too
88#ifdef SO3_DEVELOPPER_BUILD
89 #ifdef _WIN32
90 # ifndef SO3_USE_DX11
91 # include "OgreD3D9Plugin.h"
92 # else
93 # include "OgreD3D11Plugin.h"
94 # endif
95 #endif
96
97# ifndef SO3_USE_OPENGLES2
98# ifdef SO3_USE_GL3
99# include "OgreGL3PlusPlugin.h"
100# elif !defined(SO3_USE_METAL)
101# include "OgreGLPlugin.h"
102# endif
103# elif !defined(SO3_USE_METAL)
104# include "OgreGLES2Plugin.h"
105# endif
106
107#if defined(__APPLE__) && defined(SO3_USE_METAL)
108 # include "OgreMetalPlugin.h"
109#endif
110
111#if defined(_WIN64)
112 //# include "OgreTinyPlugin.h"
113
114 # include "OgreVulkanPlugin.h"
115 # include "OgreGLSLangProgramManager.h"
116#endif
117
118#endif
119
120#include <unordered_map>
121#include <unordered_set>
122
123// Set to 1 to activate Ogre's frame profiler.
124#define SO3_PROFILER 0
125
126// using strings without "std::"
127using std::string;
128
129// Constant defines
130#define CONST_COLOR 255.0f
131#define CONST_COLOR_ALPHA 127.0f
132#define SO3_PI 3.14159265358979323846f
133#define SO3_SAFE_DELETE(p) {if(p){delete(p);(p)=NULL;}}
134#define SO3_SAFE_DELETE_ARRAY(p) {if(p){delete[](p);(p)=NULL;}}
135#define SO3_MAX_PATH MAX_PATH
136
137// Special resource group for internal use only.
138#define SO3_INTERNAL_RESOURCE_GROUP "SO3/Internal"
139#define SO3_INTERNAL_DYNAMIC_RESOURCE_GROUP "SO3/Internal/DynResource"
140#define SO3_INTERNAL_DYNAMIC_READABLE_RESOURCE_GROUP "SO3/Internal/GlobalPool"
141#define SO3_INTERNAL_HYDRAX_RESOURCE_GROUP "Hydrax"
142#define SO3_INTERNAL_SKYX_RESOURCE_GROUP "SkyX"
143#define SO3_INTERNAL_SUBENTITY_SELECTOR_RESOURCE_GROUP "SO3/Internal/EntitySelector"
144
145#ifdef SO3_BUILD_DEFERRED
146#define SO3_INTERNAL_DEFERRED_RESOURCE_GROUP "SO3/Internal/DeferredSystem"
147#endif
148
149// Keywords/values of usm.ini file
150#define SO3_CONFIG_RENDERER_KEYWORD "SO3Renderer"
151#define SO3_CONFIG_RENDERER_OPENGL "OpenGL"
152#define SO3_CONFIG_RENDERER_DIRECTX "DirectX"
153#define SO3_CONFIG_RENDERER_DIRECTX9 "DirectX9"
154#define SO3_CONFIG_RENDERER_DIRECTX11 "DirectX11"
155#define SO3_CONFIG_RENDERER_VULKAN "Vulkan"
156#define SO3_CONFIG_RENDERER_TINY "Tiny"
157#define SO3_CONFIG_RENDERER_METAL "Metal"
158#define SO3_CONFIG_FSAA_KEYWORD "3DFSAA"
159#define SO3_CONFIG_QUAD_BUFFER_KEYWORD "QuadBuffer"
160#define SO3_CONFIG_FOCAL_LENGTH_KEYWORD "FocalLength"
161#define SO3_CONFIG_EYES_SEPARATION_KEYWORD "EyeSeparation"
162#define SO3_CONFIG_VSYNC_KEYWORD "VSYNC"
163
164// All so3 classes goes in this namespace.
165namespace SO3
166{
167
168// class pre-declarations
169class SAnim;
170class SAnimationFrameListener;
171class SAnimTrack;
172class SAstronomy;
173class SBitmapWidgetFactory;
174class SBody;
175class SBone;
176class SColourGradient;
177class SCamera;
178class SCompositor;
179class SCompositorPass;
180class SCompositorTarget;
181class SCompositorTechnique;
182class SCompositorMaterialListener;
183class SContactCallback;
184class SDateTime;
185
186#ifdef SO3_BUILD_DEFERRED
187class SDeferredShading;
188#endif
189
190class SDynamicCubeMap;
191class SDynamicReflectionMap;
192class SData;
193class SEntity;
194class SEnvironment;
195class SEnvironmentComponent;
196class SException;
197
198#ifdef SO3_FLASH_ENABLE
199class SFlashControl;
200class SFlashWidget;
201class SFlashWidgetFactory;
202#endif
203
204class SKeyboardHook;
205class SLogListener;
206class SLight;
207class SLightingManager;
208class SLineEntity;
209class SMaterial;
210class SMaterialID;
211class SMaterialPair;
212class SMoon;
213class SNode;
214class SNodeAnimation;
215class SObjWindowWidget;
216class SObjWindowWidgetFactory;
217class SO3ScolFileSystemArchiveFactory;
218class SParticleSystem;
219class SPass;
220class SPhysicWorld;
221class SPhysicContraint;
222class SPlugin;
223class SPluginManager;
224template <typename NUMERIC_TYPE> class SPoint;
225class SRaycastResult;
226class SRenderToTexture;
227class SResource;
228class SResourceLoader;
229class SRoot;
230class SScene;
231class STerrain;
232class SScriptFunction;
233class SSequenceAnimation;
234class SSequenceAnimationTrack;
235class SSequenceAnimationKey;
236class SShadow;
237class SShadowManager;
238class SShape;
239class SShapeBox;
240class SSkeleton;
241class SSkeletonFap;
242class SSky;
243class SSkyAstronomicalModel;
244class SSkyLight;
245class SSubEntitySelectorBuffer;
246class SSubEntitySelectorMaterialSwitcher;
247class SSun;
248class STechnique;
249class STexture;
250class SUniversalClock;
251class SViewPort;
252class SVertexAnimation;
253class SWater;
254class SWebNavigatorWidget;
255class SWebNavigatorWidgetFactory;
256class SWidget;
257class SWidgetFactory;
258class SWidgetManager;
259class SWindow;
260
261// maps pre-declaration
262typedef std::unordered_map<std::string, SAnim*> SAnimMap;
263typedef std::unordered_map<unsigned short, SAnim*> SAnimIndexMap;
264typedef std::vector<SAnimTrack*> SAnimTrackList;
265typedef std::unordered_map<std::string, SBone*> SBoneMap;
266typedef std::unordered_map<unsigned short,SBone*> SBoneIndexMap;
267typedef std::unordered_map<std::string, SCompositor*> SCompositorMap;
268typedef std::unordered_map<SEntity*, std::string> SEntityMap;
269typedef std::unordered_map<std::string, SMaterial*> SMaterialMap;
270typedef std::unordered_map<std::string, SMaterialMap*> SGroupMaterialMap;
271typedef std::unordered_map<std::string, SMaterialID*> SMaterialIDMap;
272typedef std::unordered_set<SMaterialPair*> SMaterialPairMap;
273typedef std::unordered_map<std::string, SNode*> SNodeMap;
274typedef std::unordered_map<std::string, STerrain*> STerrainMap;
275typedef std::unordered_map<std::string, SScene*> SSceneMap;
276typedef std::unordered_map<std::string, STexture*> STextureMap;
277typedef std::unordered_map<std::string, STextureMap*> SGroupTextureMap;
278typedef std::unordered_map<int, SViewPort*> SViewPortList;
279typedef std::unordered_map<std::string, SWindow*> SWindowMap;
280typedef std::vector<SSequenceAnimationKey*> SAnimSequenceKeyList;
281typedef std::unordered_set<SSequenceAnimationKey*> SAnimSequenceKeyMap;
282
283// Small enum for mouse buttons.
291
292}
293
294#endif
platform & compilator detection scripts.
librairies include
Manage Physics Bodies. .
Abstract class defining a shadow rendering technique. .
Manage Physics Contraint. .
Abstract class defining a shadow rendering technique. .
Manage Box physics shape .
Manage physics shape .
std::unordered_map< std::string, STexture * > STextureMap
std::unordered_map< unsigned short, SBone * > SBoneIndexMap
std::vector< SAnimTrack * > SAnimTrackList
std::unordered_map< std::string, SMaterial * > SMaterialMap
std::unordered_map< std::string, SCompositor * > SCompositorMap
std::unordered_map< SEntity *, std::string > SEntityMap
std::unordered_map< int, SViewPort * > SViewPortList
std::unordered_set< SMaterialPair * > SMaterialPairMap
std::unordered_map< std::string, STextureMap * > SGroupTextureMap
std::unordered_map< std::string, SBone * > SBoneMap
std::unordered_map< unsigned short, SAnim * > SAnimIndexMap
std::unordered_set< SSequenceAnimationKey * > SAnimSequenceKeyMap
std::unordered_map< std::string, STerrain * > STerrainMap
std::unordered_map< std::string, SNode * > SNodeMap
std::unordered_map< std::string, SScene * > SSceneMap
std::vector< SSequenceAnimationKey * > SAnimSequenceKeyList
std::unordered_map< std::string, SWindow * > SWindowMap
std::unordered_map< std::string, SAnim * > SAnimMap
std::unordered_map< std::string, SMaterialID * > SMaterialIDMap
@ MOUSE_RIGHT_BUTTON
@ MOUSE_MIDDLE_BUTTON
@ MOUSE_LEFT_BUTTON
std::unordered_map< std::string, SMaterialMap * > SGroupMaterialMap