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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
#include "Headers/Scene.h"

#include <Hardware/Network/Headers/ASIOImpl.h>
#include "GUI/Headers/GUI.h"

#include "Core/Headers/ParamHandler.h"
#include "Core/Math/Headers/Transform.h"

#include "Utility/Headers/XMLParser.h"
#include "Managers/Headers/AIManager.h"
#include "Managers/Headers/SceneManager.h"
#include "Managers/Headers/CameraManager.h"
#include "Rendering/Camera/Headers/FreeFlyCamera.h"

#include "Environment/Sky/Headers/Sky.h"
#include "Environment/Terrain/Headers/Terrain.h"
#include "Environment/Terrain/Headers/TerrainDescriptor.h"

#include "Geometry/Shapes/Headers/Mesh.h"
#include "Geometry/Material/Headers/Material.h"
#include "Geometry/Shapes/Headers/Predefined/Box3D.h"
#include "Geometry/Shapes/Headers/Predefined/Quad3D.h"
#include "Geometry/Shapes/Headers/Predefined/Sphere3D.h"
#include "Geometry/Shapes/Headers/Predefined/Text3D.h"

#include "Dynamics/Physics/Headers/PhysicsSceneInterface.h"

namespace Divide {

Scene::Scene() :  Resource("temp_scene"),
                 _GFX(GFX_DEVICE),
                 _LRSpeedFactor(5.0f),
                 _loadComplete(false),
                 _cookCollisionMeshesScheduled(false),
                 _paramHandler(ParamHandler::getInstance()),
                 _currentSelection(nullptr),
				 _currentSky(nullptr),
                 _sceneGraph(MemoryManager_NEW SceneGraph())
{
    _mousePressed[OIS::MB_Left]    = false;
    _mousePressed[OIS::MB_Right]   = false;
    _mousePressed[OIS::MB_Middle]  = false;
    _mousePressed[OIS::MB_Button3] = false;
    _mousePressed[OIS::MB_Button4] = false;
    _mousePressed[OIS::MB_Button5] = false;
    _mousePressed[OIS::MB_Button6] = false;
    _mousePressed[OIS::MB_Button7] = false;
}

Scene::~Scene()
{
}

bool Scene::frameStarted() {
    return true;
}

bool Scene::frameEnded() {
    return true;
}

bool Scene::idle() { //Called when application is idle
    if ( _sceneGraph ) {
        if ( _sceneGraph->getRoot()->getChildren().empty() ) {
            return false;
        }
        _sceneGraph->idle();
    }

    if ( !_modelDataArray.empty() ) {
        loadXMLAssets( true );
    }

    if ( _cookCollisionMeshesScheduled && checkLoadFlag() ) {
        if ( GFX_DEVICE.getFrameCount() > 1 ) {
            _sceneGraph->getRoot()->getComponent<PhysicsComponent>()->cookCollisionMesh( _name );
            _cookCollisionMeshesScheduled = false;
        }
    }
    return true;
}

void Scene::onCameraChange() {
    if ( _sceneGraph ) {
        _sceneGraph->getRoot()->onCameraChange();
    }
}

void Scene::postRender(){
#ifdef _DEBUG
    if ( renderState()._debugDrawLines ) {
        if ( !_lines[DEBUG_LINE_RAY_PICK].empty() ) {
            GFX_DEVICE.drawLines( _lines[DEBUG_LINE_OBJECT_TO_TARGET], mat4<F32>(), vec4<I32>(), false, false );
        }
    }
    if ( !_lines[DEBUG_LINE_OBJECT_TO_TARGET].empty() && renderState()._debugDrawTargetLines ) {
        GFX_DEVICE.drawLines( _lines[DEBUG_LINE_OBJECT_TO_TARGET], mat4<F32>(), vec4<I32>(), false, false );
    }
#endif
}

void Scene::addPatch( vectorImpl<FileData>& data ) {
}

void Scene::loadXMLAssets( bool singleStep ) {
    while ( !_modelDataArray.empty() ) {
        const FileData& it = _modelDataArray.top();
        //vegetation is loaded elsewhere
        if ( it.type == VEGETATION ) {
            _vegetationDataArray.push_back( it );
        } else {
            loadModel( it );
        }
        _modelDataArray.pop();

        if ( singleStep ) {
            return;
        }
    }
}

bool Scene::loadModel( const FileData& data ) {
    if ( data.type == PRIMITIVE ) {
        return loadGeometry( data );
    }

    ResourceDescriptor model( data.ModelName );
    model.setResourceLocation( data.ModelName );
    model.setFlag( true );
    Mesh *thisObj = CreateResource<Mesh>( model );
    if ( !thisObj ) {
        ERROR_FN( Locale::get( "ERROR_SCENE_LOAD_MODEL" ), data.ModelName.c_str() );
        return false;
    }

    SceneGraphNode* meshNode = _sceneGraph->getRoot()->createNode( thisObj, data.ItemName );
    meshNode->getComponent<RenderingComponent>()->castsShadows(data.castsShadows);
    meshNode->getComponent<RenderingComponent>()->receivesShadows(data.receivesShadows);
    meshNode->getComponent<PhysicsComponent>()->setScale( data.scale );
    meshNode->getComponent<PhysicsComponent>()->setRotation( data.orientation );
    meshNode->getComponent<PhysicsComponent>()->setPosition( data.position );
    if ( data.staticUsage ) {
        meshNode->usageContext( SceneGraphNode::NODE_STATIC );
    }
    if ( data.navigationUsage ) {
        meshNode->getComponent<NavigationComponent>()->navigationContext( NavigationComponent::NODE_OBSTACLE );
    }
    if ( data.physicsUsage ) {
        meshNode->getComponent<PhysicsComponent>()->physicsGroup(data.physicsPushable ? PhysicsComponent::NODE_COLLIDE : 
                                                                                        PhysicsComponent::NODE_COLLIDE_NO_PUSH );
    }
    if ( data.useHighDetailNavMesh ) {
        meshNode->getComponent<NavigationComponent>()->navigationDetailOverride( true );
    }
    return true;
}

bool Scene::loadGeometry( const FileData& data ) {
    Object3D* thisObj;
    ResourceDescriptor item( data.ItemName );
    item.setResourceLocation( data.ModelName );
    if ( data.ModelName.compare( "Box3D" ) == 0 ) {
        thisObj = CreateResource<Box3D>( item );
        dynamic_cast<Box3D*>( thisObj )->setSize( data.data );
    } else if ( data.ModelName.compare( "Sphere3D" ) == 0 ) {
        thisObj = CreateResource<Sphere3D>( item );
        dynamic_cast<Sphere3D*>( thisObj )->setRadius( data.data );
    } else if ( data.ModelName.compare( "Quad3D" ) == 0 ) {
        vec3<F32> scale = data.scale;
        vec3<F32> position = data.position;
        P32 quadMask; quadMask.i = 0; quadMask.b.b0 = 1;
        item.setBoolMask( quadMask );
        thisObj = CreateResource<Quad3D>( item );
        dynamic_cast<Quad3D*>( thisObj )->setCorner( Quad3D::TOP_LEFT, vec3<F32>( 0, 1, 0 ) );
        dynamic_cast<Quad3D*>( thisObj )->setCorner( Quad3D::TOP_RIGHT, vec3<F32>( 1, 1, 0 ) );
        dynamic_cast<Quad3D*>( thisObj )->setCorner( Quad3D::BOTTOM_LEFT, vec3<F32>( 0, 0, 0 ) );
        dynamic_cast<Quad3D*>( thisObj )->setCorner( Quad3D::BOTTOM_RIGHT, vec3<F32>( 1, 0, 0 ) );
    } else if ( data.ModelName.compare( "Text3D" ) == 0 ) {
        ///set font file
        item.setResourceLocation( data.data3 );
        item.setPropertyList( data.data2 );
        thisObj = CreateResource<Text3D>( item );
        dynamic_cast<Text3D*>( thisObj )->getWidth() = data.data;
    } else {
        ERROR_FN( Locale::get( "ERROR_SCENE_UNSUPPORTED_GEOM" ), data.ModelName.c_str() );
        return false;
    }
	STUBBED("Load material from XML disabled for primitives! - Ionut")
    Material* tempMaterial = nullptr/*XML::loadMaterial( stringAlg::fromBase( data.ItemName + "_material" ) )*/;
    if ( !tempMaterial ) {
        ResourceDescriptor materialDescriptor( data.ItemName + "_material" );
        tempMaterial = CreateResource<Material>( materialDescriptor );
        tempMaterial->setDiffuse( data.color );
        tempMaterial->setShadingMode(Material::SHADING_BLINN_PHONG);
    }

    thisObj->setMaterialTpl( tempMaterial );
    SceneGraphNode* thisObjSGN = _sceneGraph->getRoot()->createNode( thisObj );
    thisObjSGN->getComponent<PhysicsComponent>()->setScale( data.scale );
    thisObjSGN->getComponent<PhysicsComponent>()->setRotation( data.orientation );
    thisObjSGN->getComponent<PhysicsComponent>()->setPosition( data.position );
    thisObjSGN->getComponent<RenderingComponent>()->castsShadows(data.castsShadows);
    thisObjSGN->getComponent<RenderingComponent>()->receivesShadows(data.receivesShadows);
    if ( data.staticUsage ) {
        thisObjSGN->usageContext(SceneGraphNode::NODE_STATIC);
    }
    if ( data.navigationUsage ) {
        thisObjSGN->getComponent<NavigationComponent>()->navigationContext(NavigationComponent::NODE_OBSTACLE);
    }
    if ( data.physicsUsage ) {
        thisObjSGN->getComponent<PhysicsComponent>()->physicsGroup(data.physicsPushable ? PhysicsComponent::NODE_COLLIDE : 
                                                                                          PhysicsComponent::NODE_COLLIDE_NO_PUSH);
    }
    if ( data.useHighDetailNavMesh ) {
        thisObjSGN->getComponent<NavigationComponent>()->navigationDetailOverride(true);
    }
    return true;
}

SceneGraphNode* const Scene::addParticleEmitter(const stringImpl& name, 
                                                const ParticleEmitterDescriptor& descriptor, 
                                                SceneGraphNode* parentNode) {
    assert( parentNode != nullptr && !name.empty() );

    ResourceDescriptor particleEmitter( name );
    particleEmitter.setPropertyDescriptor( descriptor );

    return parentNode->addNode( CreateResource<ParticleEmitter>( particleEmitter ) );
}

SceneGraphNode* Scene::addLight( Light* const lightItem, SceneGraphNode* const parentNode ) {
	assert(lightItem != nullptr);

	lightItem->setCastShadows(lightItem->getType() != LIGHT_TYPE_POINT);

    SceneGraphNode* returnNode = nullptr;
    if ( parentNode ) {
        returnNode = parentNode->addNode( lightItem );
    } else {
        returnNode = _sceneGraph->getRoot()->addNode( lightItem );
    }
    return returnNode;
}

SceneGraphNode* Scene::addLight(LightType type, SceneGraphNode* const parentNode) {
	const char* lightType = "";
	switch (type) {
		case LIGHT_TYPE_DIRECTIONAL: lightType = "Default_directional_light "; break;
		case LIGHT_TYPE_POINT: lightType = "Default_point_light_"; break;
		case LIGHT_TYPE_SPOT: lightType = "Default_spot_light_"; break;
	}

	ResourceDescriptor defaultLight(stringAlg::toBase(lightType + Util::toString(LightManager::getInstance().getLights().size())));
	defaultLight.setEnumValue(type);
	return addLight(CreateResource<Light>(defaultLight), parentNode);
}

SceneGraphNode* Scene::addSky(Sky* const skyItem) {
	assert(skyItem != nullptr);
	return _sceneGraph->getRoot()->createNode(skyItem);
}

bool Scene::preLoad() {
    _GFX.enableFog(_sceneState.getFogDesc()._fogDensity,
                   _sceneState.getFogDesc()._fogColor);
    return true;
}

bool Scene::load(const stringImpl& name, CameraManager* const cameraMgr, GUI* const guiInterface){
	STUBBED("ToDo: load skyboxes from XML")
    _GUI = guiInterface;
    _name = name;
    renderState()._cameraMgr = cameraMgr;
    preLoad();
    loadXMLAssets();
    SceneGraphNode* root = _sceneGraph->getRoot();
    //Add terrain from XML
    if ( !_terrainInfoArray.empty() ) {
        for (TerrainDescriptor* terrainInfo : _terrainInfoArray) {
            ResourceDescriptor terrain(terrainInfo->getVariable("terrainName"));
            Terrain* temp = CreateResource<Terrain>( terrain );
            SceneGraphNode* terrainTemp = root->createNode( temp );
            terrainTemp->setActive(terrainInfo->getActive());
            terrainTemp->usageContext( SceneGraphNode::NODE_STATIC );

            NavigationComponent* nComp = terrainTemp->getComponent<NavigationComponent>();
            nComp->navigationContext(NavigationComponent::NODE_OBSTACLE);

            PhysicsComponent* pComp = terrainTemp->getComponent<PhysicsComponent>();
            pComp->physicsGroup(terrainInfo->getCreatePXActor() ? PhysicsComponent::NODE_COLLIDE_NO_PUSH :
                                                                  PhysicsComponent::NODE_COLLIDE_IGNORE);
        }
    }
    //Camera position is overridden in the scene's XML configuration file
    if( ParamHandler::getInstance().getParam<bool>("options.cameraStartPositionOverride" )) {
        renderState().getCamera().setEye(vec3<F32>(_paramHandler.getParam<F32>("options.cameraStartPosition.x"),
                                                     _paramHandler.getParam<F32>("options.cameraStartPosition.y"),
                                                     _paramHandler.getParam<F32>("options.cameraStartPosition.z")));
        vec2<F32> camOrientation(_paramHandler.getParam<F32>("options.cameraStartOrientation.xOffsetDegrees"),
                                 _paramHandler.getParam<F32>("options.cameraStartOrientation.yOffsetDegrees"));
        renderState().getCamera().setGlobalRotation(camOrientation.y/*yaw*/,camOrientation.x/*pitch*/);
    } else {
        renderState().getCamera().setEye( vec3<F32>( 0, 50, 0 ) );
    }

	vec3<F32> ambientColor(0.1f, 0.1f, 0.1f);
	LightManager::getInstance().setAmbientLight(ambientColor);

    //Create an AI thread, but start it only if needed
    Kernel* kernel = Application::getInstance().getKernel();
	_aiTask.reset(kernel->AddTask(getMsToUs(1000.0 / Config::AI_THREAD_UPDATE_FREQUENCY), 
                                  0, 
                                  DELEGATE_BIND(&AI::AIManager::update, 
                                                &AI::AIManager::getInstance())));

    addSelectionCallback(DELEGATE_BIND(&GUI::selectionChangeCallback, 
                                       &GUI::getInstance(), 
                                       this));
    _loadComplete = true;
    return _loadComplete;
}

bool Scene::unload() {
    // prevent double unload calls
    if ( !checkLoadFlag() ) {
        return false;
    }
    clearTasks();
    clearPhysics();
    clearObjects();
    clearLights();
    _loadComplete = false;
    return true;
}

PhysicsSceneInterface* Scene::createPhysicsImplementation(){
    return PHYSICS_DEVICE.NewSceneInterface(this);
}

bool Scene::loadPhysics(bool continueOnErrors){
    //Add a new physics scene (can be overridden in each scene for custom behavior)
	PHYSICS_DEVICE.setPhysicsScene( createPhysicsImplementation() );
    //Initialize the physics scene
    PHYSICS_DEVICE.initScene();
    //Cook geometry
	if ( _paramHandler.getParam<bool>( "options.autoCookPhysicsAssets" ) ) {
		_cookCollisionMeshesScheduled = true;
	}
    return true;
}

void Scene::clearPhysics(){
	PHYSICS_DEVICE.setPhysicsScene( nullptr );
}

bool Scene::initializeAI(bool continueOnErrors) {
    AI::AIManager::getInstance().signalInit();
    _aiTask->startTask();
    return true;
}

bool Scene::deinitializeAI(bool continueOnErrors) {	///Shut down AIManager thread
    if ( _aiTask.get() ) {
        _aiTask->stopTask();
        _aiTask.reset();
    }
    while ( _aiTask.get() ) {
    }

    return true;
}

void Scene::clearObjects() {
    for ( U8 i = 0; i < _terrainInfoArray.size(); ++i ) {
        RemoveResource( _terrainInfoArray[i] );
    }
    _terrainInfoArray.clear();

    while ( !_modelDataArray.empty() ) {
        _modelDataArray.pop();
    }
    _vegetationDataArray.clear();

    MemoryManager::DELETE( _sceneGraph );
}

void Scene::clearLights(){
    LightManager::getInstance().clear();
}

bool Scene::updateCameraControls(){
    
    Camera& cam = renderState().getCamera();
    switch ( cam.getType() ) {
        default:
        case Camera::FREE_FLY:{
            if ( state()._angleLR ) {
                cam.rotateYaw( CLAMPED<I32>( state()._angleLR, -1, 1 ) );
            }
            if ( state()._angleUD ) {
                cam.rotatePitch( CLAMPED<I32>( state()._angleUD, -1, 1 ) );
            }
            if ( state()._roll ) {
                cam.rotateRoll( CLAMPED<I32>( state()._roll, -1, 1 ) );
            }
            if ( state()._moveFB ) {
                cam.moveForward( CLAMPED<I32>( state()._moveFB, -1, 1 ) );
            }
            if ( state()._moveLR ) {
                cam.moveStrafe( CLAMPED<I32>( state()._moveLR, -1, 1 ) );
            }
        } break;
    }

    state()._cameraUpdated =  (state()._moveFB || state()._moveLR || state()._angleLR || state()._angleUD || state()._roll);
    return state()._cameraUpdated;
}

void Scene::updateSceneState(const U64 deltaTime){
    updateSceneStateInternal(deltaTime);
    state()._cameraUnderwater = renderState().getCamera().getEye().y < state()._waterHeight;
    _sceneGraph->sceneUpdate(deltaTime, _sceneState);
}

void Scene::deleteSelection(){
    if ( _currentSelection != nullptr ) {
        _currentSelection->scheduleDeletion();
    }
}

void Scene::registerTask(Task_ptr taskItem) {
    _tasks.push_back(taskItem);
}

void Scene::clearTasks() {
    PRINT_FN( Locale::get( "STOP_SCENE_TASKS" ) );
    // Calls the destructor for each task killing it's associated thread
    _tasks.clear();
}

void Scene::removeTask(I64 taskGUID) {
    for ( vectorImpl<Task_ptr>::iterator it = _tasks.begin(); it != _tasks.end(); ++it ) {
		if ((*it)->getGUID() == taskGUID) {
            ( *it )->stopTask();
            _tasks.erase( it );
            return;
        }
    }
}

void Scene::processGUI( const U64 deltaTime ) {
    for ( U16 i = 0; i < _guiTimers.size(); ++i ) {
        _guiTimers[i] += getUsToMs( deltaTime );
    }
}


void Scene::processTasks( const U64 deltaTime ) {
    for ( U16 i = 0; i < _taskTimers.size(); ++i ) {
        _taskTimers[i] += getUsToMs( deltaTime );
    }
}

TerrainDescriptor* Scene::getTerrainInfo( const stringImpl& terrainName ) {
    for ( U8 i = 0; i < _terrainInfoArray.size(); i++ ) {
        if ( terrainName.compare( _terrainInfoArray[i]->getVariable( "terrainName" ) ) == 0 ) {
            return _terrainInfoArray[i];
        }
    }

    DIVIDE_ASSERT( false, "Scene error: INVALID TERRAIN NAME FOR INFO LOOKUP" ); // not found;
    return _terrainInfoArray[0];
}

void Scene::debugDraw( const RenderStage& stage ) {
#   ifdef _DEBUG
        const SceneRenderState::GizmoState& currentGizmoState = renderState().gizmoState();

        GFX_DEVICE.drawDebugAxis( currentGizmoState != SceneRenderState::NO_GIZMO );

        if ( currentGizmoState == SceneRenderState::SELECTED_GIZMO ) {
            if (_currentSelection != nullptr && _currentSelection->getComponent<RenderingComponent>()) {
                _currentSelection->getComponent<RenderingComponent>()->drawDebugAxis();
            }
        }
#   endif
    if ( GFX_DEVICE.isCurrentRenderStage( DISPLAY_STAGE ) ) {
        // Draw bounding boxes, skeletons, axis gizmo, etc.
        GFX_DEVICE.debugDraw( renderState() );
        // Show NavMeshes
        AI::AIManager::getInstance().debugDraw( false );
    }
}

};

