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

namespace Navigation {
    NavMeshDebugDraw::NavMeshDebugDraw() : _overrideColor(false), _dirty(true), _paused(false), _color(0), _primitive(nullptr)
    {
        //Generate a render state
        RenderStateBlockDescriptor navigationDebugDesc;
        navigationDebugDesc.setCullMode(CULL_MODE_NONE);
        navigationDebugDesc.setBlend(true, BLEND_PROPERTY_SRC_ALPHA, BLEND_PROPERTY_INV_SRC_ALPHA);
        _navMeshStateBlockHash = GFX_DEVICE.getOrCreateStateBlock(navigationDebugDesc);
    }

   NavMeshDebugDraw::~NavMeshDebugDraw()
   {
       //Allow the primitive to be deleted
       if(_primitive)
           _primitive->_canZombify = true;
   }

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

   void NavMeshDebugDraw::depthMask(bool state){
      RenderStateBlockDescriptor newDepthDesc(GFX_DEVICE.getStateBlockDescriptor(_navMeshStateBlockHash));
      newDepthDesc.setZReadWrite(true, state);
      _navMeshStateBlockHash = GFX_DEVICE.getOrCreateStateBlock(newDepthDesc);
   }

   void NavMeshDebugDraw::texture(bool state){
   }

   void NavMeshDebugDraw::setDrawState(){
        GFX_DEVICE.pushWorldMatrix(mat4<F32>(), true);
   }

   void NavMeshDebugDraw::releaseDrawState(){
       GFX_DEVICE.popWorldMatrix();
   }

   void NavMeshDebugDraw::beginBatch(){
      if(!_primitive){
          _dirty = true;
          _primitive = GFX_DEVICE.createPrimitive(false);
          _primitive->stateHash(_navMeshStateBlockHash);
          _primitive->setRenderStates(DELEGATE_BIND(&NavMeshDebugDraw::setDrawState, this),
                                      DELEGATE_BIND(&NavMeshDebugDraw::releaseDrawState, this));
      }

      assert(_primitive != nullptr);

      if(_dirty) _primitive->beginBatch();
   }

   void NavMeshDebugDraw::endBatch(){
      if(_dirty) {
          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 = TRIANGLES;  break;
            case DU_DRAW_POINTS: _primType = API_POINTS; break;
            case DU_DRAW_LINES:  _primType = LINES;      break;
            case DU_DRAW_QUADS:  /*_primType = QUADS;*/ assert(prim == DU_DRAW_QUADS);
        }

        _primitive->attribute4ub("inColorData",vec4<U8>(255,255,255,64));
        _primitive->begin(_primType);
   }

   void NavMeshDebugDraw::vertex(const F32* pos, U32 color){
      vertex(pos[0], pos[1], pos[2], color);
   }

   void NavMeshDebugDraw::vertex(const F32 x, const F32 y, const F32 z, U32 color){
       if(!_dirty || !_primitive) return;
       if(_overrideColor)  color = _color;

       vec4<U8> colorVec;
       vec3<F32> vert(x,y,z);
       rcCol(color, colorVec.r, colorVec.g, colorVec.b, colorVec.a);
       colorVec.a = 64;

       _primitive->attribute4ub("inColorData",colorVec);
       _primitive->vertex(vert);
   }

   void NavMeshDebugDraw::vertex(const F32* pos, U32 color, const F32* uv) {
      vertex(pos[0], pos[1], pos[2], color);
   }

   void NavMeshDebugDraw::vertex(const F32 x, const F32 y, const F32 z, U32 color, const F32 u, const F32 v) {
      vertex(x, y, z, color);
   }

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

   void NavMeshDebugDraw::overrideColor(U32 col) {
      _overrideColor = true;
      _color = col;
   }

   void NavMeshDebugDraw::cancelOverride() {
      _overrideColor = false;
   }
};

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

Diff revisions: vs.
Revision Author Commited Message
280 Diff Diff IonutCava picture IonutCava Sat 28 Jun, 2014 19:11:37 +0000

[Ionut] [[BR]]
- Improve ClipPlane management (bunch equations into the matrix shader buffer) [[BR]]
- Immediate mode emulation primitives set their own state based on specified hash instead of relying on state functions to be defined [[BR]]
- updateStates() function is now called right before the actual draw call to facilitate future batching work [[BR]]
- added tracked bool values (similar to those in ShaderInfo) to SGN class to fix selection bug. [[BR]]
— will probably create a “stateTracker” class to allow multiple classes to use tracked variables without all of the code duplication [[BR]]

273 Diff Diff IonutCava picture IonutCava Wed 11 Jun, 2014 20:34:00 +0000

[Ionut] [[BR]]
- Improved batching part2: [[BR]]
— Moved all bone transformation matrices upload from uniform functions in SceneNode to Shader Storage Buffers in AnimationController class with updates controlled by SceneGraphNode’s AnimationComponent [[BR]]
-— No double-buffering or efficient mapping of data yet. Just raw buffer updates [[BR]]
— Replaced all RenderStateBlock* pointers with I64 hash values [[BR]]
-— Will be used later in draw commands as per-shader state hash [[BR]]
— Moved getShaderProgram from Material to Material::ShaderInfo [[BR]]
-— Improved redundant uniform checks [[BR]]
— Improved texture unit changing in case of redundant texture bind case (i.e. skip changing the texture unit) [[BR]]
[[BR]]
- Improved float and double comparison functions using algorithms described in http://randomascii.wordpress.com/2012/02/13/dont-store-that-in-a-float/ [[BR]]
- Added a new utility function, DIVIDE_ASSERT, to more easily bind an assert check with a specific message [[BR]]
- Added missing files from Forward+ renderer’s initial code [[BR]]

267 Diff Diff k1ngp1n picture k1ngp1n Wed 28 May, 2014 11:08:12 +0000

[Ionut] [[BR]]
- Improved texture handling: [[BR]]
— No more texture unbind (except when clearing the frame state) [[BR]]
— Moved texture bind checking to the GL_API class [[BR]]
- Fixed a crash related to vegetation loading due to compiler optimizations [[BR]]
- removed all “releaseMaterial” functions as they are no longer needed [[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]]

260 Diff Diff k1ngp1n picture k1ngp1n Sat 03 May, 2014 19:33:41 +0000

[Ionut] [[BR]]
- More work on CSM. Reverted back to VSM to allow easier blurring and filtering [[BR]]
- Rewrote FrameBuffer classes to fix MSAA and memory leaks that occurred on resize (double creation of textures) [[BR]]
— Removed FBType. FrameBuffer types depend only on attachment types and if it’s MSAA enabled or not [[BR]]
- Rewrote RenderState classes to be API agnostic [[BR]]
- Bug fixes in math classes [[BR]]
- Changed “resolution change” logic [[BR]]
- Simplified some options in config.xml [[BR]]
- Improved per-light shadow options [[BR]]

249 Diff Diff k1ngp1n picture k1ngp1n Mon 31 Mar, 2014 20:42:31 +0000

[Ionut] [[BR]]
- Migrated to platform toolset v100 [[BR]]
- Updated boost to 1.55 [[BR]]
- Moved from “NULL” to “nullptr” [[BR]]
- DevIL is now linked dynamically [[BR]]

248 Diff Diff k1ngp1n picture k1ngp1n Mon 24 Feb, 2014 22:35:21 +0000

[Ionut][[BR]]
- Added a GenericVertexData class that can be used to fill VBOs with generic data and upload it to the GPU (and render it, either direct or instanced) [[BR]]
- Added a basic (soft) particle system [[BR]]
- Reworked memory allocation logging [[BR]]
- Improved transparency detection for textures on load [[BR]]

232 Diff Diff k1ngp1n picture k1ngp1n Tue 14 Jan, 2014 14:58:15 +0000

[Ionut][[BR]]
- nVidia FBO_MS fix (TexParameter calls do not work on TEXTURE_2D_MULTISAMPLE) [[BR]]
- nVidia shading issue fix (uninitialized MaterialProperties values were used for lighting) [[BR]]
- more stability fixes for nav meshes and pathfinding (may still hang sometimes [[BR]]
- Some changes to WarScene: [[BR]]
— added some obstacles [[BR]]
— added auto load nav mesh in separate thread [[BR]]
— added auto draw debug nav mesh in DEBUG [[BR]]
— added basic entity position <---> entity destination debug line rendering to get a basic idea of unit’s path [[BR]]

223 Diff Diff k1ngp1n picture k1ngp1n Thu 09 Jan, 2014 15:55:04 +0000

[Ionut] [[BR]]
- Fixed most compatibility bugs on nVidia [[BR]]
— Removed the use of gl_Color in shaders [[BR]]
— Removed the use of GL_QUADS for VBOs [[BR]]
— Added VAO support to GLIM [[BR]]
— Hacked extension checking with GLEW (used glGetStringi for anisotropy and s3tc) [[BR]]
- Changed grass rendering to triangle strips (but disabled for now) [[BR]]
- Improved Transform class for more robustness [[BR]]
- Fixed transform related crash in SceneGraphNode when deleting a parentTransform [[BR]]
- Removed grandParent support in SceneGraphNode class as it was useless (getParent()->getParent() works just as well) [[BR]]

221 k1ngp1n picture k1ngp1n Wed 08 Jan, 2014 18:50:02 +0000

[Ionut] [[BR]]
- Merged branch “Shadows And Animations” back into trunk [[BR]]
- Added DoxygenGUI project file [[BR]]

  • Buggy *