Enable the RenderableShadowCylinder's color to be set via properties

This commit is contained in:
Alexander Bock
2016-02-07 20:37:11 +01:00
parent 66fdf4b6a4
commit dd98cef974
3 changed files with 7 additions and 1 deletions

View File

@@ -52,12 +52,15 @@ namespace openspace {
: Renderable(dictionary)
, _numberOfPoints("amountOfPoints", "Points", 190, 1, 300)
, _shadowLength("shadowLength", "Shadow Length", 0.1, 0.0, 0.5)
, _shadowColor("shadowColor", "Shadow Color",
glm::vec4(1.f, 1.f, 1.f, 0.25f), glm::vec4(0.f), glm::vec4(1.f))
, _shader(nullptr)
, _vao(0)
, _vbo(0)
{
addProperty(_numberOfPoints);
addProperty(_shadowLength);
addProperty(_shadowColor);
bool success = dictionary.getValue(_keyType, _terminatorType);
ghoul_assert(success, "");
@@ -132,6 +135,7 @@ void RenderableShadowCylinder::render(const RenderData& data){
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_shader->setUniform("ModelTransform", _transform);
_shader->setUniform("shadowColor", _shadowColor);
setPscUniforms(_shader.get(), &data.camera, data.position);
glBindVertexArray(_vao);

View File

@@ -72,6 +72,7 @@ namespace openspace {
void createCylinder();
properties::IntProperty _numberOfPoints;
properties::FloatProperty _shadowLength;
properties::Vec4Property _shadowColor;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;

View File

@@ -37,6 +37,7 @@ out vec4 vs_color;
//out float fade;
uniform uint nVertices;
uniform vec4 shadowColor;
//uniform float lineFade;
#include "PowerScaling/powerScaling_vs.hglsl"
@@ -46,7 +47,7 @@ void main() {
//fade = 1.0 - id;
if(mod(gl_VertexID,2) == 0.f){
vs_color = vec4(1,1,1,0.5);
vs_color = shadowColor;
}else{
vs_color = vec4(0);
}