Commits for Divide-Framework/trunk/Source Code/Scenes/Scene.cpp

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)

330 Diff Diff IonutCava picture IonutCava Fri 10 Oct, 2014 17:19:11 +0000

[Ionut]
- New rendering algorithm :
— Perform second pass for visible nodes gathering all render commands and uploading them to an indirect draw buffer
— Render geometry with indirect draw commands
— Removed per-node range binding of the node buffer. Instead, bind the entire buffer once and index data in shaders
— Use “baseInstance” parameter from IndirectDrawCommand as a node buffer index
— Prefer DSA extensions for updating buffer data where applicable
- Moved all rendering specific code from SceneGraphNode to a new RenderingComponent
- Optimized “toString” utility function

329 Diff Diff IonutCava picture IonutCava Tue 07 Oct, 2014 12:51:37 +0000

[Ionut]
- Modified material class and shaders to support multiple BRDFs (currently, only Flat, Phong and Blinn-Phong supported with Cook-Torrance and Oren-Nayar in future commits)
- Optimized transform updates and queries
- Fixed an indirect draw command (no buffer was bound to GL_DRAW_INDIRECT_BUFFER, violating a core requirement)

328 Diff Diff IonutCava picture IonutCava Sat 04 Oct, 2014 18:03:36 +0000

[Ionut]
- Added per SceneGraphNode material instances. (Cloned from the SceneNode’s material)
- Improved shader loading for materials

327 Diff Diff IonutCava picture IonutCava Thu 02 Oct, 2014 12:32:15 +0000

[Ionut]
- Removed specular color from lights (specular color should be identical to light’s diffuse color anyway)
- Doublesided materials use their own shader defines now
- Fixed a bug in the particle shader related to screen dimensions never being passed
- Disabled material loading from XML for Primitive type geometry

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

325 Diff Diff IonutCava picture IonutCava Wed 17 Sep, 2014 20:06:13 +0000

[Ionut]
- Reworked transform system:
— Parent transform chain system moved from Transform class to the PhysicsComponent
— PhysicsComponent now returns all transform values needed both global and local (still needs heavy optimization and caching)

- Reworked SceneGraph node management:
— Proper ref counting of SceneNodes and proper removing of resource (ResourceCache is now empty on destruction, as it should be)
— Removed parent transform tracking as that’s the PhysicsComponent’s responsibility
— Only nodes loaded via the ResourceCache are allowed to be added to the SceneGraph (added proper loaders for Impostors, Sky, etc)

- Optimized some of the math classes (mat4, mat3)

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