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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
/*
   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.

 */

/**************************************************************************************************************\
*                             Welcome to DIVIDE Engine's config settings!                                     *
* From here you can decide how you want to build your release of the code.
* - Decide how many threads your application can use (maximum upper limit).
* - Show the debug ms-dos window that prints application information
* - Define what the console output log file should be named
* - Enable/Disable SSE support
* - Set renderer options
***************************************************************************************************************/
#ifndef _CONFIG_HEADER_
#define _CONFIG_HEADER_

namespace Divide {
namespace Config {
	/// if this is false, a variable timestep will be used for the game loop
	const bool USE_FIXED_TIMESTEP = true;
    /// How many textures to store per material. 
    /// bump(0) + opacity(1) + spec(2) + tex[3..MAX_TEXTURE_STORAGE - 1]
    const unsigned int MAX_TEXTURE_STORAGE = 6;
    /// Application desired framerate for physics simulations
    const unsigned int TARGET_FRAME_RATE = 60;
    /// Application update rate divisor (how many draw calls per render call
    /// e.g. 2 = 30Hz update rate at 60Hz rendering)
    const unsigned int TICK_DIVISOR = 2;
    ///	Application update rate
    const unsigned int TICKS_PER_SECOND = TARGET_FRAME_RATE / TICK_DIVISOR;
    /// Maximum frameskip
    const unsigned int MAX_FRAMESKIP = 5;
	const unsigned long long SKIP_TICKS = (1000 * 1000) / Config::TICKS_PER_SECOND;
    /// AI update frequency
    const unsigned int AI_THREAD_UPDATE_FREQUENCY = TICKS_PER_SECOND;
    /// Maximum number of instances of a single mesh with a single draw call
    const unsigned int MAX_INSTANCE_COUNT = 512;
    /// Maximum number of points that can be sent to the GPU per batch
    const unsigned int MAX_POINTS_PER_BATCH = (unsigned int)(1 << 31);
    /// Maximum number of bones available per node
    const unsigned int MAX_BONE_COUNT_PER_NODE = 256;
    /// Estimated maximum number of visible objects per render pass (This includes debug primitives);
    const unsigned int MAX_VISIBLE_NODES = 2048;
    /// How many clip planes should the shaders us
    const unsigned int MAX_CLIP_PLANES = 6;
    /// How many render targets might get used in the application. Only used for caching reasons
    const unsigned int MAX_RENDER_TARGETS = 128;
    /// Generic index value used to separate primitives within the same vertex buffer
    const unsigned int PRIMITIVE_RESTART_INDEX_L = (unsigned int)(1 << 31);
    const unsigned int PRIMITIVE_RESTART_INDEX_S = (unsigned int)(1 << 15);
    /// Terrain LOD configuration
    /// Camera distance to the terrain chunk is calculated as follows:
    ///	vector EyeToChunk = terrainBoundingBoxCenter - EyePos; cameraDistance = EyeToChunk.length();
    /// Number of LOD levels for the terrain
    const unsigned int TERRAIN_CHUNKS_LOD = 3; 
    /// How many grass elements (3 quads p.e.) to add to each terrain element
    const unsigned int MAX_GRASS_BATCHES = 2000000; 
    /// SceneNode LOD selection
    /// Distance computation is identical to the of the terrain (using SceneNode's bounding box)
    const unsigned int SCENE_NODE_LOD = 3;
    /// Relative distance for LOD0->LOD1 selection
    const unsigned int SCENE_NODE_LOD0 = 100; 
    /// Relative distance for LOD0->LOD2 selection
    const unsigned int SCENE_NODE_LOD1 = 180; 
    /// Edit the maximum number of concurrent threads that this application may start excluding tasks.
    /// Default 2 without: Rendering + Update + A.I. + Networking + PhysX
    const unsigned int THREAD_LIMIT = 2;
    /// Use "precompiled" shaders if possible
    const bool USE_SHADER_BINARY = true;
    /// Use HW AA'ed lines
    const bool USE_HARDWARE_AA_LINES = true;
    /// Multi-draw causes some problems with profiling software (e.g. GPUPerfStudio2)
    const bool BATCH_DRAW_COMMANDS = false;
    /// Profiling options
    namespace Profile {
        /// use only a basic shader
        const bool DISABLE_SHADING  = false; 
        /// skip all draw calls
        const bool DISABLE_DRAWS    = false; 
        /// every viewport call is overriden with 1x1 (width x height)
        const bool USE_1x1_VIEWPORT = false; 
        /// textures are capped at 2x2 when uploaded to the GPU
        const bool USE_2x2_TEXTURES = false; 
        /// disable persistently mapped buffers
        const bool DISABLE_PERSISTENT_BUFFER = true; 
    };

