2013-07-02 09:47:22 +00:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL 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.
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2011-10-10 09:38:02 +00:00
|
|
|
|
2013-09-19 23:17:52 +00:00
|
|
|
#ifndef __CCGSUBSURF_H__
|
|
|
|
#define __CCGSUBSURF_H__
|
|
|
|
|
2011-02-27 20:40:57 +00:00
|
|
|
/** \file blender/blenkernel/intern/CCGSubSurf.h
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
typedef void* CCGMeshHDL;
|
|
|
|
typedef void* CCGVertHDL;
|
|
|
|
typedef void* CCGEdgeHDL;
|
|
|
|
typedef void* CCGFaceHDL;
|
|
|
|
|
2012-02-26 06:50:54 +00:00
|
|
|
typedef struct CCGSubSurf CCGSubSurf;
|
|
|
|
typedef struct CCGVert CCGVert;
|
|
|
|
typedef struct CCGEdge CCGEdge;
|
|
|
|
typedef struct CCGFace CCGFace;
|
- 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
|
|
|
|
2012-02-26 06:50:54 +00:00
|
|
|
typedef struct CCGMeshIFC {
|
2005-03-21 01:34:27 +00:00
|
|
|
int vertUserSize, edgeUserSize, faceUserSize;
|
2012-05-10 20:32:41 +00:00
|
|
|
int numLayers;
|
2005-03-21 01:34:27 +00:00
|
|
|
int vertDataSize;
|
2012-08-18 19:54:21 +00:00
|
|
|
int simpleSubdiv;
|
2012-02-26 06:50:54 +00:00
|
|
|
} CCGMeshIFC;
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
/***/
|
|
|
|
|
|
|
|
typedef void* CCGAllocatorHDL;
|
|
|
|
|
2012-02-26 06:50:54 +00:00
|
|
|
typedef struct CCGAllocatorIFC {
|
2005-03-21 01:34:27 +00:00
|
|
|
void* (*alloc) (CCGAllocatorHDL a, int numBytes);
|
|
|
|
void* (*realloc) (CCGAllocatorHDL a, void *ptr, int newSize, int oldSize);
|
|
|
|
void (*free) (CCGAllocatorHDL a, void *ptr);
|
|
|
|
void (*release) (CCGAllocatorHDL a);
|
2012-02-26 06:50:54 +00:00
|
|
|
} CCGAllocatorIFC;
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2014-12-10 11:06:00 +01:00
|
|
|
/* private, so we can allocate on the stack */
|
|
|
|
typedef struct _EHashIterator {
|
|
|
|
struct _EHash *eh;
|
|
|
|
int curBucket;
|
|
|
|
struct _EHEntry *curEntry;
|
|
|
|
} EHashIterator;
|
|
|
|
|
2005-03-21 01:34:27 +00:00
|
|
|
/***/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
eCCGError_None = 0,
|
|
|
|
|
|
|
|
eCCGError_InvalidSyncState,
|
|
|
|
eCCGError_InvalidValue,
|
|
|
|
} CCGError;
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
2010-06-22 15:09:41 +00:00
|
|
|
#define CCG_OMP_LIMIT 1000000
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
CCGSubSurf* ccgSubSurf_new (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator);
|
2005-03-21 01:34:27 +00:00
|
|
|
void ccgSubSurf_free (CCGSubSurf *ss);
|
|
|
|
|
|
|
|
CCGError ccgSubSurf_initFullSync (CCGSubSurf *ss);
|
|
|
|
CCGError ccgSubSurf_initPartialSync (CCGSubSurf *ss);
|
2015-07-20 16:08:06 +02:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
|
|
CCGError ccgSubSurf_initOpenSubdivSync (CCGSubSurf *ss);
|
|
|
|
#endif
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2011-12-17 03:46:38 +00:00
|
|
|
CCGError ccgSubSurf_syncVert (CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertData, int seam, CCGVert **v_r);
|
- 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
|
|
|
CCGError ccgSubSurf_syncEdge (CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r);
|
|
|
|
CCGError ccgSubSurf_syncFace (CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
CCGError ccgSubSurf_syncVertDel (CCGSubSurf *ss, CCGVertHDL vHDL);
|
|
|
|
CCGError ccgSubSurf_syncEdgeDel (CCGSubSurf *ss, CCGEdgeHDL eHDL);
|
|
|
|
CCGError ccgSubSurf_syncFaceDel (CCGSubSurf *ss, CCGFaceHDL fHDL);
|
|
|
|
|
|
|
|
CCGError ccgSubSurf_processSync (CCGSubSurf *ss);
|
|
|
|
|
2009-11-25 12:27:21 +00:00
|
|
|
CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
|
2009-12-11 10:56:20 +00:00
|
|
|
CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
|
2009-11-25 12:27:21 +00:00
|
|
|
CCGError ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **faces, int numFaces);
|
|
|
|
CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
|
|
|
|
CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **faces, int numFaces);
|
|
|
|
|
2005-03-21 01:34:27 +00:00
|
|
|
CCGError ccgSubSurf_setSubdivisionLevels (CCGSubSurf *ss, int subdivisionLevels);
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
|
2005-08-20 09:16:09 +00:00
|
|
|
CCGError ccgSubSurf_setAllowEdgeCreation (CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData);
|
|
|
|
void ccgSubSurf_getAllowEdgeCreation (CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r);
|
- 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
|
|
|
|
- shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
- added modifier_{new,free] utility function
- added ccgSubSurf_getUseAgeCounts to query info
- removed subsurf modifier faking (ME_SUBSURF flag is no
longer valid). subsurf modifier gets converted on file load
although there is obscure linked mesh situation where this
can go wrong, will fix shortly. this also means that some
places in the code that test/copy subsurf settings are broken
for the time being.
- shuffled modifier calculation to be simpler. note that
all modifiers are currently disabled in editmode (including
subsurf). don't worry, will return shortly.
- bug fix, build modifier didn't randomize meshes with only verts
- cleaned up subsurf_ccg and adapted for future editmode modifier
work
- added editmesh.derived{Cage,Final}, not used yet
- added SubsurfModifierData.{mCache,emCache}, will be used to cache
subsurf instead of caching in derivedmesh itself
- removed old subsurf buttons
- added do_modifiers_buttons to handle modifier events
- removed count_object counting of modifier (subsurfed) objects...
this would be nice to add back at some point but requires care.
probably requires rewrite of counting system.
New feature: Incremental Subsurf in Object Mode
The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.
However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.
I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
|
|
|
void ccgSubSurf_getUseAgeCounts (CCGSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r);
|
2005-03-21 01:34:27 +00:00
|
|
|
CCGError ccgSubSurf_setUseAgeCounts (CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset);
|
- 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
|
|
|
|
2005-04-03 21:52:10 +00:00
|
|
|
CCGError ccgSubSurf_setCalcVertexNormals (CCGSubSurf *ss, int useVertNormals, int normalDataOffset);
|
Add mask support to CCGSubSurf and multires.
* Add new CCG function ccgSubSurf_setAllocMask(). Similar to to
ccgSubSurf_setCalcVertexNormals(), it sets whether the CCG elements
have a mask layer and what that layer's offset is. Unlike normals
however, it doesn't change any behavior during CCG calculation; it's
there only to give CCGKey information on the mask.
* Add a new flag to _getSubSurf(), CCG_ALLOC_MASK. If set, space for
an extra layer is allocated, but the number of CCG layers is not set
to include it. This is done because GridPaintMasks are absolute,
rather than being relative to the subdivided output (as MDisp
displacements are), so we skip subdividing paint masks here.
* Add a new flag to subsurf_make_derived_from_derived(),
SUBSURF_ALLOC_PAINT_MASK. This controls whether CCG_ALLOC_MASK is
set for _getSubSurf(). Related, masks are never loaded in during
ss_sync_from_derivedmesh(). After subdivision is finished, if the
alloc mask flag is set, the number of CCG layers is increase to 4
with ccgSubSurf_setNumLayers().
* Add a new flag to multires_make_from_derived(),
MULTIRES_ALLOC_PAINT_MASK. Not all multires functions need paint
mask data (e.g. multiresModifier_base_apply.) This flag is always
set in MOD_multires.c so that subdividing a mesh with a mask updates
properly even when not in sculpt mode.
* Update multiresModifier_disp_run() to apply, calculate, and add mask
elements. It's almost the same as the existing operations with xyz
coordinates, but treats masks as absolute rather than displacements
relative to subdivided values.
* Update multires_customdata_delete to free CD_GRID_PAINT_MASK in
addition to CD_MDISPS.
* Update multires_del_higher() to call the new function
multires_grid_paint_mask_downsample(), which allocates a
lower-resolution paint mask grid and copies values over from the
high-resolution grid.
2012-05-10 20:34:08 +00:00
|
|
|
void ccgSubSurf_setAllocMask (CCGSubSurf *ss, int allocMask, int maskOffset);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2012-05-10 20:32:41 +00:00
|
|
|
void ccgSubSurf_setNumLayers (CCGSubSurf *ss, int numLayers);
|
|
|
|
|
2005-03-21 01:34:27 +00:00
|
|
|
/***/
|
|
|
|
|
2011-12-17 03:46:38 +00:00
|
|
|
int ccgSubSurf_getNumVerts (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getNumEdges (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getNumFaces (const CCGSubSurf *ss);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2011-12-17 03:46:38 +00:00
|
|
|
int ccgSubSurf_getSubdivisionLevels (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getEdgeSize (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getEdgeLevelSize (const CCGSubSurf *ss, int level);
|
|
|
|
int ccgSubSurf_getGridSize (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getGridLevelSize (const CCGSubSurf *ss, int level);
|
2012-08-18 19:54:21 +00:00
|
|
|
int ccgSubSurf_getSimpleSubdiv (const CCGSubSurf *ss);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2005-03-22 06:11:25 +00:00
|
|
|
CCGVert* ccgSubSurf_getVert (CCGSubSurf *ss, CCGVertHDL v);
|
2008-09-29 17:08:11 +00:00
|
|
|
CCGVertHDL ccgSubSurf_getVertVertHandle (CCGVert *v);
|
|
|
|
int ccgSubSurf_getVertNumFaces (CCGVert *v);
|
|
|
|
CCGFace* ccgSubSurf_getVertFace (CCGVert *v, int index);
|
|
|
|
int ccgSubSurf_getVertNumEdges (CCGVert *v);
|
|
|
|
CCGEdge* ccgSubSurf_getVertEdge (CCGVert *v, int index);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
int ccgSubSurf_getVertAge (CCGSubSurf *ss, CCGVert *v);
|
|
|
|
void* ccgSubSurf_getVertUserData (CCGSubSurf *ss, CCGVert *v);
|
|
|
|
void* ccgSubSurf_getVertData (CCGSubSurf *ss, CCGVert *v);
|
|
|
|
void* ccgSubSurf_getVertLevelData (CCGSubSurf *ss, CCGVert *v, int level);
|
|
|
|
|
2005-03-22 06:11:25 +00:00
|
|
|
CCGEdge* ccgSubSurf_getEdge (CCGSubSurf *ss, CCGEdgeHDL e);
|
2008-09-29 17:08:11 +00:00
|
|
|
CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle (CCGEdge *e);
|
|
|
|
int ccgSubSurf_getEdgeNumFaces (CCGEdge *e);
|
|
|
|
CCGFace* ccgSubSurf_getEdgeFace (CCGEdge *e, int index);
|
|
|
|
CCGVert* ccgSubSurf_getEdgeVert0 (CCGEdge *e);
|
|
|
|
CCGVert* ccgSubSurf_getEdgeVert1 (CCGEdge *e);
|
|
|
|
float ccgSubSurf_getEdgeCrease (CCGEdge *e);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
int ccgSubSurf_getEdgeAge (CCGSubSurf *ss, CCGEdge *e);
|
|
|
|
void* ccgSubSurf_getEdgeUserData (CCGSubSurf *ss, CCGEdge *e);
|
|
|
|
void* ccgSubSurf_getEdgeDataArray (CCGSubSurf *ss, CCGEdge *e);
|
|
|
|
void* ccgSubSurf_getEdgeData (CCGSubSurf *ss, CCGEdge *e, int x);
|
|
|
|
void* ccgSubSurf_getEdgeLevelData (CCGSubSurf *ss, CCGEdge *e, int x, int level);
|
|
|
|
|
2005-03-22 06:11:25 +00:00
|
|
|
CCGFace* ccgSubSurf_getFace (CCGSubSurf *ss, CCGFaceHDL f);
|
2012-03-06 01:01:42 +00:00
|
|
|
CCGFaceHDL ccgSubSurf_getFaceFaceHandle (CCGFace *f);
|
2008-09-29 17:08:11 +00:00
|
|
|
int ccgSubSurf_getFaceNumVerts (CCGFace *f);
|
2012-03-06 01:01:42 +00:00
|
|
|
CCGVert* ccgSubSurf_getFaceVert (CCGFace *f, int index);
|
|
|
|
CCGEdge* ccgSubSurf_getFaceEdge (CCGFace *f, int index);
|
2008-09-29 17:08:11 +00:00
|
|
|
int ccgSubSurf_getFaceEdgeIndex (CCGFace *f, CCGEdge *e);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
int ccgSubSurf_getFaceAge (CCGSubSurf *ss, CCGFace *f);
|
|
|
|
void* ccgSubSurf_getFaceUserData (CCGSubSurf *ss, CCGFace *f);
|
2008-09-29 17:08:11 +00:00
|
|
|
void* ccgSubSurf_getFaceCenterData (CCGFace *f);
|
2005-03-21 01:34:27 +00:00
|
|
|
void* ccgSubSurf_getFaceGridEdgeDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex);
|
|
|
|
void* ccgSubSurf_getFaceGridEdgeData (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x);
|
|
|
|
void* ccgSubSurf_getFaceGridDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex);
|
|
|
|
void* ccgSubSurf_getFaceGridData (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y);
|
|
|
|
|
2011-12-17 03:46:38 +00:00
|
|
|
int ccgSubSurf_getNumFinalVerts (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getNumFinalEdges (const CCGSubSurf *ss);
|
|
|
|
int ccgSubSurf_getNumFinalFaces (const CCGSubSurf *ss);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
/***/
|
|
|
|
|
2014-12-10 11:06:00 +01:00
|
|
|
typedef struct _EHashIterator CCGVertIterator;
|
|
|
|
typedef struct _EHashIterator CCGEdgeIterator;
|
|
|
|
typedef struct _EHashIterator CCGFaceIterator;
|
2005-03-21 01:34:27 +00:00
|
|
|
|
2014-12-10 11:06:00 +01:00
|
|
|
void ccgSubSurf_initVertIterator(CCGSubSurf *ss, CCGVertIterator *viter);
|
|
|
|
void ccgSubSurf_initEdgeIterator(CCGSubSurf *ss, CCGEdgeIterator *eiter);
|
|
|
|
void ccgSubSurf_initFaceIterator(CCGSubSurf *ss, CCGFaceIterator *fiter);
|
2005-03-21 01:34:27 +00:00
|
|
|
|
|
|
|
CCGVert* ccgVertIterator_getCurrent (CCGVertIterator *vi);
|
|
|
|
int ccgVertIterator_isStopped (CCGVertIterator *vi);
|
|
|
|
void ccgVertIterator_next (CCGVertIterator *vi);
|
|
|
|
|
|
|
|
CCGEdge* ccgEdgeIterator_getCurrent (CCGEdgeIterator *ei);
|
|
|
|
int ccgEdgeIterator_isStopped (CCGEdgeIterator *ei);
|
|
|
|
void ccgEdgeIterator_next (CCGEdgeIterator *ei);
|
|
|
|
|
|
|
|
CCGFace* ccgFaceIterator_getCurrent (CCGFaceIterator *fi);
|
|
|
|
int ccgFaceIterator_isStopped (CCGFaceIterator *fi);
|
|
|
|
void ccgFaceIterator_next (CCGFaceIterator *fi);
|
2013-09-19 23:17:52 +00:00
|
|
|
|
2015-07-20 16:08:06 +02:00
|
|
|
#ifdef WITH_OPENSUBDIV
|
|
|
|
struct DerivedMesh;
|
|
|
|
|
|
|
|
/* Check if topology changed and evaluators are to be re-created. */
|
|
|
|
void ccgSubSurf_checkTopologyChanged(CCGSubSurf *ss, struct DerivedMesh *dm);
|
|
|
|
|
|
|
|
/* Create topology refiner from give derived mesh which then later will be
|
|
|
|
* used for GL mesh creation.
|
|
|
|
*/
|
|
|
|
void ccgSubSurf_prepareTopologyRefiner(CCGSubSurf *ss, struct DerivedMesh *dm);
|
|
|
|
|
|
|
|
/* Make sure GL mesh exists, up to date and ready to draw. */
|
2016-07-22 14:46:13 +02:00
|
|
|
bool ccgSubSurf_prepareGLMesh(CCGSubSurf *ss, bool use_osd_glsl, int active_uv_index);
|
2015-07-20 16:08:06 +02:00
|
|
|
|
|
|
|
/* Draw given partitions of the GL mesh.
|
|
|
|
*
|
|
|
|
* TODO(sergey): fill_quads is actually an invariant and should be part
|
|
|
|
* of the prepare routine.
|
|
|
|
*/
|
|
|
|
void ccgSubSurf_drawGLMesh(CCGSubSurf *ss, bool fill_quads,
|
|
|
|
int start_partition, int num_partitions);
|
|
|
|
|
2015-08-25 15:05:28 +02:00
|
|
|
/* Get number of base faces in a particular GL mesh. */
|
|
|
|
int ccgSubSurf_getNumGLMeshBaseFaces(CCGSubSurf *ss);
|
|
|
|
|
|
|
|
/* Get number of vertices in base faces in a particular GL mesh. */
|
|
|
|
int ccgSubSurf_getNumGLMeshBaseFaceVerts(CCGSubSurf *ss, int face);
|
|
|
|
|
2015-07-20 16:08:06 +02:00
|
|
|
/* Controls whether CCG are needed (Cmeaning CPU evaluation) or fully GPU compute
|
|
|
|
* and draw is allowed.
|
|
|
|
*/
|
|
|
|
void ccgSubSurf_setSkipGrids(CCGSubSurf *ss, bool skip_grids);
|
|
|
|
bool ccgSubSurf_needGrids(CCGSubSurf *ss);
|
|
|
|
|
|
|
|
/* Set evaluator's face varying data from UV coordinates.
|
|
|
|
* Used for CPU evaluation.
|
|
|
|
*/
|
|
|
|
void ccgSubSurf_evaluatorSetFVarUV(CCGSubSurf *ss,
|
|
|
|
struct DerivedMesh *dm,
|
|
|
|
int layer_index);
|
|
|
|
|
|
|
|
/* TODO(sergey): Temporary call to test things. */
|
|
|
|
void ccgSubSurf_evaluatorFVarUV(CCGSubSurf *ss,
|
|
|
|
int face_index, int S,
|
|
|
|
float grid_u, float grid_v,
|
|
|
|
float uv[2]);
|
|
|
|
|
2015-08-05 14:15:46 +02:00
|
|
|
void ccgSubSurf_free_osd_mesh(CCGSubSurf *ss);
|
|
|
|
|
2015-08-05 14:43:51 +02:00
|
|
|
void ccgSubSurf_getMinMax(CCGSubSurf *ss, float r_min[3], float r_max[3]);
|
|
|
|
|
2016-07-22 17:52:30 +02:00
|
|
|
void ccgSubSurf__sync_subdivUvs(CCGSubSurf *ss, bool subsurf_uvs);
|
|
|
|
|
2015-07-20 16:08:06 +02:00
|
|
|
#endif
|
|
|
|
|
2013-09-19 23:17:52 +00:00
|
|
|
#endif /* __CCGSUBSURF_H__ */
|