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/draw/intern/draw_cache_impl_particles.c')
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 6cd03d14bfd..3c586e6daec 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -190,18 +190,18 @@ static void particle_batch_cache_clear_hair(ParticleHairCache *hair_cache)
DRW_TEXTURE_FREE_SAFE(hair_cache->strand_tex);
DRW_TEXTURE_FREE_SAFE(hair_cache->strand_seg_tex);
- for (int i = 0; i < MAX_MTFACE; ++i) {
+ for (int i = 0; i < MAX_MTFACE; i++) {
GPU_VERTBUF_DISCARD_SAFE(hair_cache->proc_uv_buf[i]);
DRW_TEXTURE_FREE_SAFE(hair_cache->uv_tex[i]);
}
- for (int i = 0; i < MAX_MCOL; ++i) {
+ for (int i = 0; i < MAX_MCOL; i++) {
GPU_VERTBUF_DISCARD_SAFE(hair_cache->proc_col_buf[i]);
DRW_TEXTURE_FREE_SAFE(hair_cache->col_tex[i]);
}
- for (int i = 0; i < MAX_HAIR_SUBDIV; ++i) {
+ for (int i = 0; i < MAX_HAIR_SUBDIV; i++) {
GPU_VERTBUF_DISCARD_SAFE(hair_cache->final[i].proc_buf);
DRW_TEXTURE_FREE_SAFE(hair_cache->final[i].proc_tex);
- for (int j = 0; j < MAX_THICKRES; ++j) {
+ for (int j = 0; j < MAX_THICKRES; j++) {
GPU_BATCH_DISCARD_SAFE(hair_cache->final[i].proc_hairs[j]);
}
}
@@ -1335,15 +1335,6 @@ static void particle_batch_cache_ensure_pos(Object *object,
sim.psmd = psys_get_modifier(object, psys);
sim.psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
- if (psys->part->phystype == PART_PHYS_KEYED) {
- if (psys->flag & PSYS_KEYED) {
- psys_count_keyed_targets(&sim);
- if (psys->totkeyed == 0) {
- return;
- }
- }
- }
-
GPU_VERTBUF_DISCARD_SAFE(point_cache->pos);
if (format.attr_len == 0) {
@@ -1551,6 +1542,9 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit, ParticleBatc
cache->edit_inner_point_len = 0;
for (int point_index = 0; point_index < edit->totpoint; point_index++) {
const PTCacheEditPoint *point = &edit->points[point_index];
+ if (point->flag & PEP_HIDE) {
+ continue;
+ }
BLI_assert(point->totkey >= 1);
cache->edit_inner_point_len += (point->totkey - 1);
}
@@ -1572,6 +1566,9 @@ static void particle_batch_cache_ensure_edit_inner_pos(PTCacheEdit *edit,
int global_key_index = 0;
for (int point_index = 0; point_index < edit->totpoint; point_index++) {
const PTCacheEditPoint *point = &edit->points[point_index];
+ if (point->flag & PEP_HIDE) {
+ continue;
+ }
for (int key_index = 0; key_index < point->totkey - 1; key_index++) {
PTCacheEditKey *key = &point->keys[key_index];
float color = (key->flag & PEK_SELECT) ? 1.0f : 0.0f;
@@ -1602,7 +1599,14 @@ static void ensure_edit_tip_points_count(const PTCacheEdit *edit, ParticleBatchC
if (cache->edit_tip_pos != NULL) {
return;
}
- cache->edit_tip_point_len = edit->totpoint;
+ cache->edit_tip_point_len = 0;
+ for (int point_index = 0; point_index < edit->totpoint; point_index++) {
+ const PTCacheEditPoint *point = &edit->points[point_index];
+ if (point->flag & PEP_HIDE) {
+ continue;
+ }
+ cache->edit_tip_point_len += 1;
+ }
}
static void particle_batch_cache_ensure_edit_tip_pos(PTCacheEdit *edit, ParticleBatchCache *cache)
@@ -1617,13 +1621,18 @@ static void particle_batch_cache_ensure_edit_tip_pos(PTCacheEdit *edit, Particle
cache->edit_tip_pos = GPU_vertbuf_create_with_format(edit_point_format);
GPU_vertbuf_data_alloc(cache->edit_tip_pos, cache->edit_tip_point_len);
+ int global_point_index = 0;
for (int point_index = 0; point_index < edit->totpoint; point_index++) {
const PTCacheEditPoint *point = &edit->points[point_index];
+ if (point->flag & PEP_HIDE) {
+ continue;
+ }
PTCacheEditKey *key = &point->keys[point->totkey - 1];
float color = (key->flag & PEK_SELECT) ? 1.0f : 0.0f;
- GPU_vertbuf_attr_set(cache->edit_tip_pos, pos_id, point_index, key->world_co);
- GPU_vertbuf_attr_set(cache->edit_tip_pos, color_id, point_index, &color);
+ GPU_vertbuf_attr_set(cache->edit_tip_pos, pos_id, global_point_index, key->world_co);
+ GPU_vertbuf_attr_set(cache->edit_tip_pos, color_id, global_point_index, &color);
+ global_point_index++;
}
}