Created renderabledataplane through own module in scenegraph

This commit is contained in:
Sebastian Piwell
2016-03-23 09:44:19 -04:00
parent 7712dd0190
commit 27666200db
6 changed files with 30 additions and 16 deletions
+9
View File
@@ -0,0 +1,9 @@
return {
{
Name = "DataSurfaces",
Parent = "Root",
Renderable = {
Type = "RenderableDataPlane"
}
}
}
+1
View File
@@ -28,6 +28,7 @@ return {
--"gridGalactic",
--"gridEcliptic",
--"gridEquatorial",
"datasurface",
}
}
+12 -11
View File
@@ -86,18 +86,19 @@ return {
Type = "Static",
Position = {0, 0, 0, 5}
}
},
{
Name = "EarthPlane",
Parent = "Earth",
Renderable = {
Type = "RenderableDataPlane"
},
Ephemeris = {
Type = "Static",
Position = {10, 0, 0, 1}
}
}
--,
--{
-- Name = "EarthPlane",
-- Parent = "Earth",
-- Renderable = {
-- Type = "RenderableDataPlane"
-- },
-- Ephemeris = {
-- Type = "Static",
-- Position = {10, 0, 0, 1}
-- }
--}
-- Plane
-- {
-- Name = "EarthPlane",
@@ -46,6 +46,7 @@ RenderableDataPlane::RenderableDataPlane(const ghoul::Dictionary& dictionary)
, _quad(0)
, _vertexPositionBuffer(0)
{
std::cout << "Creating RenderableDataPlane" << std::endl;
addProperty(_texturePath);
addProperty(_roatation);
@@ -129,9 +130,9 @@ void RenderableDataPlane::render(const RenderData& data)
// std::cout << pos.x << ", " << pos.y << ", " << pos.z << ", " << pos.w << std::endl;
// std::cout << parent->name() << std::endl;
float w = (float)_texture->width();
float h = (float)_texture->height();
float textureRatio = h/w;
// float w = (float)_texture->width();
// float h = (float)_texture->height();
// float textureRatio = h/w;
glm::mat4 transform = glm::mat4(1.0);
transform = glm::rotate(transform, _roatation.value()[0], glm::vec3(1,0,0));
@@ -145,7 +146,7 @@ void RenderableDataPlane::render(const RenderData& data)
auto psc = _parentPos;
glm::dvec4 dpc = psc.dvec4();
psc += glm::vec4(-_pscOffset.x, _pscOffset.y, _pscOffset.z, _pscOffset.w);
std::cout << dpc.x << ", " << dpc.y << ", " << dpc.z << ", " << dpc.w << std::endl;
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_shader->setUniform("ModelTransform", transform);
setPscUniforms(_shader.get(), &data.camera, psc);
@@ -30,6 +30,7 @@
#include <openspace/properties/vectorproperty.h>
#include <ghoul/opengl/texture.h>
#include <openspace/util/powerscaledcoordinate.h>
#include <modules/kameleon/include/kameleonwrapper.h>
namespace openspace{
@@ -65,6 +66,7 @@
GLuint _quad;
GLuint _vertexPositionBuffer;
KameleonWrapper* _kw;
bool _planeIsDirty;
};
+1 -1
View File
@@ -432,7 +432,7 @@ float* KameleonWrapper::getUniformSliceValues(
}
std::cout << std::endl << std::endl;
// return doubleData;
delete[] doubleData;
return data;
}