Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

cybextrusionc.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 1999  Carsten Winkelholz
00003 
00004 Malte Weiß, 16.07.2002: Node partially implemented.
00005             17.07.2002: Added GetSpineVector() which is designed to be used
00006                           by render sub-classes (e.g. CybGLExtrusionC)
00007             18.07.2002: Moved geometry creation from CybGLExtrusionC
00008                         Added event handling
00009             19.07.2002: Concave polygons supported.
00010                         Field 'solid' supported.
00011             22.07.2002: Line intersection tests added.
00012 
00013 Address:  FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V.
00014       Neuenahrer Str. 20
00015       D - 53343 Wachtberg
00016       
00017 Email:    winkelholz@fgan.de
00018 
00019 This program is free software; you can redistribute it and/or
00020 modify it under the terms of the GNU General Public License
00021 as published by the Free Software Foundation; either version 2
00022 of the License, or (at your option) any later version.
00023 
00024 This program is distributed in the hope that it will be useful,
00025 but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027 GNU General Public License for more details.
00028 
00029 You should have received a copy of the GNU General Public License
00030 along with this program; if not, write to the Free Software
00031 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00032 */
00033 
00034 #ifndef CYBEXTRUSION_HC
00035 #define CYBEXTRUSION_HC
00036 
00037 #include "oaw/ctk/cybnodec.h"
00038 #include "oaw/ctk/cybgeometryc.h"
00039 #include "oaw/ctk/cybwrlfields.h"
00040 #include "../oawconfig.h"
00041 
00042 OAW_BEGIN_NAMESPACE
00043 
00044 
00045 // Structure for spine plane
00046 
00047 typedef struct _SpinePlane
00048 {
00049   Vector3C xAxis, yAxis, zAxis;
00050 } SpinePlane;
00051 
00052 // Structure for an extrusion vertex
00053 
00054 typedef struct _ExtrusionVertex
00055 {
00056   Vector3C n;       // Normal
00057   Vector3C p;       // Position
00058   double u, v;      // Texture Coordinates
00059 
00060   Vector3C nFace;   // Normal of the face which contains the vertex
00061 } ExtrusionVertex;
00062 
00063 class CybIsectLineChannelC;
00064 
00065 // Class definition
00066 
00067 class OAW_DLLMAPPING CybExtrusionC : public CybGeometryC
00068 {
00069 public:
00070   CybExtrusionC(CybWorldC*);
00071   CybExtrusionC(const CybExtrusionC&);
00072   CybExtrusionC& operator = (const CybExtrusionC&);
00073   ~CybExtrusionC();
00074   
00075   virtual void SetEvent(long, const void*, BaseI*);
00076   virtual long GetFieldEventID(const char*);
00077   virtual long GetFieldDataType(long);
00078 
00079   virtual void ToChannelDefault(CybChannelC* pV, long lFlag);
00080   virtual void ToChannelTexture(CybChannelC* pV, long lFlag);
00081   virtual void ToIsectLineChannel(CybIsectLineChannelC* pIsectChan);
00082 
00083 protected:
00084   virtual void CreateNewCopy(CybNodeC*);
00085   virtual void LoadVRML(char*& iter, const char* iterEnd,long& znr);
00086   virtual void FinishInit();
00087   virtual void EventCascadeEnd();
00088 
00089   void         CalculateSpinePlanes();
00090   Vector3C     GetSpineVector(int nSpine, int nIndex);
00091   void         SetupPolyNormals(ExtrusionVertex *pVertices1, int nNumVertices1, ExtrusionVertex *pVertices2, int nNumVertices2);
00092   void         PrepareRender();
00093   void         TriToIsectLineChannel(CybIsectLineChannelC* pIsectChan, VectorC &vStartLine, VectorC &vEndLine, ExtrusionVertex &v0, ExtrusionVertex &v1, ExtrusionVertex &v2);
00094 
00095 protected:
00096   short m_bLoading;   // Currently loading?
00097   
00098   // List of axis-defined spine planes
00099   ArrayC<SpinePlane> m_SpinePlanes;
00100   // Spine closed (ring)?  
00101   SFBool m_bClosed;
00102 
00103   // Render data
00104   ExtrusionVertex *m_pQuadVertices;      // Quad vertices
00105   long             m_lNumQuads;          // Number of quads
00106 
00107   ExtrusionVertex *m_pBeginCapVertices;  // Cap vertices
00108   ExtrusionVertex *m_pEndCapVertices;    // Cap vertices
00109   long             m_lNumCapVertices;    // Number of quads
00110 
00111 public:
00112   // Extrusion properties
00113   SFBool      m_bBeginCap;
00114   SFBool      m_bCcw;
00115   SFBool      m_bConvex;
00116   SFFloat     m_fCreaseAngle;
00117   MFVec2f     m_mvCrossSection;
00118 
00119   SFBool      m_bEndCap;
00120   MFRotation  m_mrOrientation;
00121   MFVec2f     m_mvScale;
00122   SFBool      m_bSolid;
00123   MFVec3f     m_mvSpine;
00124 
00125   // Convex geometry data available?
00126   short        m_bConvexData;
00127 
00128   // Render data must be updated?
00129   short        m_bUpdateRender;
00130 
00131   // Key list
00132   static char VRMLKeyStrList[][30];
00133 };
00134 
00135 OAW_END_NAMESPACE
00136 
00137 
00138 #endif
00139 
00140 
00141 
00142 

Generated on Tue Jul 29 14:24:10 2003 for Open ActiveWrl by doxygen1.3-rc2