diff options
Diffstat (limited to 'source/blender/draw/intern/draw_hair.c')
-rw-r--r-- | source/blender/draw/intern/draw_hair.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 58085cf08c6..08256b931ba 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -104,12 +104,6 @@ void DRW_hair_init(void) #endif } -typedef struct DRWHairInstanceData { - DrawData dd; - - float mat[4][4]; -} DRWHairInstanceData; - static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, ParticleSystem *psys, ModifierData *md, @@ -120,13 +114,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, /* TODO(fclem): Pass the scene as parameter */ const DRWContextState *draw_ctx = DRW_context_state_get(); Scene *scene = draw_ctx->scene; - static float unit_mat[4][4] = { - {1, 0, 0, 0}, - {0, 1, 0, 0}, - {0, 0, 1, 0}, - {0, 0, 0, 1}, - }; - float(*dupli_mat)[4]; + float dupli_mat[4][4]; Object *dupli_parent = DRW_object_get_dupli_parent(object); DupliObject *dupli_object = DRW_object_get_dupli(object); @@ -164,13 +152,6 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, } if ((dupli_parent != NULL) && (dupli_object != NULL)) { - DRWHairInstanceData *hair_inst_data = (DRWHairInstanceData *)DRW_drawdata_ensure( - &object->id, - (DrawEngineType *)&drw_shgroup_create_hair_procedural_ex, - sizeof(DRWHairInstanceData), - NULL, - NULL); - dupli_mat = hair_inst_data->mat; if (dupli_object->type & OB_DUPLICOLLECTION) { copy_m4_m4(dupli_mat, dupli_parent->obmat); } @@ -181,14 +162,17 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, } } else { - dupli_mat = unit_mat; + unit_m4(dupli_mat); } DRW_shgroup_uniform_texture(shgrp, "hairPointBuffer", hair_cache->final[subdiv].proc_tex); DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1); DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res); DRW_shgroup_uniform_float(shgrp, "hairRadShape", &part->shape, 1); - DRW_shgroup_uniform_mat4(shgrp, "hairDupliMatrix", dupli_mat); + DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]); + DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]); + DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]); + DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]); DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", part->rad_root * part->rad_scale * 0.5f); DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", part->rad_tip * part->rad_scale * 0.5f); DRW_shgroup_uniform_bool_copy( |