Added gui bool for toggling merge cullable chuch nodes, and made culling view frustum static

This commit is contained in:
Erik Broberg
2016-05-13 19:53:45 -04:00
parent f48400523c
commit 276375a799
8 changed files with 15 additions and 9 deletions
+2 -1
View File
@@ -102,7 +102,8 @@ namespace openspace {
_isVisible &= HorizonCuller::isVisible(myRenderData, _surfacePatch, ellipsoid, maxHeight);
}
if (!_isVisible) return WANT_MERGE;
if(!_isVisible && owner()->mergeInvisible)
return WANT_MERGE;
Vec3 cameraPosition = myRenderData.camera.position().dvec3();
@@ -87,7 +87,7 @@ namespace openspace {
bool doHorizonCulling = true;
bool doFrustumCulling = true;
int numPosZthres;
bool mergeInvisible;
float lodScaleFactor;
bool initChunkVisible;
@@ -56,7 +56,7 @@ namespace openspace {
, _saveOrThrowCamera(properties::BoolProperty("saveOrThrowCamera", "saveOrThrowCamera"))
, doFrustumCulling(properties::BoolProperty("doFrustumCulling", "doFrustumCulling"))
, doHorizonCulling(properties::BoolProperty("doHorizonCulling", "doHorizonCulling"))
, numPosZthres(properties::IntProperty("numPosZthres", "numPosZthres", 0, 0, 9))
, mergeInvisible(properties::BoolProperty("mergeInvisible", "mergeInvisible", true))
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 10.0f, 0.0f, 100.0f))
, initChunkVisible(properties::BoolProperty("initChunkVisible", "initChunkVisible", true))
@@ -67,7 +67,7 @@ namespace openspace {
addProperty(_saveOrThrowCamera);
addProperty(doFrustumCulling);
addProperty(doHorizonCulling);
addProperty(numPosZthres);
addProperty(mergeInvisible);
addProperty(lodScaleFactor);
addProperty(initChunkVisible);
@@ -158,7 +158,7 @@ namespace openspace {
}
_chunkedLodGlobe->doFrustumCulling = doFrustumCulling.value();
_chunkedLodGlobe->doHorizonCulling = doHorizonCulling.value();
_chunkedLodGlobe->numPosZthres = numPosZthres.value();
_chunkedLodGlobe->mergeInvisible = mergeInvisible.value();
_chunkedLodGlobe->lodScaleFactor= lodScaleFactor.value();
_chunkedLodGlobe->initChunkVisible = initChunkVisible.value();
_distanceSwitch.render(data);
@@ -65,7 +65,7 @@ public:
properties::BoolProperty doFrustumCulling;
properties::BoolProperty doHorizonCulling;
properties::IntProperty numPosZthres;
properties::BoolProperty mergeInvisible;
properties::FloatProperty lodScaleFactor;
properties::BoolProperty initChunkVisible;
private:
+4 -1
View File
@@ -48,6 +48,9 @@ namespace openspace {
}
const AABB3 viewFrustum = AABB3(vec3(-1, -1, 0), vec3(1, 1, 1e35));
bool FrustumCuller::isVisible(
const RenderData& data,
const vec3& point) {
@@ -143,7 +146,7 @@ namespace openspace {
bounds.expand(cornerScreenSpace);
}
AABB3 viewFrustum(vec3(-1, -1, 0), vec3(1, 1, 1e35));
return bounds.intersects(viewFrustum);
/*
@@ -58,6 +58,8 @@ namespace openspace {
FrustumCuller();
~FrustumCuller();
static const AABB3 viewFrustum;
/**
Returns true if the point is inside the view frustrum defined in RenderData.
The third argument marginScreenSpace is added to the default screen space
@@ -45,7 +45,7 @@ Fragment getFragment() {
//frag.color = frag.color * 0.9 + 0.2*vec4(samplePos, 0, 1);
// Border overlay
frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02);
//frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02);
frag.depth = fs_position.w;
@@ -45,7 +45,7 @@ Fragment getFragment() {
//frag.color = frag.color * 0.9 + 0.2*vec4(samplePos, 0, 1);
// Border overlay
frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02);
//frag.color = frag.color + patchBorderOverlay(fs_uv, vec3(0.5, 0.5, 0.5), 0.02);
frag.depth = fs_position.w;