Polygon Crucher SDK - Documentation
Documentation
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CGeomInfo Class Reference

CGeomInfo is an helper class oftenly required by different methods. More...

Detailed Description

CGeomInfo is an helper class oftenly required by different methods.

For example, CFaceList or CPointList are not linked together. Moreover, CFaceList knows nothing about its owner, which is often a C3DGeomObject. So CGeomInfo is a way to provide that additional information when it is needed.
You can construct a CGeomInfo on the stack using the appropriate C3DGeomObject or C3DSceneNode.
Most of the time this is the CGeomInfo main usage.

But depending on the method called, CGeomInfo can also get the operation result.
This is the case for C3DFaceList::Triangulate method which does not modify the provided face list, but generates a new list.
The result can be retrieved using CGeomInfo::GetDst3DPointList.
Depending on how is initialized to the CGeomInfo you can also get additional results.

{
CGeomInfo info(faces, points);
faces->Triangulate(&info); // Only generates a triangulated face list
C3DFaceList *trifaces = info.GetDst3DFaceList(false); // info is still a trifaces owner. trifaces will be deleted when info destroyed, unless trifaces->AddRef() is called, or info.GetDst3DFaceList(true) is called
} // trifaces destroyed with CGeomInfo after this line
C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored i...
Definition 3DFaceList.h:249
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
CGeomInfo is an helper class oftenly required by different methods.
Definition GeomInfo.h:71

This code shows how to generate a triangulated object from an object.

CGeomInfo info(object);
faces->Triangulate(&info); // triangulates anything that belong to the object (faces, channel faces...)
C3DPointList *points = object->GetPointList(); // Points remain the same
points->AddRef(); // points belong to object and will be shared with triobject created below. If reference not increased, the point list will be destroyed when calling object->Delete()
C3DFaceList *trifaces = info.GetDst3DFaceList(true);
CDependentChannels *trichannels = info.GetDstChannels(true);
C3DGeomObject *triobject = xNewParams(C3DGeomObject, points, trifaces, trichannels); // Create the triangular object
object->Delete(); // Don't need original object anymore.
This is the base class for any object containing geometry (curve, polygonal object,...
Definition 3DGeomObject.h:49
Definition 3DPointList.h:267
This class contains an array of CChannel information which are associated to the object.
Definition DependentChannels.h:56

If a list is created by a method, it belongs to the CGeomInfo unless you retrieve it using on of the provided method with detach = true.
Saying that, this simply means, that things are destroyed automatically if not required by the caller.

{
CGeomInfo info(object);
faces->Triangulate(&info); // triangulates anything that belong to the object (faces, channel faces...)
} // If you did nothing with triangulation, anything provided to CGeomInfo is keep safe and anything created by triangulation process is delete here.

#include <GeomInfo.h>

Public Member Functions

 CGeomInfo (C3DSceneNode *node, C3DBaseObject *object=NULL)
 If object = NULL, node->GetBaseObject is used. scene = object scene if any, or node scene otherwise (which are the same most of the time)
 
 CGeomInfo (C3DBaseObject *object)
 
 CGeomInfo (CFaceList *faces, CPointList *points)
 Can be use with a generic CFaceList / CPointList and GetSrcFaceList / GetSrcPointList only.
 
void Init (C3DSceneNode *node=NULL, C3DBaseObject *object=NULL)
 
void SetFaceList (CFaceList *faces, CFaceList *dstfaces=NULL, unsigned int deleteInfoGeomFlags=GEOMINFO_DELETE_NONE)
 
void SetPointList (CPointList *points, CPointList *dstpoints=NULL, unsigned int deleteInfoGeomFlags=GEOMINFO_DELETE_NONE)
 
CPointListGetSrcPointList (bool detach=false) const
 Return the source point list, which has been set by the constructor. detach = true means that CGeomInfo does not own the list anymore.
 
CFaceListGetSrcFaceList (bool detach=false) const
 Return the source face list, which has been set by the constructor. detach = true means that CGeomInfo does not own the list anymore.
 
C3DPointListGetSrc3DPointList (bool detach=false) const
 Return the source 3D point list, which has been set by the constructor.
 
C3DFaceListGetSrc3DFaceList (bool detach=false) const
 
C3DPointListGetDst3DPointList (bool detach=false) const
 When using SetPointList with source and destination points.
 
C3DFaceListGetDst3DFaceList (bool detach=false) const
 When using SetFaceList with source and destination faces.
 
void SetScene (C3DScene *scene)
 
C3DSceneGetScene () const
 
C3DBaseObjectGetBaseObject () const
 
C3DGeomObjectGetGeomObject () const
 Return NULL if not a geomobject.
 
C3DSceneNodeGetNode () const
 
ChannelID GetMaterialUVWChannelID (C3DScene *scene, MaterialID id, MapType type, bool front=true) const
 Get channel ID (if any, CHANNELID_UNDEFINED otherwise) for the provided material which belong to scene (useful if object or node does not belong to any scene, or if material belong to a different scene)
 
ChannelID GetMaterialUVWChannelID (MaterialID id, MapType type, bool front=true) const
 Get the channel ID (if any, CHANNELID_UNDEFINED otherwise) for the provided material which belong to object's scene (or node's scene) that was used to initialized the CGeomInfo.
 
