Clean up code for planet radius and bounding sphere calculation (#289)

- Remove some power scaled coordaintes.
- Remove spice dependency from sphere geometry.
- Remove dead code.
This commit is contained in:
Emil Axelsson
2017-04-18 09:58:27 +02:00
committed by GitHub
parent 481ee7d821
commit 4b38b33e18
62 changed files with 178 additions and 342 deletions
@@ -49,15 +49,13 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _texture("texture", "Texture", -1, -1, 255)
, _billboard("billboard", "Billboard", false)
, _size("size", "Size", glm::vec2(1,1), glm::vec2(0.f), glm::vec2(1.f, 25.f))
, _size("size", "Size", 10, 0, std::pow(10, 25))
, _origin(Origin::Center)
, _shader(nullptr)
, _quad(0)
, _vertexPositionBuffer(0)
{
glm::vec2 size;
dictionary.getValue("Size", size);
_size = size;
dictionary.getValue("Size", _size);
if (dictionary.hasKey("Name")){
dictionary.getValue("Name", _nodeName);
@@ -104,7 +102,7 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
addProperty(_size);
_size.onChange([this](){ _planeIsDirty = true; });
setBoundingSphere(_size.value());
setBoundingSphere(_size);
}
RenderableDebugPlane::~RenderableDebugPlane() {
@@ -189,16 +187,16 @@ void RenderableDebugPlane::createPlane() {
// ============================
// GEOMETRY (quad)
// ============================
const GLfloat size = _size.value()[0];
const GLfloat w = _size.value()[1];
const GLfloat size = _size;
const GLfloat vertex_data[] = {
// x y z w s t
-size, -size, 0.f, w, 0.f, 0.f,
size, size, 0.f, w, 1.f, 1.f,
-size, size, 0.f, w, 0.f, 1.f,
-size, -size, 0.f, w, 0.f, 0.f,
size, -size, 0.f, w, 1.f, 0.f,
size, size, 0.f, w, 1.f, 1.f,
-size, -size, 0.f, 0.f, 0.f, 0.f,
size, size, 0.f, 0.f, 1.f, 1.f,
-size, size, 0.f, 0.f, 0.f, 1.f,
-size, -size, 0.f, 0.f, 0.f, 0.f,
size, -size, 0.f, 0.f, 1.f, 0.f,
size, size, 0.f, 0.f, 1.f, 1.f,
};
glBindVertexArray(_quad); // bind array
@@ -28,7 +28,6 @@
#include <openspace/rendering/renderable.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vector/vec2property.h>
#include <openspace/util/updatestructures.h>
namespace ghoul {
@@ -67,7 +66,7 @@ private:
properties::IntProperty _texture;
properties::BoolProperty _billboard;
properties::Vec2Property _size;
properties::FloatProperty _size;
Origin _origin;
std::string _nodeName;