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
// With huge thanks to:
//    Mikko Mononen http://groups.google.com/group/recastnavigation
// And thanks to  Daniel Buckmaster, 2011 for his
// T3D 1.1 implementation of Recast's DebugUtils.

#include "Headers/NavMeshDebugDraw.h"
#include "Headers/NavMesh.h"

#include "Platform/Video/Headers/GFXDevice.h"
#include "Platform/Video/Headers/IMPrimitive.h"
#include "Platform/Video/Headers/RenderStateBlock.h"

namespace Divide {
namespace AI {
namespace Navigation {

NavMeshDebugDraw::NavMeshDebugDraw()
    : _overrideColour(false),
      _dirty(true),
      _paused(false),
      _colour(0),
      _primitive(nullptr),
      _primType(PrimitiveType::COUNT),
      _vertCount(0)
{
    // Generate a render state
    RenderStateBlock navigationDebugStateBlock;
    navigationDebugStateBlock.setCullMode(CullMode::NONE);
    navigationDebugStateBlock.setBlend(true);
    _navMeshStateBlockHash = navigationDebugStateBlock.getHash();
}

NavMeshDebugDraw::~NavMeshDebugDraw()
{
	_primitive->clear();
}

void NavMeshDebugDraw::paused(bool state) {
    _paused = state;
    if (_primitive) {
        _primitive->paused(_paused);
    }
}

void NavMeshDebugDraw::beginBatch() {
    if (!_primitive) {
        _dirty = true;
        _primitive = GFX_DEVICE.newIMP();
        _primitive->stateHash(_navMeshStateBlockHash);
    }

    assert(_primitive != nullptr);

    if (_dirty) {
        _primitive->beginBatch(true, 1024, 1);
    }
}

void NavMeshDebugDraw::endBatch() {
    if (!_dirty) {
        return;
    }

    if (_primitive) {
        _primitive->endBatch();
    }

    _dirty = false;
}

void NavMeshDebugDraw::begin(duDebugDrawPrimitives prim, F32 size) {
    if (!_dirty || !_primitive) {
        return;
    }

    switch (prim) {
        default:
        case DU_DRAW_TRIS:
            _primType = PrimitiveType::TRIANGLES;
            break;
        case DU_DRAW_POINTS:
            _primType = PrimitiveType::API_POINTS;
            break;
        case DU_DRAW_LINES:
            _primType = PrimitiveType::LINES;
            break;
        case DU_DRAW_QUADS: /*_primType = PrimitiveType::QUADS;*/
            assert(prim == DU_DRAW_QUADS);
    }

    _primitive->attribute4f(to_const_uint(AttribLocation::VERTEX_COLOR), vec4<F32>(1.0f, 1.0f, 1.0f, 0.5f));
    _primitive->begin(_primType);
}

void NavMeshDebugDraw::vertex(const F32 x, const F32 y, const F32 z,
                              U32 colour) {
    if (!_dirty || !_primitive) {
        return;
    }
    if (_overrideColour) {
        colour = _colour;
    }

    vec4<U8> colourVec;
    rcCol(colour, colourVec.r, colourVec.g, colourVec.b, colourVec.a);
    colourVec.a = 64;

    _primitive->attribute4f(to_const_uint(AttribLocation::VERTEX_COLOR), Util::ToFloatColour(colourVec));
    _primitive->vertex(x, y, z);
}

void NavMeshDebugDraw::end() {
    if (_dirty && _primitive) {
        _primitive->end();
    }
}

GenericDrawCommand NavMeshDebugDraw::toDrawCommand() const {
    return _primitive->toDrawCommand();
}

void NavMeshDebugDraw::overrideColour(U32 col) {
    _overrideColour = true;
    _colour = col;
}
};  // namespace Navigation
};  // namespace AI
};  // namespace Divide

Commits for Divide-Framework/trunk/Source Code/AI/PathFinding/NavMeshes/NavMeshDebugDraw.cpp

Diff revisions: vs.
Revision Author Commited Message
788 Diff Diff IonutCava picture IonutCava Fri 21 Oct, 2016 16:11:37 +0000

[IonutCava]
- Added support for the Arena Allocator by Mamasha Knows (http://www.codeproject.com/Articles/44850/Arena-Allocator-DTOR-and-Embedded-Preallocated-Buf)
— Used for GFX Related objects: Textures, shaders, etc

777 Diff Diff IonutCava picture IonutCava Fri 07 Oct, 2016 16:14:48 +0000

[IonutCava]
- Continue to implement CommandBuffer / RenderPass / RenderSubPass system.
— Rendering artefacts are still present.

764 Diff Diff IonutCava picture IonutCava Mon 22 Aug, 2016 15:38:11 +0000

[IonutCava]
- Add some explicit include for RenderStateBlock as it will be removed from the RenderAPIWrapper.h file

721 Diff Diff IonutCava picture IonutCava Wed 08 Jun, 2016 15:47:49 +0000

[IonutCava]
- Spelling: change all references from our code of “color” to the PROPER British version of “colour” because it sounds 100x better

720 Diff Diff IonutCava picture IonutCava Mon 06 Jun, 2016 15:51:06 +0000

[IonutCava]
- PVS-Studio guided static analysis fixes and optimizations
- Added a flag to SceneState to bypass the Save/Load system not needed for certain types of scenes (menus, cinematics, etc)

654 Diff Diff IonutCava picture IonutCava Tue 01 Mar, 2016 17:22:09 +0000

[Ionut]
- Moved window related code from rendering API code into proper classes:
— DisplayWindow handles SDL based window management
— WindowManager handles multiple DisplayWindow instances
— Code still needs proper extensive testing
- Small performance optimizations

628 Diff Diff IonutCava picture IonutCava Wed 20 Jan, 2016 17:17:53 +0000

[IonutCava]
- Reworked GenericVertexData ring-buffering system and changed vertex attributes to the vertex format system
— Might be buggy
- Disabled bump-mapping for low-LoD level entities
- Removed a forgotten test line in BRDF shader that prevented lighting calculations to occur properly (an early return)
- Updated auto-reflection system for high shininess materials
- Converted a lot of ‘to_xyz’ calls to ‘to_const_xyz’ calls where appropriate to reduce runtime cost (‘to_const_xyz’ is evaluated at compile time)

617 Diff Diff IonutCava picture IonutCava Tue 05 Jan, 2016 16:47:21 +0000

[IonutCava]
- Depth writing is now a rendering API level toggle instead of a renderstateblock option
- Z-Pre-pass fixes and improvements
- Moved normal render target to the display stage from the pre-pass stage
— Normals are only used in post-processing. This improves pre-pass performance

612 Diff Diff IonutCava picture IonutCava Sun 20 Dec, 2015 17:47:26 +0000

[IonutCava]
- Z-PrePass system improvements
— Depth only rendertarget and both eye render targets (screen and anaglyph) share the same depth buffer
— Screen render targets don’t clear or write the/to the depth buffer

591 IonutCava picture IonutCava Wed 02 Dec, 2015 17:17:23 +0000

[IonutCava]
- More work on the ForwardPlus renderer
- Singleton cleanup
- First steps for reducing scope of GFXDevice class