#include <ObjectWrapper.h>
Public Types |
|
enum | { empty = 0, triObject, polyObject, patchObject } |
The type of the underlying object, triObject for Mesh, polyObject for MNMesh, and patchObject for PatchMesh. More... |
|
enum | { noneEnable = 0, triEnable = 1, polyEnable = 2, patchEnable = 4, allEnable = 0x7 } |
enum | { iv_none = 0x000, iv_verts = 0x001, iv_faces = 0x002, iv_edges = 0x004 } |
enum | { SEL_OBJECT, SEL_VERT, SEL_FACE, SEL_ELEM } |
Selection enum values. More... |
|
enum | { SUBHIT_IGNOREBACKFACING = (1<<5) } |
Public Member Functions |
|
CoreExport | ObjectWrapper () |
Constructor. The wrapper is set to an empty,
uninitialized state. |
|
CoreExport | ~ObjectWrapper () |
Destructor. Calls the Release()
method to free any memory used by the wrapper. |
|
CoreExport void | Zero () |
For internal use only. |
|
CoreExport BOOL | Init (TimeValue t, ObjectState &os, BOOL copy=FALSE, int enable=allEnable, int nativeType=polyObject) |
CoreExport void | Release () |
CoreExport BOOL | IsEmpty () |
CoreExport int | Type () |
CoreExport Mesh * | GetTriMesh () |
CoreExport MNMesh * | GetPolyMesh () |
CoreExport PatchMesh * | GetPatchMesh () |
CoreExport void | Invalidate (int iInvalid) |
CoreExport void | InvalidateGeomCache () |
CoreExport int | NumVerts () |
CoreExport int | NumFaces () |
CoreExport int | NumEdges () |
CoreExport Point3 * | Verts () |
CoreExport GenFace * | Faces () |
CoreExport GenEdge * | Edges () |
CoreExport Point3 * | GetVert (int index) |
CoreExport void | SetVert (int index, Point3 &p) |
CoreExport void | SetNumVerts (int num) |
CoreExport GenFace | GetFace (int index) |
CoreExport void | SetFace (int index, GenFace &face) |
CoreExport void | SetNumFaces (int num) |
CoreExport GenEdge | GetEdge (int index) |
CoreExport int | NumFaceEdges (int faceIndex) |
CoreExport int | GetFaceEdgeIndex (int faceIndex, int edgeIndex) |
CoreExport void | GetVertexSpace (int index, Matrix3 &tm) |
CoreExport Point3 * | GetVertexNormal (int index) |
CoreExport BOOL | GetFaceHidden (int faceIndex) |
CoreExport void | SetFaceHidden (int faceIndex, BOOL hidden) |
CoreExport BOOL | GetChannelSupport (int mapChannel) |
CoreExport void | SetChannelSupport (int mapChannel, BOOL b) |
CoreExport int | NumMapVerts (int channel) |
CoreExport void | SetNumMapVerts (int channel, int num) |
CoreExport Point3 * | GetMapVert (int channel, int index) |
CoreExport void | SetMapVert (int channel, int index, Point3 &p) |
CoreExport GenFace | GetMapFace (int channel, int index) |
CoreExport void | SetMapFace (int channel, int index, GenFace &face) |
CoreExport MtlID | GetMtlID (int index) |
CoreExport void | SetMtlID (int index, MtlID mtlID) |
CoreExport DWORD | GetSmoothingGroup (int index) |
CoreExport void | SetSmoothingGroup (int index, DWORD smGrp) |
CoreExport int | GetSelLevel () |
CoreExport void | SetSelLevel (int selLevel) |
CoreExport BitArray & | GetVertSel () |
CoreExport void | SetVertSel (BitArray &) |
CoreExport BitArray & | GetFaceSel () |
CoreExport void | SetFaceSel (BitArray &sel) |
CoreExport BitArray & | GetElemSel () |
CoreExport void | SetElemSel (BitArray &sel) |
CoreExport BitArray * | GetSel (int selLevel) |
CoreExport void | SetSel (int selLevel, BitArray &sel) |
CoreExport void | FaceToElemSel (BitArray &elemSel, BitArray &faceSel) |
Converts the bits representing a face
selection into bits representing an element selection, and expands
the selection accordingly. |
|
CoreExport void | GrowSelection (int selLevel, BitArray &newSel) |
CoreExport void | ShrinkSelection (int selLevel, BitArray &newSel) |
CoreExport void | GetSoftSel (GenSoftSelData &softSelData) |
CoreExport void | SetSoftSel (GenSoftSelData &softSelData) |
CoreExport void | UpdateSoftSel () |
CoreExport float * | SoftSelWeights () |
CoreExport Point3 | SoftSelColor (float f) |
CoreExport BOOL | SubObjectHitTest (int selLevel, GraphicsWindow *gw, Material *ma, HitRegion *hr, DWORD flags, HitListWrapper &hitList, int numMat=1, Matrix3 *mat=NULL) |
CoreExport int | IntersectRay (Ray &ray, float &intersectAt, Point3 &norm, int &fi, FloatTab &bary) |
CoreExport void | Render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat=1) |
CoreExport int | SelLevel (int selLevel) |
CoreExport int | HitLevel (int selLevel) |
Public Attributes |
|
enum ObjectWrapper:: { ... } | type |
Mesh * | mesh |
MNMesh * | poly |
PatchMesh * | patch |
MeshTempData * | meshTempData |
MNTempData * | polyTempData |
Protected Attributes |
|
TimeValue | t |
union { | |
Mesh * mesh | |
MNMesh * poly | |
PatchMesh * patch | |
}; | |
union { | |
MeshTempData * meshTempData | |
MNTempData * polyTempData | |
}; | |
BOOL | isCopy |
Point3 * | verts |
GenFace * | faces |
GenEdge * | edges |
GeomObject * | collapsedObj |
BitArray | faceSel |
BitArray | vertSel |
GenSoftSelData | softSelData |
int | invalidMask |
anonymous enum |
The type of the underlying object, triObject for Mesh, polyObject for MNMesh, and patchObject for PatchMesh.
{ empty=0, triObject, polyObject, patchObject } type;
anonymous enum |
{ noneEnable=0, triEnable=1, polyEnable=2, patchEnable=4, allEnable=0x7 };
anonymous enum |
anonymous enum |
Selection enum values.
SEL_OBJECT |
indicates the object selection level. |
SEL_VERT |
indicates the face selection level. |
SEL_FACE |
indicates the vertex selection level. |
SEL_ELEM |
indicates the element selection level. |
{ SEL_OBJECT, SEL_VERT, SEL_FACE, SEL_ELEM }; //selection enum values
anonymous enum |
{ SUBHIT_IGNOREBACKFACING=(1<<5) }; //other SUBHIT_... values defined in Mesh.h are also supported
CoreExport ObjectWrapper | ( | ) |
Constructor. The wrapper is set to an empty, uninitialized state.
CoreExport ~ObjectWrapper | ( | ) | [inline] |
CoreExport void Zero | ( | ) |
For internal use only.
CoreExport BOOL Init | ( | TimeValue | t, |
ObjectState & | os, | ||
BOOL | copy = FALSE , |
||
int | enable =
allEnable , |
||
int | nativeType =
polyObject |
||
) |
t | - The current slider time |
os | - The object |
copy | - True to make a duplicate of the object, False otherwise |
enable | - Flags indicating which types should be supported. The object will be converted to the native type (and a copy maintained) unless it is one of these supported types. For Mesh objects, set the bit ObjectWrapper::triEnable. For MNMesh objects, set the bit ObjectWrapper::polyEnable. For Patch objects, set the bit ObjectWrapper::patchEnable. |
nativeType | - Indicates which type to convert to, if the object is not already a supported type. For Mesh, pass ObjectWrapper::triObject. For MNMesh, pass ObjectWrapper::polyObject. For PatchMesh, pass ObjectWrapper::patchObject. |
CoreExport void Release | ( | ) |
CoreExport BOOL IsEmpty | ( | ) | [inline] |
CoreExport int Type | ( | ) | [inline] |
{return type;}
CoreExport Mesh* GetTriMesh | ( | ) | [inline] |
CoreExport MNMesh* GetPolyMesh | ( | ) | [inline] |
{return type==polyObject? poly:NULL;}
CoreExport PatchMesh* GetPatchMesh | ( | ) | [inline] |
{return type==patchObject? patch:NULL;}
CoreExport void Invalidate | ( | int | iInvalid | ) |
iInvalid | - The validity flags to clear. To clear the vertex channel, pass ObjectWrapper::iv_verts. To clear the face channel, pass ObjectWrapper::iv_faces. To clear the edge channel, pass ObjectWrapper::iv_edges. |
CoreExport void InvalidateGeomCache | ( | ) |
CoreExport int NumVerts | ( | ) |
CoreExport int NumFaces | ( | ) |
CoreExport int NumEdges | ( | ) |
CoreExport Point3* Verts | ( | ) |
CoreExport GenFace* Faces | ( | ) |
CoreExport GenEdge* Edges | ( | ) |
CoreExport Point3* GetVert | ( | int | index | ) |
index | - The index of the vertex to retrieve |
CoreExport void SetVert | ( | int | index, |
Point3 & | p | ||
) |
index | - The index of the vertex to set |
p | - The position of the vertex |
CoreExport void SetNumVerts | ( | int | num | ) |
num | - The vertex count |
CoreExport GenFace GetFace | ( | int | index | ) |
index | - The index of the face to retrieve |
CoreExport void SetFace | ( | int | index, |
GenFace & | face | ||
) |
index | - The index of the face to set |
face | - The data for the face |
CoreExport void SetNumFaces | ( | int | num | ) |
num | - The face count |
CoreExport GenEdge GetEdge | ( | int | index | ) |
index | - The index of the edge to retrieve |
CoreExport int NumFaceEdges | ( | int | faceIndex | ) |
faceIndex | - The index of the face |
CoreExport int GetFaceEdgeIndex | ( | int | faceIndex, |
int | edgeIndex | ||
) |
faceIndex | - The index of the face |
edgeIndex | - The index of the edge relative to the face |
CoreExport void GetVertexSpace | ( | int | index, |
Matrix3 & | tm | ||
) |
index | - The index of the vertex | |
[out] | tm | - The vertex space matrix |
CoreExport Point3* GetVertexNormal | ( | int | index | ) |
index | - The index of the vertex |
CoreExport BOOL GetFaceHidden | ( | int | faceIndex | ) |
CoreExport void SetFaceHidden | ( | int | faceIndex, |
BOOL | hidden | ||
) |
CoreExport BOOL GetChannelSupport | ( | int | mapChannel | ) |
mapChannel | - The index of the map channel |
CoreExport void SetChannelSupport | ( | int | mapChannel, |
BOOL | b | ||
) |
mapChannel | - The index of the map channel |
b | - TRUE to indicate the channel is supported; otherwise FALSE. |
CoreExport int NumMapVerts | ( | int | channel | ) |
channel | - The index of the map channel |
CoreExport void SetNumMapVerts | ( | int | channel, |
int | num | ||
) |
channel | - The index of the map channel |
num | - The number of vertices to allocate. |
CoreExport Point3* GetMapVert | ( | int | channel, |
int | index | ||
) |
channel | - The index of the map channel |
index | - The index of the texture vertex |
CoreExport void SetMapVert | ( | int | channel, |
int | index, | ||
Point3 & | p | ||
) |
channel | - The index of the map channel |
index | - The index of the texture vertex |
p | - The value to set |
CoreExport GenFace GetMapFace | ( | int | channel, |
int | index | ||
) |
channel | - The index of the map channel |
index | - The index of the texture face |
CoreExport void SetMapFace | ( | int | channel, |
int | index, | ||
GenFace & | face | ||
) |
channel | - The index of the map channel |
index | - The index of the texture face |
face | - The data for the face |
CoreExport MtlID GetMtlID | ( | int | index | ) |
index | - The index of the face |
CoreExport void SetMtlID | ( | int | index, |
MtlID | mtlID | ||
) |
index | - The index of the face |
mtlID | - The zero based material ID |
CoreExport DWORD GetSmoothingGroup | ( | int | index | ) |
index | - The index of the face |
CoreExport void SetSmoothingGroup | ( | int | index, |
DWORD | smGrp | ||
) |
index | - The index of the face |
smGrp | - The smoothing group bits |
CoreExport int GetSelLevel | ( | ) |
CoreExport void SetSelLevel | ( | int | selLevel | ) |
selLevel | - The selection level. See the selection enum values above |
CoreExport BitArray& GetVertSel | ( | ) |
CoreExport void SetVertSel | ( | BitArray & | ) |
sel | - The selection bits |
CoreExport BitArray& GetFaceSel | ( | ) |
CoreExport void SetFaceSel | ( | BitArray & | sel | ) |
sel | - The selection bits |
CoreExport BitArray& GetElemSel | ( | ) |
CoreExport void SetElemSel | ( | BitArray & | sel | ) |
sel | - The selection bits |
CoreExport BitArray* GetSel | ( | int | selLevel | ) |
selLevel | - The selection level. See the selection enum values above |
CoreExport void SetSel | ( | int | selLevel, |
BitArray & | sel | ||
) |
selLevel | - The selection level. See the selection enum values above |
sel | - The selection bits |
Converts the bits representing a face selection into bits representing an element selection, and expands the selection accordingly.
If any face in an element is selected according the input bits, then all faces within that element will be toggled as selected in the output bits. This method does not change the selection on the object; the methods SetFaceSel() or SetElemSel() are needed to apply a selection after it is calculated
[out] | elemSel | - The output selection bits for the element level |
faceSel | - The input selection bits for the face level |
CoreExport void GrowSelection | ( | int | selLevel, |
BitArray & | newSel | ||
) |
selLevel | - The selection level. See the selection enum values above | |
[out] | newSel | - The output selection bits |
CoreExport void ShrinkSelection | ( | int | selLevel, |
BitArray & | newSel | ||
) |
selLevel | - The selection level. See the selection enum values above | |
[out] | newSel | - The output selection bits |
CoreExport void GetSoftSel | ( | GenSoftSelData & | softSelData | ) |
[out] | softSelData | - The selection parameters |
CoreExport void SetSoftSel | ( | GenSoftSelData & | softSelData | ) |
softSelData | - The selection parameters |
CoreExport void UpdateSoftSel | ( | ) |
CoreExport float* SoftSelWeights | ( | ) |
CoreExport Point3 SoftSelColor | ( | float | f | ) |
f | - The selection weight, ranging from 0 to 1 |
CoreExport BOOL SubObjectHitTest | ( | int | selLevel, |
GraphicsWindow * | gw, | ||
Material * | ma, | ||
HitRegion * | hr, | ||
DWORD | flags, | ||
HitListWrapper & | hitList, | ||
int | numMat = 1 , |
||
Matrix3 * | mat = NULL |
||
) |
gw | - The graphics window associated with the viewport the object is being hit tested in. | |
ma | - The list of materials for the mesh | |
hr | - This describes the properties of a region used for the hit testing. See Class HitRegion. | |
flags | - Flags specifying how the hit testing is performed. Accepted values are SUBHIT_IGNOREBACKFACING to specify the ignore backfacing mode, plus the following values defined in Mesh.h: SUBHIT_UNSELONLY, SUBHIT_ABORTONHIT, SUBHIT_SELSOLID, and SUBHIT_USEFACESEL | |
[out] | hitList | - The hit list object to hold the results of the hit test operation. See Class HitListWrapper. |
numMat | - The number of materials for the mesh. | |
mat | - The object-to-world transform matrix for the object. This needed to calculate backface culling if the underlying object is type Mesh and the flag ObejctWrapper:: SUBHIT_IGNOREBACKFACING is specified return TRUE if any hits were found, FALSE otherwise |
CoreExport int IntersectRay | ( | Ray & | ray, |
float & | intersectAt, | ||
Point3 & | norm, | ||
int & | fi, | ||
FloatTab & | bary | ||
) |
ray | - The ray to cast | |
[out] | intersectAt | - The distance travelled by the ray to the intersection point. |
[out] | norm | - The surface normal at the intersection point. |
[out] | fi | - The face index of the intersected face |
[out] | bary | - The barycentric coordinates of the hit point. For MNMesh and PatchMesh object, there may be more than three coordinate values return Nonzero if an intersection was found, zero otherwise |
CoreExport void Render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
RECT * | rp, | ||
int | compFlags, | ||
int | numMat = 1 |
||
) |
gw | - Points to the graphics window to render to. |
ma | - The list of materials to use to render the mesh. |
rp | - Specifies the rectangular region to render. If the mesh should be rendered to the entire viewport pass NULL |
compFlags | - One or more of the following flags defined in Mesh.h: COMP_TRANSFORM, COMP_IGN_RECT, COMP_LIGHTING, COMP_ALL or COMP_OBJSELECTED |
numMat | - The number of materials for the mesh |
CoreExport int SelLevel | ( | int | selLevel | ) |
CoreExport int HitLevel | ( | int | selLevel | ) |
TimeValue t
[protected] |
union { ... } [protected] |
union { ... } [protected] |
BOOL isCopy
[protected] |
GeomObject* collapsedObj
[protected] |
GenSoftSelData softSelData
[protected] |
int invalidMask
[protected] |
enum { ... } type |