Added billboard support for RenderablePlane

This commit is contained in:
Jonas Strandstedt
2014-12-03 14:48:50 +01:00
parent a5e122b822
commit f7b2bc12e0
3 changed files with 11 additions and 1 deletions
@@ -59,6 +59,7 @@ private:
void loadTexture();
properties::StringProperty _texturePath;
properties::BoolProperty _billboard;
glm::vec2 _size;
Origin _origin;
+9
View File
@@ -47,6 +47,7 @@ namespace openspace {
RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _texturePath("texture", "Texture")
, _billboard("billboard", "Billboard", false)
, _size(glm::vec2(1,1))
, _origin(Origin::Center)
, _shader(nullptr)
@@ -75,6 +76,12 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
}
}
// Attempt to get the billboard value
bool billboard = false;
if (dictionary.getValue("Billboard", billboard)) {
_billboard = billboard;
}
std::string texturePath = "";
bool success = dictionary.getValue("Texture", texturePath);
if (success)
@@ -146,6 +153,8 @@ void RenderablePlane::render(const RenderData& data) {
return;
glm::mat4 transform = glm::mat4(1.0);
if (_billboard)
transform = glm::inverse(data.camera.viewRotationMatrix());
//transform = glm::scale(transform, glm::vec3(0.01));
// Activate shader