mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-18 09:51:18 -06:00
Merge branch 'feature/globebrowsing' of github.com:OpenSpace/OpenSpace-Development into feature/globebrowsing
This commit is contained in:
@@ -59,7 +59,7 @@ namespace openspace {
|
||||
, doFrustumCulling(properties::BoolProperty("doFrustumCulling", "doFrustumCulling"))
|
||||
, doHorizonCulling(properties::BoolProperty("doHorizonCulling", "doHorizonCulling"))
|
||||
, mergeInvisible(properties::BoolProperty("mergeInvisible", "mergeInvisible", true))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 5.0f, 0.0f, 20.0f))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 5.0f, 1.0f, 20.0f))
|
||||
, initChunkVisible(properties::BoolProperty("initChunkVisible", "initChunkVisible", true))
|
||||
, renderSmallChunksFirst(properties::BoolProperty("renderSmallChunksFirst", "renderSmallChunksFirst", true))
|
||||
{
|
||||
|
||||
@@ -37,25 +37,15 @@ uniform TextureTile colorTilesParent2[NUMLAYERS_COLORTEXTURE];
|
||||
in vec4 fs_position;
|
||||
in vec2 fs_uv;
|
||||
|
||||
in vec3 positionWorldSpace;
|
||||
|
||||
uniform vec3 cameraPosition;
|
||||
uniform float distanceScaleFactor;
|
||||
uniform int chunkLevel;
|
||||
in float tileInterpolationParameter;
|
||||
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
|
||||
// Calculate desired level based on distance
|
||||
float distToFrag = length(positionWorldSpace - cameraPosition);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToFrag;
|
||||
float desiredLevel = log2(projectedScaleFactor);
|
||||
|
||||
// x increases with distance
|
||||
float x = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - x, 0 , 1);
|
||||
float w2 = (clamp(x, 0 , 1) - clamp(x - 1, 0 , 1));
|
||||
float w3 = clamp(x - 1, 0 , 1);
|
||||
// tileInterpolationParameter increases with distance
|
||||
float w1 = clamp(1 - tileInterpolationParameter, 0 , 1);
|
||||
float w2 = (clamp(tileInterpolationParameter, 0 , 1) - clamp(tileInterpolationParameter - 1, 0 , 1));
|
||||
float w3 = clamp(tileInterpolationParameter - 1, 0 , 1);
|
||||
|
||||
#for j in 1..#{numLayersColor}
|
||||
{
|
||||
@@ -78,14 +68,6 @@ Fragment getFragment() {
|
||||
}
|
||||
#endfor
|
||||
|
||||
//frag.color.rgb *= 10;
|
||||
|
||||
// Sample position overlay
|
||||
//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.depth = fs_position.w;
|
||||
|
||||
return frag;
|
||||
|
||||
@@ -38,7 +38,6 @@ uniform vec2 minLatLon;
|
||||
uniform vec2 lonLatScalingFactor;
|
||||
|
||||
uniform int xSegments;
|
||||
uniform int ySegments;
|
||||
uniform float skirtLength;
|
||||
|
||||
uniform TextureTile heightTiles[NUMLAYERS_HEIGHTMAP];
|
||||
@@ -53,7 +52,9 @@ layout(location = 1) in vec2 in_uv;
|
||||
|
||||
out vec2 fs_uv;
|
||||
out vec4 fs_position;
|
||||
out vec3 positionWorldSpace;
|
||||
// tileInterpolationParameter is used to interpolate between a tile and its parent tiles
|
||||
// The value increases with the distance from the vertex (or fragment) to the camera
|
||||
out float tileInterpolationParameter;
|
||||
|
||||
PositionNormalPair globalInterpolation() {
|
||||
vec2 lonLatInput;
|
||||
@@ -66,20 +67,19 @@ PositionNormalPair globalInterpolation() {
|
||||
void main()
|
||||
{
|
||||
PositionNormalPair pair = globalInterpolation();
|
||||
positionWorldSpace = pair.position;
|
||||
|
||||
float height = 0;
|
||||
|
||||
// Calculate desired level based on distance
|
||||
float distToVertex = length(positionWorldSpace - cameraPosition);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToVertex;
|
||||
// Calculate desired level based on distance to the vertex on the ellipsoid
|
||||
// Before any heightmapping is done
|
||||
float distToVertexOnEllipsoid = length(pair.position - cameraPosition);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToVertexOnEllipsoid;
|
||||
float desiredLevel = log2(projectedScaleFactor);
|
||||
|
||||
// x increases with distance
|
||||
float x = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - x, 0 , 1);
|
||||
float w2 = (clamp(x, 0 , 1) - clamp(x - 1, 0 , 1));
|
||||
float w3 = clamp(x - 1, 0 , 1);
|
||||
tileInterpolationParameter = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - tileInterpolationParameter, 0 , 1);
|
||||
float w2 = (clamp(tileInterpolationParameter, 0 , 1) - clamp(tileInterpolationParameter - 1, 0 , 1));
|
||||
float w3 = clamp(tileInterpolationParameter - 1, 0 , 1);
|
||||
|
||||
#for j in 1..#{numLayersHeight}
|
||||
{
|
||||
|
||||
@@ -34,26 +34,20 @@ uniform TextureTile colorTiles[NUMLAYERS_COLORTEXTURE];
|
||||
uniform TextureTile colorTilesParent1[NUMLAYERS_COLORTEXTURE];
|
||||
uniform TextureTile colorTilesParent2[NUMLAYERS_COLORTEXTURE];
|
||||
|
||||
// tileInterpolationParameter is used to interpolate between a tile and its parent tiles
|
||||
// The value increases with the distance from the vertex (or fragment) to the camera
|
||||
in float tileInterpolationParameter;
|
||||
|
||||
in vec4 fs_position;
|
||||
in vec2 fs_uv;
|
||||
in vec3 positionCameraSpace;
|
||||
|
||||
uniform float distanceScaleFactor;
|
||||
uniform int chunkLevel;
|
||||
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
|
||||
// Calculate desired level based on distance
|
||||
float distToFrag = length(positionCameraSpace);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToFrag;
|
||||
float desiredLevel = log2(projectedScaleFactor);
|
||||
|
||||
// x increases with distance
|
||||
float x = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - x, 0 , 1);
|
||||
float w2 = (clamp(x, 0 , 1) - clamp(x - 1, 0 , 1));
|
||||
float w3 = clamp(x - 1, 0 , 1);
|
||||
// tileInterpolationParameter increases with distance to camera
|
||||
float w1 = clamp(1 - tileInterpolationParameter, 0 , 1);
|
||||
float w2 = (clamp(tileInterpolationParameter, 0 , 1) - clamp(tileInterpolationParameter - 1, 0 , 1));
|
||||
float w3 = clamp(tileInterpolationParameter - 1, 0 , 1);
|
||||
|
||||
#for j in 1..#{numLayersColor}
|
||||
{
|
||||
@@ -77,19 +71,6 @@ Fragment getFragment() {
|
||||
}
|
||||
#endfor
|
||||
|
||||
//vec2 samplePos =
|
||||
// colorTile.uvTransform.uvScale * fs_uv +
|
||||
// colorTile.uvTransform.uvOffset;
|
||||
//frag.color = texture(colorTile.textureSampler, samplePos);
|
||||
|
||||
//frag.color.rgb *= 10;
|
||||
|
||||
// Sample position overlay
|
||||
//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.depth = fs_position.w;
|
||||
|
||||
return frag;
|
||||
|
||||
@@ -45,7 +45,6 @@ uniform TextureTile heightTilesParent1[NUMLAYERS_HEIGHTMAP];
|
||||
uniform TextureTile heightTilesParent2[NUMLAYERS_HEIGHTMAP];
|
||||
|
||||
uniform int xSegments;
|
||||
uniform int ySegments;
|
||||
uniform float skirtLength;
|
||||
|
||||
uniform float distanceScaleFactor;
|
||||
@@ -55,7 +54,9 @@ layout(location = 1) in vec2 in_uv;
|
||||
|
||||
out vec2 fs_uv;
|
||||
out vec4 fs_position;
|
||||
out vec3 positionCameraSpace;
|
||||
// tileInterpolationParameter is used to interpolate between a tile and its parent tiles
|
||||
// The value increases with the distance from the vertex (or fragment) to the camera
|
||||
out float tileInterpolationParameter;
|
||||
|
||||
vec3 bilinearInterpolation(vec2 uv) {
|
||||
// Bilinear interpolation
|
||||
@@ -72,18 +73,16 @@ void main()
|
||||
|
||||
float height = 0;
|
||||
|
||||
positionCameraSpace = p;
|
||||
|
||||
// Calculate desired level based on distance
|
||||
float distToVertex = length(positionCameraSpace);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToVertex;
|
||||
// Calculate desired level based on distance to the vertex on the ellipsoid
|
||||
// Before any heightmapping is done
|
||||
float distToVertexOnEllipsoid = length(p);
|
||||
float projectedScaleFactor = distanceScaleFactor / distToVertexOnEllipsoid;
|
||||
float desiredLevel = log2(projectedScaleFactor);
|
||||
|
||||
// x increases with distance
|
||||
float x = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - x, 0 , 1);
|
||||
float w2 = (clamp(x, 0 , 1) - clamp(x - 1, 0 , 1));
|
||||
float w3 = clamp(x - 1, 0 , 1);
|
||||
tileInterpolationParameter = chunkLevel - desiredLevel;
|
||||
float w1 = clamp(1 - tileInterpolationParameter, 0 , 1);
|
||||
float w2 = (clamp(tileInterpolationParameter, 0 , 1) - clamp(tileInterpolationParameter - 1, 0 , 1));
|
||||
float w3 = clamp(tileInterpolationParameter - 1, 0 , 1);
|
||||
|
||||
#for j in 1..#{numLayersHeight}
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user