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:
authorLukas Tönne <lukas.toenne@gmail.com>2016-07-11 10:22:22 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-07-11 10:22:22 +0300
commitfd603e4f21591f7ae04f531f5a80a32a6abe239c (patch)
tree1847eb32ce63d1da87a3d3dcdb1f97613370cd48 /source/blender/editors/space_view3d
parent10e4fb01f5225da56973ed6deaf521a249c7ebd4 (diff)
Added "effects" to the hair modifier for testing deformation of the hair in the shader.
These features will ultimately be implemented through nodes, but they are quite useful for testing the shading itself and the performance.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawstrands.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/drawstrands.c b/source/blender/editors/space_view3d/drawstrands.c
index 6e6a00fd600..6b0f227caa1 100644
--- a/source/blender/editors/space_view3d/drawstrands.c
+++ b/source/blender/editors/space_view3d/drawstrands.c
@@ -79,6 +79,25 @@ static GPUStrands_ShaderModel get_shader_model(int smd_shader_model)
return 0;
}
+static int get_effects(int smd_effects)
+{
+ GPUStrands_Effects effects = 0;
+ if (smd_effects & MOD_STRANDS_EFFECT_CLUMPING)
+ effects |= GPU_STRAND_EFFECT_CLUMPING;
+ if (smd_effects & MOD_STRANDS_EFFECT_CURL)
+ effects |= GPU_STRAND_EFFECT_CURL;
+
+ return effects;
+}
+
+static void bind_strands_shader(GPUStrandsShader *shader, RegionView3D *rv3d,
+ Object *ob, StrandsModifierData *smd)
+{
+ GPU_strand_shader_bind_uniforms(shader, ob->obmat, rv3d->viewmat);
+ GPU_strand_shader_bind(shader, rv3d->viewmat, rv3d->viewinv,
+ smd->clumping_factor, smd->clumping_shape);
+}
+
void draw_strands(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d,
Object *ob, StrandsModifierData *smd)
{
@@ -96,7 +115,9 @@ void draw_strands(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d,
if (smd->gpu_buffer == NULL)
smd->gpu_buffer = GPU_strands_buffer_create(&params);
GPUDrawStrands *buffer = smd->gpu_buffer;
- GPUStrandsShader *shader = GPU_strand_shader_get(strands, get_shader_model(smd->shader_model));
+ GPUStrandsShader *shader = GPU_strand_shader_get(strands,
+ get_shader_model(smd->shader_model),
+ get_effects(smd->effects));
if (show_controls) {
GPU_strands_setup_edges(buffer, &params);
@@ -108,8 +129,7 @@ void draw_strands(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d,
}
if (show_strands) {
- GPU_strand_shader_bind_uniforms(shader, ob->obmat, rv3d->viewmat);
- GPU_strand_shader_bind(shader, rv3d->viewmat, rv3d->viewinv);
+ bind_strands_shader(shader, rv3d, ob, smd);
GPU_strands_setup_fibers(buffer, &params);
if (buffer->fiber_points) {
@@ -460,7 +480,9 @@ void draw_strands_edit(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d,
if (smd->gpu_buffer == NULL)
smd->gpu_buffer = GPU_strands_buffer_create(&params);
GPUDrawStrands *buffer = smd->gpu_buffer;
- GPUStrandsShader *shader = GPU_strand_shader_get(smd->strands, get_shader_model(smd->shader_model));
+ GPUStrandsShader *shader = GPU_strand_shader_get(smd->strands,
+ get_shader_model(smd->shader_model),
+ get_effects(smd->effects));
if (show_controls) {
GPU_strands_setup_edges(buffer, &params);
@@ -471,8 +493,7 @@ void draw_strands_edit(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d,
}
if (show_strands) {
- GPU_strand_shader_bind_uniforms(shader, ob->obmat, rv3d->viewmat);
- GPU_strand_shader_bind(shader, rv3d->viewmat, rv3d->viewinv);
+ bind_strands_shader(shader, rv3d, ob, smd);
GPU_strands_setup_fibers(buffer, &params);
if (buffer->fiber_points) {