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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#include "core.h"

#include "Headers/Console.h"
#include "Rendering/Headers/Framerate.h"
#include "config.h"
#include <iomanip>
#include <stdarg.h>

#define CONSOLE_OUTPUT_BUFFER_SIZE 2048

//! Do not remove the following license without express permission granted bu DIVIDE-Studio
void Console::printCopyrightNotice() const {
	std::cout << "------------------------------------------------------------------------------" << std::endl;
    std::cout << "Copyright (c) 2013 DIVIDE-Studio" << std::endl;
    std::cout << "Copyright (c) 2009 Ionut Cava" << std::endl;
    std::cout << std::endl;
    std::cout << "This file is part of DIVIDE Framework." << std::endl;
    std::cout << std::endl;
    std::cout << "Permission is hereby granted, free of charge, to any person obtaining a copy of this software" << std::endl;
    std::cout << "and associated documentation files (the 'Software'), to deal in the Software without restriction," << std::endl;
    std::cout << "including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense," << std::endl;
    std::cout << "and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so," << std::endl;
    std::cout << "subject to the following conditions:" << std::endl;
    std::cout << std::endl;
    std::cout << "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." << std::endl;
    std::cout << std::endl;
    std::cout << "THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED," << std::endl;
    std::cout << "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT." << std::endl;
    std::cout << "IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY," << std::endl;
    std::cout << "WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE" << std::endl;
    std::cout << "OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." << std::endl;
    std::cout << std::endl;
	std::cout << "For any problems or licensing issues I may have overlooked, please contact: " << std::endl;
	std::cout << "E-mail: ionut.cava@divide-studio.com | Website: http://wwww.divide-studio.com" << std::endl;
	std::cout << "-------------------------------------------------------------------------------" << std::endl;
	std::cout << std::endl;
}

#ifdef _DEBUG
void Console::d_printfn(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) - 1 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	strcat(text, "\n");
	va_end(args);
	output(text);
}

void Console::d_printf(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 1 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	va_end(args);
	output(text);
}

void Console::d_errorfn(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 3 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	strcat(text, "\n");
	va_end(args);
	output(text,true);
}

void Console::d_errorf(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 1 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	va_end(args);
	output(text,true);
}

#endif
void Console::printfn(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 3 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	strcat(text, "\n");
	va_end(args);
	output(text);
}

void Console::printf(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 1 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	va_end(args);
	output(text);
}

void Console::errorfn(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 3 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	strcat(text, "\n");
	va_end(args);
	output(text,true);
}

void Console::errorf(const char* format, ...) const {
	va_list args;
	char text[CONSOLE_OUTPUT_BUFFER_SIZE] = {};
	va_start(args, format);
	assert(_vscprintf(format, args) + 1 < CONSOLE_OUTPUT_BUFFER_SIZE);
	vsprintf_s(text, sizeof(text), format, args);
	va_end(args);
	output(text,true);
}

void Console::output(const char* output, const bool error) const {
	if(!_guiConsoleCallback.empty()){
		if(error){
			std::string outputString("Error: ");
			outputString.append(output);
			_guiConsoleCallback(outputString.c_str(),error);
		}else{
			_guiConsoleCallback(output,error);
		}
	}

	boost::mutex::scoped_lock lock(io_mutex);

	std::ostream& outputStream = error ? std::cerr : std::cout;

	if(_timestamps)
		outputStream << "[ " << std::setprecision(4) << GETTIME() << " ] ";

	if(error)
		outputStream << " Error: ";

	outputStream << output << std::flush;
}

Commits for Divide-Framework/trunk/Source Code/Core/Console.cpp

Diff revisions: vs.
Revision Author Commited Message
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 Diff Diff 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]]

152 Diff Diff k1ngp1n picture k1ngp1n Thu 20 Jun, 2013 14:23:31 +0000

[Ionut] [[BR]]
- New rendering pipeline (experimental and unstable): [[BR]]
— OpenGL 3.x clean context (glLight commands are still used for now, but UBO support is there, but not used yet) [[BR]]
— Custom matrix stacks and UBO based shader data (UBOs cause some link errors on some nVidia cards)[[BR]]
— Multi-threaded texture loading and shader compilation (mt shader compilation disabled for now. needs more tests) [[BR]]
— VAO rendering is self contained (no more enable/disable calls before a draw request) [[BR]]
— Render instance class used for rendering information [[BR]]
[[BR]]
- New unique ID generation base class: GUIDWrapper. Each class that derives from this, gets an application wide unique id on construction [[BR]]
- Added base code for an in-game editor using CEGUI [[BR]]
- Replaced some mutex locks with lockless data structures or atomic data [[BR]]
- CEGUI 0.8.2, FTGL-GL3 and GLIM 0.4 modified to support GLEW_MX if defined [[BR]]
- Dropped VS2008 support [[BR]]
- Networking library, server framework and ReCast files are now projects inside the Divide Framework solution [[BR]]
- New console command “setFov” that modifies the horizontal FoV value in realtime [[BR]]
- New console command “recompileShader” that reparses shader files, recompiles shaders and relinks shader programs who’s names match or contain the argument string [[BR]]
- New debug utility: axis angle drawn in corner of the screen if needed [[BR]]
- More ‘const’-s pasted around the code, more loop performance tweaks (allocations before a loop, tighter loops, etc), more utility member functions added to various classes [[BR]]

149 Diff Diff k1ngp1n picture k1ngp1n Sun 21 Apr, 2013 21:38:05 +0000

[Ionut] [[BR]]
- Major GUI revamp: [[BR]]
— Fixed CEGUI rendering (invalid state reset after VBO/VAO unbind) [[BR]]
— Added a working Console window with a basic command parser [[BR]]
— GUI inputs take priority over scene (e.g. pressing a key in the console, does not affect the scene)[[BR]]
— Added AutoKey repeat [[BR]]
— Added config options for the GUI [[BR]]
- Revamped OpenGL Vertex Array Object class [[BR]]
— VBO’s without a shader attached will not use VAO’s [[BR]]
— VAO’s and VBO’s cleanup all states after them [[BR]]
- Added multiple Joystick support [[BR]]
- FrameBufferObject take in account the combination of texture id and bind slot when checking for double binds [[BR]]
- Upgraded Framerate/timing system [[BR]]
- Fixed Deferred rendering (typo in normal buffer creation) [[BR]]
- Fixed initial camera placement via scene config (RotateX(Y) replace with setAngleX(Y)) on camera init) [[BR]]
- Added better thread deletion in Event class [[BR]]
- Major mutex/semaphore/shared_lock rework in threaded classes [[BR]]
- Better A.I. initialization/destruction [[BR]]
- Fixed a typo in window positioning [[BR]]
- Better Unit movement code [[BR]]

141 Diff Diff k1ngp1n picture k1ngp1n Wed 30 Jan, 2013 19:35:31 +0000

[Ionut] [[BR]]
-Updated to boost 1.52 and CEGUI 0.7.9 [[BR]]
-Updated to PhysX 3.2 [[BR]]
-Updated copyright notices [[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]]

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]]