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:
Diffstat (limited to 'source/blender/blenkernel/BKE_DerivedMesh.h')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h217
1 files changed, 23 insertions, 194 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 89f3431fec8..0349c09ef13 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -95,8 +95,8 @@ struct KeyBlock;
struct ModifierData;
struct MCol;
struct ColorBand;
+struct Depsgraph;
struct GPUVertexAttribs;
-struct GPUDrawObject;
struct PBVH;
/* number of sub-elements each mesh element has (for interpolation) */
@@ -126,36 +126,6 @@ typedef enum DerivedMeshType {
DM_TYPE_CCGDM
} DerivedMeshType;
-typedef enum DMDrawOption {
- /* the element is hidden or otherwise non-drawable */
- DM_DRAW_OPTION_SKIP = 0,
- /* normal drawing */
- DM_DRAW_OPTION_NORMAL = 1,
- /* draw, but don't set the color from mcol */
- DM_DRAW_OPTION_NO_MCOL = 2,
- /* used in drawMappedFaces, use GL stipple for the face */
- DM_DRAW_OPTION_STIPPLE = 3,
-} DMDrawOption;
-
-/* Drawing callback types */
-typedef int (*DMSetMaterial)(int mat_nr, void *attribs);
-typedef int (*DMCompareDrawOptions)(void *userData, int cur_index, int next_index);
-typedef void (*DMSetDrawInterpOptions)(void *userData, int index, float t);
-typedef DMDrawOption (*DMSetDrawOptions)(void *userData, int index);
-typedef DMDrawOption (*DMSetDrawOptionsMappedTex)(void *userData, int origindex, int mat_nr);
-typedef DMDrawOption (*DMSetDrawOptionsTex)(struct MTexPoly *mtexpoly, const bool has_vcol, int matnr);
-
-typedef enum DMDrawFlag {
- DM_DRAW_USE_COLORS = (1 << 0),
- DM_DRAW_ALWAYS_SMOOTH = (1 << 1),
- DM_DRAW_USE_ACTIVE_UV = (1 << 2),
- DM_DRAW_USE_TEXPAINT_UV = (1 << 3),
- DM_DRAW_SKIP_HIDDEN = (1 << 4),
- DM_DRAW_SKIP_SELECT = (1 << 5),
- DM_DRAW_SELECT_USE_EDITMODE = (1 << 6),
- DM_DRAW_NEED_NORMALS = (1 << 7)
-} DMDrawFlag;
-
typedef enum DMForeachFlag {
DM_FOREACH_NOP = 0,
DM_FOREACH_USE_NORMAL = (1 << 0), /* foreachMappedVert, foreachMappedLoop, foreachMappedFaceCenter */
@@ -164,14 +134,9 @@ typedef enum DMForeachFlag {
typedef enum DMDirtyFlag {
/* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */
DM_DIRTY_TESS_CDLAYERS = 1 << 0,
- /* One of the MCOL layers have been updated, force updating of GPUDrawObject's colors buffer.
- * This is necessary with modern, VBO draw code, as e.g. in vpaint mode me->mcol may be updated
- * without actually rebuilding dm (hence by default keeping same GPUDrawObject, and same colors
- * buffer, which prevents update during a stroke!). */
- DM_DIRTY_MCOL_UPDATE_DRAW = 1 << 1,
/* check this with modifier dependsOnNormals callback to see if normals need recalculation */
- DM_DIRTY_NORMALS = 1 << 2,
+ DM_DIRTY_NORMALS = 1 << 1,
} DMDirtyFlag;
typedef struct DerivedMesh DerivedMesh;
@@ -182,9 +147,7 @@ struct DerivedMesh {
int needsFree; /* checked on ->release, is set to 0 for cached results */
int deformedOnly; /* set by modifier stack if only deformed from original */
BVHCache *bvhCache;
- struct GPUDrawObject *drawObject;
DerivedMeshType type;
- float auto_bump_scale;
DMDirtyFlag dirty;
int totmat; /* total materials. Will be valid only before object drawing. */
struct Material **mat; /* material array. Will be valid only before object drawing */
@@ -384,117 +347,6 @@ struct DerivedMesh {
*/
struct PBVH *(*getPBVH)(struct Object *ob, DerivedMesh *dm);
- /* Drawing Operations */
-
- /** Draw all vertices as bgl points (no options) */
- void (*drawVerts)(DerivedMesh *dm);
-
- /** Draw edges in the UV mesh (if exists) */
- void (*drawUVEdges)(DerivedMesh *dm);
-
- /** Draw all edges as lines (no options)
- *
- * Also called for *final* editmode DerivedMeshes
- */
- void (*drawEdges)(DerivedMesh *dm, bool drawLooseEdges, bool drawAllEdges);
-
- /** Draw all loose edges (edges w/ no adjoining faces) */
- void (*drawLooseEdges)(DerivedMesh *dm);
-
- /** Draw all faces
- * o Set face normal or vertex normal based on inherited face flag
- * o Use inherited face material index to call setMaterial
- * o Only if setMaterial returns true
- *
- * Also called for *final* editmode DerivedMeshes
- */
- void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
- bool fast, DMSetMaterial setMaterial);
-
- /** Draw all faces using MTFace
- * - Drawing options too complicated to enumerate, look at code.
- */
- void (*drawFacesTex)(DerivedMesh *dm,
- DMSetDrawOptionsTex setDrawOptions,
- DMCompareDrawOptions compareDrawOptions,
- void *userData, DMDrawFlag flag);
-
- /** Draw all faces with GLSL materials
- * o setMaterial is called for every different material nr
- * o Only if setMaterial returns true
- */
- void (*drawFacesGLSL)(DerivedMesh *dm, DMSetMaterial setMaterial);
-
- /** Draw mapped faces (no color, or texture)
- * - Only if !setDrawOptions or
- * setDrawOptions(userData, mapped-face-index, r_drawSmooth)
- * returns true
- *
- * If drawSmooth is set to true then vertex normals should be set and
- * glShadeModel called with GL_SMOOTH. Otherwise the face normal should
- * be set and glShadeModel called with GL_FLAT.
- *
- * The setDrawOptions is allowed to not set drawSmooth (for example, when
- * lighting is disabled), in which case the implementation should draw as
- * smooth shaded.
- */
- void (*drawMappedFaces)(DerivedMesh *dm,
- DMSetDrawOptions setDrawOptions,
- DMSetMaterial setMaterial,
- DMCompareDrawOptions compareDrawOptions,
- void *userData,
- DMDrawFlag flag);
-
- /** Draw mapped faces using MTFace
- * - Drawing options too complicated to enumerate, look at code.
- */
- void (*drawMappedFacesTex)(DerivedMesh *dm,
- DMSetDrawOptionsMappedTex setDrawOptions,
- DMCompareDrawOptions compareDrawOptions,
- void *userData, DMDrawFlag flag);
-
- /** Draw mapped faces with GLSL materials
- * - setMaterial is called for every different material nr
- * - setDrawOptions is called for every face
- * - Only if setMaterial and setDrawOptions return true
- */
- void (*drawMappedFacesGLSL)(DerivedMesh *dm,
- DMSetMaterial setMaterial,
- DMSetDrawOptions setDrawOptions,
- void *userData);
-
- /** Draw mapped edges as lines
- * - Only if !setDrawOptions or setDrawOptions(userData, mapped-edge)
- * returns true
- */
- void (*drawMappedEdges)(DerivedMesh *dm,
- DMSetDrawOptions setDrawOptions,
- void *userData);
-
- /** Draw mapped edges as lines with interpolation values
- * - Only if !setDrawOptions or
- * setDrawOptions(userData, mapped-edge, mapped-v0, mapped-v1, t)
- * returns true
- *
- * NOTE: This routine is optional!
- */
- void (*drawMappedEdgesInterp)(DerivedMesh *dm,
- DMSetDrawOptions setDrawOptions,
- DMSetDrawInterpOptions setDrawInterpOptions,
- void *userData);
-
- /** Draw all faces with materials
- * - setMaterial is called for every different material nr
- * - setFace is called to verify if a face must be hidden
- */
- void (*drawMappedFacesMat)(DerivedMesh *dm,
- void (*setMaterial)(void *userData, int matnr, void *attribs),
- bool (*setFace)(void *userData, int index), void *userData);
-
- struct GPUDrawObject *(*gpuObjectNew)(DerivedMesh *dm);
- void (*copy_gpu_data)(DerivedMesh *dm, int type, void *varray_p,
- const int *mat_orig_to_new, const void *user_data);
-
/** Release reference to the DerivedMesh. This function decides internally
* if the DerivedMesh will be freed, or cached for later use. */
void (*release)(DerivedMesh *dm);
@@ -535,9 +387,6 @@ void DM_to_bmesh_ex(struct DerivedMesh *dm, struct BMesh *bm, const boo
struct BMesh *DM_to_bmesh(struct DerivedMesh *dm, const bool calc_face_normal);
-/** Utility function to convert a DerivedMesh to a shape key block */
-void DM_to_meshkey(DerivedMesh *dm, struct Mesh *me, struct KeyBlock *kb);
-
void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
/* adds a vertex/edge/face custom data layer to a DerivedMesh, optionally
@@ -546,19 +395,19 @@ void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
* freed, see BKE_customdata.h for the different options
*/
void DM_add_vert_layer(
- struct DerivedMesh *dm, int type, int alloctype,
+ struct DerivedMesh *dm, int type, eCDAllocType alloctype,
void *layer);
void DM_add_edge_layer(
- struct DerivedMesh *dm, int type, int alloctype,
+ struct DerivedMesh *dm, int type, eCDAllocType alloctype,
void *layer);
void DM_add_tessface_layer(
- struct DerivedMesh *dm, int type, int alloctype,
+ struct DerivedMesh *dm, int type, eCDAllocType alloctype,
void *layer);
void DM_add_loop_layer(
- DerivedMesh *dm, int type, int alloctype,
+ DerivedMesh *dm, int type, eCDAllocType alloctype,
void *layer);
void DM_add_poly_layer(
- struct DerivedMesh *dm, int type, int alloctype,
+ struct DerivedMesh *dm, int type, eCDAllocType alloctype,
void *layer);
/* custom data access functions
@@ -679,57 +528,44 @@ DMCoNo *mesh_get_mapped_verts_nors(struct Scene *scene, struct Object *ob);
void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int totcos);
/* */
-DerivedMesh *mesh_get_derived_final(
- struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
-DerivedMesh *mesh_get_derived_deform(
- struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_for_modifier(
- struct Scene *scene, struct Object *ob,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob,
struct ModifierData *md, int build_shapekey_layers);
DerivedMesh *mesh_create_derived_render(
- struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ struct Depsgraph *depsgraph, struct Scene *scene,
+ struct Object *ob, CustomDataMask dataMask);
DerivedMesh *getEditDerivedBMesh(
struct BMEditMesh *em, struct Object *ob, CustomDataMask data_mask,
float (*vertexCos)[3]);
DerivedMesh *mesh_create_derived_index_render(
- struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask, int index);
+ struct Depsgraph *depsgraph, struct Scene *scene,
+ struct Object *ob, CustomDataMask dataMask, int index);
/* same as above but wont use render settings */
DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]);
DerivedMesh *mesh_create_derived_view(
- struct Scene *scene, struct Object *ob,
- CustomDataMask dataMask);
+ struct Depsgraph *depsgraph, struct Scene *scene,
+ struct Object *ob, CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_no_deform(
- struct Scene *scene, struct Object *ob,
- float (*vertCos)[3],
+ struct Depsgraph *depsgraph, struct Scene *scene,
+ struct Object *ob, float (*vertCos)[3],
CustomDataMask dataMask);
DerivedMesh *mesh_create_derived_no_deform_render(
- struct Scene *scene, struct Object *ob,
- float (*vertCos)[3],
- CustomDataMask dataMask);
-/* for gameengine */
-DerivedMesh *mesh_create_derived_no_virtual(
- struct Scene *scene, struct Object *ob, float (*vertCos)[3],
- CustomDataMask dataMask);
-DerivedMesh *mesh_create_derived_physics(
- struct Scene *scene, struct Object *ob, float (*vertCos)[3],
+ struct Depsgraph *depsgraph, struct Scene *scene,
+ struct Object *ob, float (*vertCos)[3],
CustomDataMask dataMask);
DerivedMesh *editbmesh_get_derived_base(
struct Object *ob, struct BMEditMesh *em, CustomDataMask data_mask);
DerivedMesh *editbmesh_get_derived_cage(
- struct Scene *scene, struct Object *,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
struct BMEditMesh *em, CustomDataMask dataMask);
DerivedMesh *editbmesh_get_derived_cage_and_final(
- struct Scene *scene, struct Object *,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
struct BMEditMesh *em, CustomDataMask dataMask,
DerivedMesh **r_final);
@@ -738,7 +574,7 @@ DerivedMesh *object_get_derived_final(struct Object *ob, const bool for_render);
float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *r_numVerts))[3];
bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm);
void makeDerivedMesh(
- struct Scene *scene, struct Object *ob, struct BMEditMesh *em,
+ struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em,
CustomDataMask dataMask, const bool build_shapekey_layers);
void weight_to_rgb(float r_rgb[3], const float weight);
@@ -783,25 +619,18 @@ void DM_vertex_attributes_from_gpu(
DerivedMesh *dm,
struct GPUVertexAttribs *gattribs, DMVertexAttribs *attribs);
-void DM_draw_attrib_vertex(DMVertexAttribs *attribs, int a, int index, int vert, int loop);
-void DM_draw_attrib_vertex_uniforms(const DMVertexAttribs *attribs);
-
void DM_calc_tangents_names_from_gpu(
const struct GPUVertexAttribs *gattribs,
char (*tangent_names)[MAX_NAME], int *tangent_names_count);
+
void DM_add_named_tangent_layer_for_uv(
CustomData *uv_data, CustomData *tan_data, int numLoopData,
const char *layer_name);
-#define DM_TANGENT_MASK_ORCO (1 << 9)
-void DM_calc_loop_tangents_step_0(
- const CustomData *loopData, bool calc_active_tangent,
- const char (*tangent_names)[MAX_NAME], int tangent_names_count,
- bool *rcalc_act, bool *rcalc_ren, int *ract_uv_n, int *rren_uv_n,
- char *ract_uv_name, char *rren_uv_name, short *rtangent_mask);
void DM_calc_loop_tangents(
DerivedMesh *dm, bool calc_active_tangent, const char (*tangent_names)[MAX_NAME],
int tangent_names_count);
+
void DM_calc_auto_bump_scale(DerivedMesh *dm);
/** Set object's bounding box based on DerivedMesh min/max data */