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:
authorAlexander Romanov <a.romanov@blend4web.com>2015-07-14 19:48:54 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-07-14 19:52:29 +0300
commit38940662e540743a6a8da287390a02a9f3f76f6d (patch)
treef29f438c5365e2ea2699853ef9510ee676273dc7 /source/blender/gpu/intern/gpu_material.c
parent107e34407d0ae4120cc7a12fdb208986a0b47d8e (diff)
Particle Info node support for GLSL mode and the internal render.
With this patch "Particle Info" node from Cycles works in GLSL and BI Alexander (Blend4Web Team) Reviewers: psy-fi Note: moved particle info to object render instance instead of shadeinput during review - Antony. Differential Revision: https://developer.blender.org/D1313
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index bd17fb0b1aa..5db516daa26 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -112,6 +112,11 @@ struct GPUMaterial {
int obcolloc, obautobumpscaleloc;
int cameratexcofacloc;
+ int partscalarpropsloc;
+ int partcoloc;
+ int partvel;
+ int partangvel;
+
ListBase lamps;
bool bound;
};
@@ -241,6 +246,14 @@ static int GPU_material_construct_end(GPUMaterial *material, const char *passnam
material->obautobumpscaleloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_AUTO_BUMPSCALE));
if (material->builtins & GPU_CAMERA_TEXCO_FACTORS)
material->cameratexcofacloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_CAMERA_TEXCO_FACTORS));
+ if (material->builtins & GPU_PARTICLE_SCALAR_PROPS)
+ material->partscalarpropsloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_SCALAR_PROPS));
+ if (material->builtins & GPU_PARTICLE_LOCATION)
+ material->partcoloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_LOCATION));
+ if (material->builtins & GPU_PARTICLE_VELOCITY)
+ material->partvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_VELOCITY));
+ if (material->builtins & GPU_PARTICLE_ANG_VELOCITY)
+ material->partangvel = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_PARTICLE_ANG_VELOCITY));
return 1;
}
@@ -367,7 +380,7 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim
}
}
-void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float obcol[4], float autobumpscale)
+void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float obcol[4], float autobumpscale, GPUParticleInfo* pi)
{
if (material->pass) {
GPUShader *shader = GPU_pass_shader(material->pass);
@@ -389,6 +402,19 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[4][4], float
if (material->builtins & GPU_AUTO_BUMPSCALE) {
GPU_shader_uniform_vector(shader, material->obautobumpscaleloc, 1, 1, &autobumpscale);
}
+ if (material->builtins & GPU_PARTICLE_SCALAR_PROPS) {
+ GPU_shader_uniform_vector(shader, material->partscalarpropsloc, 4, 1, pi->scalprops);
+ }
+ if (material->builtins & GPU_PARTICLE_LOCATION) {
+ GPU_shader_uniform_vector(shader, material->partcoloc, 3, 1, pi->location);
+ }
+ if (material->builtins & GPU_PARTICLE_VELOCITY) {
+ GPU_shader_uniform_vector(shader, material->partvel, 3, 1, pi->velocity);
+ }
+ if (material->builtins & GPU_PARTICLE_ANG_VELOCITY) {
+ GPU_shader_uniform_vector(shader, material->partangvel, 3, 1, pi->angular_velocity);
+ }
+
}
}