Add base texture or color to ModelProjection

This commit is contained in:
Malin Ejdbo
2021-06-28 15:28:08 +02:00
parent 44080b2f94
commit 7aafe39583
3 changed files with 12 additions and 4 deletions

View File

@@ -344,7 +344,7 @@ void RenderableModelProjection::imageProjectGPU(
_transform
);
_geometry->render(*_fboProgramObject, false);
_geometry->render(*_fboProgramObject, false, true);
_depthFboProgramObject->deactivate();
_projectionComponent.depthMapRenderEnd();
@@ -374,7 +374,7 @@ void RenderableModelProjection::imageProjectGPU(
_fboProgramObject->setUniform(_fboUniformCache.ModelTransform, _transform);
_fboProgramObject->setUniform(_fboUniformCache.boresight, _boresight);
_geometry->render(*_fboProgramObject, false);
_geometry->render(*_fboProgramObject, false, true);
_fboProgramObject->deactivate();
_projectionComponent.imageProjectEnd();

View File

@@ -30,7 +30,9 @@ in vec3 vs_normalViewSpace;
in float vs_depth;
in vec4 vs_positionCameraSpace;
uniform bool has_texture_diffuse;
uniform sampler2D baseTexture;
uniform vec3 baseColor;
uniform sampler2D projectionTexture;
uniform bool performShading;
uniform float projectionFading;
@@ -44,7 +46,13 @@ const float specularIntensity = 0.0;
const float specularPower = 100.0;
Fragment getFragment() {
vec4 textureColor = texture(baseTexture, vs_st);
vec4 textureColor;
if (has_texture_diffuse) {
textureColor = texture(baseTexture, vs_st);
}
else {
textureColor.rgb = baseColor;
}
vec4 projectionColor = texture(projectionTexture, vs_st);
if (projectionColor.a > 0.0) {
textureColor.rgb = mix(