Distant dependent LOD geometry. Demo purpose only.

This commit is contained in:
Erik Broberg
2016-04-07 20:54:52 -04:00
parent efe2bef2d4
commit d0773bcf32
7 changed files with 214 additions and 41 deletions
+30 -13
View File
@@ -25,7 +25,8 @@
#include "gtest/gtest.h"
#include <openspace/scene/scenegraphnode.h>
#include <openspace/../modules/globebrowsing/datastructures/chunknode.h>
#include <modules/globebrowsing/rendering/chunklodglobe.h>
#include <modules/globebrowsing/datastructures/chunknode.h>
#include <fstream>
#include <glm/glm.hpp>
@@ -34,26 +35,39 @@ using namespace openspace;
class ChunkNodeTest : public testing::Test {};
/*
TEST_F(ChunkNodeTest, Split) {
ghoul::Dictionary dict;
ChunkLodGlobe chunkLodNode(dict);
chunkLodNode.initialize();
BoundingRect bounds(Vec2(2, 2), Vec2(2, 2));
auto cn = std::shared_ptr<ChunkNode>(new ChunkNode(bounds));
ASSERT_TRUE(cn->isRoot()) << "Chunk node is root";
ASSERT_TRUE(cn->isLeaf()) << "Chunk node is leaf";
ChunkNode cn(chunkLodNode,bounds);
ASSERT_TRUE(cn.isRoot()) << "Chunk node is root";
ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf";
cn->split();
ASSERT_TRUE(cn->isRoot()) << "Chunk node is root";
ASSERT_FALSE(cn->isLeaf()) << "Chunk node is not leaf";
cn.split();
ASSERT_TRUE(cn.isRoot()) << "Chunk node is root";
ASSERT_FALSE(cn.isLeaf()) << "Chunk node is not leaf";
ASSERT_EQ(cn->bounds.center.x, cn->getChild(Quad::NORTH_WEST).bounds.center.x * 2);
ASSERT_EQ(cn->bounds.center.x, cn->getChild(Quad::NORTH_EAST).bounds.center.x * 2/3);
ASSERT_EQ(cn.bounds.center.x, cn.getChild(Quad::NORTH_WEST).bounds.center.x * 2);
ASSERT_EQ(cn.bounds.center.x, cn.getChild(Quad::NORTH_EAST).bounds.center.x * 2/3);
ASSERT_EQ(cn->bounds.halfSize.x, cn->getChild(Quad::NORTH_WEST).bounds.halfSize.x * 2);
ASSERT_EQ(cn->bounds.halfSize.y, cn->getChild(Quad::NORTH_WEST).bounds.halfSize.y * 2);
ASSERT_EQ(cn.bounds.halfSize.x, cn.getChild(Quad::NORTH_WEST).bounds.halfSize.x * 2);
ASSERT_EQ(cn.bounds.halfSize.y, cn.getChild(Quad::NORTH_WEST).bounds.halfSize.y * 2);
chunkLodNode.deinitialize();
}
TEST_F(ChunkNodeTest, Merge) {
ghoul::Dictionary dict;
ChunkLodGlobe chunkLodNode(dict);
chunkLodNode.initialize();
BoundingRect bounds(Vec2(2, 2), Vec2(2, 2));
ChunkNode cn(bounds);
ChunkNode cn(chunkLodNode,bounds);
ASSERT_TRUE(cn.isRoot()) << "Chunk node is root";
ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf";
@@ -65,4 +79,7 @@ TEST_F(ChunkNodeTest, Merge) {
ASSERT_TRUE(cn.isRoot()) << "Chunk node is root";
ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf";
}
chunkLodNode.deinitialize();
}
*/