diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2015-05-12 09:05:04 +0300 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2015-05-12 09:05:04 +0300 |
commit | 8478c71a7b8f75dcf4855747347ba53639e6aac3 (patch) | |
tree | f86f474911c55a050bfe73da8acdd5d83bd16685 /source/blender/gpu/intern/gpu_material.c | |
parent | ce504cffad49da80aff5b18d0f59d42998e3a9f7 (diff) |
BGE: Adding material IPO support to GLSL materials
Most of this patch was created by Daniel Stokes, I'm mostly just cleaning
it up and testing it. Still todo: hardness. I need to figure out how to
handle the integer -> float conversion on a dynamic uniform.
Reviewers: psy-fi, brecht
Reviewed By: psy-fi
Subscribers: psy-fi
Differential Revision: https://developer.blender.org/D511
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 12672b5f5af..774dee9ebc2 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1449,7 +1449,6 @@ static void do_material_tex(GPUShadeInput *shi) void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi) { - float hard = ma->har; float one = 1.0f; memset(shi, 0, sizeof(*shi)); @@ -1457,20 +1456,20 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi) shi->gpumat = mat; shi->mat = ma; - GPU_link(mat, "set_rgb", GPU_uniform(&ma->r), &shi->rgb); - GPU_link(mat, "set_rgb", GPU_uniform(&ma->specr), &shi->specrgb); + GPU_link(mat, "set_rgb", GPU_dynamic_uniform(&ma->r, GPU_DYNAMIC_MAT_DIFFRGB, NULL), &shi->rgb); + GPU_link(mat, "set_rgb", GPU_dynamic_uniform(&ma->specr, GPU_DYNAMIC_MAT_SPECRGB, NULL), &shi->specrgb); GPU_link(mat, "shade_norm", GPU_builtin(GPU_VIEW_NORMAL), &shi->vn); if (mat->alpha) - GPU_link(mat, "set_value", GPU_uniform(&ma->alpha), &shi->alpha); + GPU_link(mat, "set_value", GPU_dynamic_uniform(&ma->alpha, GPU_DYNAMIC_MAT_ALPHA, NULL), &shi->alpha); else GPU_link(mat, "set_value", GPU_uniform(&one), &shi->alpha); - GPU_link(mat, "set_value", GPU_uniform(&ma->ref), &shi->refl); - GPU_link(mat, "set_value", GPU_uniform(&ma->spec), &shi->spec); - GPU_link(mat, "set_value", GPU_uniform(&ma->emit), &shi->emit); - GPU_link(mat, "set_value", GPU_uniform(&hard), &shi->har); - GPU_link(mat, "set_value", GPU_uniform(&ma->amb), &shi->amb); + GPU_link(mat, "set_value", GPU_dynamic_uniform(&ma->ref, GPU_DYNAMIC_MAT_REF, NULL), &shi->refl); + GPU_link(mat, "set_value", GPU_dynamic_uniform(&ma->spec, GPU_DYNAMIC_MAT_SPEC, NULL), &shi->spec); + GPU_link(mat, "set_value", GPU_dynamic_uniform(&ma->emit, GPU_DYNAMIC_MAT_EMIT, NULL), &shi->emit); + GPU_link(mat, "set_value", GPU_dynamic_uniform((float*)&ma->har, GPU_DYNAMIC_MAT_HARD, NULL), &shi->har); + GPU_link(mat, "set_value", GPU_dynamic_uniform(&ma->amb, GPU_DYNAMIC_MAT_AMB, NULL), &shi->amb); GPU_link(mat, "set_value", GPU_uniform(&ma->spectra), &shi->spectra); GPU_link(mat, "shade_view", GPU_builtin(GPU_VIEW_POSITION), &shi->view); GPU_link(mat, "vcol_attribute", GPU_attribute(CD_MCOL, ""), &shi->vcol); |