Commit 372a704f authored by Michele Bosi's avatar Michele Bosi

Vivid: support for 1D, 2D, 3D textures

parent 763427a8
...@@ -71,14 +71,26 @@ vec4 LightingStage() ...@@ -71,14 +71,26 @@ vec4 LightingStage()
} }
if ( vl_Vivid.enablePointSprite ) { if ( vl_Vivid.enablePointSprite ) {
color = color * texture2D( vl_UserTexture, gl_PointCoord.st ); if ( vl_Vivid.textureDimension == 2 ) {
color = color * texture2D( vl_UserTexture2D, gl_PointCoord.st );
}
// More aggressive pixel discard for point sprites // More aggressive pixel discard for point sprites
if ( color.a < 0.004 ) { if ( color.a < 0.004 ) {
discard; discard;
} }
} else } else
if ( vl_Vivid.enableTextureMapping ) { if ( vl_Vivid.enableTextureMapping ) {
color = color * texture2D( vl_UserTexture, gl_TexCoord[0].st ); if ( vl_Vivid.textureDimension == 1 ) {
color = color * texture1D( vl_UserTexture1D, gl_TexCoord[0].s );
} else
if ( vl_Vivid.textureDimension == 2 ) {
color = color * texture2D( vl_UserTexture2D, gl_TexCoord[0].st );
} else
if ( vl_Vivid.textureDimension == 3 ) {
color = color * texture3D( vl_UserTexture3D, gl_TexCoord[0].str );
}
} }
return color; return color;
......
...@@ -23,7 +23,9 @@ uniform mat4 vl_NormalMatrix; ...@@ -23,7 +23,9 @@ uniform mat4 vl_NormalMatrix;
// Texture Mapping // Texture Mapping
// <automatic> // <automatic>
uniform sampler2D vl_UserTexture; // Always set to vl::VividRendering::UserTexture uniform sampler1D vl_UserTexture1D; // Always set to vl::VividRendering::UserTexture
uniform sampler2D vl_UserTexture2D; // Always set to vl::VividRendering::UserTexture
uniform sampler3D vl_UserTexture3D; // Always set to vl::VividRendering::UserTexture
// Smart Fog Stage // Smart Fog Stage
...@@ -109,6 +111,10 @@ struct vl_VividParameters { ...@@ -109,6 +111,10 @@ struct vl_VividParameters {
// Whether to use texture mapping or not // Whether to use texture mapping or not
bool enableTextureMapping; bool enableTextureMapping;
// <automatic>
// Whether the texture is a 1D, 2D or 3D texture
bool textureDimension;
// <per-Shader> // <per-Shader>
// Whether to render points as textured point sprites // Whether to render points as textured point sprites
// Requires enableTextureMapping=1 // Requires enableTextureMapping=1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment