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

#include "Core/Headers/Application.h"
#include "Scenes/Headers/SceneState.h"
#include "Managers/Headers/CameraManager.h"
#include "Core/Resources/Headers/ResourceCache.h"

void GFXDevice::previewDepthBuffer(){
    if (!_previewDepthBuffer)
        return;

    if(!_previewDepthMapShader){
        ResourceDescriptor shadowPreviewShader("fbPreview.LinearDepth");
        _previewDepthMapShader = CreateResource<ShaderProgram>(shadowPreviewShader);
        assert(_previewDepthMapShader != nullptr);
        _previewDepthMapShader->UniformTexture("tex", 0);
        _previewDepthMapShader->Uniform("useScenePlanes", true);
    }

    if(_previewDepthMapShader->getState() != RES_LOADED)
        return;

    _previewDepthMapShader->bind();
    _renderTarget[RENDER_TARGET_DEPTH]->Bind(0, TextureDescriptor::Depth);
    
    renderInViewport(vec4<I32>(Application::getInstance().getResolution().width-256,0,256,256), DELEGATE_BIND(&GFXDevice::drawPoints, this, 1, _defaultStateNoDepthHash));
}

void GFXDevice::debugDraw(const SceneRenderState& sceneRenderState) {
    drawDebugAxis(sceneRenderState);

    _imShader->bind();

    for(IMPrimitive* priv : _imInterfaces){
        if(priv->paused())
            continue;

        if(!priv->inUse() && priv->_canZombify) {
            priv->zombieCounter(priv->zombieCounter() + 1);
            continue;
        }
        
        setStateBlock(priv->stateHash());

        priv->setupStates();
        
        if(priv->_hasLines)
            setLineWidth(priv->_lineWidth);
        
        bool texture = (priv->_texture != nullptr);

        if(texture)
            priv->_texture->Bind(0);
        
        _imShader->Uniform("useTexture", texture);
        _imShader->Uniform("dvd_WorldMatrix", priv->worldMatrix());

        priv->render(1, priv->forceWireframe());

        if(priv->_hasLines)
            restoreLineWidth();
      
        priv->resetStates();

        if(priv->_canZombify)
            priv->inUse(false);
    }
    
    _imShader->unbind();
}

void GFXDevice::drawDebugAxis(const SceneRenderState& sceneRenderState) {
    if(!drawDebugAxis()) return;

    if(_axisLines.empty()){
        //Red X-axis
        _axisLines.push_back(Line(VECTOR3_ZERO, WORLD_X_AXIS, vec4<U8>(255, 0, 0, 255)));
        //Green Y-axis
        _axisLines.push_back(Line(VECTOR3_ZERO, WORLD_Y_AXIS, vec4<U8>(0, 255, 0, 255))); 
        //Blue Z-axis
        _axisLines.push_back(Line(VECTOR3_ZERO, WORLD_Z_AXIS, vec4<U8>(0, 0, 255, 255)));
    }

    const Camera& cam = sceneRenderState.getCameraConst();

    mat4<F32> offset(- cam.getViewDir() * 2, VECTOR3_ZERO, cam.getUpDir());

    drawLines(_axisLines, offset * _viewMatrix.getInverse(), vec4<I32>(_renderTarget[RENDER_TARGET_SCREEN]->getWidth() - 128, 0, 128, 128), true, true);
}

Commits for Divide-Framework/trunk/Source Code/Hardware/Video/GFXDeviceDebug.cpp

Diff revisions: vs.
Revision Author Commited Message
286 IonutCava picture IonutCava Fri 18 Jul, 2014 16:32:03 +0000

[Ionut] [[BR]]

    • very buggy commit ** [[BR]]

- New rendering pipeline: [[BR]]
— Bumped OpenGL version to 4.4 [[BR]]
— Command based rendering. GFXDevice dispatches rendering commands to their respective buffers [[BR]]
— State changing is exclusively controlled by the GFXDevice class [[BR]]
— Material properties and transform matrices are stored in shader storage buffers that are updated after culling and uploaded once per RenderPass. Objects use drawIDs to index data in shaders [[BR]]
— Removed all custom matrices and other, per shader, bind data [[BR]]
— Removed per node light data. Light culling and shader buffers will replace the old light management system [[BR]]
— Framebuffers now use the Texture class for attachments [[BR]]
— Sampler objects now work like RenderStateBlocks. GL_API handles them and stores them in a hash indexed map [[BR]]
— Removed “prepareMaterial” calls. Pre-draw material setup is now only limited to texture binding [[BR]]
— Moved immediate mode emulation and primitive rendering from API level to GFXDevice level [[BR]]
— Framebuffer rendering must be completed with a call to end() to ensure proper MSAA resolve (asserts, otherwise) [[BR]]
- Fixed hash code generation for RenderStateBlock (and now, glSamplerObject) using boost::hash_combine [[BR]]
- Temporarily disabled XML caching for materials [[BR]]