Added BKE_freestyle_lineset_delete() by generalizing FRS_delete_active_lineset().
[blender.git] / source / blender / blenkernel / BKE_subsurf.h
index 47aee714bf7c1cef23ee68dcdd676fe95b27a520..3dae4087866f4d7320cea79f7bd127e4190f5153 100644 (file)
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SUBSURF_H
-#define BKE_SUBSURF_H
+#ifndef __BKE_SUBSURF_H__
+#define __BKE_SUBSURF_H__
 
 /** \file BKE_subsurf.h
  *  \ingroup bke
  */
 
+/* struct DerivedMesh is used directly */
+#include "BKE_DerivedMesh.h"
+
+struct CCGElem;
+struct DMFlagMat;
 struct DMGridAdjacency;
-struct DMGridData;
 struct DerivedMesh;
-struct EditMesh;
-struct IndexNode;
-struct ListBase;
+struct MeshElemMap;
 struct Mesh;
+struct MPoly;
 struct MultiresSubsurf;
 struct Object;
 struct PBVH;
 struct SubsurfModifierData;
-struct _CCGEdge;
-struct _CCGFace;
-struct _CCGSubsurf;
-struct _CCGVert;
+struct CCGEdge;
+struct CCGFace;
+struct CCGSubsurf;
+struct CCGVert;
 struct EdgeHash;
 struct PBVH;
-struct DMGridData;
 struct DMGridAdjacency;
 
 /**************************** External *****************************/
 
+typedef enum {
+       SUBSURF_USE_RENDER_PARAMS = 1,
+       SUBSURF_IS_FINAL_CALC = 2,
+       SUBSURF_FOR_EDIT_MODE = 4,
+       SUBSURF_IN_EDIT_MODE = 8,
+       SUBSURF_ALLOC_PAINT_MASK = 16
+} SubsurfFlags;
+
 struct DerivedMesh *subsurf_make_derived_from_derived(
-                                               struct DerivedMesh *dm,
-                                               struct SubsurfModifierData *smd,
-                                               int useRenderParams, float (*vertCos)[3],
-                                               int isFinalCalc, int forEditMode, int inEditMode);
+        struct DerivedMesh *dm,
+        struct SubsurfModifierData *smd,
+        float (*vertCos)[3],
+        SubsurfFlags flags);
+
+void subsurf_calculate_limit_positions(struct Mesh *me, float (*r_positions)[3]);
+
+/* get gridsize from 'level', level must be greater than zero */
+int BKE_ccg_gridsize(int level);
 
-void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
+/* x/y grid coordinates at 'low_level' can be multiplied by the result
+ * of this function to convert to grid coordinates at 'high_level' */
+int BKE_ccg_factor(int low_level, int high_level);
+
+void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
+                              const struct MPoly *mpoly,
+                              struct MVert *mvert,
+                              const struct MDisps *mdisps);
+
+void subsurf_copy_grid_paint_mask(struct DerivedMesh *dm,
+                                  const struct MPoly *mpoly, float *paint_mask,
+                                  const struct GridPaintMask *grid_paint_mask);
+
+typedef enum MultiresModifiedFlags {
+       /* indicates the grids have been sculpted on, so MDisps
+        * have to be updated */
+       MULTIRES_COORDS_MODIFIED = 1,
+       /* indicates elements have been hidden or unhidden */
+       MULTIRES_HIDDEN_MODIFIED = 2
+} MultiresModifiedFlags;
 
 /**************************** Internal *****************************/
 
 typedef struct CCGDerivedMesh {
        DerivedMesh dm;
 
-       struct _CCGSubSurf *ss;
+       struct CCGSubSurf *ss;
        int freeSS;
        int drawInteriorEdges, useSubsurfUv;
 
-       struct {int startVert; struct _CCGVert *vert;} *vertMap;
-       struct {int startVert; int startEdge; struct _CCGEdge *edge;} *edgeMap;
+       struct {int startVert; struct CCGVert *vert; } *vertMap;
+       struct {int startVert; int startEdge; struct CCGEdge *edge; } *edgeMap;
        struct {int startVert; int startEdge;
-                       int startFace; struct _CCGFace *face;} *faceMap;
+                   int startFace; struct CCGFace *face; } *faceMap;
 
        short *edgeFlags;
-       char *faceFlags;
+       struct DMFlagMat *faceFlags;
 
        int *reverseFaceMap;
 
        struct PBVH *pbvh;
-       struct ListBase *fmap;
-       struct IndexNode *fmap_mem;
 
-       struct ListBase *pmap;
-       struct IndexNode *pmap_mem;
+       struct MeshElemMap *pmap;
+       int *pmap_mem;
 
-       struct DMGridData **gridData;
+       struct CCGElem **gridData;
        struct DMGridAdjacency *gridAdjacency;
        int *gridOffset;
-       struct _CCGFace **gridFaces;
+       struct CCGFace **gridFaces;
+       struct DMFlagMat *gridFlagMats;
+       unsigned int **gridHidden;
 
        struct {
                struct MultiresModifierData *mmd;
@@ -100,9 +134,7 @@ typedef struct CCGDerivedMesh {
                float (*orco)[3];
 
                struct Object *ob;
-               int modified;
-
-               void (*update)(DerivedMesh*);
+               MultiresModifiedFlags modified_flags;
        } multires;
 
        struct EdgeHash *ehash;