Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 349 vs 350 for /trunk/Source Code/Core/Headers/Kernel.h

Diff revisions: vs.
  @@ -4,18 +4,27 @@
4 4
5 5 This file is part of DIVIDE Framework.
6 6
7 - Permission is hereby granted, free of charge, to any person obtaining a copy of this software
8 - and associated documentation files (the "Software"), to deal in the Software without restriction,
9 - including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 - and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
7 + Permission is hereby granted, free of charge, to any person obtaining a copy
8 + of this software
9 + and associated documentation files (the "Software"), to deal in the Software
10 + without restriction,
11 + including without limitation the rights to use, copy, modify, merge, publish,
12 + distribute, sublicense,
13 + and/or sell copies of the Software, and to permit persons to whom the
14 + Software is furnished to do so,
11 15 subject to the following conditions:
12 16
13 - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17 + The above copyright notice and this permission notice shall be included in
18 + all copies or substantial portions of the Software.
14 19
15 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16 - INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 + IMPLIED,
22 + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 + PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 + DAMAGES OR OTHER LIABILITY,
26 + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 + IN CONNECTION WITH THE SOFTWARE
19 28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 29
21 30 */
  @@ -47,37 +56,40 @@
47 56 struct FrameEvent;
48 57 class GUI;
49 58
50 - ///The kernel is the main interface to our engine components:
59 + /// The kernel is the main interface to our engine components:
51 60 ///-video
52 61 ///-audio
53 62 ///-physx
54 63 ///-scene manager
55 64 ///-etc
56 65 class Kernel : public Input::InputAggregatorInterface, private NonCopyable {
57 - public:
58 - Kernel(I32 argc, char **argv, Application& parentApp);
66 + public:
67 + Kernel(I32 argc, char** argv, Application& parentApp);
59 68 ~Kernel();
60 69
61 70 ErrorCode initialize(const stringImpl& entryPoint);
62 71
63 72 void runLogicLoop();
64 73 /// Our main application rendering loop.
65 - /// Call input requests, physics calculations, pre-rendering, rendering,post-rendering etc
74 + /// Call input requests, physics calculations, pre-rendering,
75 + /// rendering,post-rendering etc
66 76 static void mainLoopApp();
67 77 /// Called after a swap-buffer call and before a clear-buffer call.
68 - /// In a GPU-bound application, the CPU will wait on the GPU to finish processing the frame
78 + /// In a GPU-bound application, the CPU will wait on the GPU to finish
79 + /// processing the frame
69 80 /// so this should keep it busy (old-GLUT heritage)
70 81 static void idle();
71 82 /// Update all engine components that depend on the current resolution
72 83 static void updateResolutionCallback(I32 w, I32 h);
73 84
74 - GFXDevice& getGFXDevice() const {return _GFX;}
75 - SFXDevice& getSFXDevice() const {return _SFX;}
76 - PXDevice& getPXDevice() const {return _PFX;}
85 + GFXDevice& getGFXDevice() const { return _GFX; }
86 + SFXDevice& getSFXDevice() const { return _SFX; }
87 + PXDevice& getPXDevice() const { return _PFX; }
77 88 /// Get elapsed time since kernel initialization
78 - inline U64 getCurrentTime() const {return _currentTime;}
79 - inline U64 getCurrentTimeDelta() const {return _currentTimeDelta;}
80 - /// Get a pointer to the kernel's threadpool to add,remove,pause or stop tasks
89 + inline U64 getCurrentTime() const { return _currentTime; }
90 + inline U64 getCurrentTimeDelta() const { return _currentTimeDelta; }
91 + /// Get a pointer to the kernel's threadpool to add,remove,pause or stop
92 + /// tasks
81 93 inline boost::threadpool::pool* const getThreadPool() {
82 94 assert(_mainTaskPool != nullptr);
83 95 return _mainTaskPool;
  @@ -91,63 +103,65 @@
91 103 /// Key released
92 104 bool onKeyUp(const Input::KeyEvent& key);
93 105 /// Joystick axis change
94 - bool joystickAxisMoved(const Input::JoystickEvent& arg,I8 axis);
106 + bool joystickAxisMoved(const Input::JoystickEvent& arg, I8 axis);
95 107 /// Joystick direction change
96 - bool joystickPovMoved(const Input::JoystickEvent& arg,I8 pov);
108 + bool joystickPovMoved(const Input::JoystickEvent& arg, I8 pov);
97 109 /// Joystick button pressed
98 - bool joystickButtonPressed(const Input::JoystickEvent& arg,I8 button);
110 + bool joystickButtonPressed(const Input::JoystickEvent& arg, I8 button);
99 111 /// Joystick button released
100 112 bool joystickButtonReleased(const Input::JoystickEvent& arg, I8 button);
101 - bool joystickSliderMoved( const Input::JoystickEvent &arg, I8 index);
102 - bool joystickVector3DMoved( const Input::JoystickEvent &arg, I8 index);
113 + bool joystickSliderMoved(const Input::JoystickEvent& arg, I8 index);
114 + bool joystickVector3DMoved(const Input::JoystickEvent& arg, I8 index);
103 115 /// Mouse moved
104 116 bool mouseMoved(const Input::MouseEvent& arg);
105 117 /// Mouse button pressed
106 - bool mouseButtonPressed(const Input::MouseEvent& arg, Input::MouseButton button);
118 + bool mouseButtonPressed(const Input::MouseEvent& arg,
119 + Input::MouseButton button);
107 120 /// Mouse button released
108 - bool mouseButtonReleased(const Input::MouseEvent& arg, Input::MouseButton button);
121 + bool mouseButtonReleased(const Input::MouseEvent& arg,
122 + Input::MouseButton button);
109 123
110 - Task* AddTask(U64 tickInterval,
111 - I32 numberOfTicks,
112 - const DELEGATE_CBK<>& threadedFunction,
113 - const DELEGATE_CBK<>& onCompletionFunction = DELEGATE_CBK<>());
114 -
115 - private:
116 - static void firstLoop();
117 - void shutdown();
118 - void renderScene();
119 - void renderSceneAnaglyph();
120 - bool mainLoopScene(FrameEvent& evt);
121 - bool presentToScreen(FrameEvent& evt);
122 - void threadPoolCompleted(U64 onExitTaskID);
124 + Task* AddTask(
125 + U64 tickInterval, I32 numberOfTicks,
126 + const DELEGATE_CBK<>& threadedFunction,
127 + const DELEGATE_CBK<>& onCompletionFunction = DELEGATE_CBK<>());
128 +
129 + private:
130 + static void firstLoop();
131 + void shutdown();
132 + void renderScene();
133 + void renderSceneAnaglyph();
134 + bool mainLoopScene(FrameEvent& evt);
135 + bool presentToScreen(FrameEvent& evt);
136 + void threadPoolCompleted(U64 onExitTaskID);
123 137
124 - private:
138 + private:
125 139 friend class SceneManager;
126 140 void submitRenderCall(const RenderStage& stage,
127 - const SceneRenderState& sceneRenderState,
141 + const SceneRenderState& sceneRenderState,
128 142 const DELEGATE_CBK<>& sceneRenderCallback) const;
129 -
130 - private:
131 - Application& _APP;
132 - ///Access to the GPU
133 - GFXDevice& _GFX;
134 - ///Access to the audio device
135 - SFXDevice& _SFX;
136 - ///Access to the physics system
137 - PXDevice& _PFX;
138 - ///The graphical user interface
139 - GUI& _GUI;
140 - ///The input interface
143 +
144 + private:
145 + Application& _APP;
146 + /// Access to the GPU
147 + GFXDevice& _GFX;
148 + /// Access to the audio device
149 + SFXDevice& _SFX;
150 + /// Access to the physics system
151 + PXDevice& _PFX;
152 + /// The graphical user interface
153 + GUI& _GUI;
154 + /// The input interface
141 155 Input::InputInterface& _input;
142 - ///The SceneManager/ Scene Pool
143 - SceneManager& _sceneMgr;
144 - ///Keep track of all active cameras used by the engine
156 + /// The SceneManager/ Scene Pool
157 + SceneManager& _sceneMgr;
158 + /// Keep track of all active cameras used by the engine
145 159 std::unique_ptr<CameraManager> _cameraMgr;
146 160
147 - static bool _keepAlive;
148 - static bool _renderingPaused;
149 - static bool _freezeLoopTime;
150 - static bool _freezeGUITime;
161 + static bool _keepAlive;
162 + static bool _renderingPaused;
163 + static bool _freezeLoopTime;
164 + static bool _freezeGUITime;
151 165 boost::threadpool::pool* _mainTaskPool;
152 166 // both are in ms
153 167 static U64 _currentTime;
  @@ -157,14 +171,14 @@
157 171 static D32 _nextGameTick;
158 172
159 173 static SharedLock _threadedCallbackLock;
160 - static vectorImpl<U64 > _threadedCallbackBuffer;
174 + static vectorImpl<U64> _threadedCallbackBuffer;
161 175 static hashMapImpl<U64, DELEGATE_CBK<> > _threadedCallbackFunctions;
162 176
163 - //Command line arguments
164 - I32 _argc;
165 - char **_argv;
177 + // Command line arguments
178 + I32 _argc;
179 + char** _argv;
166 180 };
167 181
168 - }; //namespace Divide
182 + }; // namespace Divide
169 183
170 - #endif //_CORE_KERNEL_H_
184 + #endif //_CORE_KERNEL_H_