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:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-03-06 06:40:08 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-03-06 06:40:08 +0400
commitc7ffe7f621810f61e53343850ce42f367830fad9 (patch)
treefb1559aeac12e64ab91bedd25a8bf6c153d68dbb /source/blender/blenlib/BLI_pbvh.h
parent9c7e8e837d07ef4b6e296e6effd6eea2c53945e6 (diff)
Draw individual face's material and shading correctly in the PBVH.
Previously, the shading and material was set once per PBVHNode when drawing. This is still the case, but PBVHNodes are now built to contain only one material and shading mode. This is done with an extra partitioning step; once the number of primitives in the node falls below the PBVH leaf limit, it's primitives are checked for matching materials. If more than one material or shading mode is present in the node, it is split and partitioned (partitioned by material rather than 3D location.) Given a sufficiently 'annoying' input, like a dense mesh with thousands of materials randomly scattered across it, this could greatly increase PBVH build time (since nodes might end up containing a single primitive), but in general this shouldn't come up. In order to support materials for grids, the CCGDM is building another grid array (of DMFaceMat structs). This could be used to replace CCGDM.faceFlag for some small memory savings (TODO).
Diffstat (limited to 'source/blender/blenlib/BLI_pbvh.h')
-rw-r--r--source/blender/blenlib/BLI_pbvh.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index 85dd1c1a197..f0d56a3cf52 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -26,13 +26,14 @@
* \brief A BVH for high poly meshes.
*/
-struct MFace;
-struct MVert;
+struct DMFlagMat;
struct DMGridAdjacency;
struct DMGridData;
+struct ListBase;
+struct MFace;
+struct MVert;
struct PBVH;
struct PBVHNode;
-struct ListBase;
typedef struct PBVH PBVH;
typedef struct PBVHNode PBVHNode;
@@ -56,7 +57,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
int totface, int totvert);
void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
struct DMGridAdjacency *gridadj, int totgrid,
- int gridsize, void **gridfaces);
+ int gridsize, void **gridfaces, struct DMFlagMat *flagmats);
void BLI_pbvh_free(PBVH *bvh);
/* Hierarchical Search in the BVH, two methods:
@@ -85,7 +86,8 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
void BLI_pbvh_node_draw(PBVHNode *node, void *data);
int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
-void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], int smooth);
+void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
+ int (*setMaterial)(int, void *attribs));
/* Node Access */