[Bf-blender-cvs] [1aae5ac1a8e] hair_guides_grooming: Merge branch 'hair_guides' into hair_guides_grooming
Lukas Tönne
noreply at git.blender.org
Tue Jun 5 22:23:47 CEST 2018
Commit: 1aae5ac1a8ef63d954f85ad2425c07e648de722a
Author: Lukas Tönne
Date: Tue Jun 5 21:23:35 2018 +0100
Branches: hair_guides_grooming
https://developer.blender.org/rB1aae5ac1a8ef63d954f85ad2425c07e648de722a
Merge branch 'hair_guides' into hair_guides_grooming
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_main.h
index b17a96a45a1,0913cf208eb..9290999a95d
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@@ -127,10 -127,7 +127,8 @@@ typedef struct Main
ListBase linestyle;
ListBase cachefiles;
ListBase workspaces;
+ ListBase grooms;
- char id_tag_update[MAX_LIBARRAY];
-
/* Must be generated, used and freed by same code - never assume this is valid data unless you know
* when, who and how it was created.
* Used by code doing a lot of remapping etc. at once to speed things up. */
diff --cc source/blender/blenkernel/intern/object_update.c
index 7a329c163f3,852d8197a6c..534f33b1d1c
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@@ -329,66 -335,7 +336,10 @@@ void BKE_object_eval_uber_data(Depsgrap
case OB_MBALL:
BKE_mball_batch_cache_dirty(ob->data, BKE_MBALL_BATCH_DIRTY_ALL);
break;
+ case OB_GROOM:
+ BKE_groom_batch_cache_dirty(ob->data, BKE_GROOM_BATCH_DIRTY_ALL);
+ break;
}
-
- if (DEG_depsgraph_use_copy_on_write()) {
- if (ob->type == OB_MESH) {
- /* Quick hack to convert evaluated derivedMesh to Mesh. */
- DerivedMesh *dm = ob->derivedFinal;
- if (dm != NULL) {
- Mesh *mesh = (Mesh *)ob->data;
- Mesh *new_mesh = BKE_libblock_alloc_notest(ID_ME);
- BKE_mesh_init(new_mesh);
- /* Copy ID name so GS(new_mesh->id) works correct later on. */
- BLI_strncpy(new_mesh->id.name, mesh->id.name, sizeof(new_mesh->id.name));
- /* Copy materials so render engines can access them. */
- new_mesh->mat = MEM_dupallocN(mesh->mat);
- new_mesh->totcol = mesh->totcol;
- DM_to_mesh(dm, new_mesh, ob, CD_MASK_MESH, true);
- new_mesh->edit_btmesh = mesh->edit_btmesh;
- /* Store result mesh as derived_mesh of object. This way we have
- * explicit way to query final object evaluated data and know for sure
- * who owns the newly created mesh datablock.
- */
- ob->mesh_evaluated = new_mesh;
- /* TODO(sergey): This is kind of compatibility thing, so all render
- * engines can use object->data for mesh data for display. This is
- * something what we might want to change in the future.
- * XXX: This can sometimes cause modifiers to be applied twice!
- */
- ob->data = new_mesh;
- /* Special flags to help debugging. */
- new_mesh->id.tag |= LIB_TAG_COPY_ON_WRITE_EVAL;
- /* Save some memory by throwing DerivedMesh away. */
- /* NOTE: Watch out, some tools might need it!
- * So keep around for now..
- */
- /* Store original ID as a pointer in evaluated ID.
- * This way we can restore original object data when we are freeing
- * evaluated mesh.
- */
- new_mesh->id.orig_id = &mesh->id;
- /* Copy autosmooth settings from original mesh. */
- new_mesh->flag |= (mesh->flag & ME_AUTOSMOOTH);
- new_mesh->smoothresh = mesh->smoothresh;
- }
- #if 0
- if (ob->derivedFinal != NULL) {
- ob->derivedFinal->needsFree = 1;
- ob->derivedFinal->release(ob->derivedFinal);
- ob->derivedFinal = NULL;
- }
- if (ob->derivedDeform != NULL) {
- ob->derivedDeform->needsFree = 1;
- ob->derivedDeform->release(ob->derivedDeform);
- ob->derivedDeform = NULL;
- }
- #endif
- }
- }
}
void BKE_object_eval_cloth(Depsgraph *depsgraph,
diff --cc source/blender/bmesh/intern/bmesh_walkers_impl.c
index 45288f1350d,81487b70edc..e1a40272952
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@@ -706,12 -708,15 +706,13 @@@ static void *bmw_IslandboundWalker_step
iwalk = &owalk;
l = iwalk->curloop;
- e = l->e;
- v = BM_edge_other_vert(e, iwalk->lastv);
+ v = BM_edge_other_vert(l->e, iwalk->lastv);
-
+
/* pop off current state */
BMW_state_remove(walker);
-
+
- f = l->f;
+
while (1) {
l = BM_loop_other_edge_loop(l, v);
if (BM_loop_is_manifold(l)) {
diff --cc source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index b8a4cdc7641,0f49d57a826..10af3fef5b6
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@@ -467,17 -477,20 +486,23 @@@ void update_edit_mode_pointers(const De
const ID_Type type = GS(id_orig->name);
switch (type) {
case ID_AR:
- updata_armature_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ update_armature_edit_mode_pointers(depsgraph, id_orig, id_cow);
break;
case ID_ME:
- updata_mesh_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ update_mesh_edit_mode_pointers(depsgraph, id_orig, id_cow);
break;
case ID_CU:
- updata_curve_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ update_curve_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ break;
+ case ID_MB:
+ update_mball_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ break;
+ case ID_LT:
+ update_lattice_edit_mode_pointers(depsgraph, id_orig, id_cow);
break;
+ case ID_GM:
+ update_groom_edit_mode_pointers(depsgraph, id_orig, id_cow);
+ break;
default:
break;
}
@@@ -857,9 -927,12 +945,15 @@@ void discard_edit_mode_pointers(ID *id_
case ID_CU:
discard_curve_edit_mode_pointers(id_cow);
break;
+ case ID_GM:
+ discard_groom_edit_mode_pointers(id_cow);
+ break;
+ case ID_MB:
+ discard_mball_edit_mode_pointers(id_cow);
+ break;
+ case ID_LT:
+ discard_lattice_edit_mode_pointers(id_cow);
+ break;
default:
break;
}
diff --cc source/blender/draw/engines/eevee/eevee_engine.c
index 4e7b6c5a5d3,f159bf21d03..a2c339784d8
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@@ -135,29 -137,32 +137,32 @@@ static void eevee_cache_populate(void *
}
}
- if (DRW_check_object_visible_within_active_context(ob) == false) {
- return;
+ if (ob->base_flag & BASE_VISIBLED) {
+ EEVEE_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
}
- if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_GROOM)) {
- bool cast_shadow;
-
- EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
-
- if (cast_shadow) {
- EEVEE_lights_cache_shcaster_object_add(sldata, ob);
+ if (DRW_check_object_visible_within_active_context(ob)) {
- if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
++ if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_GROOM)) {
+ EEVEE_materials_cache_populate(vedata, sldata, ob, &cast_shadow);
}
- }
- else if (ob->type == OB_LIGHTPROBE) {
- if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
- /* TODO: Special case for dupli objects because we cannot save the object pointer. */
+ else if (!USE_SCENE_LIGHT(draw_ctx->v3d)) {
+ /* do not add any scene light sources to the cache */
}
- else {
- EEVEE_lightprobes_cache_add(sldata, ob);
+ else if (ob->type == OB_LIGHTPROBE) {
+ if ((ob->base_flag & BASE_FROMDUPLI) != 0) {
+ /* TODO: Special case for dupli objects because we cannot save the object pointer. */
+ }
+ else {
+ EEVEE_lightprobes_cache_add(sldata, ob);
+ }
+ }
+ else if (ob->type == OB_LAMP) {
+ EEVEE_lights_cache_add(sldata, ob);
}
}
- else if (ob->type == OB_LAMP) {
- EEVEE_lights_cache_add(sldata, ob);
+
+ if (cast_shadow) {
+ EEVEE_lights_cache_shcaster_object_add(sldata, ob);
}
}
diff --cc source/blender/draw/engines/eevee/eevee_materials.c
index 9c4e4246086,6f5ca45ffbc..58325ffd848
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@@ -1457,7 -1531,6 +1533,7 @@@ static void material_hair
EEVEE_ViewLayerData *sldata,
Object *ob,
HairSystem *hsys,
- Material *material,
++ Material *ma,
struct Mesh *scalp)
{
EEVEE_PassList *psl = ((EEVEE_Data *)vedata)->psl;
@@@ -1467,57 -1541,55 +1544,54 @@@
float mat[4][4];
copy_m4_m4(mat, ob->obmat);
- HairExportCache *hair_export = BKE_hair_export_cache_new();
- BKE_hair_export_cache_update(hair_export, hsys, subdiv, scalp, HAIR_EXPORT_ALL);
-
- const DRWHairFiberTextureBuffer *fiber_buffer = NULL;
- struct Gwn_Batch *hair_geom = DRW_cache_hair_get_fibers(hsys, hair_export, &fiber_buffer);
-
- BKE_hair_export_cache_free(hair_export);
- Material *ma = give_current_material(ob, hsys->material_index);
+ if (ma == NULL) {
+ ma = &defmaterial;
+ }
- if (!hsys->draw_texture_cache) {
- hsys->draw_texture_cache = DRW_texture_create_2D(fiber_buffer->width, fiber_buffer->height,
- GPU_RG32F, 0, fiber_buffer->data);
+ {
+ /*DRWShadingGroup *shgrp =*/ DRW_shgroup_hair_fibers_create(scene, ob, hsys, scalp, psl->depth_pass, e_data.default_prepass_hair_fiber_sh);
}
- GPUTexture **fiber_texture = (GPUTexture **)(&hsys->draw_texture_cache);
-
- if (material == NULL) {
- material = &defmaterial;
+ {
+ /*DRWShadingGroup *shgrp =*/ DRW_shgroup_hair_fibers_create(scene, ob, hsys, scalp, psl->depth_pass_clip, e_data.default_prepass_hair_fiber_clip_sh);
}
- DRW_shgroup_call_add(stl->g_data->hair_fibers_depth_shgrp, hair_geom, mat);
- DRW_hair_shader_uniforms(stl->g_data->hair_fibers_depth_shgrp, scene,
- fiber_texture, fiber_buffer);
-
- DRW_shgroup_call_add(stl->g_data->hair_fibers_depth_shgrp_clip, hair_geom, mat);
- DRW_hair_shader_uniforms(stl->g_data->hair_fibers_depth_shgrp_clip, scene,
- fiber_texture, fiber_buffer);
-
- DRWShadingGroup *shgrp = BLI_ghash_lookup(material_hash, (const void *)material);
- if (!shgrp) {
- float *color_p = &material->r;
- float *metal_p = &material->ray_mirror;
- float *spec_p = &material->spec;
- float *rough_p = &material->gloss_mir;
+ {
+ float *color_p = &ma->r;
+ float *metal_p = &ma->metallic;
+ float *spec_p = &ma->spec;
+ float *rough_p = &ma->roughness;
- if (material->use_nodes && material->nodetree) {
- struct GPUMaterial *gpumat = EEVEE_material_hair_get(scene, material, sldata-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list