Cleanup: style/whitespace
Also use 'uint'.
This commit is contained in:
@@ -3351,7 +3351,8 @@ MovieClip *BKE_object_movieclip_get(Scene *scene, Object *ob, bool use_default)
|
||||
return clip;
|
||||
}
|
||||
|
||||
void BKE_object_runtime_reset(Object *object) {
|
||||
void BKE_object_runtime_reset(Object *object)
|
||||
{
|
||||
memset(&object->runtime, 0, sizeof(object->runtime));
|
||||
}
|
||||
|
||||
|
@@ -462,7 +462,7 @@ static void studiolight_add_files_from_datafolder(const int folder_id, const cha
|
||||
struct direntry *dir;
|
||||
const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
|
||||
if (folder) {
|
||||
unsigned int totfile = BLI_filelist_dir_contents(folder, &dir);
|
||||
uint totfile = BLI_filelist_dir_contents(folder, &dir);
|
||||
int i;
|
||||
for (i = 0; i < totfile; i++) {
|
||||
if ((dir[i].type & S_IFREG)) {
|
||||
@@ -512,7 +512,7 @@ static int studiolight_cmp(const void *a, const void *b)
|
||||
}
|
||||
|
||||
/* icons */
|
||||
static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size)
|
||||
static uint *studiolight_radiance_preview(StudioLight *sl, int icon_size)
|
||||
{
|
||||
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IMAGE_LOADED);
|
||||
|
||||
@@ -566,7 +566,7 @@ static unsigned int* studiolight_radiance_preview(StudioLight *sl, int icon_size
|
||||
return rect;
|
||||
}
|
||||
|
||||
static unsigned int* studiolight_irradiance_preview(StudioLight *sl, int icon_size)
|
||||
static uint *studiolight_irradiance_preview(StudioLight *sl, int icon_size)
|
||||
{
|
||||
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_DIFFUSE_LIGHT_CALCULATED);
|
||||
|
||||
@@ -660,7 +660,8 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag)
|
||||
if (STREQLEN(sl->name, name, FILE_MAXFILE)) {
|
||||
if ((sl->flag & flag) == flag) {
|
||||
return sl;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* flags do not match, so use default */
|
||||
return studiolights.first;
|
||||
}
|
||||
@@ -686,11 +687,12 @@ const struct ListBase *BKE_studiolight_listbase(void)
|
||||
return &studiolights;
|
||||
}
|
||||
|
||||
unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type)
|
||||
uint *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type)
|
||||
{
|
||||
if (icon_id_type == STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE) {
|
||||
return studiolight_irradiance_preview(sl, icon_size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return studiolight_radiance_preview(sl, icon_size);
|
||||
}
|
||||
}
|
||||
|
@@ -300,7 +300,8 @@ void DEG_iterator_ids_begin(BLI_Iterator *iter, DEGIDIterData *data)
|
||||
iter->data = data;
|
||||
|
||||
if ((num_id_nodes == 0) ||
|
||||
(data->only_updated && !DEG_id_type_any_updated(depsgraph))) {
|
||||
(data->only_updated && !DEG_id_type_any_updated(depsgraph)))
|
||||
{
|
||||
iter->valid = false;
|
||||
return;
|
||||
}
|
||||
|
@@ -511,10 +511,13 @@ void EEVEE_draw_effects(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
|
||||
/* Save the final texture and framebuffer for final transformation or read. */
|
||||
effects->final_tx = effects->source_buffer;
|
||||
effects->final_fb = (effects->target_buffer != fbl->main_color_fb) ? fbl->main_fb : fbl->effect_fb;
|
||||
if ((effects->enabled_effects & EFFECT_TAA) && (effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0) {
|
||||
if ((effects->enabled_effects & EFFECT_TAA) &&
|
||||
(effects->enabled_effects & (EFFECT_BLOOM | EFFECT_DOF | EFFECT_MOTION_BLUR)) == 0)
|
||||
{
|
||||
if (!effects->swap_double_buffer) {
|
||||
effects->final_fb = fbl->double_buffer_fb;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
effects->final_fb = fbl->main_fb;
|
||||
}
|
||||
}
|
||||
|
@@ -32,13 +32,14 @@
|
||||
|
||||
#include "eevee_private.h"
|
||||
|
||||
void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass, World *world, EEVEE_LightProbesInfo *pinfo)
|
||||
void EEVEE_lookdev_cache_init(
|
||||
EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShader *shader, DRWPass *pass,
|
||||
World *world, EEVEE_LightProbesInfo *pinfo)
|
||||
{
|
||||
EEVEE_StorageList *stl = vedata->stl;
|
||||
const DRWContextState *draw_ctx = DRW_context_state_get();
|
||||
View3D *v3d = draw_ctx->v3d;
|
||||
if (LOOK_DEV_MODE_ENABLED(v3d))
|
||||
{
|
||||
if (LOOK_DEV_MODE_ENABLED(v3d)) {
|
||||
StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_ORIENTATION_WORLD);
|
||||
if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) {
|
||||
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
|
||||
@@ -57,14 +58,18 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, DRWShadingGroup **grp, GPUShad
|
||||
|
||||
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE);
|
||||
tex = sl->equirectangular_irradiance_gputexture;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
|
||||
tex = sl->equirectangular_radiance_gputexture;
|
||||
}
|
||||
DRW_shgroup_uniform_texture(*grp, "image", tex);
|
||||
|
||||
/* Do we need to recalc the lightprobes? */
|
||||
if (pinfo && (pinfo->studiolight_index != sl->index || pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)) {
|
||||
if (pinfo &&
|
||||
((pinfo->studiolight_index != sl->index) ||
|
||||
(pinfo->studiolight_rot_z != v3d->shading.studiolight_rot_z)))
|
||||
{
|
||||
pinfo->update_world |= PROBE_UPDATE_ALL;
|
||||
pinfo->studiolight_index = sl->index;
|
||||
pinfo->studiolight_rot_z = v3d->shading.studiolight_rot_z;
|
||||
|
@@ -37,7 +37,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
|
||||
|
||||
copy_v3_v3(wd->object_outline_color, wpd->shading.object_outline_color);
|
||||
wd->object_outline_color[3] = 1.0f;
|
||||
wd->specular_sharpness = 100 - sqrtf(scene->display.roughness)* 100;
|
||||
wd->specular_sharpness = 100.0f - sqrtf(scene->display.roughness) * 100.0f;
|
||||
|
||||
wpd->world_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_World), &wpd->world_data);
|
||||
}
|
||||
|
@@ -3252,7 +3252,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
|
||||
/* Create edges for each pair of triangles sharing an edge. */
|
||||
for (int i = 0; i < tri_len; i++) {
|
||||
for (int e = 0; e < 3; ++e) {
|
||||
unsigned int v0, v1, v2;
|
||||
uint v0, v1, v2;
|
||||
if (rdata->edit_bmesh) {
|
||||
const BMLoop **bm_looptri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
|
||||
if (BM_elem_flag_test(bm_looptri[0]->f, BM_ELEM_HIDDEN)) {
|
||||
@@ -3283,7 +3283,7 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
|
||||
/* HACK Tag as not used. Prevent overhead of BLI_edgehash_remove. */
|
||||
*pval = SET_INT_IN_POINTER(NO_EDGE);
|
||||
bool inv_opposite = (v_data < 0);
|
||||
unsigned int v_opposite = (unsigned int)abs(v_data) - 1;
|
||||
uint v_opposite = (uint)abs(v_data) - 1;
|
||||
|
||||
if (inv_opposite == inv_indices) {
|
||||
/* Don't share edge if triangles have non matching winding. */
|
||||
@@ -3303,15 +3303,15 @@ static Gwn_IndexBuf *mesh_batch_cache_get_edges_adjacency(MeshRenderData *rdata,
|
||||
BLI_edgehashIterator_isDone(ehi) == false;
|
||||
BLI_edgehashIterator_step(ehi))
|
||||
{
|
||||
unsigned int v1, v2;
|
||||
uint v1, v2;
|
||||
int v_data = GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
|
||||
if (v_data == NO_EDGE) {
|
||||
continue;
|
||||
}
|
||||
BLI_edgehashIterator_getKey(ehi, &v1, &v2);
|
||||
unsigned int v0 = (unsigned int)abs(v_data) - 1;
|
||||
uint v0 = (uint)abs(v_data) - 1;
|
||||
if (v_data < 0) { /* inv_opposite */
|
||||
SWAP(unsigned int, v1, v2);
|
||||
SWAP(uint, v1, v2);
|
||||
}
|
||||
GWN_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0);
|
||||
cache->is_manifold = false;
|
||||
|
@@ -216,7 +216,8 @@ void DRW_particle_batch_cache_free(ParticleSystem *psys)
|
||||
MEM_SAFE_FREE(psys->batch_cache);
|
||||
}
|
||||
|
||||
static void count_cache_segment_keys(ParticleCacheKey **pathcache,
|
||||
static void count_cache_segment_keys(
|
||||
ParticleCacheKey **pathcache,
|
||||
const int num_path_cache_keys,
|
||||
ParticleHairCache *hair_cache)
|
||||
{
|
||||
@@ -230,12 +231,14 @@ static void count_cache_segment_keys(ParticleCacheKey **pathcache,
|
||||
}
|
||||
}
|
||||
|
||||
static void ensure_seg_pt_count(PTCacheEdit *edit,
|
||||
static void ensure_seg_pt_count(
|
||||
PTCacheEdit *edit,
|
||||
ParticleSystem *psys,
|
||||
ParticleHairCache *hair_cache)
|
||||
{
|
||||
if ((hair_cache->pos != NULL && hair_cache->indices != NULL) ||
|
||||
(hair_cache->proc_point_buf != NULL)) {
|
||||
(hair_cache->proc_point_buf != NULL))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +271,8 @@ static void particle_pack_mcol(MCol *mcol, unsigned short r_scol[3])
|
||||
}
|
||||
|
||||
/* Used by parent particles and simple children. */
|
||||
static void particle_calculate_parent_uvs(ParticleSystem *psys,
|
||||
static void particle_calculate_parent_uvs(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const int num_uv_layers,
|
||||
const int parent_index,
|
||||
@@ -292,7 +296,8 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_uv_layers; j++) {
|
||||
psys_interpolate_uvs(mtfaces[j] + num,
|
||||
psys_interpolate_uvs(
|
||||
mtfaces[j] + num,
|
||||
mface->v4,
|
||||
particle->fuv,
|
||||
r_uv[j]);
|
||||
@@ -300,7 +305,8 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_calculate_parent_mcol(ParticleSystem *psys,
|
||||
static void particle_calculate_parent_mcol(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const int num_uv_layers,
|
||||
const int parent_index,
|
||||
@@ -324,7 +330,8 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_uv_layers; j++) {
|
||||
psys_interpolate_mcol(mcols[j] + num,
|
||||
psys_interpolate_mcol(
|
||||
mcols[j] + num,
|
||||
mface->v4,
|
||||
particle->fuv,
|
||||
&r_mcol[j]);
|
||||
@@ -333,7 +340,8 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
|
||||
}
|
||||
|
||||
/* Used by interpolated children. */
|
||||
static void particle_interpolate_children_uvs(ParticleSystem *psys,
|
||||
static void particle_interpolate_children_uvs(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const int num_uv_layers,
|
||||
const int child_index,
|
||||
@@ -352,7 +360,8 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys,
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_uv_layers; j++) {
|
||||
psys_interpolate_uvs(mtfaces[j] + num,
|
||||
psys_interpolate_uvs(
|
||||
mtfaces[j] + num,
|
||||
mface->v4,
|
||||
particle->fuv,
|
||||
r_uv[j]);
|
||||
@@ -360,7 +369,8 @@ static void particle_interpolate_children_uvs(ParticleSystem *psys,
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_interpolate_children_mcol(ParticleSystem *psys,
|
||||
static void particle_interpolate_children_mcol(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const int num_col_layers,
|
||||
const int child_index,
|
||||
@@ -379,7 +389,8 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys,
|
||||
if (num != DMCACHE_NOTFOUND) {
|
||||
MFace *mface = &psmd->mesh_final->mface[num];
|
||||
for (int j = 0; j < num_col_layers; j++) {
|
||||
psys_interpolate_mcol(mcols[j] + num,
|
||||
psys_interpolate_mcol(
|
||||
mcols[j] + num,
|
||||
mface->v4,
|
||||
particle->fuv,
|
||||
&r_mcol[j]);
|
||||
@@ -387,7 +398,8 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys,
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_calculate_uvs(ParticleSystem *psys,
|
||||
static void particle_calculate_uvs(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const bool is_simple,
|
||||
const int num_uv_layers,
|
||||
@@ -433,7 +445,8 @@ static void particle_calculate_uvs(ParticleSystem *psys,
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_calculate_mcol(ParticleSystem *psys,
|
||||
static void particle_calculate_mcol(
|
||||
ParticleSystem *psys,
|
||||
ParticleSystemModifierData *psmd,
|
||||
const bool is_simple,
|
||||
const int num_col_layers,
|
||||
@@ -508,11 +521,13 @@ static int particle_batch_cache_fill_segments(
|
||||
const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN);
|
||||
if (is_simple && *r_parent_uvs == NULL) {
|
||||
/* TODO(sergey): For edit mode it should be edit->totcached. */
|
||||
*r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart,
|
||||
*r_parent_uvs = MEM_callocN(
|
||||
sizeof(*r_parent_uvs) * psys->totpart,
|
||||
"Parent particle UVs");
|
||||
}
|
||||
if (is_simple && *r_parent_mcol == NULL) {
|
||||
*r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart,
|
||||
*r_parent_mcol = MEM_callocN(
|
||||
sizeof(*r_parent_mcol) * psys->totpart,
|
||||
"Parent particle MCol");
|
||||
}
|
||||
int curr_point = start_index;
|
||||
@@ -552,16 +567,15 @@ static int particle_batch_cache_fill_segments(
|
||||
for (int k = 0; k < num_uv_layers; k++) {
|
||||
GWN_vertbuf_attr_set(
|
||||
hair_cache->pos, uv_id[k], curr_point,
|
||||
(is_simple && is_child)
|
||||
? (*r_parent_uvs)[psys->child[i].parent][k]
|
||||
: uv[k]);
|
||||
(is_simple && is_child) ?
|
||||
(*r_parent_uvs)[psys->child[i].parent][k] : uv[k]);
|
||||
}
|
||||
for (int k = 0; k < num_col_layers; k++) {
|
||||
/* TODO Put the conversion outside the loop */
|
||||
unsigned short scol[4];
|
||||
particle_pack_mcol((is_simple && is_child)
|
||||
? &(*r_parent_mcol)[psys->child[i].parent][k]
|
||||
: &mcol[k],
|
||||
particle_pack_mcol(
|
||||
(is_simple && is_child) ?
|
||||
&(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
|
||||
scol);
|
||||
GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol);
|
||||
}
|
||||
@@ -580,16 +594,15 @@ static int particle_batch_cache_fill_segments(
|
||||
for (int k = 0; k < num_uv_layers; k++) {
|
||||
GWN_vertbuf_attr_set(
|
||||
hair_cache->pos, uv_id[k], curr_point,
|
||||
(is_simple && is_child)
|
||||
? (*r_parent_uvs)[psys->child[i].parent][k]
|
||||
: uv[k]);
|
||||
(is_simple && is_child) ?
|
||||
(*r_parent_uvs)[psys->child[i].parent][k] : uv[k]);
|
||||
}
|
||||
for (int k = 0; k < num_col_layers; k++) {
|
||||
/* TODO Put the conversion outside the loop */
|
||||
unsigned short scol[4];
|
||||
particle_pack_mcol((is_simple && is_child)
|
||||
? &(*r_parent_mcol)[psys->child[i].parent][k]
|
||||
: &mcol[k],
|
||||
particle_pack_mcol(
|
||||
(is_simple && is_child) ?
|
||||
&(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
|
||||
scol);
|
||||
GWN_vertbuf_attr_set(hair_cache->pos, col_id[k], curr_point, scol);
|
||||
}
|
||||
@@ -675,11 +688,13 @@ static int particle_batch_cache_fill_strands_data(
|
||||
const bool is_child = (particle_source == PARTICLE_SOURCE_CHILDREN);
|
||||
if (is_simple && *r_parent_uvs == NULL) {
|
||||
/* TODO(sergey): For edit mode it should be edit->totcached. */
|
||||
*r_parent_uvs = MEM_callocN(sizeof(*r_parent_uvs) * psys->totpart,
|
||||
*r_parent_uvs = MEM_callocN(
|
||||
sizeof(*r_parent_uvs) * psys->totpart,
|
||||
"Parent particle UVs");
|
||||
}
|
||||
if (is_simple && *r_parent_mcol == NULL) {
|
||||
*r_parent_mcol = MEM_callocN(sizeof(*r_parent_mcol) * psys->totpart,
|
||||
*r_parent_mcol = MEM_callocN(
|
||||
sizeof(*r_parent_mcol) * psys->totpart,
|
||||
"Parent particle MCol");
|
||||
}
|
||||
int curr_point = start_index;
|
||||
@@ -689,7 +704,7 @@ static int particle_batch_cache_fill_strands_data(
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned int *seg_data = (unsigned int *)GWN_vertbuf_raw_step(data_step);
|
||||
uint *seg_data = (uint *)GWN_vertbuf_raw_step(data_step);
|
||||
*seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24);
|
||||
curr_point += path->segments + 1;
|
||||
|
||||
@@ -719,9 +734,9 @@ static int particle_batch_cache_fill_strands_data(
|
||||
}
|
||||
for (int k = 0; k < num_col_layers; k++) {
|
||||
unsigned short *scol = (unsigned short *)GWN_vertbuf_raw_step(col_step + k);
|
||||
particle_pack_mcol((is_simple && is_child)
|
||||
? &(*r_parent_mcol)[psys->child[i].parent][k]
|
||||
: &mcol[k],
|
||||
particle_pack_mcol(
|
||||
(is_simple && is_child) ?
|
||||
&(*r_parent_mcol)[psys->child[i].parent][k] : &mcol[k],
|
||||
scol);
|
||||
}
|
||||
if (!is_simple) {
|
||||
@@ -733,7 +748,8 @@ static int particle_batch_cache_fill_strands_data(
|
||||
return curr_point;
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCache *cache,
|
||||
static void particle_batch_cache_ensure_procedural_final_points(
|
||||
ParticleHairCache *cache,
|
||||
int subdiv)
|
||||
{
|
||||
/* Same format as point_tex. */
|
||||
@@ -752,7 +768,8 @@ static void particle_batch_cache_ensure_procedural_final_points(ParticleHairCach
|
||||
cache->final[subdiv].proc_tex = GPU_texture_create_from_vertbuf(cache->final[subdiv].proc_buf);
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit,
|
||||
static void particle_batch_cache_ensure_procedural_strand_data(
|
||||
PTCacheEdit *edit,
|
||||
ParticleSystem *psys,
|
||||
ModifierData *md,
|
||||
ParticleHairCache *cache)
|
||||
@@ -783,13 +800,13 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
|
||||
MCol **parent_mcol = NULL;
|
||||
|
||||
Gwn_VertFormat format_data = {0};
|
||||
unsigned int data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
||||
uint data_id = GWN_vertformat_attr_add(&format_data, "data", GWN_COMP_U32, 1, GWN_FETCH_INT);
|
||||
|
||||
Gwn_VertFormat format_uv = {0};
|
||||
unsigned int uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
|
||||
uint uv_id = GWN_vertformat_attr_add(&format_uv, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
|
||||
|
||||
Gwn_VertFormat format_col = {0};
|
||||
unsigned int col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
|
||||
uint col_id = GWN_vertformat_attr_add(&format_col, "col", GWN_COMP_U16, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
|
||||
|
||||
memset(cache->uv_layer_names, 0, sizeof(cache->uv_layer_names));
|
||||
memset(cache->col_layer_names, 0, sizeof(cache->col_layer_names));
|
||||
@@ -806,7 +823,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
|
||||
GWN_vertbuf_attr_get_raw_data(cache->proc_uv_buf[i], uv_id, &uv_step[i]);
|
||||
|
||||
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPUV, i);
|
||||
unsigned int hash = BLI_ghashutil_strhash_p(name);
|
||||
uint hash = BLI_ghashutil_strhash_p(name);
|
||||
int n = 0;
|
||||
BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "u%u", hash);
|
||||
BLI_snprintf(cache->uv_layer_names[i][n++], MAX_LAYER_NAME_LEN, "a%u", hash);
|
||||
@@ -822,7 +839,7 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
|
||||
GWN_vertbuf_attr_get_raw_data(cache->proc_col_buf[i], col_id, &col_step[i]);
|
||||
|
||||
const char *name = CustomData_get_layer_name(&psmd->mesh_final->ldata, CD_MLOOPCOL, i);
|
||||
unsigned int hash = BLI_ghashutil_strhash_p(name);
|
||||
uint hash = BLI_ghashutil_strhash_p(name);
|
||||
int n = 0;
|
||||
BLI_snprintf(cache->col_layer_names[i][n++], MAX_LAYER_NAME_LEN, "c%u", hash);
|
||||
|
||||
@@ -909,7 +926,8 @@ static void particle_batch_cache_ensure_procedural_strand_data(PTCacheEdit *edit
|
||||
}
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit,
|
||||
static void particle_batch_cache_ensure_procedural_indices(
|
||||
PTCacheEdit *edit,
|
||||
ParticleSystem *psys,
|
||||
ParticleHairCache *cache,
|
||||
int thickness_res,
|
||||
@@ -957,13 +975,15 @@ static void particle_batch_cache_ensure_procedural_indices(PTCacheEdit *edit,
|
||||
}
|
||||
}
|
||||
|
||||
cache->final[subdiv].proc_hairs[thickness_res-1] = GWN_batch_create_ex(prim_type,
|
||||
cache->final[subdiv].proc_hairs[thickness_res - 1] = GWN_batch_create_ex(
|
||||
prim_type,
|
||||
vbo,
|
||||
GWN_indexbuf_build(&elb),
|
||||
GWN_BATCH_OWNS_VBO | GWN_BATCH_OWNS_INDEX);
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit,
|
||||
static void particle_batch_cache_ensure_procedural_pos(
|
||||
PTCacheEdit *edit,
|
||||
ParticleSystem *psys,
|
||||
ParticleHairCache *cache)
|
||||
{
|
||||
@@ -1011,7 +1031,8 @@ static void particle_batch_cache_ensure_procedural_pos(PTCacheEdit *edit,
|
||||
cache->point_tex = GPU_texture_create_from_vertbuf(cache->proc_point_buf);
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit,
|
||||
static void particle_batch_cache_ensure_pos_and_seg(
|
||||
PTCacheEdit *edit,
|
||||
ParticleSystem *psys,
|
||||
ModifierData *md,
|
||||
ParticleHairCache *hair_cache)
|
||||
@@ -1090,7 +1111,8 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit,
|
||||
GWN_vertbuf_data_alloc(hair_cache->pos, hair_cache->point_count);
|
||||
|
||||
Gwn_IndexBufBuilder elb;
|
||||
GWN_indexbuf_init_ex(&elb,
|
||||
GWN_indexbuf_init_ex(
|
||||
&elb,
|
||||
GWN_PRIM_LINE_STRIP,
|
||||
hair_cache->elems_count, hair_cache->point_count,
|
||||
true);
|
||||
@@ -1163,7 +1185,8 @@ static void particle_batch_cache_ensure_pos_and_seg(PTCacheEdit *edit,
|
||||
hair_cache->indices = GWN_indexbuf_build(&elb);
|
||||
}
|
||||
|
||||
static void particle_batch_cache_ensure_pos(Object *object,
|
||||
static void particle_batch_cache_ensure_pos(
|
||||
Object *object,
|
||||
ParticleSystem *psys,
|
||||
ParticlePointCache *point_cache)
|
||||
{
|
||||
@@ -1240,7 +1263,8 @@ static void particle_batch_cache_ensure_pos(Object *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_particle_update_ptcache_edit(Object *object_eval,
|
||||
static void drw_particle_update_ptcache_edit(
|
||||
Object *object_eval,
|
||||
ParticleSystem *psys,
|
||||
PTCacheEdit *edit)
|
||||
{
|
||||
@@ -1259,7 +1283,8 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
|
||||
}
|
||||
if (edit->pathcache == NULL) {
|
||||
Depsgraph *depsgraph = draw_ctx->depsgraph;
|
||||
psys_cache_edit_paths(depsgraph,
|
||||
psys_cache_edit_paths(
|
||||
depsgraph,
|
||||
scene_orig, object_orig,
|
||||
edit,
|
||||
DEG_get_ctime(depsgraph),
|
||||
@@ -1267,7 +1292,8 @@ static void drw_particle_update_ptcache_edit(Object *object_eval,
|
||||
}
|
||||
}
|
||||
|
||||
static void drw_particle_update_ptcache(Object *object_eval,
|
||||
static void drw_particle_update_ptcache(
|
||||
Object *object_eval,
|
||||
ParticleSystem *psys)
|
||||
{
|
||||
if ((object_eval->mode & OB_MODE_PARTICLE_EDIT) == 0) {
|
||||
@@ -1294,11 +1320,11 @@ Gwn_Batch *DRW_particles_batch_cache_get_hair(
|
||||
drw_particle_update_ptcache(object, psys);
|
||||
ensure_seg_pt_count(NULL, psys, &cache->hair);
|
||||
particle_batch_cache_ensure_pos_and_seg(NULL, psys, md, &cache->hair);
|
||||
cache->hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP,
|
||||
cache->hair.hairs = GWN_batch_create(
|
||||
GWN_PRIM_LINE_STRIP,
|
||||
cache->hair.pos,
|
||||
cache->hair.indices);
|
||||
}
|
||||
|
||||
return cache->hair.hairs;
|
||||
}
|
||||
|
||||
@@ -1326,13 +1352,15 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_strands(
|
||||
drw_particle_update_ptcache_edit(object, psys, edit);
|
||||
ensure_seg_pt_count(edit, psys, &cache->edit_hair);
|
||||
particle_batch_cache_ensure_pos_and_seg(edit, psys, NULL, &cache->edit_hair);
|
||||
cache->edit_hair.hairs = GWN_batch_create(GWN_PRIM_LINE_STRIP,
|
||||
cache->edit_hair.hairs = GWN_batch_create(
|
||||
GWN_PRIM_LINE_STRIP,
|
||||
cache->edit_hair.pos,
|
||||
cache->edit_hair.indices);
|
||||
return cache->edit_hair.hairs;
|
||||
}
|
||||
|
||||
static void ensure_edit_inner_points_count(const PTCacheEdit *edit,
|
||||
static void ensure_edit_inner_points_count(
|
||||
const PTCacheEdit *edit,
|
||||
ParticleBatchCache *cache)
|
||||
{
|
||||
if (cache->edit_inner_pos != NULL) {
|
||||
@@ -1346,7 +1374,8 @@ static void ensure_edit_inner_points_count(const PTCacheEdit *edit,
|
||||
}
|
||||
}
|
||||
|
||||
static void edit_colors_get(PTCacheEdit *edit,
|
||||
static void edit_colors_get(
|
||||
PTCacheEdit *edit,
|
||||
float selected_color[4],
|
||||
float normal_color[4])
|
||||
{
|
||||
@@ -1410,13 +1439,15 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_inner_points(
|
||||
drw_particle_update_ptcache_edit(object, psys, edit);
|
||||
ensure_edit_inner_points_count(edit, cache);
|
||||
particle_batch_cache_ensure_edit_inner_pos(edit, cache);
|
||||
cache->edit_inner_points = GWN_batch_create(GWN_PRIM_POINTS,
|
||||
cache->edit_inner_points = GWN_batch_create(
|
||||
GWN_PRIM_POINTS,
|
||||
cache->edit_inner_pos,
|
||||
NULL);
|
||||
return cache->edit_inner_points;
|
||||
}
|
||||
|
||||
static void ensure_edit_tip_points_count(const PTCacheEdit *edit,
|
||||
static void ensure_edit_tip_points_count(
|
||||
const PTCacheEdit *edit,
|
||||
ParticleBatchCache *cache)
|
||||
{
|
||||
if (cache->edit_tip_pos != NULL) {
|
||||
@@ -1475,7 +1506,8 @@ Gwn_Batch *DRW_particles_batch_cache_get_edit_tip_points(
|
||||
drw_particle_update_ptcache_edit(object, psys, edit);
|
||||
ensure_edit_tip_points_count(edit, cache);
|
||||
particle_batch_cache_ensure_edit_tip_pos(edit, cache);
|
||||
cache->edit_tip_points = GWN_batch_create(GWN_PRIM_POINTS,
|
||||
cache->edit_tip_points = GWN_batch_create(
|
||||
GWN_PRIM_POINTS,
|
||||
cache->edit_tip_pos,
|
||||
NULL);
|
||||
return cache->edit_tip_points;
|
||||
|
@@ -367,7 +367,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obm
|
||||
}
|
||||
|
||||
static void drw_shgroup_call_procedural_add_ex(
|
||||
DRWShadingGroup *shgroup, Gwn_PrimType prim_type, unsigned int prim_count, float (*obmat)[4])
|
||||
DRWShadingGroup *shgroup, Gwn_PrimType prim_type, uint prim_count, float (*obmat)[4])
|
||||
{
|
||||
BLI_assert(ELEM(shgroup->type, DRW_SHG_NORMAL, DRW_SHG_FEEDBACK_TRANSFORM));
|
||||
|
||||
@@ -383,17 +383,17 @@ static void drw_shgroup_call_procedural_add_ex(
|
||||
BLI_LINKS_APPEND(&shgroup->calls, call);
|
||||
}
|
||||
|
||||
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, unsigned int point_count, float (*obmat)[4])
|
||||
void DRW_shgroup_call_procedural_points_add(DRWShadingGroup *shgroup, uint point_count, float (*obmat)[4])
|
||||
{
|
||||
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_POINTS, point_count, obmat);
|
||||
}
|
||||
|
||||
void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, unsigned int line_count, float (*obmat)[4])
|
||||
void DRW_shgroup_call_procedural_lines_add(DRWShadingGroup *shgroup, uint line_count, float (*obmat)[4])
|
||||
{
|
||||
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_LINES, line_count, obmat);
|
||||
}
|
||||
|
||||
void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, unsigned int tria_count, float (*obmat)[4])
|
||||
void DRW_shgroup_call_procedural_triangles_add(DRWShadingGroup *shgroup, uint tria_count, float (*obmat)[4])
|
||||
{
|
||||
drw_shgroup_call_procedural_add_ex(shgroup, GWN_PRIM_TRIS, tria_count, obmat);
|
||||
}
|
||||
|
@@ -749,8 +749,9 @@ static void draw_matrices_model_prepare(DRWCallState *st)
|
||||
/* No need to go further the call will not be used. */
|
||||
if ((st->flag & DRW_CALL_CULLED) != 0 &&
|
||||
(st->flag & DRW_CALL_BYPASS_CULLING) == 0)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
/* Order matters */
|
||||
if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE |
|
||||
DRW_CALL_NORMALVIEW | DRW_CALL_EYEVEC))
|
||||
|
@@ -717,7 +717,7 @@ static void rna_View3DShading_studio_light_orientation_set(PointerRNA *UNUSED(pt
|
||||
static int rna_View3DShading_studio_light_get(PointerRNA *ptr)
|
||||
{
|
||||
View3D *v3d = (View3D *)ptr->data;
|
||||
const int flag = v3d->drawtype == OB_MATERIAL? STUDIOLIGHT_ORIENTATION_WORLD: 0;
|
||||
const int flag = (v3d->drawtype == OB_MATERIAL) ? STUDIOLIGHT_ORIENTATION_WORLD : 0;
|
||||
StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, flag);
|
||||
BLI_strncpy(v3d->shading.studio_light, sl->name, FILE_MAXFILE);
|
||||
return sl->index;
|
||||
@@ -747,7 +747,8 @@ static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(
|
||||
if ((sl->flag & STUDIOLIGHT_EXTERNAL_FILE) == 0) {
|
||||
/* always show internal lights */
|
||||
show_studiolight = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
switch (v3d->drawtype) {
|
||||
case OB_SOLID:
|
||||
case OB_TEXTURE:
|
||||
|
@@ -415,7 +415,8 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, Mes
|
||||
LIB_ID_CREATE_NO_DEG_TAG |
|
||||
LIB_ID_COPY_NO_PREVIEW,
|
||||
false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
result = mesh;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user