00001 #ifndef COM_M4NKIND_Object3DMarchCube_H 00002 #define COM_M4NKIND_Object3DMarchCube_H 00003 00004 #include "Object3DVirtualDynamic.h" 00005 00006 #include "PackULong_Flags.h" 00007 #include "PackObjectReference.h" 00008 #include "PackFloatByte_Limits.h" 00009 #include "PackFloatByte_Color.h" 00010 #include "PackList.h" 00011 #include "MarchinCubeSpace.h" 00012 class Equ_XYZD_Virtual; 00013 00014 /*! 00015 \class Object3DMarchCube 00016 \ingroup BaseObjectInherited_VedaLibDemo 00017 \brief virtual Class defining a generic Object3D build with the 00018 technic of the <b>marching cubes</b>. 00019 */ 00020 class Object3DMarchCube : public Object3DVirtualDynamic 00021 { 00022 /*================================================================== 00023 PUBLIC 00024 ==================================================================*/ 00025 public: 00026 /*! 00027 \brief Constructor. There should only be members initialisation there. 00028 */ 00029 Object3DMarchCube(void); 00030 00031 /*! 00032 \brief Class Inheritance Descriptors. Also forces a destructor. See BASEOBJECT_DECLARE_... in .cpp 00033 */ 00034 BASEOBJECT_DEFINE_CLASS(Object3DMarchCube); 00035 /*! 00036 \brief Nested class that describes an element of the list of terms 00037 used to define implicitly the object, in mSer_EquationTermList 00038 */ 00039 class EquationTerm : public PackStruct 00040 { 00041 public: 00042 //! \brief element constructor 00043 EquationTerm(void); 00044 //! the reference to the equation term, the 4D equations that define the object: 00045 PackObjectReference mSer_Equation; 00046 //! the color that identify this term: 00047 PackFloatByte_Color mSer_Color; 00048 }; 00049 /*! 00050 \brief static method passed to the list to create new elements. 00051 \return a new EquationTerm object. 00052 */ 00053 static BaseType *NewEquationTerm(){ return new EquationTerm(); }; 00054 00055 /*================================================================== 00056 PROTECTED 00057 ==================================================================*/ 00058 protected: 00059 //! a cube space is needed to build an object: 00060 PackObjectReference mSer_MarchinCubeSpaceRef; 00061 //! a special lightning model can be used or not: 00062 PackObjectReference mSer_LightModel; 00063 //! list of terms to build object. 00064 PackList mSer_EquationTermList; 00065 //! edgerate 00066 PackFloatByte_Limits mSer_Thresold; 00067 //! table used to convert RGBA char to float. 00068 float m_ColorConversion[256]; 00069 //! realtime tool var for marchube: number of cube in a X line. 00070 unsigned int m_nxt; 00071 //! realtime tool var for marchube: number of cube in a X line mult NbY. 00072 unsigned int m_nxtnyt; 00073 //! on pass2 (vertex creation), cubes that create vertexes are kept in a table if pass4 is needed. 00074 //! this table keeps 4 chars(X,Y,Z,edgeCreators) once for each. Maxium is like the maximum of vertex. 00075 unsigned char *m_pPass4EdgeCubeIndex; 00076 //! RGB by vertex created 00077 float *m_pVertexLightTerm; 00078 //! 00079 unsigned int m_NumberOfCreativeCubes; 00080 //! 00081 unsigned int m_NbVertexCreated; 00082 //! 00083 unsigned int m_checkdate_pass1; 00084 /* 00085 \brief do pass 4. 00086 \param _framedate date in seconds for dynamic lights. 00087 pass1: scalar values computation 00088 pass2: vertex creation 00089 pass3: polygon creation (done with pass2) 00090 pass4: light model affinage, if needed. 00091 */ 00092 void Pass4_Diffuse(float _framedate); 00093 /* 00094 \brief do pass 4. 00095 pass1: scalar values computation 00096 pass2: vertex creation 00097 pass3: polygon creation (done with pass2) 00098 pass4: light model affinage, if needed. 00099 */ 00100 void Pass4_AmbientOcclusion(); 00101 00102 #ifdef _ENGINE_EDITABLE_ 00103 //! number of vertex created; this info is not in the mesh object m_pObject3DVirtualBuffer,and is only used in editable mode for stats. 00104 //unsigned int m_CurrentNumberOfVertex; 00105 #endif 00106 /*! 00107 \brief just use CreateInternal() to return an error in some case... 00108 no use in other cases... 00109 */ 00110 virtual bool CreateInternal(void); 00111 #ifdef _ENGINE_EDITABLE_ 00112 /*! 00113 \brief that closes everything. Still, the object exist and can be rebuild the same using Create() 00114 */ 00115 virtual void CloseInternal(void); 00116 #endif 00117 /*! 00118 \brief update the shape of the object for this date, during 00119 the lifetime the object, when it is created. 00120 by defdault, does nothing, so static object can be created 00121 with CreateInternal() only. 00122 \param _newShapeTime the new date. 00123 \param _shapeIndex the index of the shape to modify. 00124 */ 00125 virtual void CreateShape(float _newShapeTime, unsigned int _shapeIndex=0); 00126 00127 /*! 00128 \brief Method that creates a vertex, from an equation, by finding its normals and stuffs... 00129 \param vertex object to init 00130 \param _vector the x,y,z coordinate. 00131 */ 00132 inline void CreateOneVertex_X_RGBA( const MarchinCubeSpace::MarchCubeExtraValue *_pCubeExtraValue, 00133 VirtualMachine::InternalVertex *_pvtx, 00134 float _rate ); 00135 inline void CreateOneVertex_Y_RGBA( const MarchinCubeSpace::MarchCubeExtraValue *_pCubeExtraValue, 00136 VirtualMachine::InternalVertex *_pvtx, 00137 float _rate ); 00138 inline void CreateOneVertex_Z_RGBA( const MarchinCubeSpace::MarchCubeExtraValue *_pCubeExtraValue, 00139 VirtualMachine::InternalVertex *_pvtx, 00140 float _rate ); 00141 00142 inline void CreateOneVertex_X_Normal( const float *_pCubeValue, 00143 VirtualMachine::InternalVertex *_pvtx, 00144 float _rate ); 00145 inline void CreateOneVertex_Y_Normal( const float *_pCubeValue, 00146 VirtualMachine::InternalVertex *_pvtx, 00147 float _rate ); 00148 inline void CreateOneVertex_Z_Normal( const float *_pCubeValue, 00149 VirtualMachine::InternalVertex *_pvtx, 00150 float _rate ); 00151 00152 }; 00153 00154 #endif
/\/\ 4 N k ! N D _______ _ __ ___ _____ ___ _ _ ____ ___________ __//___ /________ |/ / ___________\_______/ \ / _ _ \/ _ / _ / _/_/____/ _ __ / / / / / / / \ \/ / / \ \ / \\___/___/___/ ¯ _____/_____/ ______\___/_____/\________\\ \________/_ ___ __ l____\ /elD! http://www.m4nkind.com \____/