2005-03-27 20:34:18 +00:00
|
|
|
/**
|
2005-03-28 08:17:51 +00:00
|
|
|
* $Id$
|
2005-03-27 20:34:18 +00:00
|
|
|
*
|
|
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version. The Blender
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
|
|
* about this.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BKE_DERIVEDMESH_H
|
|
|
|
#define BKE_DERIVEDMESH_H
|
|
|
|
|
2005-03-28 05:58:43 +00:00
|
|
|
/* TODO (Probably)
|
|
|
|
*
|
|
|
|
* o Make drawMapped* functions take a predicate function that
|
|
|
|
* determines whether to draw the edge (this predicate can
|
|
|
|
* also set color, etc). This will be slightly more general
|
|
|
|
* and allow some of the functions to be collapsed.
|
2005-03-28 08:17:51 +00:00
|
|
|
* o Once accessor functions are added then single element draw
|
|
|
|
* functions can be implemented using primitive accessors.
|
2005-03-28 21:53:26 +00:00
|
|
|
* o Add function to dispatch to renderer instead of using
|
|
|
|
* conversion to DLM.
|
2005-03-28 05:58:43 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-11 16:38:37 +00:00
|
|
|
#include "DNA_customdata_types.h"
|
2006-12-05 17:42:03 +00:00
|
|
|
#include "BKE_customdata.h"
|
2006-08-28 01:12:36 +00:00
|
|
|
|
2005-07-17 17:41:03 +00:00
|
|
|
struct MVert;
|
2006-08-28 01:12:36 +00:00
|
|
|
struct MEdge;
|
|
|
|
struct MFace;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
struct MTFace;
|
2005-03-27 20:34:18 +00:00
|
|
|
struct Object;
|
2006-08-28 01:12:36 +00:00
|
|
|
struct Mesh;
|
2005-03-29 16:43:39 +00:00
|
|
|
struct EditMesh;
|
2005-07-26 00:45:19 +00:00
|
|
|
struct ModifierData;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
struct MCol;
|
2005-03-27 20:34:18 +00:00
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* number of sub-elements each mesh element has (for interpolation) */
|
|
|
|
#define SUB_ELEMS_VERT 0
|
|
|
|
#define SUB_ELEMS_EDGE 2
|
|
|
|
#define SUB_ELEMS_FACE 4
|
|
|
|
|
2005-03-27 20:34:18 +00:00
|
|
|
typedef struct DerivedMesh DerivedMesh;
|
|
|
|
struct DerivedMesh {
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* Private DerivedMesh data, only for internal DerivedMesh use */
|
2006-08-28 01:12:36 +00:00
|
|
|
CustomData vertData, edgeData, faceData;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
int numVertData, numEdgeData, numFaceData;
|
|
|
|
int needsFree; /* checked on ->release, is set to 0 for cached results */
|
2006-08-28 01:12:36 +00:00
|
|
|
|
2005-03-27 21:27:12 +00:00
|
|
|
/* Misc. Queries */
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Also called in Editmode */
|
2005-03-27 21:27:12 +00:00
|
|
|
int (*getNumVerts)(DerivedMesh *dm);
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Also called in Editmode */
|
2005-03-27 21:27:12 +00:00
|
|
|
int (*getNumFaces)(DerivedMesh *dm);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
int (*getNumEdges)(DerivedMesh *dm);
|
|
|
|
|
|
|
|
/* copy a single vert/edge/face from the derived mesh into
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
* *{vert/edge/face}_r. note that the current implementation
|
|
|
|
* of this function can be quite slow, iterating over all
|
|
|
|
* elements (editmesh, verse mesh)
|
2006-08-28 01:12:36 +00:00
|
|
|
*/
|
|
|
|
void (*getVert)(DerivedMesh *dm, int index, struct MVert *vert_r);
|
|
|
|
void (*getEdge)(DerivedMesh *dm, int index, struct MEdge *edge_r);
|
|
|
|
void (*getFace)(DerivedMesh *dm, int index, struct MFace *face_r);
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* return a pointer to the entire array of verts/edges/face from the
|
|
|
|
* derived mesh. if such an array does not exist yet, it will be created,
|
|
|
|
* and freed on the next ->release(). consider using getVert/Edge/Face if
|
|
|
|
* you are only interested in a few verts/edges/faces.
|
|
|
|
*/
|
|
|
|
struct MVert *(*getVertArray)(DerivedMesh *dm);
|
|
|
|
struct MEdge *(*getEdgeArray)(DerivedMesh *dm);
|
|
|
|
struct MFace *(*getFaceArray)(DerivedMesh *dm);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* copy all verts/edges/faces from the derived mesh into
|
|
|
|
* *{vert/edge/face}_r (must point to a buffer large enough)
|
|
|
|
*/
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
void (*copyVertArray)(DerivedMesh *dm, struct MVert *vert_r);
|
|
|
|
void (*copyEdgeArray)(DerivedMesh *dm, struct MEdge *edge_r);
|
|
|
|
void (*copyFaceArray)(DerivedMesh *dm, struct MFace *face_r);
|
2006-08-28 01:12:36 +00:00
|
|
|
|
|
|
|
/* return a copy of all verts/edges/faces from the derived mesh
|
|
|
|
* it is the caller's responsibility to free the returned pointer
|
|
|
|
*/
|
|
|
|
struct MVert *(*dupVertArray)(DerivedMesh *dm);
|
|
|
|
struct MEdge *(*dupEdgeArray)(DerivedMesh *dm);
|
|
|
|
struct MFace *(*dupFaceArray)(DerivedMesh *dm);
|
|
|
|
|
|
|
|
/* return a pointer to a single element of vert/edge/face custom data
|
|
|
|
* from the derived mesh (this gives a pointer to the actual data, not
|
|
|
|
* a copy)
|
|
|
|
*/
|
|
|
|
void *(*getVertData)(DerivedMesh *dm, int index, int type);
|
|
|
|
void *(*getEdgeData)(DerivedMesh *dm, int index, int type);
|
|
|
|
void *(*getFaceData)(DerivedMesh *dm, int index, int type);
|
|
|
|
|
|
|
|
/* return a pointer to the entire array of vert/edge/face custom data
|
|
|
|
* from the derived mesh (this gives a pointer to the actual data, not
|
|
|
|
* a copy)
|
|
|
|
*/
|
|
|
|
void *(*getVertDataArray)(DerivedMesh *dm, int type);
|
|
|
|
void *(*getEdgeDataArray)(DerivedMesh *dm, int type);
|
|
|
|
void *(*getFaceDataArray)(DerivedMesh *dm, int type);
|
|
|
|
|
|
|
|
/* Iterate over each mapped vertex in the derived mesh, calling the
|
|
|
|
* given function with the original vert and the mapped vert's new
|
|
|
|
* coordinate and normal. For historical reasons the normal can be
|
|
|
|
* passed as a float or short array, only one should be non-NULL.
|
|
|
|
*/
|
|
|
|
void (*foreachMappedVert)(
|
|
|
|
DerivedMesh *dm,
|
|
|
|
void (*func)(void *userData, int index, float *co,
|
|
|
|
float *no_f, short *no_s),
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
/* Iterate over each mapped edge in the derived mesh, calling the
|
|
|
|
* given function with the original edge and the mapped edge's new
|
|
|
|
* coordinates.
|
|
|
|
*/
|
|
|
|
void (*foreachMappedEdge)(DerivedMesh *dm,
|
|
|
|
void (*func)(void *userData, int index,
|
|
|
|
float *v0co, float *v1co),
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
/* Iterate over each mapped face in the derived mesh, calling the
|
|
|
|
* given function with the original face and the mapped face's (or
|
|
|
|
* faces') center and normal.
|
|
|
|
*/
|
|
|
|
void (*foreachMappedFaceCenter)(DerivedMesh *dm,
|
|
|
|
void (*func)(void *userData, int index,
|
|
|
|
float *cent, float *no),
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
/* Iterate over all vertex points, calling DO_MINMAX with given args.
|
|
|
|
*
|
|
|
|
* Also called in Editmode
|
|
|
|
*/
|
2005-07-17 04:17:33 +00:00
|
|
|
void (*getMinMax)(DerivedMesh *dm, float min_r[3], float max_r[3]);
|
2005-07-17 01:18:59 +00:00
|
|
|
|
|
|
|
/* Direct Access Operations */
|
|
|
|
/* o Can be undefined */
|
|
|
|
/* o Must be defined for modifiers that only deform however */
|
2006-08-28 01:12:36 +00:00
|
|
|
|
|
|
|
/* Get vertex location, undefined if index is not valid */
|
2005-07-17 01:18:59 +00:00
|
|
|
void (*getVertCo)(DerivedMesh *dm, int index, float co_r[3]);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Fill the array (of length .getNumVerts()) with all vertex locations */
|
2005-07-18 19:58:23 +00:00
|
|
|
void (*getVertCos)(DerivedMesh *dm, float (*cos_r)[3]);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Get vertex normal, undefined if index is not valid */
|
2005-07-17 01:18:59 +00:00
|
|
|
void (*getVertNo)(DerivedMesh *dm, int index, float no_r[3]);
|
|
|
|
|
2005-03-27 20:34:18 +00:00
|
|
|
/* Drawing Operations */
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Draw all vertices as bgl points (no options) */
|
2005-03-27 20:34:18 +00:00
|
|
|
void (*drawVerts)(DerivedMesh *dm);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Draw edges in the UV mesh (if exists) */
|
2005-08-18 11:31:20 +00:00
|
|
|
void (*drawUVEdges)(DerivedMesh *dm);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Draw all edges as lines (no options)
|
|
|
|
*
|
|
|
|
* Also called for *final* editmode DerivedMeshes
|
|
|
|
*/
|
2005-08-14 10:35:58 +00:00
|
|
|
void (*drawEdges)(DerivedMesh *dm, int drawLooseEdges);
|
2005-08-18 11:31:20 +00:00
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Draw all loose edges (edges w/ no adjoining faces) */
|
2005-08-21 20:48:45 +00:00
|
|
|
void (*drawLooseEdges)(DerivedMesh *dm);
|
2005-08-18 11:31:20 +00:00
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* 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
|
|
|
|
*/
|
2005-07-13 20:16:35 +00:00
|
|
|
void (*drawFacesSolid)(DerivedMesh *dm, int (*setMaterial)(int));
|
2005-03-27 20:34:18 +00:00
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* Draw all faces
|
|
|
|
* o If useTwoSided, draw front and back using col arrays
|
|
|
|
* o col1,col2 are arrays of length numFace*4 of 4 component colors
|
|
|
|
* in ABGR format, and should be passed as per-face vertex color.
|
|
|
|
*/
|
|
|
|
void (*drawFacesColored)(DerivedMesh *dm, int useTwoSided,
|
|
|
|
unsigned char *col1, unsigned char *col2);
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* Draw all faces using MTFace
|
2006-08-28 01:12:36 +00:00
|
|
|
* o Drawing options too complicated to enumerate, look at code.
|
|
|
|
*/
|
|
|
|
void (*drawFacesTex)(DerivedMesh *dm,
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
int (*setDrawOptions)(struct MTFace *tface,
|
|
|
|
struct MCol *mcol, int matnr));
|
2006-08-28 01:12:36 +00:00
|
|
|
|
|
|
|
/* Draw mapped faces (no color, or texture)
|
|
|
|
* o Only if !setDrawOptions or
|
|
|
|
* setDrawOptions(userData, mapped-face-index, drawSmooth_r)
|
|
|
|
* 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,
|
|
|
|
int (*setDrawOptions)(void *userData, int index,
|
|
|
|
int *drawSmooth_r),
|
|
|
|
void *userData, int useColors);
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* Draw mapped faces using MTFace
|
2006-08-28 01:12:36 +00:00
|
|
|
* o Drawing options too complicated to enumerate, look at code.
|
|
|
|
*/
|
|
|
|
void (*drawMappedFacesTex)(DerivedMesh *dm,
|
|
|
|
int (*setDrawOptions)(void *userData,
|
|
|
|
int index),
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
/* Draw mapped edges as lines
|
|
|
|
* o Only if !setDrawOptions or setDrawOptions(userData, mapped-edge)
|
|
|
|
* returns true
|
|
|
|
*/
|
|
|
|
void (*drawMappedEdges)(DerivedMesh *dm,
|
|
|
|
int (*setDrawOptions)(void *userData, int index),
|
|
|
|
void *userData);
|
|
|
|
|
|
|
|
/* Draw mapped edges as lines with interpolation values
|
|
|
|
* o Only if !setDrawOptions or
|
|
|
|
* setDrawOptions(userData, mapped-edge, mapped-v0, mapped-v1, t)
|
|
|
|
* returns true
|
|
|
|
*
|
|
|
|
* NOTE: This routine is optional!
|
|
|
|
*/
|
- convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
- dropped convertToDispListMeshMapped (whew, glad of it too)
- added DerivedMesh drawMappedFaces function
- dropped EM suffix for DerivedMesh functions, it was neither
particularly correct nor descriptive
- converted test_index_mface to test_index_face that also corrects
MCol and TFace. Good thing we had three versions of this routine,
you never know when one might burn down.
- removed flipnorm_mesh, not used anymore (and was incorrect to
boot)
- Getting face select to work with modifiers turned out to be much
more complicated than expected. Reworked mapping architecture for
modifiers - basically elements in a DispListMesh are now required
to be stored in an order that corresponds exactly to original
ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
that is set on each element that is set on the first derived element
of each original element. I can't say the code to follow these
requirements for subsurf is particularly transparent, but on the
upside it is a reasonably consistent and simple system that is memory
efficient and allows keeping the DispListMesh structure.
- rewrote mirror modifier to be simpler/conform to new requirements
for mapped DispListMesh structure. This also means that mirror interacts
much better with incremental subsurf calculation (it used to recalc
one entire side on any topology change, now it generally avoids that).
- added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
functions to handle mapping indices back into appropriate EditMesh
structures.
- bug fix, make edges didn't recalc object data
- bug fix, initial image assignment to TFace's didn't recalc object data
- new feature, added circle select support for FACESELECT
- bug fix, creating new faces in editmode duplicated the TFACE active
flag - but there should only be one active tface
- bug fix, possible crash when deleting all faces in faceselect mode
on mesh with tfaces...
Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
|
|
|
void (*drawMappedEdgesInterp)(DerivedMesh *dm,
|
2006-08-28 01:12:36 +00:00
|
|
|
int (*setDrawOptions)(void *userData,
|
|
|
|
int index),
|
|
|
|
void (*setDrawInterpOptions)(void *userData,
|
|
|
|
int index,
|
|
|
|
float t),
|
|
|
|
void *userData);
|
2005-03-28 06:46:21 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* Release reference to the DerivedMesh. This function decides internally
|
|
|
|
* if the DerivedMesh will be freed, or cached for later use. */
|
2005-03-27 20:34:18 +00:00
|
|
|
void (*release)(DerivedMesh *dm);
|
|
|
|
};
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* utility function to initialise a DerivedMesh's function pointers to
|
|
|
|
* the default implementation (for those functions which have a default)
|
|
|
|
*/
|
|
|
|
void DM_init_funcs(DerivedMesh *dm);
|
|
|
|
|
|
|
|
/* utility function to initialise a DerivedMesh for the desired number
|
|
|
|
* of vertices, edges and faces (doesn't allocate memory for them, just
|
|
|
|
* sets up the custom data layers)
|
|
|
|
*/
|
|
|
|
void DM_init(DerivedMesh *dm, int numVerts, int numEdges, int numFaces);
|
|
|
|
|
|
|
|
/* utility function to initialise a DerivedMesh for the desired number
|
|
|
|
* of vertices, edges and faces, with a layer setup copied from source
|
|
|
|
*/
|
|
|
|
void DM_from_template(DerivedMesh *dm, DerivedMesh *source,
|
|
|
|
int numVerts, int numEdges, int numFaces);
|
|
|
|
|
|
|
|
/* utility function to release a DerivedMesh's layers
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
* returns 1 if DerivedMesh has to be released by the backend, 0 otherwise
|
2006-08-28 01:12:36 +00:00
|
|
|
*/
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
int DM_release(DerivedMesh *dm);
|
2006-08-28 01:12:36 +00:00
|
|
|
|
|
|
|
/* utility function to convert a DerivedMesh to a Mesh
|
|
|
|
*/
|
|
|
|
void DM_to_mesh(DerivedMesh *dm, struct Mesh *me);
|
|
|
|
|
2006-12-05 17:42:03 +00:00
|
|
|
/* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
|
|
|
|
* zero for the layer type, so only layer types specified by the mask
|
|
|
|
* will be copied
|
|
|
|
*/
|
|
|
|
void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
|
|
|
|
|
2006-08-28 01:12:36 +00:00
|
|
|
/* adds a vertex/edge/face custom data layer to a DerivedMesh, optionally
|
|
|
|
* backed by an external data array
|
|
|
|
* if layer != NULL, it is used as the layer data array, otherwise new memory
|
|
|
|
* is allocated
|
|
|
|
* the layer data will be freed by dm->release unless
|
|
|
|
* (flag & LAYERFLAG_NOFREE) is true
|
|
|
|
*/
|
|
|
|
void DM_add_vert_layer(struct DerivedMesh *dm, int type, int flag,
|
|
|
|
void *layer);
|
|
|
|
void DM_add_edge_layer(struct DerivedMesh *dm, int type, int flag,
|
|
|
|
void *layer);
|
|
|
|
void DM_add_face_layer(struct DerivedMesh *dm, int type, int flag,
|
|
|
|
void *layer);
|
|
|
|
|
|
|
|
/* custom data access functions
|
|
|
|
* return pointer to data from first layer which matches type
|
|
|
|
* if they return NULL for valid indices, data doesn't exist
|
|
|
|
* note these return pointers - any change modifies the internals of the mesh
|
|
|
|
*/
|
|
|
|
void *DM_get_vert_data(struct DerivedMesh *dm, int index, int type);
|
|
|
|
void *DM_get_edge_data(struct DerivedMesh *dm, int index, int type);
|
|
|
|
void *DM_get_face_data(struct DerivedMesh *dm, int index, int type);
|
|
|
|
|
|
|
|
/* custom data layer access functions
|
|
|
|
* return pointer to first data layer which matches type (a flat array)
|
|
|
|
* if they return NULL, data doesn't exist
|
|
|
|
* note these return pointers - any change modifies the internals of the mesh
|
|
|
|
*/
|
|
|
|
void *DM_get_vert_data_layer(struct DerivedMesh *dm, int type);
|
|
|
|
void *DM_get_edge_data_layer(struct DerivedMesh *dm, int type);
|
|
|
|
void *DM_get_face_data_layer(struct DerivedMesh *dm, int type);
|
|
|
|
|
|
|
|
/* custom data setting functions
|
|
|
|
* copy supplied data into first layer of type using layer's copy function
|
|
|
|
* (deep copy if appropriate)
|
|
|
|
*/
|
|
|
|
void DM_set_vert_data(struct DerivedMesh *dm, int index, int type, void *data);
|
|
|
|
void DM_set_edge_data(struct DerivedMesh *dm, int index, int type, void *data);
|
|
|
|
void DM_set_face_data(struct DerivedMesh *dm, int index, int type, void *data);
|
|
|
|
|
|
|
|
/* custom data copy functions
|
|
|
|
* copy count elements from source_index in source to dest_index in dest
|
2006-12-05 17:42:03 +00:00
|
|
|
* these copy all layers for which the CD_FLAG_NOCOPY flag is not set
|
2006-08-28 01:12:36 +00:00
|
|
|
*/
|
|
|
|
void DM_copy_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int source_index, int dest_index, int count);
|
|
|
|
void DM_copy_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int source_index, int dest_index, int count);
|
|
|
|
void DM_copy_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int source_index, int dest_index, int count);
|
|
|
|
|
|
|
|
/* custom data free functions
|
|
|
|
* free count elements, starting at index
|
|
|
|
* they free all layers for which the LAYERFLAG_NOFREE flag is not set
|
|
|
|
*/
|
|
|
|
void DM_free_vert_data(struct DerivedMesh *dm, int index, int count);
|
|
|
|
void DM_free_edge_data(struct DerivedMesh *dm, int index, int count);
|
|
|
|
void DM_free_face_data(struct DerivedMesh *dm, int index, int count);
|
|
|
|
|
|
|
|
/* interpolates vertex data from the vertices indexed by src_indices in the
|
|
|
|
* source mesh using the given weights and stores the result in the vertex
|
|
|
|
* indexed by dest_index in the dest mesh
|
|
|
|
*/
|
|
|
|
void DM_interp_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int *src_indices, float *weights,
|
|
|
|
int count, int dest_index);
|
|
|
|
|
|
|
|
/* interpolates edge data from the edges indexed by src_indices in the
|
|
|
|
* source mesh using the given weights and stores the result in the edge indexed
|
|
|
|
* by dest_index in the dest mesh.
|
|
|
|
* if weights is NULL, all weights default to 1.
|
|
|
|
* if vert_weights is non-NULL, any per-vertex edge data is interpolated using
|
|
|
|
* vert_weights[i] multiplied by weights[i].
|
|
|
|
*/
|
|
|
|
typedef float EdgeVertWeight[SUB_ELEMS_EDGE][SUB_ELEMS_EDGE];
|
|
|
|
void DM_interp_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int *src_indices,
|
|
|
|
float *weights, EdgeVertWeight *vert_weights,
|
|
|
|
int count, int dest_index);
|
|
|
|
|
|
|
|
/* interpolates face data from the faces indexed by src_indices in the
|
|
|
|
* source mesh using the given weights and stores the result in the face indexed
|
|
|
|
* by dest_index in the dest mesh.
|
|
|
|
* if weights is NULL, all weights default to 1.
|
|
|
|
* if vert_weights is non-NULL, any per-vertex face data is interpolated using
|
|
|
|
* vert_weights[i] multiplied by weights[i].
|
|
|
|
*/
|
|
|
|
typedef float FaceVertWeight[SUB_ELEMS_FACE][SUB_ELEMS_FACE];
|
|
|
|
void DM_interp_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
|
|
|
|
int *src_indices,
|
|
|
|
float *weights, FaceVertWeight *vert_weights,
|
|
|
|
int count, int dest_index);
|
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
void DM_swap_face_data(struct DerivedMesh *dm, int index, int *corner_indices);
|
2005-11-12 10:35:14 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* Simple function to get me->totvert amount of vertices/normals,
|
|
|
|
correctly deformed and subsurfered. Needed especially when vertexgroups are involved.
|
|
|
|
In use now by vertex/weigt paint and particles */
|
|
|
|
float *mesh_get_mapped_verts_nors(struct Object *ob);
|
2005-03-29 16:43:39 +00:00
|
|
|
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
|
|
|
/* */
|
2006-12-05 17:42:03 +00:00
|
|
|
DerivedMesh *mesh_get_derived_final(struct Object *ob,
|
|
|
|
CustomDataMask dataMask);
|
|
|
|
DerivedMesh *mesh_get_derived_deform(struct Object *ob,
|
|
|
|
CustomDataMask dataMask);
|
2005-03-29 16:43:39 +00:00
|
|
|
|
2005-07-26 00:45:19 +00:00
|
|
|
DerivedMesh *mesh_create_derived_for_modifier(struct Object *ob, struct ModifierData *md);
|
|
|
|
|
2006-12-05 17:42:03 +00:00
|
|
|
DerivedMesh *mesh_create_derived_render(struct Object *ob,
|
|
|
|
CustomDataMask dataMask);
|
|
|
|
/* same as above but wont use render settings */
|
|
|
|
DerivedMesh *mesh_create_derived_view(struct Object *ob,
|
|
|
|
CustomDataMask dataMask);
|
|
|
|
DerivedMesh *mesh_create_derived_no_deform(struct Object *ob,
|
|
|
|
float (*vertCos)[3],
|
|
|
|
CustomDataMask dataMask);
|
|
|
|
DerivedMesh *mesh_create_derived_no_deform_render(struct Object *ob,
|
|
|
|
float (*vertCos)[3],
|
|
|
|
CustomDataMask dataMask);
|
2005-07-18 19:58:23 +00:00
|
|
|
|
2005-08-06 20:44:59 +00:00
|
|
|
DerivedMesh *editmesh_get_derived_base(void);
|
2006-12-05 17:42:03 +00:00
|
|
|
DerivedMesh *editmesh_get_derived_cage(CustomDataMask dataMask);
|
|
|
|
DerivedMesh *editmesh_get_derived_cage_and_final(DerivedMesh **final_r,
|
|
|
|
CustomDataMask dataMask);
|
2005-03-28 05:58:43 +00:00
|
|
|
|
2006-09-03 12:16:14 +00:00
|
|
|
void weight_to_rgb(float input, float *fr, float *fg, float *fb);
|
|
|
|
|
2006-12-05 17:42:03 +00:00
|
|
|
/* determines required DerivedMesh data according to view and edit modes */
|
|
|
|
CustomDataMask get_viewedit_datamask();
|
|
|
|
|
2005-03-27 20:34:18 +00:00
|
|
|
#endif
|
|
|
|
|