	namespace Assert {
#if defined(_DEBUG)
        /// Log assert fails messages to the error log file
		const bool LOG_ASSERTS = true; 
        /// Do not call the platform "assert" function in order to continue application execution
		const bool CONTINUE_ON_ASSERT = false; 
        /// Popup a GUI Message Box on asserts;
		const bool SHOW_MESSAGE_BOX = false; 
#elif defined(_PROFILE)
		const bool LOG_ASSERTS = true;
		const bool CONTINUE_ON_ASSERT = false;
		const bool SHOW_MESSAGE_BOX = false;
#else //_RELEASE
		const bool LOG_ASSERTS = false;
		const bool CONTINUE_ON_ASSERT = false;
		const bool SHOW_MESSAGE_BOX = false;
#endif
	}
	
    namespace Lighting {
        /// How many lights total to use in the application (4 should be enough)
        const unsigned int MAX_LIGHTS_PER_SCENE = 4;
        /// How many lights (in order as passed to the shader for the node) should cast shadows
        const unsigned int MAX_SHADOW_CASTING_LIGHTS_PER_NODE = 2;
        /// Used for CSM or PSSM to determine the maximum number of frustum splits
        const unsigned int MAX_SPLITS_PER_LIGHT = 4;
        /// How many "units" away should a directional light source be from the camera's position
        const unsigned int DIRECTIONAL_LIGHT_DISTANCE = 500;
        // Note: since each uniform buffer may at most be 64kb, care must be taken that the grid resolution doesnt exceed this
        //       e.g. 1920x1200 wont do with 16x16.
        const unsigned int LIGHT_GRID_TILE_DIM_X = 64;
        const unsigned int LIGHT_GRID_TILE_DIM_Y = 64;
        // used for clustered forward
        const unsigned int LIGHT_GRID_MAX_DIM_Z = 256;

        // Max screen size of 1920x1080
        const unsigned int LIGHT_GRID_MAX_DIM_X = ((1920 + LIGHT_GRID_TILE_DIM_X - 1) / 
                                                  LIGHT_GRID_TILE_DIM_X);
        const unsigned int LIGHT_GRID_MAX_DIM_Y = ((1080 + LIGHT_GRID_TILE_DIM_Y - 1) / 
                                                  LIGHT_GRID_TILE_DIM_Y);

        /// the maximum number of lights supported, this is limited by constant buffer size, commonly
        /// this is 64kb, but AMD only seem to allow 2048 lights...
        const unsigned int NUM_POSSIBLE_LIGHTS = 1024;
    };
}; //namespace Config
}; //namespace Divide

///OS specific stuff
#if defined( _WIN32 )
    #define OS_WINDOWS

    #if defined (_WIN64)
        #define WIN64
    #else
        #define WIN32
    #endif
    
    ///Reduce Build time on Windows Platform
    #ifndef WIN32_LEAN_AND_MEAN
        #define WIN32_LEAN_AND_MEAN 1
        #ifndef VC_EXTRALEAN
            #define VC_EXTRALEAN
        #endif //VC_EXTRALEAN
    #endif //WIN32_LEAN_AND_MEAN
    /// If the target machine uses the nVidia Optimus layout (IntelHD + nVidia discreet GPU) 
    /// this will force the engine to use the nVidia GPU always
    #ifndef FORCE_NV_OPTIMUS_HIGHPERFORMANCE
        #define FORCE_NV_OPTIMUS_HIGHPERFORMANCE
    #endif
#elif defined( __APPLE_CC__ ) // Apple OS X could be supported in the future
    #define OS_APPLE
#else //Linux is the only other OS supported
    #define OS_NIX
#endif

///Please enter the desired log file name
#ifndef OUTPUT_LOG_FILE
    #define OUTPUT_LOG_FILE "console.log"
#endif //OUTPUT_LOG_FILE

#ifndef ERROR_LOG_FILE
    #define ERROR_LOG_FILE "errors.log"
#endif //ERROR_LOG_FILE

///Use eastl or stl string classes
///0 = EASTL
///1 = STL
#ifndef STRING_IMP
    #define STRING_IMP 0
#endif //STRING_IMP

///Use boost, eastl or stl vector
///0 = EASTL
///1 = STL
#ifndef VECTOR_IMP
	#define VECTOR_IMP 0
#endif //VECTOR_IMP

