Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
3DPatch.h
Go to the documentation of this file.
1//! @file 3DPatch.h
2//! @brief The file contains C3DPatch class definition which is an object smoothed by a subdivision algorithm
3//!
4//////////////////////////////////////////////////////////////////////
5
6#if !defined(AFX_3DPATCH_H__31D6A937_B14E_11D2_A1E5_000000000000__INCLUDED_)
7#define AFX_3DPATCH_H__31D6A937_B14E_11D2_A1E5_000000000000__INCLUDED_
8
9#ifdef _MSC_VER
10#pragma once
11#endif // _MSC_VER
12
13#include "3DGeomObject.h"
14
15BEGIN_MOOTOOLS_NAMESPACE
16
17#define MAX_PATCH_LEVEL 8 /* maximum subdivision depth */
18#define UNDEFINED_PATCH_LEVEL -1
19
20#if !defined(MOOTOOLS_AUTODESK) && !defined(MOOTOOLS_CRUNCHERSDK)
21//#ifdef _DEBUG
22//# define ALLOW_ALTERNATIVE_SUBDIVISION
23//#endif
24#endif
25
26class TriMesh;
27class QuadMesh;
28
29//! @class C3DPatch
30//! @brief C3DPatch handles handles patch object smoothed using a subdivision algorithm
31//! @details The patch object subdivision can be modified using C3DPatch::SetLevel / C3DPatch::GetLevel.
32//! The sudivided object can be retrieved using C3DPatch::GetFinalObject which is recomputed each time subdivision level changed.
33class DLL_3DFUNCTION C3DPatch : public C3DGeomObject
34{
35 friend CGeomInfo;
36
37 DECLARE_SERIAL_XOBJECT(C3DPatch);
38
39protected:
40 int level;
41
42#ifdef ALLOW_ALTERNATIVE_SUBDIVISION
43 int method;
46#endif
47
48 C3DObject *smoothObject;
49
50 void Subdivide(int level);
51 void Subdivide3(C3DObject *object);
52 void Subdivide4(C3DObject *object);
53
54#ifdef ALLOW_ALTERNATIVE_SUBDIVISION
55 void InitPatch(int method = 1);
56#else
57 void InitPatch();
58#endif
59 bool ReleasePatch(); // Return true if something released
60
61public:
62 C3DPatch();
63 virtual ~C3DPatch();
64
65 virtual void Invalidate(unsigned int invalidate, bool set = true);
66 virtual bool InvalidateChannels(unsigned int channelType);
67 virtual bool Update(C3DScene *scene, unsigned int updateMode);
68
69 bool InternalCopy(C3DBaseObject *&dstObject, int flags = OBJECT_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL) const;
70
71 void SetLevel(int level);
72 int GetLevel() const;
73
74 virtual void SetScene(C3DScene *scene); // update guid for camera and its patch
75 virtual bool IsFinalObject() const { return false; }
76 virtual C3DBaseObject *GetFinalObject(bool detach = false, bool computeIfNeeded = true); // Get the smooth mesh
77
78 static int EstimateLevel(C3DObject *object, unsigned int level);
79};
80
81END_MOOTOOLS_NAMESPACE
82
83#endif // !defined(AFX_3DPATCH_H__31D6A937_B14E_11D2_A1E5_000000000000__INCLUDED_)
This is the base class for any kind of object.
Definition 3DBaseObject.h:106
This is the base class for any object containing geometry (curve, polygonal object,...
Definition 3DGeomObject.h:49
This class can be provided in C3DScene::Copy operations and allows to modify the created kind of clas...
Definition 3DScene.h:47
C3DObject handles polygonal mesh.
Definition 3DObject.h:24
C3DPatch handles handles patch object smoothed using a subdivision algorithm.
Definition 3DPatch.h:34
virtual bool InvalidateChannels(unsigned int channelType)
Notify that channels that have cache should be recomputed (ie, UVW channel or normal channel for exam...
virtual bool Update(C3DScene *scene, unsigned int updateMode)
Information that have been invalidated are recomputed when calling this method.IsInstanciated.
virtual C3DBaseObject * GetFinalObject(bool detach=false, bool computeIfNeeded=true)
Returns the object itself or any kind of object. For example for a patch it can returns a C3DObject o...
virtual void SetScene(C3DScene *scene)
Associate the object to a scene. a GUID for that object in the scene is assigned.
virtual void Invalidate(unsigned int invalidate, bool set=true)
Notify that some information changed (combination of OBJECT_UPDATE_PROPERTIES invalidation flags) and...
The class allows to get access to the scene graph, node hierarchy, material.
Definition 3DScene.h:306
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