CDependentChannelsGetSrcChannels (bool detach=false) const
 
CUVWChannelGetSrcUVWChannelByIndex (unsigned int index, CUVWFaceList *&faces, CUVWPointList *&uvpoints) const
 Internally call CDependentChannels::GetUVWChannelByIndex. Return NULL if no UVW index exists in source channel.
 
CUVWChannelGetSrcUVWChannelByID (ChannelID chnid, CUVWFaceList *&faces, CUVWPointList *&uvpoints) const
 Internally call CDependentChannels::GetUVWChannelByID. Return NULL if no UVW ID exists in source channel.
 
CVCChannelGetSrcVCChannelByIndex (unsigned int index, CVCFaceList *&faces, CVCPointList *&uvpoints) const
 Internally call CDependentChannels::GetVCChannelByIndex. Return NULL if no VC index exists in source channel.
 
CVCChannelGetSrcVCChannelByID (ChannelID chnid, CVCFaceList *&faces, CVCPointList *&points) const
 Internally call CDependentChannels::GetVCChannelByID. Return NULL if no VC ID exists in source channel.
 
CPointNormalChannelGetSrcPointNormalChannel (CNormalFaceList *&faces, C3DVectorList *&points, bool createIfNeeded=false) const
 Return the point normal channel and optionally create it if it does not exists in source channel.
 
CFaceNormalChannelGetSrcFaceNormalChannel (C3DVectorList *&points, bool createIfNeeded=false) const
 Return the face normal channel and optionally create it if it does not exists in source channel.
 
CSpecNormalChannelGetSrcSpecNormalChannel (CNormalFaceList *&faces, C3DVectorList *&points) const
 Return the specified normals channels in source channel.
 
int GetChannelSize () const
 Return the number of channels in source channels.
 
int GetChannelNumber (Channel3DType type=ALL_CHANNELS_TYPE, bool onlyValid=true) const
 Return the number of channels of the given type in source channels (cf. CDependentChannels::GetChannelsNumber).
 
void SetChannels (CDependentChannels *srcchannels, CDependentChannels *dstchannels=NULL, unsigned int deleteInfoGeomFlags=GEOMINFO_DELETE_NONE)
 You may provide the source channels and corresponding destination channels. For example, in the triangulation case, C3DGeomObject::Triangulate will only process these channels.
 
CDependentChannelsGetDstChannels (bool detach=false) const
 
void GetChannelFaceList (int i, CFaceList *&srcfaces, CFaceList *&dstfaces) const
 Get the #i source and destination face list.
 
void GetChannelPointList (int i, CPointList *&srcpts, CPointList *&dstpts) const
 Get the #i source and destination point list.
 

Member Function Documentation

◆ GetChannelNumber()

int CGeomInfo::GetChannelNumber ( Channel3DType  type = ALL_CHANNELS_TYPE,
bool  onlyValid = true 
) const

Return the number of channels of the given type in source channels (cf. CDependentChannels::GetChannelsNumber).

CGeomInfo methods to simplify a source and destination channels access


The documentation for this class was generated from the following file: