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

cybindexedfacesetc.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 1999  Carsten Winkelholz
00003 
00004 Address:  FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V.
00005       Neuenahrer Str. 20
00006       D - 53343 Wachtberg
00007       
00008 Email:    winkelholz@fgan.de
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 
00026 #ifndef CYBINDEXEDFACESETC_H
00027 #define CYBINDEXEDFACESETC_H
00028 
00029 #include <math.h>
00030 #include <stdio.h>
00031 #include <fstream>
00032 
00033 #include "oaw/misc/matrixc.h"
00034 #include "oaw/misc/vectorc.h"
00035 #include "oaw/misc/stringc.h"
00036 #include "oaw/ctk/cybnodec.h"
00037 #include "oaw/ctk/cybworldc.h"
00038 #include "oaw/ctk/cybgeometryc.h"
00039 #include "oaw/ctk/cybcoordinatec.h"
00040 #include "oaw/ctk/cybtexturecoordinatec.h"
00041 #include "oaw/ctk/cybnormalc.h"
00042 #include "oaw/misc/kettec.h"
00043 #include "oaw/misc/arrayc.h"
00044 
00045 #include "../oawconfig.h"
00046 
00047 OAW_BEGIN_NAMESPACE
00048 
00049 
00050 #define TRUE 1
00051 #define FALSE 0
00052 
00053 class CybGLViewC;
00054 class CybNormalC;
00055 class CybCoordinateC;
00056 class CybTextureCoordinateC;
00057 class CybColorC;
00058 class CybIndexedFaceC;
00059 class CybIndexedVertexC;
00060 class CybIndexedTriangleStripC;
00061 class CybIsectLineChannelC;
00062 
00064 // cybindexedfacesetc.h
00066 
00067 
00068 
00069 class OAW_DLLMAPPING CybIndexedFaceSetC : public CybGeometryC
00070 {
00071   friend class CybShapeC;
00072   friend class CybIndexedFaceC;
00073   friend class CybIndexedVertexC;
00074 
00075 public:
00076   CybIndexedFaceSetC(CybWorldC*);
00077   virtual ~CybIndexedFaceSetC();
00078   CybIndexedFaceSetC(const CybIndexedFaceSetC&);
00079   CybIndexedFaceSetC& operator = (const CybIndexedFaceSetC&);  
00080   virtual void Copy(const CybNodeC*);
00081   virtual void FinishInit();
00082   virtual void SetEvent(long,const void*, BaseI*);
00083   virtual long BufEvent(long,const void*, BaseI*);
00084   virtual long GetEventBufMinDataSize();
00085   virtual long GetEventBufMaxDataSize();
00086   virtual short CopyEventBuf(AnyC&,long);
00087   virtual short SetEventBuf(AnyC&,BaseI*);
00088   virtual void EventCascadeEnd();
00089   virtual void ToChannelDefault(CybChannelC*, long flag);
00090   virtual void ToChannelTexture(CybChannelC*, long flag);
00091 
00092   
00093   virtual long GetFieldEventID(const char*);
00094   virtual long GetFieldDataType(long);
00095 
00096   virtual short GetFieldData(long ,void*);
00097 
00098 protected:
00099   virtual void CreateNewCopy(CybNodeC*);
00100   void InitDefault();
00101   virtual void Load_coordIndex(char*&, const char*,long&);
00102   virtual void Load_colorIndex(char*&, const char*,long&);
00103   virtual void Load_normalIndex(char*&, const char*,long&);
00104   virtual void Load_texCoordIndex(char*&, const char*,long&);
00105   virtual void Load_creaseAngle(char*&, const char*,long&);
00106   virtual void Load_ccw(char*&, const char*,long&);
00107   virtual void Load_colorPerVertex(char*&, const char*,long&);
00108   virtual void Load_convex(char*&, const char*,long&);
00109   virtual void Load_normalPerVertex(char*&, const char*,long&);
00110   virtual void Load_solid(char*&, const char*,long&);
00111   virtual void Load_End(char*&, const char*,long&);
00112   void RecalcNormals();
00113   virtual void Calc();
00114   void ToIsectLineChannel(CybIsectLineChannelC*);
00115 public:  
00116   virtual int SetNode(CybNodeC*);
00117   virtual void GetMessageAsObjectI(void*,long,SharedObjectC*);
00118   virtual const CybBInfoC& GetBInfo(){return m_pCoord->GetBInfo();}
00119   void BestimmeEzmax();
00120 protected:
00121   void SetCoordinate(CybCoordinateC*);
00122   void SetTextureCoordinate(CybTextureCoordinateC*);
00123   void SetNormal(CybNormalC*);
00124   void SetColor(CybColorC*);
00125 private:
00126   void InitDefaultNormals();
00127   void InitIndexedFaces();
00128   void InitIndexedVertices();
00129   void CalcNumberOfFaces();
00130   VectorC CalcNormalOfNextFace(long&);
00131   void InvertOrderOfCoordIndices();
00132   void SmoothCreases();
00133   void SeparateTriangleStrips();
00134   void AddTriangleStripOfFace(long, long&, long&, CybIndexedTriangleStripC&);
00135   void GetTriangleStrip(long, long, CybIndexedTriangleStripC&, KetteC<long>&);
00136 
00137   //void InitIndexedLines();
00138   //long FaceOfBorder(long,long);
00139 protected: 
00140   
00141   CybCoordinateC*         m_pCoord;
00142   CybNormalC*             m_pNormal;
00143   CybColorC*              m_pColor;
00144   CybTextureCoordinateC*  m_pTexCoord;
00145   
00146   MFInt32 m_indexNormal;
00147   MFInt32 m_indexCoord;
00148   MFInt32 m_indexColor;
00149   MFInt32 m_indexTexCoord;
00150 
00151   long* m_indexNormalBuf;
00152   long* m_indexCoordBuf;
00153   long* m_indexColorBuf;
00154   long* m_indexTexCoordBuf;
00155 
00156   long m_numberOfCoordIndicesBuf;
00157   long m_numberOfNormalIndicesBuf;
00158   long m_numberOfColorIndicesBuf;    
00159   long m_numberOfTexCoordIndicesBuf; 
00160 
00161   long m_copyEventCoordBufState;
00162   long m_copyEventTexCoordBufState;
00163   long m_copyEventColorBufState;
00164   long m_copyEventNormalBufState;
00165 
00166   short m_bIndexUpdate;
00167   short m_bDefaultNormals;
00168   short m_bCoordUpdate;
00169   short m_bColorUpdate;
00170   short m_bTexCoordUpdate;
00171   short m_bNormalUpdate;
00172 
00173   long m_recalcNormalCount;
00174 
00175   int   m_normalPerVertex;
00176   int   m_colorPerVertex;
00177   int   m_ccw;
00178   int   m_convex;
00179   int   m_solid;
00180   
00181   int   m_ezmax;
00182 
00183   long m_numberOfFaces;
00184   long m_anzahlvertices;
00185   
00186   int   m_triangleStrip;
00187 
00188   double m_creaseAngle;
00189                         
00190   short   m_bStatic;
00191 
00192   CybIndexedFaceC*    m_indexedFace;
00193   CybIndexedVertexC*    m_indexedVertex;
00194 
00195   //überflüssig
00196   //long* m_indexLine;
00197   //long m_numberOfLines; 
00198 };
00199 
00200 
00201 class OAW_DLLMAPPING CybIndexedFaceC
00202 {
00203 public: 
00204   CybIndexedFaceC();
00205   virtual ~CybIndexedFaceC();
00206   CybIndexedFaceC(const CybIndexedFaceC& n);
00207   CybIndexedFaceC& operator = (const CybIndexedFaceC&);  
00208   void UpdateNormal();
00209   void SetIndexedFaceSet(CybIndexedFaceSetC* pS){m_pSet=pS;}
00210 public:
00211   long* m_indexCoord;
00212   long* m_indexTexCoord;
00213   long* m_indexColor;
00214   long* m_indexNormal;
00215   int m_numberOfCorner;
00216   CybIndexedFaceSetC* m_pSet;
00217   VectorC m_normal;
00218   long m_index;
00219   int m_flag;
00220 };
00221 
00222 
00223 class OAW_DLLMAPPING CybIndexedVertexC
00224 {
00225 public:
00226   CybIndexedVertexC(){m_pSet=0;}
00227   void SetIndexedFaceSet(CybIndexedFaceSetC* pS){m_pSet=pS;}
00228 public:
00229   KetteC<long> m_kindexFace;
00230   long m_index;
00231 protected:
00232   CybIndexedFaceSetC* m_pSet;
00233 };
00234 
00235 class OAW_DLLMAPPING CybIndexedTriangleStripC
00236 {
00237 public:
00238   CybIndexedTriangleStripC(){m_pSet=0;}
00239   void SetIndexedFaceSet(CybIndexedFaceSetC* pS){m_pSet=pS;} 
00240   void Empty();
00241   CybIndexedTriangleStripC& operator = (const CybIndexedTriangleStripC&);
00242 public:
00243   KetteC<long> m_kindexCoord;
00244   KetteC<long> m_kindexNormal;
00245   KetteC<long> m_kindexColor;
00246   KetteC<long> m_kindexTexCoord;
00247 protected:
00248   CybIndexedFaceSetC* m_pSet;  
00249 };
00250 
00251 
00253 
00254 /*
00255 void GetTriangleStrip(KettenElementC< KetteC<long> >* zgmin,
00256           KettenElementC<long>* zstart,
00257           KetteC< KetteC<long> >& kfl, 
00258           KetteC<long>& kstripe,
00259           KetteC< KettenElementC< KetteC<long> >* >& kv
00260           );
00261           */
00262 
00263 OAW_END_NAMESPACE
00264 
00265 #endif
00266 
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 

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