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:
-rw-r--r--source/blender/blenkernel/BKE_bmesh.h67
-rw-r--r--source/blender/blenkernel/intern/BME_mesh.c30
-rw-r--r--source/blender/blenkernel/intern/bmesh_private.h4
3 files changed, 87 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index 87202ce047a..ab2fd34cd42 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -41,18 +41,79 @@
#include "BLI_ghash.h"
#include "BLI_memarena.h"
#include "DNA_customdata_types.h"
+#include "DNA_image_types.h"
#include "BLI_editVert.h"
#include "BKE_DerivedMesh.h"
#include "transform.h"
+/*forward declerations*/
struct BME_Vert;
struct BME_Edge;
struct BME_Poly;
struct BME_Loop;
+
struct BME_mempool;
typedef struct BME_mempool BME_mempool;
+/*Custom Data Types and defines
+ Eventual plan is to move almost everything to custom data and let caller
+ decide when making the mesh what layers they want to store in the mesh
+
+ This stuff should probably go in a seperate file....
+*/
+typedef struct BME_CustomDataLayer {
+ int type; /* type of data in layer */
+ int offset; /* offset of layer in block */
+ int active; /* offset of active layer*/
+ char name[32]; /* layer name */
+} BME_CustomDataLayer;
+
+typedef struct BME_CustomData {
+ BME_CustomDataLayer *layers; /*Custom Data Layers*/
+ BME_mempool *pool; /*pool for alloc of blocks*/
+ int totlayer, totsize; /*total layers and total size in bytes of each block*/
+} BME_CustomData;
+
+#define BME_CD_FACETEX 1 /*Image texture/texface*/
+#define BME_CD_LOOPTEX 2 /*UV coordinates*/
+#define BME_CD_LOOPCOL 3 /*Vcolors*/
+#define BME_CD_DEFORMVERT 4 /*Vertex Group/Weights*/
+#define BME_CD_NUMTYPES 5
+
+typedef struct BME_DeformWeight {
+ int def_nr;
+ float weight;
+} BME_DeformWeight;
+
+typedef struct BME_DeformVert {
+ struct BME_DeformWeight *dw;
+ int totweight;
+} BME_DeformVert;
+
+typedef struct BME_facetex{
+ struct Image *tpage;
+ char flag, transp;
+ short mode, tile, unwrap;
+}BME_facetex;
+
+typedef struct BME_looptex{
+ float u, v;
+}BME_looptex;
+
+typedef struct BME_loopcol{
+ char r, g, b, a;
+}BME_loopcol;
+
+/*Notes on further structure Cleanup:
+ -Remove the tflags, they belong in custom data layers
+ -Remove the eflags completely, they are mostly not used
+ -Remove the selection/vis/bevel weight flag/values ect and move them to custom data
+ -Remove EID member and move to custom data
+ -Add a radial cycle length, disk cycle length and loop cycle lenght attributes to custom data and have eulers maintain/use them if present.
+ -Move data such as vertex coordinates/normals to custom data and leave pointers in structures to active layer data.
+ -Remove BME_CycleNode structure?
+*/
typedef struct BME_CycleNode{
struct BME_CycleNode *next, *prev;
void *data;
@@ -72,9 +133,9 @@ typedef struct BME_Mesh
struct BME_Loop **lpar;
struct BME_Poly **plar;
int vtarlen, edarlen, lparlen, plarlen;
- int totvert, totedge, totpoly, totloop; /*record keeping*/
- int nextv, nexte, nextp, nextl; /*Next element ID for verts/edges/faces/loops. Never reused*/
- //struct CustomData vdata, edata, pdata, ldata; /*Custom Data Layer information*/
+ int totvert, totedge, totpoly, totloop; /*record keeping*/
+ int nextv, nexte, nextp, nextl; /*Next element ID for verts/edges/faces/loops. Never reused*/
+ struct BME_CustomData vdata, edata, pdata, ldata; /*Custom Data Layer information*/
} BME_Mesh;
typedef struct BME_Vert
diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c
index 307047463cf..e12ba2f8c65 100644
--- a/source/blender/blenkernel/intern/BME_mesh.c
+++ b/source/blender/blenkernel/intern/BME_mesh.c
@@ -62,8 +62,7 @@
* Allocates a new BME_Mesh structure
*/
-
-
+//BME_Mesh *BME_make_mesh(int valloc, int ealloc, int lalloc, int palloc, int vdata[BME_CD_NUMTYPES], int edata[BME_CD_NUMTYPES], int ldata[BME_CD_NUMTYPES], int pdata[BME_CD_NUMTYPES])
BME_Mesh *BME_make_mesh(int valloc, int ealloc, int lalloc, int palloc){
/*allocate the structure*/
BME_Mesh *bm = MEM_callocN(sizeof(BME_Mesh),"BMesh");
@@ -72,11 +71,17 @@ BME_Mesh *BME_make_mesh(int valloc, int ealloc, int lalloc, int palloc){
bm->epool = BME_mempool_create(sizeof(BME_Edge), ealloc, ealloc);
bm->ppool = BME_mempool_create(sizeof(BME_Poly), palloc, palloc);
bm->lpool = BME_mempool_create(sizeof(BME_Loop), lalloc, lalloc);
- /*allocate the customdata pools*/
- return bm;
-}
+ /*Setup Custom data structs and layers*/
+ /*
+ BME_CD_Create(bm, &bm->vdata, vdata);
+ BME_CD_Create(bm, &bm->edata, edata);
+ BME_CD_Create(bm, &bm->ldata, ldata);
+ BME_CD_Create(bm, &bm->pdata, pdata);
+ */
+ return bm;
+}
/*
* BME FREE MESH
*
@@ -90,8 +95,12 @@ void BME_free_mesh(BME_Mesh *bm)
BME_mempool_destroy(bm->epool);
BME_mempool_destroy(bm->ppool);
BME_mempool_destroy(bm->lpool);
- /*destroy custom data pools*/
-
+ /*
+ BME_CD_Free(bm, &bm->vdata);
+ BME_CD_Free(bm, &bm->edata);
+ BME_CD_Free(bm, &bm->ldata);
+ BME_CD_Free(bm, &bm->pdata);
+ */
MEM_freeN(bm);
}
@@ -156,6 +165,13 @@ void BME_model_end(BME_Mesh *bm){
}
}
+/*note, this needs to be turned on for debugging only.
+ We need two levels of debugging,
+ 1: Mesh level
+ 2: Euler level
+ Both need to be turned off in production builds (they really slow things down)
+*/
+
/*
* BME VALIDATE MESH
*
diff --git a/source/blender/blenkernel/intern/bmesh_private.h b/source/blender/blenkernel/intern/bmesh_private.h
index ed58421ffb7..4aa2a85b8b1 100644
--- a/source/blender/blenkernel/intern/bmesh_private.h
+++ b/source/blender/blenkernel/intern/bmesh_private.h
@@ -39,10 +39,6 @@
#include "BKE_bmesh.h"
-/*MEMORY MANAGMENT*/
-struct BME_mempool;
-typedef struct BME_mempool BME_mempool;
-
struct BME_mempool *BME_mempool_create(int esize, int tote, int pchunk);
void BME_mempool_destroy(struct BME_mempool *pool);
void *BME_mempool_alloc(struct BME_mempool *pool);