mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-07 03:49:43 -05:00
Added billboard support for RenderablePlane
This commit is contained in:
@@ -59,6 +59,7 @@ private:
|
||||
void loadTexture();
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::BoolProperty _billboard;
|
||||
|
||||
glm::vec2 _size;
|
||||
Origin _origin;
|
||||
|
||||
+1
-1
Submodule openspace-data updated: 3ae31e943f...48daa03562
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user