Refactored uniform types.

This commit is contained in:
Branimir Karadžić
2015-05-28 15:27:00 -07:00
parent 4bd29facd0
commit ff01992cb7
717 changed files with 637 additions and 728 deletions

View File

@@ -7,7 +7,7 @@ $input v_pos, v_view, v_normal, v_color0
#include "../common/common.sh"
uniform float u_time;
uniform vec4 u_time;
vec2 blinn(vec3 _lightDir, vec3 _normal, vec3 _viewDir)
{
@@ -39,9 +39,9 @@ void main()
vec4 lc = lit(bln.x, bln.y, 1.0);
float fres = fresnel(bln.x, 0.2, 5.0);
float index = ( (sin(v_pos.x*3.0+u_time)*0.3+0.7)
+ ( cos(v_pos.y*3.0+u_time)*0.4+0.6)
+ ( cos(v_pos.z*3.0+u_time)*0.2+0.8)
float index = ( (sin(v_pos.x*3.0+u_time.x)*0.3+0.7)
+ ( cos(v_pos.y*3.0+u_time.x)*0.4+0.6)
+ ( cos(v_pos.z*3.0+u_time.x)*0.2+0.8)
)*M_PI;
vec3 color = vec3(sin(index*8.0)*0.4 + 0.6

View File

@@ -27,7 +27,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
, 0
);
bgfx::UniformHandle u_time = bgfx::createUniform("u_time", bgfx::UniformType::Uniform1f);
bgfx::UniformHandle u_time = bgfx::createUniform("u_time", bgfx::UniformType::Vec4);
// Create program from shaders.
bgfx::ProgramHandle program = loadProgram("vs_mesh", "fs_mesh");
@@ -98,11 +98,11 @@ int _main_(int /*_argc*/, char** /*_argv*/)
bx::mtxRotateXY(mtx
, 0.0f
, time*0.37f
);
);
meshSubmit(mesh, 0, program, mtx);
// Advance to next frame. Rendering thread will be kicked to
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
}

View File

@@ -8,14 +8,14 @@ $output v_pos, v_view, v_normal, v_color0
#include "../common/common.sh"
uniform float u_time;
uniform vec4 u_time;
void main()
{
vec3 pos = a_position;
float sx = sin(pos.x*32.0+u_time*4.0)*0.5+0.5;
float cy = cos(pos.y*32.0+u_time*4.0)*0.5+0.5;
float sx = sin(pos.x*32.0+u_time.x*4.0)*0.5+0.5;
float cy = cos(pos.y*32.0+u_time.x*4.0)*0.5+0.5;
vec3 displacement = vec3(sx, cy, sx*cy);
vec3 normal = a_normal.xyz*2.0 - 1.0;