mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-25 06:19:02 -06:00
Enable fading of projection layer
This commit is contained in:
@@ -82,6 +82,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
, _fboProgramObject(nullptr)
|
||||
, _baseTexture(nullptr)
|
||||
, _projectionTexture(nullptr)
|
||||
, _projectionFading("projectionFading", "Projection Fading", 1.f, 0.f, 1.f)
|
||||
, _geometry(nullptr)
|
||||
, _alpha(1.f)
|
||||
, _performShading("performShading", "Perform Shading", true)
|
||||
@@ -113,6 +114,8 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
|
||||
addPropertySubOwner(_geometry);
|
||||
|
||||
addProperty(_projectionFading);
|
||||
|
||||
addProperty(_colorTexturePath);
|
||||
_colorTexturePath.onChange(std::bind(&RenderableModelProjection::loadTextures, this));
|
||||
|
||||
@@ -351,6 +354,7 @@ void RenderableModelProjection::render(const RenderData& data) {
|
||||
_programObject->setUniform("sun_pos", _sunPosition.vec3());
|
||||
_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_programObject->setUniform("ModelTransform", _transform);
|
||||
_programObject->setUniform("_projectionFading", _projectionFading);
|
||||
setPscUniforms(*_programObject, data.camera, data.position);
|
||||
|
||||
_geometry->setUniforms(*_programObject);
|
||||
|
||||
@@ -85,6 +85,8 @@ namespace openspace {
|
||||
std::unique_ptr<ghoul::opengl::Texture> _baseTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _projectionTexture;
|
||||
|
||||
properties::FloatProperty _projectionFading;
|
||||
|
||||
modelgeometry::ModelGeometry* _geometry;
|
||||
|
||||
float _alpha;
|
||||
|
||||
@@ -36,8 +36,7 @@ uniform vec3 camdir;
|
||||
uniform sampler2D baseTexture;
|
||||
uniform sampler2D projectionTexture;
|
||||
uniform bool _performShading;
|
||||
|
||||
|
||||
uniform float _projectionFading;
|
||||
uniform vec3 sun_pos;
|
||||
|
||||
Fragment getFragment() {
|
||||
@@ -75,12 +74,10 @@ Fragment getFragment() {
|
||||
textureColor.rgb = mix(
|
||||
textureColor.rgb,
|
||||
projectionColor.rgb,
|
||||
min(1.0, projectionColor.a)
|
||||
min(_projectionFading, projectionColor.a)
|
||||
);
|
||||
}
|
||||
|
||||
// textureColor = projectionColor;
|
||||
|
||||
Fragment frag;
|
||||
frag.color = max(intensity * textureColor, ambient);
|
||||
frag.depth = depth;
|
||||
|
||||
Reference in New Issue
Block a user