فهرست منبع

Merge pull request #735 from sgrenier/next

Terrain test updates
Steve Grenier 13 سال پیش
والد
کامیت
7bc9cbf953
4فایلهای تغییر یافته به همراه10 افزوده شده و 3 حذف شده
  1. 2 0
      gameplay/src/Control.cpp
  2. 1 0
      gameplay/src/Terrain.cpp
  3. 2 1
      gameplay/src/Terrain.h
  4. 5 2
      gameplay/src/TerrainPatch.cpp

+ 2 - 0
gameplay/src/Control.cpp

@@ -43,6 +43,8 @@ void Control::initialize(Theme::Style* style, Properties* properties)
 
     _consumeInputEvents = properties->getBool("consumeInputEvents", true);
 
+    _visible = properties->getBool("visible", true);
+
     if (properties->exists("zIndex"))
     {
         _zIndex = properties->getInt("zIndex");

+ 1 - 0
gameplay/src/Terrain.cpp

@@ -1,5 +1,6 @@
 #include "Base.h"
 #include "Terrain.h"
+#include "TerrainPatch.h"
 #include "Node.h"
 #include "FileSystem.h"
 

+ 2 - 1
gameplay/src/Terrain.h

@@ -1,10 +1,11 @@
 #ifndef TERRAIN_H_
 #define TERRAIN_H_
 
-#include "TerrainPatch.h"
 #include "Transform.h"
 #include "Properties.h"
 #include "HeightField.h"
+#include "Texture.h"
+#include "BoundingBox.h"
 
 namespace gameplay
 {

+ 5 - 2
gameplay/src/TerrainPatch.cpp

@@ -561,8 +561,11 @@ unsigned int TerrainPatch::getVisibleTriangleCount() const
 
     // Does the current camera intersect this patch at all?
     BoundingBox bounds = getBoundingBox(true);
-    if (!camera->getFrustum().intersects(bounds))
-        return 0;
+    if (_terrain->_flags & Terrain::FRUSTUM_CULLING)
+    {
+        if (!camera->getFrustum().intersects(bounds))
+            return 0;
+    }
 
     // Return the triangle count of the LOD level depending on the camera
     size_t lod = computeLOD(camera, bounds);