Browse Source

Allow the application to get access to a View's occlusion buffer for debug visualization. Clear occlusion buffer to farclip Z value instead of maximum (0x7fffffff)

Lasse Öörni 10 years ago
parent
commit
0a6a8a9de6

+ 2 - 1
Source/Urho3D/Graphics/OcclusionBuffer.cpp

@@ -147,9 +147,10 @@ void OcclusionBuffer::Clear()
 
     int* dest = buffer_;
     int count = width_ * height_;
+    int fillValue = (int)OCCLUSION_Z_SCALE;
 
     while (count--)
-        *dest++ = 0x7fffffff;
+        *dest++ = fillValue;
 
     depthHierarchyDirty_ = true;
 }

+ 1 - 1
Source/Urho3D/Graphics/View.cpp

@@ -295,6 +295,7 @@ View::View(Context* context) :
     camera_(0),
     cameraZone_(0),
     farClipZone_(0),
+    occlusionBuffer_(0),
     renderTarget_(0),
     substituteRenderTarget_(0)
 {
@@ -644,7 +645,6 @@ void View::Render()
     octree_ = 0;
     cameraZone_ = 0;
     farClipZone_ = 0;
-    occlusionBuffer_ = 0;
     frame_.camera_ = 0;
 }
 

+ 3 - 0
Source/Urho3D/Graphics/View.h

@@ -162,6 +162,9 @@ public:
     /// Return light batch queues.
     const Vector<LightBatchQueue>& GetLightQueues() const { return lightQueues_; }
 
+    /// Return the last used software occlusion buffer.
+    OcclusionBuffer* GetOcclusionBuffer() const { return occlusionBuffer_; }
+
     /// Set global (per-frame) shader parameters. Called by Batch and internally by View.
     void SetGlobalShaderParameters();
     /// Set camera-specific shader parameters. Called by Batch and internally by View.