Subversion Repository Public Repository

Divide-Framework

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
   Copyright (c) 2014 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy of this software
   and associated documentation files (the "Software"), to deal in the Software without restriction,
   including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef _APPLICATION_H_
#define _APPLICATION_H_

#include <fstream>
#include "Core/Headers/Singleton.h"
#include "Core/Math/Headers/MathClasses.h"
#include "Hardware/Platform/Headers/Thread.h"

class Kernel;
///Lightweight singleton class that manages our application's kernel and window information
DEFINE_SINGLETON( Application )

public:
    ///Startup and shutdown
    I8 initialize(const std::string& entryPoint,I32 argc, char **argv);
    void deinitialize();
    void run();

    ///Application resolution (either fullscreen resolution or window dimensions)
    inline const vec2<U16>& getResolution()   const {return _resolution;}
    inline const vec2<U16>& getScreenCenter() const {return _screenCenter;}
    inline void setResolutionWidth(U16 w)           {_resolution.width = w; _screenCenter.x = w / 2;}
    inline void setResolutionHeight(U16 h)          {_resolution.height = h; _screenCenter.y = h / 2;}
    inline void setResolution(U16 w, U16 h)         {_resolution.set(w,h); _screenCenter.set(_resolution / 2);}
    inline void RequestShutdown()                   {_requestShutdown = true;}
    inline void CancelShutdown()                    {_requestShutdown = false;}
    inline bool ShutdownRequested()           const {return _requestShutdown;}
    ///Application window ID
    inline I8            getMainWindowId()    const {return _mainWindowId;}
    inline Kernel* const getKernel()          const {return _kernel;}

    inline const boost::thread::id&  getMainThreadId()               const {return _threadId;}
    inline bool isMainThread()                                       const {return (_threadId == boost::this_thread::get_id());}
    inline void setMemoryLogFile(const std::string& fileName)              {_memLogBuffer.open(fileName.c_str());}
    ///Append to "_memLogBuffer" the string contained in "logMsg" and update _totalMemoryOcuppied with "size" accordingly based on the "allocation" flag
    void logMemoryOperation(bool allocation, const char* logMsg, size_t size);

    inline bool hasFocus()                 const {return _hasFocus;}
    inline void hasFocus(const bool state)       {_hasFocus = state;}

    inline bool isFullScreen()                 const {return _isFullscreen;}
    inline void isFullScreen(const bool state)       {_isFullscreen = state;}

    inline bool mainLoopActive()           const { return _mainLoopActive; }
    inline void mainLoopActive(bool state)       { _mainLoopActive = state; }
protected:
    friend class InputInterface;
    void setMousePosition(U16 x, U16 y) const;

private:
    Application();
    ~Application();

private:
    I8        _mainWindowId;
    /// this is true when we are inside the main app loop
    bool      _mainLoopActive;
    bool      _requestShutdown;
    /// this is false if the window/application lost focus (e.g. clicked another window, alt + tab, etc)
    bool      _hasFocus; 
    /// this is false if the application is running in windowed mode
    bool      _isFullscreen;
    /// size in bytes of currently allocated memory by the "New" override (delete calls are taken in consideration)
    size_t    _totalMemoryOcuppied;
    vec2<U16> _resolution;
    vec2<U16> _screenCenter;
    Kernel*   _kernel;
    ///buffer to register all of the memory allocations recorded via "New"
    std::ofstream _memLogBuffer;
    ///Main application thread id
    boost::thread::id _threadId;

END_SINGLETON

#endif

Commits for Divide-Framework/trunk/Source Code/Core/Headers/Application.h

Diff revisions: vs.
Revision Author Commited Message
259 Diff Diff k1ngp1n picture k1ngp1n Sun 27 Apr, 2014 18:24:52 +0000

