00001 00002 /* 00003 TEDDY - General graphics application library 00004 Copyright (C) 1999-2002 Timo Suoranta 00005 tksuoran@cc.helsinki.fi 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 $Id: LWInstance.h,v 1.1 2002/02/16 12:41:39 tksuoran Exp $ 00022 */ 00023 00024 00025 #ifndef TEDDY__IMPORTS__LW_INSTANCE__H 00026 #define TEDDY__IMPORTS__LW_INSTANCE__H 00027 00028 00029 #include "Teddy/TeddyConfig.h" 00030 #if defined( TEDDY_INCLUDE_LW_SCENE ) 00031 00032 00033 #if defined(_MSC_VER) 00034 #pragma warning(disable:4786) 00035 #endif 00036 00037 00038 #include "Teddy/Maths/Vector.h" 00039 #include "Teddy/Models/Model.h" 00040 #include "Teddy/SysSupport/StdMap.h" 00041 using namespace Teddy::Maths; 00042 using namespace Teddy::Models; 00043 00044 00045 namespace Teddy { 00046 namespace Imports { 00047 00048 00049 class LWBone; 00050 class LWModel; 00051 class LWMotion; 00052 00053 00054 typedef std::map<int, LWBone*> int_to_LWBone; 00055 00056 00057 #define LWI_VISIBILITY_HIDDEN 0 00058 #define LWI_VISIBILITY_BOUNDING_BOX 1 00059 #define LWI_VISIBILITY_VERTICES_ONLY 2 00060 #define LWI_VISIBILITY_WIREFRAME 3 00061 #define LWI_VISIBILITY_FRONT_FACE_WIREFRAME 4 00062 #define LWI_VISIBILITY_SHADED_SOLID 5 00063 #define LWI_VISIBILITY_TEXTURED_SHADED_SOLID 6 00064 00065 00066 class LWInstance { 00067 public: 00068 LWInstance(); 00069 00070 void add ( LWBone *bone ); 00071 LWBone *getBone ( int bone_num ); 00072 void setModel ( Model *mi ); 00073 Model *getModel (); 00074 void setModelName ( const std::string &model_name ); 00075 std::string &getModelName (); 00076 LWMotion *getMotion (); 00077 void setMotion ( LWMotion *motion ); 00078 void setVisibility ( int visibility ); 00079 void setColor ( int color ); 00080 void setParentObjectId( unsigned long parent_object_id ); 00081 unsigned long getParentObjectId(); 00082 Vector &evalPosition ( float time ); 00083 Matrix &evalRotation ( float time ); 00084 Vector &evalPivot ( float time ); 00085 void setTime ( float time ); 00086 void setPivotPosition ( Vector pivot_position ); 00087 void setParentObject ( LWInstance *parent ); 00088 00089 protected: 00090 unsigned long parent_object_id; 00091 LWInstance *parent_object; 00092 LWMotion *motion; 00093 Model *model; 00094 std::string model_name; 00095 int_to_LWBone bones; 00096 int next_bone; 00097 int visibility; // old refresh value 00098 int color; 00099 float last_po_time; 00100 float last_ro_time; 00101 float last_pi_time; 00102 Vector pivot_position; 00103 Vector last_position; 00104 Matrix last_rotation; 00105 Vector last_pivot; 00106 }; 00107 00108 00109 }; // namespace Imports 00110 }; // namespace Teddy 00111 00112 00113 #endif // TEDDY_INCLUDE_LW_SCENE 00114 #endif // TEDDY__IMPORTS__LW_INSTANCE_H 00115