Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-07-12 10:15:49 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-12 10:15:49 +0300
commit99bb1accbbb8e1ba38f30b073b22deb107bf3220 (patch)
tree7852ec686524e785486c452ec959713abbbef666 /source/blender/gpu/intern
parent732cd96737007b1411a161369f842209a4c26419 (diff)
parentb8f217ef213f908a6b5407f162a8f980091e838d (diff)
Merge branch 'master' into asset-experiments
Conflicts: source/blender/blenloader/intern/readfile.c source/blender/windowmanager/intern/wm_init_exit.c
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c4
-rw-r--r--source/blender/gpu/intern/gpu_material.c39
2 files changed, 40 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 36d297fb9fe..c663af0ccbb 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1033,7 +1033,7 @@ static void gpu_color_from_mask_quad_copy(const CCGKey *key,
void GPU_update_mesh_pbvh_buffers(
GPU_PBVH_Buffers *buffers, const MVert *mvert,
const int *vert_indices, int totvert, const float *vmask,
- const int (*face_vert_indices)[4], bool show_diffuse_color)
+ const int (*face_vert_indices)[3], bool show_diffuse_color)
{
VertexBufferFormat *vert_data;
int i, j;
@@ -1161,7 +1161,7 @@ void GPU_update_mesh_pbvh_buffers(
}
GPU_PBVH_Buffers *GPU_build_mesh_pbvh_buffers(
- const int (*face_vert_indices)[4],
+ const int (*face_vert_indices)[3],
const MPoly *mpoly, const MLoop *mloop, const MLoopTri *looptri,
const MVert *mvert,
const int *face_indices,
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index f14b2e6e170..0f95107c018 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -88,6 +88,7 @@ static struct GPUWorld {
float mistcol[4];
float horicol[3];
float ambcol[4];
+ float zencol[3];
} GPUWorld;
struct GPUMaterial {
@@ -1673,6 +1674,11 @@ void GPU_ambient_update_color(float color[3])
GPUWorld.ambcol[3] = 1.0f;
}
+void GPU_zenith_update_color(float color[3])
+{
+ copy_v3_v3(GPUWorld.zencol, color);
+}
+
void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
{
GPUMaterial *mat = shi->gpumat;
@@ -1729,6 +1735,37 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
ulinfac, ulogfac, &shr->spec);
}
+ /* environment lighting */
+ if (!(mat->scene->gm.flag & GAME_GLSL_NO_ENV_LIGHTING) &&
+ (world->mode & WO_ENV_LIGHT) &&
+ (mat->scene->r.mode & R_SHADOW) &&
+ !BKE_scene_use_new_shading_nodes(mat->scene))
+ {
+ if ((world->ao_env_energy != 0.0f) && (GPU_link_changed(shi->amb) || ma->amb != 0.0f) &&
+ (GPU_link_changed(shi->refl) || ma->ref != 0.0f))
+ {
+ if (world->aocolor != WO_AOPLAIN) {
+ if (!(is_zero_v3(&world->horr) & is_zero_v3(&world->zenr)))
+ {
+ GPUNodeLink *fcol, *f;
+ GPU_link(mat, "math_multiply", shi->amb, shi->refl, &f);
+ GPU_link(mat, "math_multiply", f, GPU_uniform(&world->ao_env_energy), &f);
+ GPU_link(mat, "shade_mul_value", f, shi->rgb, &fcol);
+ GPU_link(mat, "env_apply", shr->combined,
+ GPU_dynamic_uniform(GPUWorld.horicol, GPU_DYNAMIC_HORIZON_COLOR, NULL),
+ GPU_dynamic_uniform(GPUWorld.zencol, GPU_DYNAMIC_ZENITH_COLOR, NULL), fcol,
+ GPU_builtin(GPU_VIEW_MATRIX), shi->vn, &shr->combined);
+ }
+ }
+ else {
+ GPUNodeLink *f;
+ GPU_link(mat, "math_multiply", shi->amb, shi->refl, &f);
+ GPU_link(mat, "math_multiply", f, GPU_uniform(&world->ao_env_energy), &f);
+ GPU_link(mat, "shade_maddf", shr->combined, f, shi->rgb, &shr->combined);
+ }
+ }
+ }
+
/* ambient color */
if (GPU_link_changed(shi->amb) || ma->amb != 0.0f) {
GPU_link(mat, "shade_maddf", shr->combined, GPU_uniform(&ma->amb),
@@ -2552,7 +2589,7 @@ int GPU_lamp_shadow_bind_code(GPULamp *lamp)
float *GPU_lamp_dynpersmat(GPULamp *lamp)
{
- return lamp->dynpersmat ? (float *)lamp->dynpersmat : NULL;
+ return &lamp->dynpersmat[0][0];
}
int GPU_lamp_shadow_layer(GPULamp *lamp)