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
/*�Copyright 2009-2012 DIVIDE-Studio�*/
/* This file is part of DIVIDE Framework.

   DIVIDE Framework is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   DIVIDE Framework is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with DIVIDE Framework.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _APPLICATION_H_
#define _APPLICATION_H_

#include "core.h"
class Kernel;
///Lightweight singleton class that manages our application's kernel and window information
DEFINE_SINGLETON( Application )

public:
	///Startup and shutdown
	void Initialize(const std::string& entryPoint);
	void Deinitialize();
	void run();

	///Application window dimensions
	inline const vec2<F32>& getWindowDimensions() const {return _dimensions;}
	inline void setWindowWidth(U16 w){_dimensions.x = w;}
	inline void setWindowHeight(U16 h){_dimensions.y = h;}

	///Application window ID
	inline I8 const&  getMainWindowId() {return _mainWindowId;}
	inline Kernel* const getKernel()    {return _kernel;}

	inline void setMemoryLogFile(const std::string& fileName) {memLogBuffer.open(fileName.c_str());}
	inline void logMemoryAllocation(const std::stringstream& buffer) {if(memLogBuffer.is_open()){ memLogBuffer << buffer.str();}}

private:
	Application();
	~Application();

private:
	I8 _mainWindowId;
	vec2<F32> _dimensions;
	Kernel* _kernel;
	///buffer to register all of the memory allocations recorded via "New"
	std::ofstream memLogBuffer;
	
END_SINGLETON

#endif

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

Diff revisions: vs.
Revision Author Commited Message
117 Diff Diff k1ngp1n picture k1ngp1n Tue 05 Jun, 2012 17:30:40 +0000

[Ionut] [[BR]]
-Separated responsibilities between “Application” and “Kernel” [[BR]]
--“Application” handles data such as window dimensions, logs, “ParamHandler” etc [[BR]]
--“Kernel” handles the main loop, SFX, GFX, physics, sceneManager etc updates [[BR]]
---“Kernel” is now a “Core” component [[BR]]
-Reduced coupling between some classes by passing more info via parameters rather than relying on singleton access [[BR]]
--Ex: eyePos in “Terrain”,“Water” and “Trigger” classes is now passed as a "vec3<F32>" on render call rather than querying “CameraManager” [[BR]]
-Reworked “GLWrapper” shutdown routine [[BR]]
Singleton witch hunt [[BR]]
-“Kernel” is no longer a singleton and it’s initialized on application startup in the “Application” class[[BR]]
-“CameraManager” is no longer a singleton and it’s instantiated in the kernel [[BR]]

115 Diff Diff k1ngp1n picture k1ngp1n Sat 02 Jun, 2012 19:25:51 +0000

[Ionut] [[BR]]
-Resource’s should NOT keep track of their ref counts as they are not the only objects that need reference counting [[BR]]
--Moved all ref counting elements to a new super class “TrackObject” [[BR]]
--Removed hackish “createCopy” / “removeCopy” methods and use dependency map instead (registered via macros) [[BR}}
-Added a basic smart pointer implementation that uses TrackObject, but the pointer is not used itself yet [[BR]]

114 Diff Diff k1ngp1n picture k1ngp1n Sat 02 Jun, 2012 13:03:01 +0000

[Ionut][[BR]]
-First steps in moving away from a generalized “ResourceManager”: [[BR]]
--Added templated resource loaders (Core\Resources\ConcreteLoaders). Just add a new loader for a new resource type and it’s ready for use [[BR]]
---Next step involves moving loading responsibility from the resource itself to the resource loader that handles it’s creation [[BR]]
--Renamed the ResourceManager to ResourceCache and limited it’s responsibility from general resource operations to a more standard abstract template factory with cache [[BR]]
---Manager base class is renamed to BaseCache as it’s a wrapper for a cache map in essence [[BR]]
---Next step involves adding a ResourceCache per scene (dropping Singleton status) with the possibility of sharing resources between them (to avoid reloading existing resources for a new scene) [[BR]]
-Translated AITenisScene and PingPongScene source code to english [[BR]]

113 Diff Diff k1ngp1n picture k1ngp1n Fri 01 Jun, 2012 16:51:23 +0000

[Ionut] [[BR]]
-Fixed animated bounding box calculations[[BR]]
-BoundingBox recalculation per frame is now a general SceneNode property [[BR]]
--Note: Animated BB’s have problems with multi-threaded collision detection for now (see AITenisScene) [[BR]]
-Wrapped boost::mutex to separate file and moved it to shared_mutex structure as read requests are more frequent than write requests [[BR]]
-Mesh class now calls animations update on all of it’s subclasses so animations for each node in a mesh are in sync [[BR]]
-Split up GUI elements by class [[BR]]
-Added base code for a console GUI element (disabled) [[BR]]
-Animations can now be disabled in confg file [[BR]]
-Added a “texture not found” default texture [[BR]]
-Some AI rewrite in AITenisScene (translation to english in next commit) [[BR]]
-Inlines, const’s, cleanups, etc [[BR]]

106 Diff Diff k1ngp1n picture k1ngp1n Wed 28 Mar, 2012 21:50:23 +0000

[Ionut] [[BR]]
Unstable revision – New animation code is not yet optimized and loading performance is low [[BR]]
[[BR]]
-Added animation loading and bone matrix calculations (actual skinning not implemented yet)[[BR]]
-Modified VBO classes to support dynamic data and faster updates [[BR]]
-Templatized Math classes (vec2,vec3,vec4,mat3,mat4) for greater flexibility [[BR]]
-Separated Rendering API from Rendering API version [[BR]]
-Fixed buggy GL error checking [[BR]]
-Small bugs fixed in Projectile and Weapon classes [[BR]]

103 Diff Diff k1ngp1n picture k1ngp1n Mon 12 Mar, 2012 19:06:00 +0000

[Ionut] [[BR]]
Features: [[BR]]
-Added a proper RenderState Management system similar to the D3D default one[[BR]]
--All possible states are managed: cull, blend, alpha-blend, color mask, lighting, stencil mask, fill mode etc [[BR]]
--Every material has different states for normal rendering, shadow rendering and reflection rendering [[BR]]
--Nodes are sorted by shader first then by state hash depending on current render stage [[BR]]
--Redundant states are not changed [[BR]]
--Every entity submits it’s desired state before render [[BR]]
--Every state is checked before rendering a VBO or other primitive type[[BR]]
[[BR]]
-Added a Reflector base class used for reflection calculations and updates (useful for water, mirrors, portals etc)[[BR]]
--Reflections are triggered between pre-render and render calls [[BR]]
--Water now derives from Reflector class as well [[BR]]
[[BR]]
-Material now properly calculates if it has transparency or is double sided, setting desired states to handle this feature (cull, blend) [[BR]]
-Added some basic defines or inline template functions to facilitate access to useful classes and methods (hardware devices, resource management, console printing, etc) [[BR]]
-Lights are updated after every camera update[[BR]]
-Added a new FrameListener event triggered after pre-render call is finished (used by reflectors) [[BR]]
-Added a CRC class to compute unique hash values for entities[[BR]]
-Added D3D dummy files [[BR]]
-Removed executables from subversion [[BR]]
Performance: [[BR]]
-Image loading has been improved a bit [[BR]]
-Terrain texel density now varies with LOD level [[BR]]
-Light API specific calls,except position, are set only if values changed[[BR]]
-Specific GUI casting and rendering are the Rendering API’s job now, not the GUI class [[BR]]
-Rendering Queue processing is now more efficient in sorting valid visible nodes and setting appropriate states/materials
[[BR]]
Bug fixes: [[BR]]
-Better drawState checks[[BR]]
-Proper light effects in deferred rendering[[BR]]
-Light dummy now renders properly[[BR]]
-Reworked bounding box computation [[BR]]
[[BR]]
Known bugs: [[BR]]
-Terrain infinite plain still not visible [[BR]]
-Some z-fighting occurs when looking at certain objects from a distance. (looking at another object and back again fixes it) [[BR]]

101 Diff Diff k1ngp1n picture k1ngp1n Wed 07 Mar, 2012 13:56:56 +0000

[Ionut] [[BR]]
-Added GLSL effect-like file support using GLSW [http://prideout.net/blog/?p=11] [[BR]]
-Added GLSL “#include” support. Now shader functions can be define in separate frag/vert files as atoms and included in the glsl effect file [[BR]]
-Added more DoxyGen-comments[[BR]]

100 Diff Diff k1ngp1n picture k1ngp1n Mon 05 Mar, 2012 17:45:11 +0000

[Ionut] [[BR]]
Features: [[BR]]
-Added a physics system interface instead of direct PhysX interaction to allow other physics engines (Bullet, ODE etc) to be easily implemented [[BR]]
--This will aid in Object-Object collisions and character control in future revisions [[BR]]
-Added an Ogre3D inspired FrameListener which now allows Before-frame/during-frame/after-frame event plugins of callbacks [[BR]]
-Added a renderInViewport system to draw elements in a user defined rectangle on screen [[BR]]
--Current uses: shadowmap preview (F10) [[BR]]
-Separated Shaders from ShaderPrograms[[BR]]
--ShaderPrograms can now use multiple Shaders [[BR]]
-Error output is now sent to errors.log[[BR]]
-All SceneNode based elements now have a postDraw calls as well [[BR]]
-A cubemap generating function has been added to the GFXDevice class[[BR]]
-Added debug only print options to the Console class [[BR]]
[[BR]]
Performance: [[BR]]
-All shadows are now filtered by a faster Gaussian 3x3 blur filter [[BR]]
-All renderables are now sorted and rendered by material/front-to-back/back-to-front, depending on case [[BR]]
-RenderQueue now sorts and queue’s translucent and opaque objects separately[[BR]]
-Shader uniforms/attributes are now cached to reduce number of address calls to the GPU[[BR]]
-Shaders are now cached, so that if multiple ShaderPrograms use an already compiled Shader, that Shader is returned from memory instead of creating a new copy[[BR]]
-Shaders are not unbound/rebound except when an objects demands so (vastly improves performance)[[BR]]
-Reduced calls to glEnable[[BR]]
[[BR]]
Bug fixes: [[BR]]
-Preprocessor configurations now work properly [[BR]]
-Video API is now unloaded before destruction [[BR]]
-Manager base class now properly frees memory [[BR]]
-Materials are saved to XML only if they are changed at any point [[BR]]

99 Diff Diff k1ngp1n picture k1ngp1n Fri 10 Feb, 2012 22:17:24 +0000

[ Ionut ] [[BR]]
- Added a PreRenderStage Builder that allows multiple pre-render stages to be added to the pre-render step [[ BR ]]
--A PreRenderStage is composed of a series of PreRender Operators that generate certain PostFX outputs that are used by the PostFX class [[BR]]
--Each PreRenderOperator, similar to a “plugin”, can use any number of input FBO’s, any input shader and render target to generate an effect [[BR]]
--Rendering pipeline has been modified to allow the specification of current render stage [[BR]]
[[BR]]
Added C++<>Shader attribute passing support for shaders[[BR]]
-Added per-pixel fog [[BR]]
-Fixed some typo’s in uniform names [[BR]]
-Optimized shadow generation pipeline [[BR]]
-Added cast/receive shadow options for materials [[BR]]
-FBO’s now clear color and depth buffers when Begin() is called [[BR]]
-Fixed loading of primitives' material properties [[BR]]
-All shaders now use the same shadowmapping techniques [[BR]]
-Quad3D’s can now be modified by specifying a target rect [[BR]]
-Split the “lighting.frag” shader in 3 variants: one that only applies color properties, one with textures and one with bump-mapping [[BR]]
--This reduces fragment shader complexity for the first 2 shaders [[BR]]
--Each material change will now force a shader recalculation for the object [[BR]]
-Renamed sphere’s “size” member to “radius” [[BR]]

97 k1ngp1n picture k1ngp1n Tue 07 Feb, 2012 15:23:45 +0000

[ Ionut ] [[BR]]
-Restructured code base to a more logical layout [[BR]]
--Geometry folder contains shapes, materials, animations and the importer; Environment folder holds sky, terrain, water, vegetation; etc [[BR]]
--All header files are moved to a “Headers” sub-folder [[BR]]
--Renamed most of the Romanian code/comments/files/folders to English [[BR]]
--Added comments to parts of the code (ongoing from now on) [[BR]]
[[BR]]
-Rewrote the entire lighting system [[BR]]
--Added a LightManager class to handle all lights [[BR]]
---LightManager calls updates and render calls to all lights it manages [[BR]]
--Lights have all needed properties stored in 2 maps (one for vector values, one for float values) [[BR]]
--Added a LightImpostor class that takes the light’s properties and applies it to a dummy sphere [[BR]]
--If a light should draw it’s impostor, the impostor draws the dummy sphere [[BR]]
--Rewrote the Light <-> GFXDevice interaction [[BR]]
---Each light stores it’s type in a variable and passes all properties to the rendering API that then decides what to use based on that type [[BR]]
--Each light handles it’s own ShadowMapping [[BR]]
[[BR]]
-ShadowMapping: [[BR]]
-Each light stores it’s own depth maps and generates them based on it’s type [[BR]]
-LightManager binds all available depth maps and shaders pick them up automatically for use [[BR]]
-Each shadow map (of a total of 3 per light) corresponds to a detail level[[BR]]
-The final shadow map resolution is decided by the shadow detail level set in the config [[BR]]
--Camera and Frustum are set up for shadow rendering and applied to the render callback set for the current light (for example, Scene::render()) [[BR]]
--The light manager tells every light that has “_castShadows = true” to generate shadowmaps automatically after the Scene::PreRender stage [[BR]]
--ShadowMaps are blurred before applied to the fragment’s final color via shaders. [[BR]]
[[BR]]
-Added detail level configuration options [[BR]]
--ToDo: add shaders for each detail level [[BR]]
[[BR]]
-Moved all predefined geometry from immediate mode to VBO’s [[BR]]
--This allowed the rendering pipeline to be more streamlined (one render function for all geometry) [[BR]]
[[BR]]
-Fixed GuiElement visibility toggle [[BR]]
-Fixed GuiText color state problem [[BR]]
-Added FBO texture format options [[BR]]
-VBO rendering uses U16 as default instead of U32 (better for GPU) [[BR]]
-VBO’s now contain BiTangent data as well [[BR]]
-Added OpenGL 2.0 compatibility (not guaranteed!) [[BR]]
-Added static (on load) shader selection based on detail level [[BR]]
-Added SSAO PostFX option, but this won’t work until the implementation of “plugins” for PostFX system [[BR]]
-Optimized/Fixed code based on VisualLint + CppCheck analysis [[BR]]