43 if (final_points_len > 0) {
57 int strands_start = 0;
58 while (strands_start < strands_len) {
59 int batch_strands_len = std::min(strands_len - strands_start, max_strands_per_call);
62 strands_start += batch_strands_len;
77 object, psys, md, &cache, gpu_material, subdiv, thickness_res);
96 object, psys, md,
nullptr, subdiv, thickness_res);
104 float (*dupli_mat)[4])
109 if ((dupli_parent !=
nullptr) && (dupli_object !=
nullptr)) {
113 if (collection !=
nullptr) {
116 mul_m4_m4m4(dupli_mat, dupli_parent->object_to_world().ptr(), dupli_mat);
119 copy_m4_m4(dupli_mat, dupli_object->
ob->object_to_world().ptr());
144 object, psys, md, &cache, gpu_material, subdiv, thickness_res);
153 const int final_points_len = cache->
final[subdiv].
strands_res * strands_len;
154 if (final_points_len > 0) {
166 int strands_start = 0;
167 while (strands_start < strands_len) {
168 int batch_strands_len = std::min(strands_len - strands_start, max_strands_per_call);
172 strands_start += batch_strands_len;
188 object, psys, md,
nullptr, subdiv, thickness_res);
193template<
typename PassT>
207 object, psys, md, gpu_material, subdiv, thickness_res);
215 sub_ps.bind_texture(
"u",
module.dummy_vbo);
216 sub_ps.bind_texture(
"au",
module.dummy_vbo);
217 sub_ps.bind_texture(
"a",
module.dummy_vbo);
218 sub_ps.bind_texture(
"c",
module.dummy_vbo);
219 sub_ps.bind_texture(
"ac",
module.dummy_vbo);
224 sub_ps.bind_texture(attr->input_name,
module.dummy_vbo);
245 float hair_rad_shape = part->
shape;
250 sub_ps.bind_texture(
"hairPointBuffer", hair_cache->
final[subdiv].
proc_buf);
255 sub_ps.bind_ubo(
"drw_curves",
module.ubo_pool.dummy_get());
256 sub_ps.push_constant(
"hairStrandsRes", &hair_cache->
final[subdiv].
strands_res, 1);
257 sub_ps.push_constant(
"hairThicknessRes", thickness_res);
258 sub_ps.push_constant(
"hairRadShape", hair_rad_shape);
259 sub_ps.push_constant(
"hairDupliMatrix", dupli_mat);
260 sub_ps.push_constant(
"hairRadRoot", hair_rad_root);
261 sub_ps.push_constant(
"hairRadTip", hair_rad_tip);
262 sub_ps.push_constant(
"hairCloseTip", hair_close_tip);
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m4_m4(float m1[4][4], const float m2[4][4])
bool invert_m4(float mat[4][4])
void unit_m4(float m[4][4])
MINLINE void sub_v3_v3(float r[3], const float a[3])
Object groups, one object can be in many groups at once.
int GPU_max_work_group_count(int index)
ListBase GPU_material_attributes(const GPUMaterial *material)
void bind_texture(const char *name, GPUTexture *texture, GPUSamplerState state=sampler_auto)
PassBase< DrawCommandBufType > & sub(const char *name)
void dispatch(int group_len)
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, GPUStorageBuf *buffer)
void shader_set(GPUShader *shader)
detail::PassBase< command::DrawCommandBuf > Sub
void DRW_hair_duplimat_get(const blender::draw::ObjectRef &ob_ref, ParticleSystem *psys, ModifierData *md, float(*dupli_mat)[4])
const DRWContext * DRW_context_get()
blender::gpu::VertBuf * DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, ModifierData *md)
static void drw_hair_particle_cache_update_compute(ParticleHairCache *cache, const int subdiv)
void DRW_hair_duplimat_get(const blender::draw::ObjectRef &ob_ref, ParticleSystem *, ModifierData *, float(*dupli_mat)[4])
static ParticleHairCache * drw_hair_particle_cache_get(Object *object, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material, int subdiv, int thickness_res)
@ PART_REFINE_CATMULL_ROM
#define MAX_LAYER_NAME_CT
GPUShader * DRW_shader_hair_refine_get(ParticleRefineShader)
detail::Pass< command::DrawCommandBuf > PassSimple
blender::gpu::Batch * hair_sub_pass_setup_implementation(PassT &sub_ps, const Scene *scene, const ObjectRef &ob_ref, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material)
gpu::Batch * hair_sub_pass_setup(PassMain::Sub &sub_ps, const Scene *scene, const ObjectRef &ob_ref, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material=nullptr)
bool particles_ensure_procedural_data(Object *object, ParticleSystem *psys, ModifierData *md, ParticleHairCache **r_hair_cache, GPUMaterial *gpu_material, int subdiv, int thickness_res)
gpu::VertBuf * hair_pos_buffer_get(Scene *scene, Object *object, ParticleSystem *psys, ModifierData *md)
static ParticleHairCache * hair_particle_cache_get(Object *object, ParticleSystem *psys, ModifierData *md, GPUMaterial *gpu_material, int subdiv, int thickness_res)
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 3 > int3
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
static void update(bNodeTree *ntree)
static struct PyModuleDef module
blender::draw::CurvesModule * curves_module
struct Collection * instance_collection
GPUTexture * uv_tex[MAX_MTFACE]
blender::gpu::VertBuf * proc_length_buf
blender::gpu::VertBuf * proc_strand_buf
blender::gpu::VertBuf * proc_strand_seg_buf
char uv_layer_names[MAX_MTFACE][MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN]
blender::gpu::VertBuf * proc_point_buf
ParticleHairFinalCache final[MAX_HAIR_SUBDIV]
char(* col_layer_names)[MAX_LAYER_NAME_CT][MAX_LAYER_NAME_LEN]
blender::gpu::VertBuf * proc_buf
blender::gpu::Batch * proc_hairs[MAX_THICKRES]
const c_style_mat & ptr() const
DupliObject * dupli_object