[Ionut][[BR]]
- Implemented Exponential Stable Cascaded Shadow Maps for directional lights (still buggy, but basically working) [[BR]]
— CSM settings (resolution, number of splits, etc) are part of the scene render state [[BR]]
- SGN can skip rendering for the current frame if they are not ready (e.g. OnDraw can now return false or materials can fail to bind) [[BR]]
- Frustum class is now using the Plane class [[BR]]
- Removed Math SIMD implementation as the compiler generated code will always be faster and safer [[BR]]
- Added a “STUBBED” macro for outputing to the error stream of important messages (instead of using #pragma message) [[BR]]
- Added “freeze time” logic to pause/resume updates with or without freezing the GUI too [[BR]]
- Added “processGUI” method the every Scene class to separate time-sensitive GUI updates from game logic loop [[BR]]
- GLSL <-> Vertex Buffer bind locations are automatically set for every vertex shader [[BR]]
- Added basic support for compute shaders [[BR]]
- Removed most OS define checks to make porting to a new platform easier [[BR]]
- Texture transparency check per-pixel is now using OpenMP [[BR]]
- Texture samplers can now set a border color for CLAMP_TO_BORDER wrap mode [[BR]]
- Removed “Object” suffix from GFX Classes (pixel buffer, vertex buffer, frame buffer, etc) [[BR]]
- Stop processing scene input when application looses focus [[BR]]
- SceneGraphNode class is now responsible for updating SGNComponents on draw and calling its _node’s OnDraw method [[BR]]
- UBOs can now list all of the active uniforms inside a block with info such as type and offset [[BR]]
- Removed deprecated ‘GLCheck’ macro [[BR]]
- A lot of bug fixes and performance improvements in various places [[BR]]

241 Diff Diff k1ngp1n picture k1ngp1n Sun 02 Feb, 2014 22:07:51 +0000

[Ionut] [[BR]]
- Implemented a basic ThirdPerson camera [[BR]]
— Does not limit rotations yet [[BR]]
— Does not have on click and drag functionality yet [[BR]]

235 Diff Diff k1ngp1n picture k1ngp1n Thu 16 Jan, 2014 22:31:48 +0000

[Ionut] [[BR]]
- W.I.P. anti-stuck system for agents [[BR]]
- Fixed lerp functions in math classes [[BR]]
- Used lerp-based translation for Character class [[BR]]
- Code cleanups and utility functions [[BR]]

221 Diff Diff k1ngp1n picture k1ngp1n Wed 08 Jan, 2014 18:50:02 +0000

[Ionut] [[BR]]
- Merged branch “Shadows And Animations” back into trunk [[BR]]
- Added DoxygenGUI project file [[BR]]

  • Buggy *
178 Diff Diff k1ngp1n picture k1ngp1n Sat 16 Nov, 2013 16:42:20 +0000

[Ionut][[BR]]
- Path generation between 2 points using a specified NavMesh (Part 1 / 3 - “Base Code”) [[BR]]

171 Diff Diff k1ngp1n picture k1ngp1n Sun 03 Nov, 2013 18:15:06 +0000

-Replaced all tabs with spaces [[BR]]

170 Diff Diff k1ngp1n picture k1ngp1n Sun 03 Nov, 2013 17:24:57 +0000

-Moved hardware related code to a separate project [[BR]]
-More work on post-processing: [[BR]]
— HDR rendering is working, but final tonemapping needs more work [[BR]]
-Important changes in BloomPreRenderOperator.cpp, PostFX.cpp and glFrameBufferObject.cpp [[BR]]
-Trailing and leading whitespace cleanups [[BR]]

169 Diff Diff k1ngp1n picture k1ngp1n Tue 29 Oct, 2013 21:17:29 +0000

Ionut: [[BR]]
- Code cleanups and optimizations [[BR]]
- Better memory allocation and deallocation tracking and logging [[BR]]
- Added vertex color support for VBOs [[BR]]
-Improved PostProcessing: [[BR]]
— A lot of code cleanups and scalability was increased [[BR]]
-— HDR lighting with automatic exposure, God Rays and working SSAO will be added in the next commit [[BR]]
— Added single pass SSAO by Aurel Manea [[BR]]
-— Not finished – a lot of artifacts [[BR]]
— Reduced the VRAM requirements for most render targets by using smaller data types [[BR]]

168 Diff Diff k1ngp1n picture k1ngp1n Sat 26 Oct, 2013 19:03:21 +0000

- Reworked the Camera class[[BR]]
— Now fully quaternion based [[BR]]
— Basic camera types added but not used yet (third person, first person, orbit) [[BR]]
- Cleaned up Material and Texture handling [[BR]]
- Added clipping plane support [[BR]]
— Similar to OpenGL fixed-function clip planes but fully shader driven [[BR]]
— Added a new class, “Plane”, that helps define clip planes [[BR]]
- Optimized the Singleton class to allow faster “getInstance” calls without performance penalties [[BR]]
-- “createInstance” must be called for each singleton class before usage. Or “gerOrCreateInstance” can be used, which is basically the former “getInstance” implementation [[BR]]
- Improved console logging by changing some heap allocations to stack and removing dependencies on the std::string class [[BR]]
- Added a lot of performance optimizations related to coding standards and redundant calculations [[BR]]
— e.g. Frustum AABB check didn’t need to recompute the AABB points as they were calculated already [[BR]]
— e.g. A vector did not need to be set to 0 on initialization as that is already it’s default state on creation [[BR]]
— e.g. Faster Framerate and Timing calculations by using less member variables that are not needed outsied of calling functions [[BR]]
- The SceneState now contains the SceneRenderState and is passed on to the SceneGraph’s update calls [[BR]]
- Better material export/import to/from XML format [[BR]]
- More bug fixes and cleanups [[BR]]

160 k1ngp1n picture k1ngp1n Wed 10 Jul, 2013 17:07:04 +0000

[Ionut] [[BR]]
- Changed licensing from LGPL to the MIT license [[BR]]
— Code can now be used in non-commercial or commercial closed or open source projects [[BR]]