Removed flipV from 14-shadowvolumes example.
This commit is contained in:
parent
35a349ad68
commit
7ec6e06fee
@ -1,4 +1,4 @@
|
||||
$input v_normal, v_view, v_pos
|
||||
$input v_normal, v_view
|
||||
|
||||
/*
|
||||
* Copyright 2013-2014 Dario Manesku. All rights reserved.
|
||||
@ -67,8 +67,7 @@ void main()
|
||||
vec3 viewDir = -normalize(v_view);
|
||||
vec3 lightColor = calcLight(v_view, normal, viewDir) * u_lightningPass;
|
||||
|
||||
vec2 ndc = ((v_pos.xy / v_pos.w) + 1.0) / 2.0;
|
||||
ndc += u_viewTexel.xy * u_texelHalf;
|
||||
vec2 ndc = gl_FragCoord.xy * u_viewTexel.xy + u_viewTexel.xy * u_texelHalf;
|
||||
vec4 texcolor = texture2D(u_texStencil, ndc);
|
||||
float s = (texcolor.x - texcolor.y) + 2.0 * (texcolor.z - texcolor.w);
|
||||
s *= u_useStencilTex;
|
||||
|
@ -19,4 +19,4 @@ void main()
|
||||
}
|
||||
|
||||
gl_FragColor = toGamma(tcolor + u_color);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
$input v_normal, v_view, v_texcoord0, v_pos
|
||||
$input v_normal, v_view, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2013-2014 Dario Manesku. All rights reserved.
|
||||
@ -68,8 +68,7 @@ void main()
|
||||
vec3 viewDir = -normalize(v_view);
|
||||
vec3 lightColor = calcLight(v_view, normal, viewDir) * u_lightningPass;
|
||||
|
||||
vec2 ndc = ((v_pos.xy / v_pos.w) + 1.0) / 2.0;
|
||||
ndc += u_viewTexel.xy * u_texelHalf;
|
||||
vec2 ndc = gl_FragCoord.xy * u_viewTexel.xy + u_viewTexel.xy * u_texelHalf;
|
||||
vec4 texcolor = texture2D(u_texStencil, ndc);
|
||||
float s = (texcolor.x - texcolor.y) + 2.0 * (texcolor.z - texcolor.w);
|
||||
s *= u_useStencilTex;
|
||||
|
@ -109,7 +109,6 @@ static const uint16_t s_planeIndices[] =
|
||||
};
|
||||
|
||||
static const char* s_shaderPath = NULL;
|
||||
static bool s_flipV = false;
|
||||
static float s_texelHalf = 0.0f;
|
||||
|
||||
static uint32_t s_viewMask = 0;
|
||||
@ -269,8 +268,6 @@ struct Uniforms
|
||||
|
||||
m_time = 0.0f;
|
||||
|
||||
m_flipV = float(s_flipV) * 2.0f - 1.0f;
|
||||
|
||||
m_lightPosRadius[0] = 0.0f;
|
||||
m_lightPosRadius[1] = 0.0f;
|
||||
m_lightPosRadius[2] = 0.0f;
|
||||
@ -294,7 +291,6 @@ struct Uniforms
|
||||
u_fog = bgfx::createUniform("u_fog", bgfx::UniformType::Uniform4fv);
|
||||
u_color = bgfx::createUniform("u_color", bgfx::UniformType::Uniform4fv);
|
||||
u_time = bgfx::createUniform("u_time", bgfx::UniformType::Uniform1f );
|
||||
u_flipV = bgfx::createUniform("u_flipV", bgfx::UniformType::Uniform1f );
|
||||
u_lightPosRadius = bgfx::createUniform("u_lightPosRadius", bgfx::UniformType::Uniform4fv);
|
||||
u_lightRgbInnerR = bgfx::createUniform("u_lightRgbInnerR", bgfx::UniformType::Uniform4fv);
|
||||
u_virtualLightPos_extrusionDist = bgfx::createUniform("u_virtualLightPos_extrusionDist", bgfx::UniformType::Uniform4fv);
|
||||
@ -307,7 +303,6 @@ struct Uniforms
|
||||
bgfx::setUniform(u_diffuse, &m_diffuse);
|
||||
bgfx::setUniform(u_specular_shininess, &m_specular_shininess);
|
||||
bgfx::setUniform(u_fog, &m_fog);
|
||||
bgfx::setUniform(u_flipV, &m_flipV);
|
||||
}
|
||||
|
||||
//call this once per frame
|
||||
@ -337,7 +332,6 @@ struct Uniforms
|
||||
bgfx::destroyUniform(u_fog);
|
||||
bgfx::destroyUniform(u_color);
|
||||
bgfx::destroyUniform(u_time);
|
||||
bgfx::destroyUniform(u_flipV);
|
||||
bgfx::destroyUniform(u_lightPosRadius);
|
||||
bgfx::destroyUniform(u_lightRgbInnerR);
|
||||
bgfx::destroyUniform(u_virtualLightPos_extrusionDist);
|
||||
@ -367,7 +361,6 @@ struct Uniforms
|
||||
float m_fog[4];
|
||||
float m_color[4];
|
||||
float m_time;
|
||||
float m_flipV;
|
||||
float m_lightPosRadius[4];
|
||||
float m_lightRgbInnerR[4];
|
||||
float m_virtualLightPos_extrusionDist[4];
|
||||
@ -392,7 +385,6 @@ struct Uniforms
|
||||
bgfx::UniformHandle u_fog;
|
||||
bgfx::UniformHandle u_color;
|
||||
bgfx::UniformHandle u_time;
|
||||
bgfx::UniformHandle u_flipV;
|
||||
bgfx::UniformHandle u_lightPosRadius;
|
||||
bgfx::UniformHandle u_lightRgbInnerR;
|
||||
bgfx::UniformHandle u_virtualLightPos_extrusionDist;
|
||||
@ -1910,7 +1902,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
uint32_t debug = BGFX_DEBUG_TEXT;
|
||||
uint32_t reset = BGFX_RESET_VSYNC;
|
||||
|
||||
bgfx::init();
|
||||
bgfx::init(bgfx::RendererType::OpenGL);
|
||||
bgfx::reset(viewState.m_width, viewState.m_height, reset);
|
||||
|
||||
// Enable debug text.
|
||||
@ -1932,12 +1924,10 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||
|
||||
case bgfx::RendererType::OpenGL:
|
||||
s_shaderPath = "shaders/glsl/";
|
||||
s_flipV = true;
|
||||
break;
|
||||
|
||||
case bgfx::RendererType::OpenGLES:
|
||||
s_shaderPath = "shaders/gles/";
|
||||
s_flipV = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
|
||||
vec4 v_pos : TEXCOORD1 = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
vec3 v_normal : NORMAL = vec3(0.0, 0.0, 1.0);
|
||||
vec3 v_view : TEXCOORD2 = vec3(0.0, 0.0, 0.0);
|
||||
vec4 v_color0 : COLOR0 = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
|
@ -1,14 +1,12 @@
|
||||
$input a_position, a_color0, a_normal, a_texcoord0
|
||||
$output v_normal, v_view, v_pos
|
||||
$output v_normal, v_view
|
||||
|
||||
/*
|
||||
* Copyright 2013-2014 Dario Manesku. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "../common/common.sh"
|
||||
|
||||
uniform float u_flipV;
|
||||
#include "../common/common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -17,7 +15,4 @@ void main()
|
||||
vec4 normal = a_normal * 2.0f - 1.0f;
|
||||
v_normal = mul(u_modelView, vec4(normal.xyz, 0.0)).xyz;
|
||||
v_view = mul(u_modelView, vec4(a_position, 1.0)).xyz;
|
||||
|
||||
v_pos = gl_Position;
|
||||
v_pos.y *= u_flipV;
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
$input a_position, a_normal, a_texcoord0
|
||||
$output v_normal, v_view, v_texcoord0, v_pos
|
||||
$output v_normal, v_view, v_texcoord0
|
||||
|
||||
/*
|
||||
* Copyright 2013-2014 Dario Manesku. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "../common/common.sh"
|
||||
|
||||
uniform float u_flipV;
|
||||
#include "../common/common.sh"
|
||||
|
||||
void main()
|
||||
{
|
||||
@ -19,7 +17,4 @@ void main()
|
||||
v_view = mul(u_modelView, vec4(a_position, 1.0)).xyz;
|
||||
|
||||
v_texcoord0 = a_texcoord0;
|
||||
|
||||
v_pos = gl_Position;
|
||||
v_pos.y *= u_flipV;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user