* 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:
Alexander Bock
2018-03-13 10:35:10 -04:00
committed by GitHub
parent f38c26eff0
commit 737e82584a
31 changed files with 575 additions and 253 deletions
@@ -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"
);