Commit: 7e1832c8d546ec13e752b7bd42ce13e3fc10ae86 Author: Lukas Tönne Date: Sun Apr 15 11:16:55 2018 +0100 Branches: hair_guides https://developer.blender.org/rB7e1832c8d546ec13e752b7bd42ce13e3fc10ae86
Merge branch 'blender2.8' into hair_guides =================================================================== =================================================================== diff --cc source/blender/bmesh/operators/bmo_face_island.c index 77b28f2f29c,00000000000..e52052a28d3 mode 100644,000000..100644 --- a/source/blender/bmesh/operators/bmo_face_island.c +++ b/source/blender/bmesh/operators/bmo_face_island.c @@@ -1,238 -1,0 +1,238 @@@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) Blender Foundation + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Lukas Toenne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_face_island.c + * \ingroup bmesh + * + * Face island search. + */ + +#include "MEM_guardedalloc.h" + +#include "BLI_array.h" +#include "BLI_math.h" + +#include "bmesh.h" + +#include "intern/bmesh_operators_private.h" + + +#define FACE_MARK 1 + +static BMLoop* bmo_face_island_find_start_loop(BMesh *bm, BMOperator *op) +{ + BMFace *f; + BMOIter oiter; + BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) + { + BMLoop *l; + BMIter l_iter; + BM_ITER_ELEM(l, &l_iter, f, BM_LOOPS_OF_FACE) + { + BMLoop *lr = l; + do + { + if (!BM_loop_is_manifold(lr)) { + /* treat non-manifold edges as boundaries */ + return lr; + } + if (!BMO_face_flag_test(bm, lr->f, FACE_MARK)) + { + return lr; + } + lr = lr->radial_next; + } + while (lr != l); + } + } + return NULL; +} + +void bmo_face_island_boundary_exec(BMesh *bm, BMOperator *op) +{ + BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK); + + BMLoop *l_start = bmo_face_island_find_start_loop(bm, op); + if (!l_start) + { + return; + } + + BMLoop **boundary = NULL; + BLI_array_declare(boundary); + + BMWalker walker; + BMW_init(&walker, bm, BMW_ISLANDBOUND, + BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK, + BMW_FLAG_NOP, /* no need to check BMW_FLAG_TEST_HIDDEN, faces are already marked by the bmo */ + BMW_NIL_LAY); + + for (BMLoop *l_iter = BMW_begin(&walker, l_start); l_iter; l_iter = BMW_step(&walker)) + { + BLI_array_append(boundary, l_iter); + } + BMW_end(&walker); + + { + BMOpSlot *slot = BMO_slot_get(op->slots_out, "boundary"); - BMO_slot_buffer_from_array(op, slot, (BMHeader **)boundary, BLI_array_count(boundary)); ++ BMO_slot_buffer_from_array(op, slot, (BMHeader **)boundary, BLI_array_len(boundary)); + BLI_array_free(boundary); + } + +#if 0 + BMOIter oiter; + BMFace *f; + BMFace ***regions = NULL; + BMFace **faces = NULL; + BLI_array_declare(regions); + BLI_array_declare(faces); + BMFace *act_face = bm->act_face; + BMWalker regwalker; + int i; + + const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts"); + + if (use_verts) { + /* tag verts that start out with only 2 edges, + * don't remove these later */ + BMIter viter; + BMVert *v; + + BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) { + BMO_vert_flag_set(bm, v, VERT_MARK, !BM_vert_is_edge_pair(v)); + } + } + + BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_MARK | FACE_TAG); + + /* collect region */ + BMO_ITER (f, &oiter, op->slots_in, "faces", BM_FACE) { + BMFace *f_iter; + if (!BMO_face_flag_test(bm, f, FACE_TAG)) { + continue; + } + + BLI_array_empty(faces); + faces = NULL; /* forces different allocatio */ + + BMW_init(®walker, bm, BMW_ISLAND_MANIFOLD, + BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK, + BMW_FLAG_NOP, /* no need to check BMW_FLAG_TEST_HIDDEN, faces are already marked by the bmo */ + BMW_NIL_LAY); + + for (f_iter = BMW_begin(®walker, f); f_iter; f_iter = BMW_step(®walker)) { + BLI_array_append(faces, f_iter); + } + BMW_end(®walker); + + for (i = 0; i < BLI_array_count(faces); i++) { + f_iter = faces[i]; + BMO_face_flag_disable(bm, f_iter, FACE_TAG); + BMO_face_flag_enable(bm, f_iter, FACE_ORIG); + } + + if (BMO_error_occurred(bm)) { + BMO_error_clear(bm); + BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, NULL); + goto cleanup; + } + + BLI_array_append(faces, NULL); + BLI_array_append(regions, faces); + } + + /* track how many faces we should end up with */ + int totface_target = bm->totface; + + for (i = 0; i < BLI_array_count(regions); i++) { + BMFace *f_new; + int tot = 0; + + faces = regions[i]; + if (!faces[0]) { + BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, + "Could not find boundary of dissolve region"); + goto cleanup; + } + + while (faces[tot]) + tot++; + + f_new = BM_faces_join(bm, faces, tot, true); + + if (f_new) { + /* maintain active face */ + if (act_face && bm->act_face == NULL) { + bm->act_face = f_new; + } + totface_target -= tot - 1; + } + else { + BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, + "Could not create merged face"); + goto cleanup; + } + + /* if making the new face failed (e.g. overlapping test) + * unmark the original faces for deletion */ + BMO_face_flag_disable(bm, f_new, FACE_ORIG); + BMO_face_flag_enable(bm, f_new, FACE_NEW); + } + + /* Typically no faces need to be deleted */ + if (totface_target != bm->totface) { + BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", FACE_ORIG, DEL_FACES); + } + + if (use_verts) { + BMIter viter; + BMVert *v, *v_next; + + BM_ITER_MESH_MUTABLE (v, v_next, &viter, bm, BM_VERTS_OF_MESH) { + if (BMO_vert_flag_test(bm, v, VERT_MARK)) { + if (BM_vert_is_edge_pair(v)) { + BM_vert_collapse_edge(bm, v->e, v, true, true); + } + } + } + } + + if (BMO_error_occurred(bm)) { + goto cleanup; + } + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW); + +cleanup: + /* free/cleanup */ + for (i = 0; i < BLI_array_count(regions); i++) { + if (regions[i]) MEM_freeN(regions[i]); + } + + BLI_array_free(regions); +#endif +} diff --cc source/blender/depsgraph/intern/builder/deg_builder_relations.h index 1d556f6b2ce,df6fb100d22..4ddad462a5a --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@@ -72,9 -75,6 +75,7 @@@ struct ViewLayer struct Tex; struct World; struct EffectorWeights; - struct ParticleSystem; - struct ParticleSettings; +struct Groom; struct PropertyRNA; diff --cc source/blender/depsgraph/intern/depsgraph_tag.cc index e5c714cfd74,6a6ebd1be44..2091d597ffa --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@@ -92,8 -95,8 +95,9 @@@ void depsgraph_geometry_tag_to_componen case OB_CURVE: case OB_SURF: case OB_FONT: + case OB_LATTICE: case OB_MBALL: + case OB_GROOM: *component_type = DEG_NODE_TYPE_GEOMETRY; break; case OB_ARMATURE: diff --cc source/blender/draw/CMakeLists.txt index 4dcc8dc081c,eb66e9c20ea..1529ee7022e --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@@ -64,10 -62,13 +64,14 @@@ set(SR intern/draw_cache_impl_metaball.c intern/draw_cache_impl_particles.c intern/draw_common.c + intern/draw_hair.c intern/draw_instance_data.c intern/draw_manager.c + intern/draw_manager_data.c + intern/draw_manager_exec.c + intern/draw_manager_shader.c intern/draw_manager_text.c + intern/draw_manager_texture.c intern/draw_manager_profiling.c intern/draw_view.c modes/edit_armature_mode.c diff --cc source/blender/draw/engines/eevee/eevee_materials.c index cde14f0efc3,fc4439a253c..d146fda5373 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@@ -505,8 -529,10 +545,8 @@@ static void EEVEE_update_viewvecs(floa void EEVEE_materials_init(EEVEE_ViewLayerData *sldata, EEVEE_StorageList *stl, EEVEE_FramebufferList *fbl) { if (!e_data.frag_shader_lib) { - char *frag_str = NULL; - /* Shaders */ - e_data.frag_shader_lib = BLI_string_joinN( + e_data.shadow_shader_lib = BLI_string_joinN( datatoc_common_uniforms_lib_glsl, datatoc_bsdf_common_lib_glsl, datatoc_bsdf_sampling_lib_glsl, @@@ -529,8 -555,13 +569,13 @@@ datatoc_lit_surface_frag_glsl, datatoc_lit_surface_frag_glsl, datatoc_volumetric_lib_glsl); - + + e_data.frag_shader_lib = BLI_string_joinN( + datatoc_common_view_lib_glsl, + e_data.shadow_shader_lib); + e_data.volume_shader_lib = BLI_string_joinN( + datatoc_common_view_lib_glsl, datatoc_common_uniforms_lib_glsl, datatoc_bsdf_common_lib_glsl, datatoc_ambient_occlusion_lib_glsl, @@@ -799,36 -779,25 +809,36 @@@ struct GPUMaterial *EEVEE_material_mesh } struct GPUMaterial *EEVEE_material_hair_get( - struct Scene *scene, Material *ma, int shadow_method) + struct Scene *scene, Material *ma, int shadow_method, bool use_fibers) { const void *engine = &DRW_engine_viewport_eevee_type; - int options = VAR_MAT_MESH | VAR_MAT_HAIR; - + int options = VAR_MAT_HAIR | VAR_MAT_MESH; options |= eevee_material_shadow_option(shadow_method); - + if (use_fibers) { + options |= VAR_MAT_HAIR_FIBERS; + } - GPUMaterial *mat = GPU_material_from_nodetree_find(&ma->gpumaterial, engine, options); + GPUMate @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs