00001 /* 00002 Copyright (C) 1999 Carsten Winkelholz 00003 00004 Malte Weiß, 19.07.2002: Event handling implemented. 00005 00006 Address: FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V. 00007 Neuenahrer Str. 20 00008 D - 53343 Wachtberg 00009 00010 Email: winkelholz@fgan.de 00011 00012 This program is free software; you can redistribute it and/or 00013 modify it under the terms of the GNU General Public License 00014 as published by the Free Software Foundation; either version 2 00015 of the License, or (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; if not, write to the Free Software 00024 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00025 */ 00026 00027 00028 #ifndef CYBTRANSFORMC_H 00029 #define CYBTRANSFORMC_H 00030 00031 #include <math.h> 00032 #include <stdio.h> 00033 #include <fstream> 00034 00035 #include "oaw/ctk/cybgroupc.h" 00036 #include "oaw/ctk/cybwrlfields.h" 00037 #include "oaw/misc/matrixc.h" 00038 #include "oaw/misc/vectorc.h" 00039 #include "oaw/misc/quaternionc.h" 00040 #include "oaw/misc/stringc.h" 00041 #include "oaw/misc/arrayc.h" 00042 //#include <gl/gl.h> 00043 #include "../oawconfig.h" 00044 00045 OAW_BEGIN_NAMESPACE 00046 00047 00048 #define TRUE 1 00049 #define FALSE 0 00050 00051 00053 // CybNodeC class 00055 00056 class OAW_DLLMAPPING CybTransformC : public CybGroupC 00057 { 00058 // Attributes 00059 protected: 00060 int m_scaleFlag; 00061 00062 SFVec3f m_vCenter; 00063 SFRotation m_rRotation; 00064 QuaternionC m_rQuatRot; 00065 SFVec3f m_vScale; 00066 SFRotation m_rScaleOrientation; 00067 SFVec3f m_vTranslation; 00068 00069 Matrix4C m_T; 00070 Matrix4C m_R; 00071 Matrix4C m_S; 00072 Matrix4C m_SR; 00073 Matrix4C m_mC; 00074 Matrix4C m_C; 00075 Matrix4C m_M; 00076 00077 Matrix4C m_TmpR; 00078 Matrix4C m_TmpT; 00079 00080 public: 00081 CybTransformC(CybWorldC*); 00082 virtual ~CybTransformC(); 00083 CybTransformC(const CybTransformC&); 00084 CybTransformC& operator = (const CybTransformC&); 00085 00086 Matrix4C GetTransformMatrix(){return m_M;} 00087 virtual void SetTransformMatrix(Matrix4C m){m_M = m;} 00088 00089 void InitOM(); 00090 virtual void LoadVRML(char*&, const char*,long&); 00091 00092 // Set values 00093 virtual void SetTranslation(const SFVec3f&); 00094 virtual void SetCenter(const SFVec3f&); 00095 virtual void SetScale(const SFVec3f&); 00096 virtual void SetRotation(const SFRotation&); 00097 virtual void SetScaleOrientation(const SFRotation&); 00098 00099 // Retrieve values 00100 inline virtual SFVec3f GetTranslation() { return m_vTranslation; } 00101 inline virtual SFVec3f GetCenter() { return m_vCenter; } 00102 inline virtual SFVec3f GetScale() { return m_vScale; } 00103 inline virtual SFRotation GetRotation() { return m_rRotation; } 00104 inline virtual SFRotation GetScaleOrientation() { return m_rScaleOrientation; } 00105 00106 virtual void ToChannel(CybChannelC*,long flag); 00107 00108 virtual void SetEvent(long,const void*, BaseI*); 00109 virtual short GetFieldData(long,void* data); 00110 virtual long GetFieldEventID(const char*); 00111 virtual long GetFieldDataType(long); 00112 00113 protected: 00114 virtual void SetQuatRot(const SFRotation&); 00115 virtual void CreateNewCopy(CybNodeC*); 00116 virtual void UpdateBInfo(); 00117 private: 00118 static char VRMLKeyStrList[][30]; 00119 }; 00120 00121 OAW_END_NAMESPACE 00122 00123 00124 #endif 00125 00126 00127 00128 00129 00130 00131 00132
1.3-rc2