mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 18:11:01 -05:00
Solve merge conflict and removed rendering of borders.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
|
||||
// open space includes
|
||||
@@ -38,6 +39,7 @@
|
||||
|
||||
// STL includes
|
||||
#include <sstream>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
@@ -119,25 +121,16 @@ namespace openspace {
|
||||
|
||||
}
|
||||
|
||||
void ChunkRenderer::renderChunk(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
{
|
||||
void ChunkRenderer::renderChunk(const Chunk& chunk, const RenderData& data) {
|
||||
if (chunk.index().level < 9) {
|
||||
renderChunkGlobally(chunk, ellipsoid, data);
|
||||
renderChunkGlobally(chunk, data);
|
||||
}
|
||||
else {
|
||||
renderChunkLocally(chunk, ellipsoid, data);
|
||||
renderChunkLocally(chunk, data);
|
||||
}
|
||||
}
|
||||
|
||||
void ChunkRenderer::renderChunkGlobally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
{
|
||||
|
||||
void ChunkRenderer::renderChunkGlobally(const Chunk& chunk, const RenderData& data){
|
||||
using namespace glm;
|
||||
|
||||
// All providers of tiles
|
||||
@@ -242,6 +235,7 @@ namespace openspace {
|
||||
mat4 viewTransform = data.camera.combinedViewMatrix();
|
||||
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
|
||||
* viewTransform * modelTransform;
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Upload the uniform variables
|
||||
programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
|
||||
@@ -310,6 +304,7 @@ namespace openspace {
|
||||
|
||||
Geodetic2 swCorner = chunk.surfacePatch().southWestCorner();
|
||||
auto patchSize = chunk.surfacePatch().size();
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
_programObjectGlobalRendering->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
|
||||
_programObjectGlobalRendering->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
|
||||
_programObjectGlobalRendering->setUniform("lonLatScalingFactor", vec2(patchSize.toLonLatVec2()));
|
||||
@@ -327,13 +322,8 @@ namespace openspace {
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void ChunkRenderer::renderChunkLocally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& data)
|
||||
{
|
||||
|
||||
using namespace glm;
|
||||
|
||||
// All providers of tiles
|
||||
@@ -447,11 +437,13 @@ namespace openspace {
|
||||
Geodetic2 nw = chunk.surfacePatch().northWestCorner();
|
||||
Geodetic2 ne = chunk.surfacePatch().northEastCorner();
|
||||
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Get model space positions of the four control points
|
||||
Vec3 patchSwModelSpace = ellipsoid.geodetic2ToCartesian(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.geodetic2ToCartesian(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.geodetic2ToCartesian(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.geodetic2ToCartesian(ne);
|
||||
Vec3 patchSwModelSpace = ellipsoid.cartesianSurfacePosition(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.cartesianSurfacePosition(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.cartesianSurfacePosition(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.cartesianSurfacePosition(ne);
|
||||
|
||||
// Transform all control points to camera space
|
||||
Vec3 patchSwCameraSpace = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSwModelSpace, 1));
|
||||
@@ -544,11 +536,13 @@ namespace openspace {
|
||||
Geodetic2 nw = chunk.surfacePatch().northWestCorner();
|
||||
Geodetic2 ne = chunk.surfacePatch().northEastCorner();
|
||||
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Get model space positions of the four control points
|
||||
Vec3 patchSwModelSpace = ellipsoid.geodetic2ToCartesian(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.geodetic2ToCartesian(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.geodetic2ToCartesian(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.geodetic2ToCartesian(ne);
|
||||
Vec3 patchSwModelSpace = ellipsoid.cartesianSurfacePosition(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.cartesianSurfacePosition(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.cartesianSurfacePosition(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.cartesianSurfacePosition(ne);
|
||||
|
||||
// Transform all control points to camera space
|
||||
Vec3 patchSwCameraSpace = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSwModelSpace, 1));
|
||||
@@ -843,10 +837,10 @@ namespace openspace {
|
||||
ivec2 contraction = ivec2(intSnapCoord.y % 2, intSnapCoord.x % 2);
|
||||
|
||||
// Get global positions of the four control points
|
||||
Vec3 patchSw = ellipsoid.geodetic2ToCartesian(newPatch.southWestCorner());
|
||||
Vec3 patchSe = ellipsoid.geodetic2ToCartesian(newPatch.southEastCorner());
|
||||
Vec3 patchNw = ellipsoid.geodetic2ToCartesian(newPatch.northWestCorner());
|
||||
Vec3 patchNe = ellipsoid.geodetic2ToCartesian(newPatch.northEastCorner());
|
||||
Vec3 patchSw = ellipsoid.cartesianSurfacePosition(newPatch.southWestCorner());
|
||||
Vec3 patchSe = ellipsoid.cartesianSurfacePosition(newPatch.southEastCorner());
|
||||
Vec3 patchNw = ellipsoid.cartesianSurfacePosition(newPatch.northWestCorner());
|
||||
Vec3 patchNe = ellipsoid.cartesianSurfacePosition(newPatch.northEastCorner());
|
||||
|
||||
// Transform all control points to camera space
|
||||
patchSw = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSw, 1));
|
||||
|
||||
Reference in New Issue
Block a user