mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 12:39:49 -06:00
Implement skirts.
This commit is contained in:
@@ -38,6 +38,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/trianglesoup.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/grid.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/basicgrid.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/skirtedgrid.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/clipmapgrid.h
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/geodetics/geodetic2.h
|
||||
@@ -75,6 +76,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/trianglesoup.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/grid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/basicgrid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/skirtedgrid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/meshes/clipmapgrid.cpp
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/geodetics/geodetic2.cpp
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/meshes/basicgrid.h>
|
||||
#include <modules/globebrowsing/meshes/skirtedgrid.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -63,7 +63,7 @@ namespace openspace {
|
||||
, _savedCamera(nullptr)
|
||||
{
|
||||
|
||||
auto geometry = std::shared_ptr<BasicGrid>(new BasicGrid(
|
||||
auto geometry = std::shared_ptr<SkirtedGrid>(new SkirtedGrid(
|
||||
segmentsPerPatch,
|
||||
segmentsPerPatch,
|
||||
TriangleSoup::Positions::No,
|
||||
|
||||
@@ -247,6 +247,7 @@ namespace openspace {
|
||||
programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
|
||||
programObject->setUniform("lonLatScalingFactor", vec2(patchSize.toLonLatVec2()));
|
||||
programObject->setUniform("radiiSquared", vec3(ellipsoid.radiiSquared()));
|
||||
programObject->setUniform("xSegments", _grid->xSegments());
|
||||
|
||||
// OpenGL rendering settings
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -481,6 +482,8 @@ namespace openspace {
|
||||
"projectionTransform",
|
||||
data.camera.projectionMatrix());
|
||||
|
||||
programObject->setUniform("xSegments", _grid->xSegments());
|
||||
|
||||
// OpenGL rendering settings
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
@@ -37,6 +37,9 @@ uniform vec3 radiiSquared;
|
||||
uniform vec2 minLatLon;
|
||||
uniform vec2 lonLatScalingFactor;
|
||||
|
||||
uniform int xSegments;
|
||||
uniform int ySegments;
|
||||
|
||||
uniform TextureTile heightTiles[NUMLAYERS_HEIGHTMAP];
|
||||
|
||||
layout(location = 1) in vec2 in_uv;
|
||||
@@ -70,6 +73,16 @@ void main()
|
||||
height = (sampledValue *
|
||||
heightTiles[#{i}].depthTransform.depthScale +
|
||||
heightTiles[#{i}].depthTransform.depthOffset);
|
||||
|
||||
// Skirts
|
||||
int vertexIDx = gl_VertexID % (xSegments + 3);
|
||||
int vertexIDy = gl_VertexID / (xSegments + 3);
|
||||
if (vertexIDx == 0 ||
|
||||
vertexIDy == 0 ||
|
||||
vertexIDx == (xSegments + 2) ||
|
||||
vertexIDy == (xSegments + 2) ) {
|
||||
height = 0;
|
||||
}
|
||||
}
|
||||
#endfor
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ uniform vec3 patchNormalCameraSpace;
|
||||
|
||||
uniform TextureTile heightTiles[NUMLAYERS_HEIGHTMAP];
|
||||
|
||||
uniform int xSegments;
|
||||
uniform int ySegments;
|
||||
|
||||
layout(location = 1) in vec2 in_uv;
|
||||
|
||||
out vec2 fs_uv;
|
||||
@@ -74,6 +77,16 @@ void main()
|
||||
height = (sampledValue *
|
||||
heightTiles[#{i}].depthTransform.depthScale +
|
||||
heightTiles[#{i}].depthTransform.depthOffset);
|
||||
|
||||
// Skirts
|
||||
int vertexIDx = gl_VertexID % (xSegments + 3);
|
||||
int vertexIDy = gl_VertexID / (xSegments + 3);
|
||||
if (vertexIDx == 0 ||
|
||||
vertexIDy == 0 ||
|
||||
vertexIDx == (xSegments + 2) ||
|
||||
vertexIDy == (xSegments + 2) ) {
|
||||
height = 0;
|
||||
}
|
||||
}
|
||||
#endfor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user