mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#168 Fixed shader based light in parallel projection
Added the light position as a uniform in the standard light model shader snippet in the effect generator. Set the uniform default value on the shader program where ever it is used. Added an override global uniform set on the viewer to control the light position, and to set it far behind camera when in parallel projection.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "cvfShaderSourceProvider.h"
|
||||
#include "cvfTexture.h"
|
||||
#include "cvfTexture2D_FF.h"
|
||||
#include "cvfUniform.h"
|
||||
|
||||
|
||||
|
||||
@@ -81,6 +82,8 @@ void RivTernaryScalarMapperEffectGenerator::updateForShaderBasedRendering(cvf::E
|
||||
cvf::ref<cvf::ShaderProgram> prog = gen.generate();
|
||||
eff->setShaderProgram(prog.p());
|
||||
|
||||
if(!m_disableLighting) prog->setDefaultUniform(new cvf::UniformFloat("u_ecLightPosition", cvf::Vec3f(0.5, 5.0, 7.0)));
|
||||
|
||||
// Result mapping texture
|
||||
|
||||
m_textureImage = new cvf::TextureImage();
|
||||
|
||||
Reference in New Issue
Block a user