diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-04-09 05:03:25 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-04-09 05:03:44 +0400 |
commit | b5d3f183b0fd6f72d84fbcdd594f80e70422eb24 (patch) | |
tree | c3a2d297f165c45d63d21a790bc9632264e3d341 /source/blender/blenkernel/intern/DerivedMesh.c | |
parent | 6ffabfae852f956f5074ddb75e94a4f6fb846d1d (diff) |
Add material storage to derivedmesh.
The variables are considered invalid unless DM_update_materials is
called prior to use. Only use case currently is
mesh drawing. This helps with excessive allocation on the stack during
GPUObject creation, but may help elsewhere in the future as well.
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 1a9ca234f8d..dcaf102ef01 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -54,6 +54,7 @@ #include "BKE_displist.h" #include "BKE_editmesh.h" #include "BKE_key.h" +#include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_mesh.h" #include "BKE_mesh_mapping.h" @@ -482,6 +483,13 @@ void DM_update_tessface_data(DerivedMesh *dm) dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS; } +void DM_update_materials(DerivedMesh *dm, Object *ob) +{ + dm->totmat = ob->totcol + 1; /* materials start from 1, default material is 0 */ + dm->mat = *give_matarar(ob); +} + + void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask) { /* dm might depend on me, so we need to do everything with a local copy */ |