00001 /* -*- C++ -*- */ 00002 00003 /* COPYRIGHT 00004 * 00005 * This file is part of the Visual Effects Engine - VEE 00006 * 00007 * Read the "VEE-LICENSE" file for the license. 00008 * 00009 * Authors & Copyright: 00010 * 00011 * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 00012 * Janne Kontkanen 2001-2004 00013 * 00014 * Additional copyrights: Tekes 2003-2004 00015 * 00016 * firstname.lastname@hut.fi 00017 * 00018 */ 00019 00020 #ifndef VEE_OPCODE_COLLISION_H 00021 #define VEE_OPCODE_COLLISION_H 00022 00023 #include <vee_object.h> 00024 00025 #include <vee_matrix4.h> 00026 00027 #include <Opcode.h> 00028 #include <OPC_RayCollider.h> 00029 00030 #include <vector> 00031 00032 class VEE_BoundingBox; 00033 00036 class VEE_OpcodeCollision : public VEE_Object 00037 { 00038 public: 00039 VEE_OpcodeCollision(); 00040 virtual ~VEE_OpcodeCollision(); 00041 00042 virtual bool setValue(const char *, VEE_Value *); 00043 virtual VEE_Variable getVariable(const char *) const; 00044 virtual void update(float); 00045 00046 virtual void render(VEE_Renderer *); 00047 virtual VEE_Object * clone() const; 00048 00049 bool loadModel(const char *file); 00050 00051 protected: 00052 00053 void recursiveImpact(VEE_SceneBox *scene, VEE_BoundingBox *bb); 00054 00055 struct Triangle { int m_indices[3]; }; 00056 00057 float m_scale; 00058 VEE_Matrix3 m_rotation; 00059 VEE_Matrix4 m_opcMatrix; 00060 float m_bounce; 00061 float m_drag; 00062 00063 Opcode::OPCODECREATE m_opcCreate; 00064 Opcode::MeshInterface m_meshinterface; 00065 Opcode::CollisionFaces m_collisionFaces; 00066 Opcode::RayCollider m_rayCollider; 00067 Opcode::Model m_opcModel; 00068 00069 std::vector<VEE_Vector3> m_vertices; 00070 std::vector<VEE_Vector3> m_normals; 00071 std::vector<Triangle> m_triangles; 00072 00073 float m_dt; 00074 }; 00075 00076 #endif