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
#include "Headers/CubeScene.h"

#include "Managers/Headers/SceneManager.h"
#include "Geometry/Shapes/Headers/Predefined/Quad3D.h"
#include "Rendering/Headers/DeferredShadingRenderer.h"
#include "Core/Math/Headers/Transform.h"

namespace Divide {

REGISTER_SCENE(CubeScene);

void CubeScene::render(){
}

void CubeScene::processTasks(const U64 deltaTime){
    Light::LightMap& lights = LightManager::getInstance().getLights();
    D32 updateLights = getSecToMs(0.05);

    if(_taskTimers[0] >= updateLights){
        for(U8 row=0; row<3; row++)
            for(U8 col=0; col < lights.size()/3.0f; col++){
                F32 x = col * 150.0f - 5.0f + cos(GETMSTIME()*(col-row+2)*0.008f)*200.0f;
                F32 y = cos(GETTIME()*(col-row+2)*0.01f)*200.0f+20;;
                F32 z = row * 500.0f -500.0f - cos(GETMSTIME()*(col-row+2)*0.009f)*200.0f+10;
                F32 r = 1;
                F32 g = 1.0f-(row/3.0f);
                F32 b = col/(lights.size()/3.0f);

                lights[row*10+col]->setPosition(vec3<F32>(x,y,z));
                lights[row*10+col]->setDiffuseColor(vec3<F32>(r,g,b));
            }

        _taskTimers[0] = 0.0;
    }
    Scene::processTasks(deltaTime);
}

I8 g_j = 1;
F32 g_i = 0;
bool _switch = false;
void CubeScene::preRender() {
    if(g_i >= 360) _switch = true;
    else if(g_i <= 0) _switch = false;

    if(!_switch) g_i += 0.1f;
    else g_i -= 0.1f;

    g_i >= 180 ? g_j = -1 : g_j = 1;

    SceneGraphNode* cutia1 = _sceneGraph->findNode("Cutia1");
    SceneGraphNode* hellotext = _sceneGraph->findNode("HelloText");
    SceneGraphNode* bila = _sceneGraph->findNode("Bila");
    SceneGraphNode* dwarf = _sceneGraph->findNode("dwarf");
    cutia1->getComponent<PhysicsComponent>()->rotate(vec3<F32>(0.3f*g_i, 0.6f*g_i,0));
    hellotext->getComponent<PhysicsComponent>()->rotate(vec3<F32>(0.6f,0.2f,0.4f),g_i);
    bila->getComponent<PhysicsComponent>()->translateY(g_j*0.25f);
    dwarf->getComponent<PhysicsComponent>()->rotate(vec3<F32>(0,1,0),g_i);
}

void CubeScene::processInput(const U64 deltaTime){
}

bool CubeScene::load(const stringImpl& name, CameraManager* const cameraMgr, GUI* const gui){
    GFX_DEVICE.setRenderer(MemoryManager_NEW DeferredShadingRenderer());
    //Load scene resources
    return SCENE_LOAD(name,cameraMgr,gui,true,true);
}

bool CubeScene::loadResources(bool continueOnErrors){
    //30 lights? >:)

    for(U8 row=0; row<3; row++)
        for(U8 col=0; col < 10; col++){
            U8 lightId = (U8)(row*10+col);
            std::stringstream ss; ss << (U32)lightId;
            ResourceDescriptor tempLight(stringAlg::toBase("Light Deferred " + ss.str()));
            tempLight.setEnumValue(LIGHT_TYPE_POINT);
            Light* light = CreateResource<Light>(tempLight);
            light->setDrawImpostor(true);
            light->setRange(30.0f);
            light->setCastShadows(false); //ToDo: Shadows are ... for another time -Ionut
            _sceneGraph->getRoot()->addNode(light);
            addLight(light);
    }

    _taskTimers.push_back(0.0);

    return true;
}

bool CubeScene::onKeyUp(const Input::KeyEvent& key)
{
    bool keyState = Scene::onKeyUp(key);
    switch(key._key)
    {
        case Input::KeyCode::KC_T:	_GFX.getRenderer()->toggleDebugView(); break;
        default: break;
    }
    return keyState;
}

};

