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:
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 3e8f0baf7b0..56b7af787e7 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -117,6 +117,11 @@ struct GPUMaterial {
int obcolloc, obautobumpscaleloc;
int cameratexcofacloc;
+ int partscalarpropsloc;
+ int partcoloc;
+ int partvel;
+ int partangvel;
+
ListBase lamps;
bool bound;
@@ -255,6 +260,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;
}
else {
@@ -387,7 +400,7 @@ void GPU_material_bind(
void GPU_material_bind_uniforms(
GPUMaterial *material, float obmat[4][4], float viewmat[4][4], float obcol[4],
- float autobumpscale)
+ float autobumpscale, GPUParticleInfo *pi)
{
if (material->pass) {
GPUShader *shader = GPU_pass_shader(material->pass);
@@ -424,6 +437,18 @@ void GPU_material_bind_uniforms(
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);
+ }
}
}