///Use boost, eastl or stl hash maps / unordered maps
///0 = BOOST
///1 = EASTL
///2 = STL
#ifndef HASH_MAP_IMP
    #define HASH_MAP_IMP 1
#endif //HASH_MAP_IMP

#endif //_CONFIG_HEADER

Commits for Divide-Framework/trunk/Source Code/config.h

Diff revisions: vs.
Revision Author Commited Message
331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

326 Diff Diff IonutCava picture IonutCava Tue 30 Sep, 2014 21:11:32 +0000

[Ionut]
- Fixed more memory leaks
- Simplified Task interface and timing System
- Improved compatibility between Boost, STL and EASTL with random combinations of vectors, strings and maps
- Simplified Light class by removing the “slot” member
- Random optimizations

324 Diff Diff IonutCava picture IonutCava Sun 14 Sep, 2014 14:01:39 +0000

[Ionut]
- New memory management system (no custom allocators in this commit)
— Memory tracer to detect memory leaks on shutdown (from: https://www.relisoft.com/book/tech/9new.html)
— SAFE_DELETE_XYZ are now inline template functions not macros
— ASSERTION system now supports logging and message boxes and continue on error configurable for each build type
— Fixed a lot of memory leaks detected by the new system (some still remain)

- Added SRGB support (part 1)
— Albedo textures are loaded as SRGB (make sure resources are SRGB)
— Shaders output gamma corrected colors
— Moved terrain textures back to 2 array system (albedo and normal maps, albedo maps using a SRGB sampler)

- Sky is now loaded via the ResourceCache system
- Added include safeguards in shader atoms

322 Diff Diff IonutCava picture IonutCava Sat 06 Sep, 2014 20:33:47 +0000

[Ionut]
- Refactored most of Boost related code to be C++11 based
— Boost is only used for ThreadPool, Mutex handling, XML parsing and networking (ASIO)
— Function binds, threads, regex, NonCopyable base, Hashing algorithms and more are now using C++11 libraries
- Replaced all FOR_EACH calls with standard, range, “for” calls

321 Diff Diff IonutCava picture IonutCava Wed 03 Sep, 2014 22:05:15 +0000

[Ionut]
- Added support (and enabled by default) for the EASTL library (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html / https://github.com/paulhodge/EASTL)
— Strings, vectors and hash_maps can be combined from EASTL, STL and Boost (not all combinations work. e.g. EASTL strings with STL/Boost containers due to the lack of a proper hash function)

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

[Ionut]
- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

308 Diff Diff IonutCava picture IonutCava Sat 16 Aug, 2014 19:49:31 +0000

[Ionut]
- Moved Transform from SceneGraphNode to PhysicsComponent and modified BoundingBox update system based on transform update
- Added PhysicsAsset to PhysicsComponent for interfacing with PshysicsAPIs (e.g. PhysXActor inherits PhysicsAsset)
- PhysicsAsset keeps track of the parent PhysicsComponent to have direct access to a node’s transform
- Rewrote GUIConsole to only print items when visible, and use a single circular buffer for entries.
- Updated GUI input system to match the interface that both Kernel and SceneManager share (should probably abstract all the input methods in a class and have Kernel, SceneManager, Scene and GUI inherit from that. In next commit.)
- Updated CEGUI to probably match the OIS states(mouse, keyboard, etc) and properly inject time inputs.

299 Diff Diff IonutCava picture IonutCava Mon 04 Aug, 2014 22:09:22 +0000

[Ionut]
- Disabled shader binary dump/load on non-nVidia GPUs (caused issues)
- More code cleanup/comments/formating (GFXDevice.cpp)

295 Diff Diff k1ngp1n picture k1ngp1n Fri 01 Aug, 2014 20:10:44 +0000

[Ionut]
- If a shader fails to bind, skip draw call. A shader will fail to bind if it wasn’t linked properly, as well
- Moved ShaderManager to the Hardware project due to its tight coupling
- More code cleanup and comments:
— OpenGL wrapper code : GLWrapper.h, GLWrapper.cpp, GLStates.cpp, glShaderProgram.cpp
- Cleaned up Shader.cpp
- Binary shader dump also saves binary format in .fmt file for each binary shader
- Renamed immediate mode primitive files

292 k1ngp1n picture k1ngp1n Mon 28 Jul, 2014 20:23:56 +0000

[Ionut]
- More nVidia compatibility issues (including the ability to disable persistent mapped buffer altogether. Thanks nsight ....)
- Cross-platform compatibility fixes for types (custom types now mirror types in stdint.h and are now typdefed instead of defined)
- Removed redundant files