Commits for Divide-Framework/trunk/Source Code/Scenes/CubeScene/CubeScene.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)

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

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.

306 Diff Diff IonutCava picture IonutCava Tue 12 Aug, 2014 12:47:31 +0000

[Ionut]
- More World Editor work:
— Move and Scale selected objects
— Disabling object specific controls when nothing is selected
— Toggle PostFX and Fog controls working
— Do not pass input to scene when clicking on any editor controls
— Granularity fields working
— Input fields only allow floating point inputs (via regex check)
- Cleaned up Transform class

272 Diff Diff IonutCava picture IonutCava Wed 11 Jun, 2014 11:30:51 +0000

[Ionut] [[BR]]
- Added initial code for Forward+ rendering (grid based light culling) [[BR]]
- Simplified Light class [[BR]]
- Moved more light uniform data to ShaderBuffers [[BR]]
- Double buffered grass rendering [[BR]]
- Added a better attribute interface to GenericVertexData [[BR]]
- Fixed screenshot capture [[BR]]
- Fixed texture double-bind checks [[BR]]

264 Diff Diff k1ngp1n picture k1ngp1n Tue 27 May, 2014 13:04:38 +0000

[Ionut] [[BR]]
- New camera system: [[BR]]
— Stack based (push/pop active camera) [[BR]]
— Per camera frustum [[BR]]
— Per camera projection [[BR]]
— Shadow mapping now uses the new camera system (each light has a shadow camera) [[BR]]
[[BR]]
- New terrain, water and vegetation system: [[BR]]
— Direct import of terrain from L3DT both as 8-bit grayscale and 16-bit raw formats [[BR]]
— Multiple alpha maps for texture splatting support [[BR]]
— Per texture detail map support [[BR]]
— Transform feedback based visibility culling for vegetation [[BR]]
— Alpha-map based vegetation placing on terrain [[BR]]
— Water now uses a refraction map instead of alpha blending for better refraction effects [[BR]]
[[BR]]
- SceneGraph improvements: [[BR]]
— Better bounding box updates from child to parent [[BR]]
— Better onDraw / postDraw implementation [[BR]]
[[BR]]
- Performance improvements: [[BR]]
— Batch 2D rendering tasks together as much as possible[[BR]]
— Improve renderStateBlock hash generation for better sorting [[BR]]
— Move most state related gfx changes from API implementation to the GFXDevice class [[BR]]
— Move viewport stack to the GFXDevice class [[BR]]
— Added various performance counters (frame duration with round-robin query system, draw call count, etc) [[BR]]
— Fixed and improved clip plane management [[BR]]
— Delete client-side texture data after GPU upload [[BR]]
[[BR]]
- New features: [[BR]]
— Added callback support to the Task class so that a specific task may call a function in the main thread upon completion [[BR]]
— Added mouse-wheel zoom support to Orbit/ThirdPerson cameras [[BR]]
— Added 2D Texture Array support (e.g. used for terrain textures) [[BR]]

258 Diff Diff k1ngp1n picture k1ngp1n Tue 15 Apr, 2014 15:26:22 +0000

[Ionut]
- Bumped minimum OpenGL required version to 4.3 (any Fermi and GCN 1.1 GPU)
- Fixed an issue with opacity maps
- Improved loading times by optimizing console output system and various optimizations in DVDConverter
- Create GUIConsole when needed (not on load)
- Moved common control code to the Scene class

253 k1ngp1n picture k1ngp1n Wed 09 Apr, 2014 11:30:54 +0000

[Ionut] [[BR]]
- Split SceneAnimator in global and per-instance data (SceneAnimator and AnimatorComponent) respectively [[BR]]
— Each SceneNode, sharing the same skinned mesh can have different animations with different timings now [[BR]]
- Fixed particle systems' billboarding issues [[BR]]
- More cleaning up of the Material class [[BR]]