Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache_impl_particles.c
| Show First 20 Lines • Show All 1,333 Lines • ▼ Show 20 Lines | static void particle_batch_cache_ensure_pos(Object *object, | ||||
| sim.psys = psys; | sim.psys = psys; | ||||
| sim.psmd = psys_get_modifier(object, psys); | sim.psmd = psys_get_modifier(object, psys); | ||||
| sim.psys->lattice_deform_data = psys_create_lattice_deform_data(&sim); | sim.psys->lattice_deform_data = psys_create_lattice_deform_data(&sim); | ||||
| GPU_VERTBUF_DISCARD_SAFE(point_cache->pos); | GPU_VERTBUF_DISCARD_SAFE(point_cache->pos); | ||||
| if (format.attr_len == 0) { | if (format.attr_len == 0) { | ||||
| /* initialize vertex format */ | /* initialize vertex format */ | ||||
| pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); | pos_id = GPU_vertformat_attr_add(&format, "part_pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | ||||
| rot_id = GPU_vertformat_attr_add(&format, "rot", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); | val_id = GPU_vertformat_attr_add(&format, "part_val", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); | ||||
| val_id = GPU_vertformat_attr_add(&format, "val", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); | rot_id = GPU_vertformat_attr_add(&format, "part_rot", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); | ||||
| } | } | ||||
| point_cache->pos = GPU_vertbuf_create_with_format(&format); | point_cache->pos = GPU_vertbuf_create_with_format(&format); | ||||
| GPU_vertbuf_data_alloc(point_cache->pos, psys->totpart); | GPU_vertbuf_data_alloc(point_cache->pos, psys->totpart); | ||||
| for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { | for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) { | ||||
| state.time = DEG_get_ctime(draw_ctx->depsgraph); | state.time = DEG_get_ctime(draw_ctx->depsgraph); | ||||
| if (!psys_get_particle_state(&sim, i, &state, 0)) { | if (!psys_get_particle_state(&sim, i, &state, 0)) { | ||||
| ▲ Show 20 Lines • Show All 347 Lines • Show Last 20 Lines | |||||