3ds Max C++ API Reference
|
A multi-polygon shape class. More...
#include <polyshp.h>
Public Member Functions | |
CoreExport | PolyShape () |
Constructor. More... | |
CoreExport | PolyShape (PolyShape &from) |
Constructor. More... | |
CoreExport | ~PolyShape () |
Destructor. More... | |
CoreExport void | Init () |
For Internal use only. More... | |
CoreExport void | NewShape () |
This deletes all the lines from the PolyShape and clears the shape out. More... | |
CoreExport BOOL | SetNumLines (int count, BOOL keep=TRUE) |
Sets the number of polygons used by the poly shape. More... | |
CoreExport PolyLine * | NewLine () |
Creates a new PolyLine and appends it to the end of the list of lines maintained by this PolyShape. More... | |
CoreExport void | Append (PolyLine &l) |
Appends the specified PolyLine to the end of the lines list. More... | |
CoreExport void | Insert (int where, PolyLine &l) |
Inserts the specified PolyLine at the input location. More... | |
CoreExport void | Delete (int where) |
Deletes the specified PolyLine from the lines list. More... | |
CoreExport PolyShape & | operator= (PolyShape &from) |
Assignment operator. More... | |
CoreExport PolyShape & | operator= (BezierShape &from) |
Assignment operator. More... | |
CoreExport void | Reverse (int poly, BOOL keepZero=FALSE) |
Reverses the PolyLine whose index is passed. More... | |
CoreExport void | Reverse (BitArray &reverse, BOOL keepZero=FALSE) |
Reverses the splines of this shape if the corresponding bit in reverse is set. More... | |
CoreExport MtlID | GetMatID (int poly, int piece) |
Returns the material ID for the specified segment of the specified poly. More... | |
CoreExport bool | Delete (const unsigned int *indices, unsigned int n) |
Deletes multiple lines at once. More... | |
CoreExport void | Append (PolyLine *pLines, unsigned int n, bool useSwap=false) |
Append multiple lines at once. More... | |
Bounding Box/InvalidateGeomCache/InvalidateCapCache | |
CoreExport void | BuildBoundingBox (void) |
Builds a bounding box surrounding every line in the lines list. More... | |
CoreExport void | InvalidateGeomCache (BOOL unused) |
Invalidates the cache of each line in the PolyShape. More... | |
CoreExport void | InvalidateCapCache () |
Invalidates the morph, and grid cap caches. More... | |
CoreExport Box3 | GetBoundingBox (Matrix3 *tm=NULL) |
Returns the bounding box of the PolyLines in this PolyShape. More... | |
CoreExport void | GetDeformBBox (TimeValue t, Box3 &box, Matrix3 *tm, BOOL useSel) |
Computes the bounding box of this PolyShape. More... | |
Render/Select/Snap/Transform | |
CoreExport void | Render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat) |
CoreExport BOOL | Select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE) |
CoreExport void | Snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm) |
CoreExport void | Snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm, DWORD vflags) |
CoreExport void | Transform (Matrix3 &tm) |
Transforms the vertices of each PolyLine in this PolyShape by the specified matrix. More... | |
Capping Methods | |
CoreExport int | MakeCap (TimeValue t, MeshCapInfo &capInfo, int capType) |
This method may be called to fill in the MeshCapInfo passed with the appropriate capping information. More... | |
CoreExport int | MakeCap (TimeValue t, PatchCapInfo &capInfo) |
This method may be called to fill in the PatchCapInfo passed with the appropriate capping information. More... | |
CoreExport int | Make3DSCap (MeshCapInfo &capInfo, DWORD options=0) |
CoreExport int | MakeGridCap (MeshCapInfo &capInfo) |
Dump/Load/Save | |
CoreExport void | Dump (const MCHAR *title=NULL) |
This may be called to display information about the PolyShape to the debug window via DebugPrint(). More... | |
CoreExport IOResult | Save (ISave *isave) |
CoreExport IOResult | Load (ILoad *iload) |
Shape Hierarchy | |
CoreExport void | UpdateCachedHierarchy () |
CoreExport ShapeHierarchy & | OrganizeCurves (TimeValue t, ShapeHierarchy *hier=NULL) |
This methods looks at the shape organization, and puts together a shape hierarchy. More... | |
Selection/UpdateSels | |
CoreExport void | UpdateSels () |
This is a very important call to make. More... | |
CoreExport BitArray | VertexTempSel (int poly) |
Constructs a vertex selection list based on the current selection level of the specified poly. More... | |
Data Flow Evaluation | |
CoreExport void | ShallowCopy (PolyShape *ashape, ChannelMask channels) |
CoreExport void | DeepCopy (PolyShape *ashape, ChannelMask channels) |
CoreExport void | NewAndCopyChannels (ChannelMask channels) |
CoreExport void | FreeChannels (ChannelMask channels, int zeroOthers=1) |
Public Attributes | |
int | numLines |
The number of lines in the polyshape. More... | |
PolyLine * | lines |
The array of lines. More... | |
DWORD | flags |
Currently not used. More... | |
Box3 | bdgBox |
Stores the bounding box surrounding each PolyLine in the shape. More... | |
DWORD | selLevel |
The selection level. More... | |
DWORD | dispFlags |
Display Attribute Flags. More... | |
Selections | |
ShapeVSel | vertSel |
selected vertices More... | |
ShapeSSel | segSel |
selected segments More... | |
ShapePSel | polySel |
selected polygons More... | |
Capping Caches | |
MeshCapInfo | morphCap |
The morph cap information. More... | |
BOOL | morphCapCacheValid |
Determines if the morph cap is valid. More... | |
MeshCapInfo | gridCap |
The grid cap information. More... | |
BOOL | gridCapCacheValid |
Determines if the grid cap is valid. More... | |
PatchCapInfo | patchCap |
The patch cap information. More... | |
BOOL | patchCapCacheValid |
Determines if the patch cap is valid. More... | |
ShapeHierarchy | cachedHier |
Hierarchy cache. More... | |
BOOL | hierCacheValid |
Determines if the hierarchy cache is valid. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from MaxHeapOperators | |
static UtilExport void * | operator new (size_t size) |
Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e) |
Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new (size_t size, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, int block_type, const char *filename, int line) |
New operator used to allocate arrays of objects. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void * | operator new[] (size_t size, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More... | |
static UtilExport void * | operator new[] (size_t size, const std::nothrow_t &e, unsigned long flags) |
New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More... | |
static UtilExport void | operator delete (void *ptr) |
Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete (void *ptr, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e) |
Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, int block_type, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line) |
Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More... | |
static UtilExport void | operator delete[] (void *ptr, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void | operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags) |
Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More... | |
static UtilExport void * | operator new (size_t size, void *placement_ptr) |
Placement new operator. More... | |
static UtilExport void | operator delete (void *ptr, void *placement_ptr) |
Placement delete operator. More... | |
static UtilExport void * | aligned_malloc (size_t size, size_t alignment) |
Allocates memory on a specified alignment boundary. More... | |
static UtilExport void * | aligned_realloc (void *ptr, size_t size, size_t alignment) |
Reallocates memory on a specified alignment boundary. More... | |
static UtilExport void | aligned_free (void *ptr) |
Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More... | |
A multi-polygon shape class.
This class is used in the caching of bezier shapes. This is used for doing a one time interpolation of a bezier shape into a form that is the same shape but doesn't require any further interpolation. In this way the system can do the complex calculations once, store the shape into this PolyShape representation, and not have to go through the cubic spline calculations to figure out where the points are in the future. This class maintains an array of PolyLines. As an example, this is used in the Extrude modifier. First, it generates a PolyShape from the bezier shape it is extruding. Next, this PolyShape is used to generate the mesh.
CoreExport PolyShape | ( | ) |
Constructor.
The number of lines is set to 0, the lines array is set to NULL, the flags and display flags are set to 0, the selection level is set to SHAPE_OBJECT, the geometry cache is invalidated, and the object is set to NULL.
CoreExport PolyShape | ( | PolyShape & | from | ) |
CoreExport ~PolyShape | ( | ) |
Destructor.
CoreExport void Init | ( | ) |
For Internal use only.
Initializes member variables. This function is a special version used by the constructors and should not be called by plug-in developers. If you need to clear out a PolyShape use NewShape().
CoreExport void NewShape | ( | ) |
CoreExport BOOL SetNumLines | ( | int | count, |
BOOL | keep = TRUE |
||
) |
Sets the number of polygons used by the poly shape.
count | The number of lines. |
keep | If set to true, any old lines are copied to the new storage. They are freed otherwise. Defaults to true. |
CoreExport PolyLine* NewLine | ( | ) |
CoreExport void Append | ( | PolyLine & | l | ) |
CoreExport void Insert | ( | int | where, |
PolyLine & | l | ||
) |
CoreExport void Delete | ( | int | where | ) |
Deletes the specified PolyLine from the lines list.
where | The index into the lines list specifying which line to delete. |
CoreExport PolyShape& operator= | ( | PolyShape & | from | ) |
Assignment operator.
CoreExport PolyShape& operator= | ( | BezierShape & | from | ) |
Assignment operator.
Note that this operator does not offer as much control as calling the method on the BezierShape itself named MakePolyShape(). That version allows you to specify the number of steps and an optimize parameter. These options are not available on this simple assignment operator.
CoreExport void BuildBoundingBox | ( | void | ) |
Builds a bounding box surrounding every line in the lines list.
The bounding box is returned through the bdgBox data member.
CoreExport void InvalidateGeomCache | ( | BOOL | unused | ) |
Invalidates the cache of each line in the PolyShape.
The bounding box is set to empty. This method also invalidates the capping caches.
unused | This parameter is not used. |
CoreExport void InvalidateCapCache | ( | ) |
Invalidates the morph, and grid cap caches.
CoreExport Box3 GetBoundingBox | ( | Matrix3 * | tm = NULL | ) |
Returns the bounding box of the PolyLines in this PolyShape.
The optional TM allows the box to be calculated in any space.
tm | The points of the PolyLines in this PolyShape are transformed by this matrix prior to the bounding box computations. optional TM allows the box to be calculated in any space. |
CoreExport void GetDeformBBox | ( | TimeValue | t, |
Box3 & | box, | ||
Matrix3 * | tm, | ||
BOOL | useSel | ||
) |
Computes the bounding box of this PolyShape.
CoreExport void Render | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
RECT * | rp, | ||
int | compFlags, | ||
int | numMat | ||
) |
This method is used internally.
CoreExport BOOL Select | ( | GraphicsWindow * | gw, |
Material * | ma, | ||
HitRegion * | hr, | ||
int | abortOnHit = FALSE |
||
) |
This method is used internally.
CoreExport void Snap | ( | GraphicsWindow * | gw, |
SnapInfo * | snap, | ||
IPoint2 * | p, | ||
Matrix3 & | tm | ||
) |
This method is used internally.
CoreExport void Snap | ( | GraphicsWindow * | gw, |
SnapInfo * | snap, | ||
IPoint2 * | p, | ||
Matrix3 & | tm, | ||
DWORD | vflags | ||
) |
This method is used internally.
CoreExport void Transform | ( | Matrix3 & | tm | ) |
CoreExport int MakeCap | ( | TimeValue | t, |
MeshCapInfo & | capInfo, | ||
int | capType | ||
) |
This method may be called to fill in the MeshCapInfo passed with the appropriate capping information.
See Patches and Faces for more details on capping. This method is used for meshes. The method below is used for patches.
t | This should be passed as the current time. You may retrieve this using Interface::GetTime() (See Class Interface). |
capInfo | This information is filled in by this method. (See Class MeshCapInfo). |
capType | The cap type. See Shape Capping Types. |
CoreExport int MakeCap | ( | TimeValue | t, |
PatchCapInfo & | capInfo | ||
) |
This method may be called to fill in the PatchCapInfo passed with the appropriate capping information.
This method is used for patches. Note that it is generally not recommended to try to create patch caps from PolyShapes. The patch cap uses bezier information, so it is much better to use a BezierShape to make a patch cap. It is very inefficient to do this with a PolyShape.
t | This should be passed as the current time. You may retrieve this using Interface::GetTime() (See Class Interface). |
capInfo | This information is filled in by this method. (See Class PatchCapInfo). |
CoreExport int Make3DSCap | ( | MeshCapInfo & | capInfo, |
DWORD | options = 0 |
||
) |
This method is used internally.
CoreExport int MakeGridCap | ( | MeshCapInfo & | capInfo | ) |
This method is used internally.
CoreExport void Dump | ( | const MCHAR * | title = NULL | ) |
This may be called to display information about the PolyShape to the debug window via DebugPrint().
See Troubleshooting.
title | A string to be display before the PolyShape data is displayed. |
CoreExport void UpdateCachedHierarchy | ( | ) |
This method is used internally.
CoreExport ShapeHierarchy& OrganizeCurves | ( | TimeValue | t, |
ShapeHierarchy * | hier = NULL |
||
) |
This methods looks at the shape organization, and puts together a shape hierarchy.
This provides information on how the shapes are nested. For example on a donut object with two circles, this method determines which circle is inside the other one.
t | This parameter is not used. |
hier | If non-NULL the result is store here (in addition to being returned). (See Class ShapeHierarchy). |
CoreExport void UpdateSels | ( | ) |
This is a very important call to make.
Whenever you have changed the PolyShape, for example after you are done adding polygons to the shape or have changed the number of points in a shape, you should call this method. This method updates a set of embedded selection set data within the shape. This selection set data tells what polygons are selected, what segments are selected, and what control points are selected. This resets the sizes of the selection bit arrays for this shape.
CoreExport BitArray VertexTempSel | ( | int | poly | ) |
Constructs a vertex selection list based on the current selection level of the specified poly.
For example if the selection level is at object level all the bits are set. If the selection level is at vertex level only the selected vertex bits are set. See Class BitArray.
poly | The poly whose selection level is constructed. |
CoreExport void Reverse | ( | int | poly, |
BOOL | keepZero = FALSE |
||
) |
Reverses the PolyLine whose index is passed.
poly | The spline to reverse. |
keepZero | This should normally be passed as "true". If set to true, and the polyline is closed, this method will make sure that vertex zero is the same on the reversed version as on the non-reversed version. Otherwise, if set to false, the last vertex becomes the first vertex, and the first vertex becomes the last. This is an important distinction for the lofter because it always wants vertex zero to be in the same place. |
CoreExport void Reverse | ( | BitArray & | reverse, |
BOOL | keepZero = FALSE |
||
) |
Reverses the splines of this shape if the corresponding bit in reverse is set.
The BitArray has one bit for each polyline.
reverse | If the bit is set the spline is reversed; otherwise it is left alone. |
keepZero | This should normally be passed as TRUE. If set to true, and the polyline is closed, this method will make sure that vertex zero is the same on the reversed version as on the non-reversed version. Otherwise, if set to false, the last vertex becomes the first vertex, and the first vertex becomes the last. This is an important distinction for the lofter because it always wants vertex zero to be in the same place. |
CoreExport MtlID GetMatID | ( | int | poly, |
int | piece | ||
) |
Returns the material ID for the specified segment of the specified poly.
poly | The zero based index of the poly. |
piece | The zero based index of the segment. |
CoreExport void ShallowCopy | ( | PolyShape * | ashape, |
ChannelMask | channels | ||
) |
This method is used internally in data flow evaluation in the pipeline.
CoreExport void DeepCopy | ( | PolyShape * | ashape, |
ChannelMask | channels | ||
) |
This method is used internally in data flow evaluation in the pipeline.
CoreExport void NewAndCopyChannels | ( | ChannelMask | channels | ) |
This method is used internally in data flow evaluation in the pipeline.
CoreExport void FreeChannels | ( | ChannelMask | channels, |
int | zeroOthers = 1 |
||
) |
This method is used internally in data flow evaluation in the pipeline.
CoreExport IOResult Save | ( | ISave * | isave | ) |
This method is used internally in saving to the MAX file.
CoreExport IOResult Load | ( | ILoad * | iload | ) |
This method is used internally in loading from the MAX file.
CoreExport bool Delete | ( | const unsigned int * | indices, |
unsigned int | n | ||
) |
Deletes multiple lines at once.
This is faster than deleting one by one using Delete(), because the internal bookkeeping only needs to be done once. Lines are deleted in reverse order, from highest index to lowest index. If the array of indices is not properly sorted (in ascending order), or if the indices are not unique, the results will be undefined: the wrong lines may be deleted, or more likely 'false' will be returned, leaving you with a ShapeObject in an undefined state.
indices | Point to an array of indices to delete. Indices should be unique, and sorted in ascending order. |
n | Number of entries in the indices array. |
CoreExport void Append | ( | PolyLine * | pLines, |
unsigned int | n, | ||
bool | useSwap = false |
||
) |
Append multiple lines at once.
This is faster than appending one by one using Append(), because the internal bookkeeping only needs to be done once.
pLines | Array of lines to append. |
n | Number of entries in the lines array. |
useSwap | Should PolyLine::Swap() be used instead of operator = ? Using Swap() is faster, and should be used if you are just going to discard the contents of the lines array. |
int numLines |
The number of lines in the polyshape.
PolyLine* lines |
The array of lines.
DWORD flags |
Currently not used.
ShapeVSel vertSel |
selected vertices
ShapeSSel segSel |
selected segments
ShapePSel polySel |
selected polygons
DWORD selLevel |
The selection level.
One of the following values: Selection Level Flags
DWORD dispFlags |
Display Attribute Flags.
MeshCapInfo morphCap |
The morph cap information.
BOOL morphCapCacheValid |
Determines if the morph cap is valid.
MeshCapInfo gridCap |
The grid cap information.
BOOL gridCapCacheValid |
Determines if the grid cap is valid.
PatchCapInfo patchCap |
The patch cap information.
BOOL patchCapCacheValid |
Determines if the patch cap is valid.
ShapeHierarchy cachedHier |
Hierarchy cache.
BOOL hierCacheValid |
Determines if the hierarchy cache is valid.