mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 14:29:42 -05:00
Issue/24 (#549)
* Implemented property animation mechanism * Added easing functions to Ghoul and make them usable in animation * Make sure that we don't leave properties around if SceneGraphNodes are deleted * Adding opacity settings to base renderables
This commit is contained in:
@@ -123,6 +123,10 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
"RenderableModel"
|
||||
);
|
||||
|
||||
addProperty(_opacity);
|
||||
registerUpdateRenderBinFromOpacity();
|
||||
|
||||
|
||||
if (dictionary.hasKey(KeyGeometry)) {
|
||||
std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
|
||||
ghoul::Dictionary dict = dictionary.value<ghoul::Dictionary>(KeyGeometry);
|
||||
@@ -163,6 +167,7 @@ void RenderableModel::initializeGL() {
|
||||
absPath("${MODULE_BASE}/shaders/model_fs.glsl")
|
||||
);
|
||||
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
|
||||
"directionToSunViewSpace"
|
||||
);
|
||||
@@ -176,6 +181,8 @@ void RenderableModel::initializeGL() {
|
||||
"performShading"
|
||||
);
|
||||
_uniformCache.texture = _programObject->uniformLocation("texture1");
|
||||
|
||||
|
||||
loadTexture();
|
||||
|
||||
_geometry->initialize(this);
|
||||
@@ -197,6 +204,8 @@ void RenderableModel::deinitializeGL() {
|
||||
void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
|
||||
_programObject->setUniform(_uniformCache.opacity, _opacity);
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
@@ -244,6 +253,7 @@ void RenderableModel::update(const UpdateData&) {
|
||||
if (_programObject->isDirty()) {
|
||||
_programObject->rebuildFromFile();
|
||||
|
||||
_uniformCache.opacity = _programObject->uniformLocation("opacity");
|
||||
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
|
||||
"directionToSunViewSpace"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user