This commit is contained in:
Branimir Karadžić 2015-06-19 21:47:20 -07:00
parent f2e8d6c239
commit 0283c83c0a
9 changed files with 10 additions and 10 deletions

View file

@ -7,16 +7,16 @@ $input v_texcoord0
#include "../common/common.sh" #include "../common/common.sh"
uniform vec4 u_color; uniform vec4 u_color;
SAMPLER2D(u_texColor, 0); SAMPLER2D(s_texColor, 0);
void main() void main()
{ {
vec4 tcolor = toLinear(texture2D(u_texColor, v_texcoord0)); vec4 color = toLinear(texture2D(s_texColor, v_texcoord0) );
if (tcolor.x < 0.1) //OK for now. if (color.x < 0.1)
{ {
discard; discard;
} }
gl_FragColor = toGamma(tcolor + u_color); gl_FragColor = toGamma(color + u_color);
} }

View file

@ -6,9 +6,9 @@ $input v_texcoord0
*/ */
#include "../common/common.sh" #include "../common/common.sh"
SAMPLER2D(u_texColor, 0); SAMPLER2D(s_texColor, 0);
void main() void main()
{ {
gl_FragColor = texture2D(u_texColor, v_texcoord0); gl_FragColor = texture2D(s_texColor, v_texcoord0);
} }

View file

@ -149,7 +149,7 @@ static const uint16_t s_planeIndices[] =
static bool s_flipV = false; static bool s_flipV = false;
static uint32_t s_viewMask = 0; static uint32_t s_viewMask = 0;
static uint32_t s_clearMask = 0; static uint32_t s_clearMask = 0;
static bgfx::UniformHandle u_texColor; static bgfx::UniformHandle s_texColor;
inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far) inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far)
{ {
@ -809,7 +809,7 @@ struct Mesh
// Set texture // Set texture
if (bgfx::invalidHandle != _texture.idx) if (bgfx::invalidHandle != _texture.idx)
{ {
bgfx::setTexture(0, u_texColor, _texture); bgfx::setTexture(0, s_texColor, _texture);
} }
// Apply render state // Apply render state
@ -864,7 +864,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
s_uniforms.init(); s_uniforms.init();
s_uniforms.submitConstUniforms(); s_uniforms.submitConstUniforms();
u_texColor = bgfx::createUniform("u_texColor", bgfx::UniformType::Int1); s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
bgfx::ProgramHandle programTextureLightning = loadProgram("vs_stencil_texture_lightning", "fs_stencil_texture_lightning"); bgfx::ProgramHandle programTextureLightning = loadProgram("vs_stencil_texture_lightning", "fs_stencil_texture_lightning");
bgfx::ProgramHandle programColorLightning = loadProgram("vs_stencil_color_lightning", "fs_stencil_color_lightning" ); bgfx::ProgramHandle programColorLightning = loadProgram("vs_stencil_color_lightning", "fs_stencil_color_lightning" );
@ -1397,7 +1397,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bgfx::destroyProgram(programColorBlack); bgfx::destroyProgram(programColorBlack);
bgfx::destroyProgram(programTexture); bgfx::destroyProgram(programTexture);
bgfx::destroyUniform(u_texColor); bgfx::destroyUniform(s_texColor);
s_uniforms.destroy(); s_uniforms.destroy();