Browse Source

Avoiding infinite background depth for faster deferred light.

David Piuva 5 years ago
parent
commit
95dbc22b08
2 changed files with 4 additions and 3 deletions
  1. 4 1
      Source/SDK/SpriteEngine/spriteAPI.cpp
  2. 0 2
      Source/SDK/sandbox/sandbox.cpp

+ 4 - 1
Source/SDK/SpriteEngine/spriteAPI.cpp

@@ -10,6 +10,9 @@
 // Comment out a flag to disable an optimization when debugging
 #define DIRTY_RECTANGLE_OPTIMIZATION
 
+// Do not place anything visible below the bottom clip plane
+static const float bottomClipPlane = -1000000.0f;
+
 namespace dsr {
 
 template <bool HIGH_QUALITY>
@@ -518,7 +521,7 @@ private:
 	// Pre-condition: diffuseBuffer must be cleared unless sprites cover the whole block
 	void draw(Octree<SpriteInstance>& sprites, Octree<ModelInstance>& models, const OrthoView& ortho) {
 		image_fill(this->normalBuffer, ColorRgbaI32(128));
-		image_fill(this->heightBuffer, -std::numeric_limits<float>::max());
+		image_fill(this->heightBuffer, bottomClipPlane);
 		OcTreeFilter orthoCullingFilter = [ortho,this](const IVector3D& minBound, const IVector3D& maxBound){
 			return orthoCullingTest(ortho, minBound, maxBound, this->worldRegion);
 		};

+ 0 - 2
Source/SDK/sandbox/sandbox.cpp

@@ -12,8 +12,6 @@ BUGS:
 		How can a new mouse-move event be triggered from the current location when toggling full-screen so that the window itself moves?
 	* Tiles placed at different heights do not have synchronized rounding between each other.
 		Try to round the Y offset separatelly from the XZ location's screen coordinate.
-	* The light buffer gets white from point light when there's nothing drawn on the background.
-		This prevent using other background colors than black.
 
 3D BUGS:
 	DRAWN: