diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-06 06:40:08 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-03-06 06:40:08 +0400 |
commit | c7ffe7f621810f61e53343850ce42f367830fad9 (patch) | |
tree | fb1559aeac12e64ab91bedd25a8bf6c153d68dbb /source/blender/blenkernel/BKE_DerivedMesh.h | |
parent | 9c7e8e837d07ef4b6e296e6effd6eea2c53945e6 (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/blenkernel/BKE_DerivedMesh.h')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index b9e2fddb895..8c03624dbf7 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -112,6 +112,12 @@ typedef struct DMGridAdjacency { int rotation[4]; } DMGridAdjacency; +/* keep in sync with MFace/MPoly types */ +typedef struct DMFlagMat { + short mat_nr; + char flag; +} DMFlagMat; + typedef enum DerivedMeshType { DM_TYPE_CDDM, DM_TYPE_EDITBMESH, @@ -218,6 +224,8 @@ struct DerivedMesh { DMGridData **(*getGridData)(DerivedMesh *dm); DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm); int *(*getGridOffset)(DerivedMesh *dm); + DMFlagMat *(*getGridFlagMats)(DerivedMesh *dm); + /* Iterate over each mapped vertex in the derived mesh, calling the * given function with the original vert and the mapped vert's new |