Sion Tower (demo técnica) 0.1
|
00001 /* 00002 * This file is part of SionTower. 00003 * 00004 * 00005 * David Saltares Márquez (C) 2011 00006 * <david.saltares@gmail.com> 00007 * 00008 * 00009 * SionTower examples are free software: you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License ad 00011 * published by the Free Software Foundation, either version 3 of the 00012 * License, or (at your option) ant later version. 00013 * 00014 * SionTower examples are distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with SionTower examples. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 00023 #ifndef SIONTOWER_TRUNK_SRC_INCLUDE_BODY_H_ 00024 #define SIONTOWER_TRUNK_SRC_INCLUDE_BODY_H_ 00025 00026 #include <vector> 00027 00028 #include <OGRE/Ogre.h> 00029 00030 class Shape; 00031 class GameObject; 00032 00034 00035 00080 class Body { 00081 public: 00091 Body(GameObject* gameObject, 00092 const std::vector<Shape*>& shapes, 00093 const Ogre::Vector3& position = Ogre::Vector3::ZERO, 00094 const Ogre::Vector3& scale = Ogre::Vector3::UNIT_SCALE, 00095 const Ogre::Quaternion& orientation = Ogre::Quaternion::IDENTITY, 00096 int type = 0); 00097 00106 Body(GameObject* gameObject = 0, 00107 const Ogre::Vector3& position = Ogre::Vector3::ZERO, 00108 const Ogre::Vector3& scale = Ogre::Vector3::UNIT_SCALE, 00109 const Ogre::Quaternion& orientation = Ogre::Quaternion::IDENTITY, 00110 int type = 0); 00111 00118 ~Body(); 00119 00123 GameObject* getGameObject(); 00124 00128 void setGameObject(GameObject* gameObject); 00129 00133 const std::vector<Shape*> getShapes() const; 00134 00139 const std::vector<Shape*> getWorldSpaceShapes() const; 00140 00147 void addShape(Shape* shape); 00148 00157 bool removeShape(Shape* shape); 00158 00167 bool removeShape(const Ogre::String& name); 00168 00172 Ogre::Matrix4 getTransform() const; 00173 00177 void setTransform(const Ogre::Matrix4& transform); 00178 00182 const Ogre::Vector3& getPosition() const; 00183 00187 void setPosition(const Ogre::Vector3& position); 00188 00192 const Ogre::Vector3& getScale() const; 00193 00197 void setScale(const Ogre::Vector3& scale); 00198 00202 const Ogre::Quaternion& getOrientation() const; 00203 00207 void setOrientation(const Ogre::Quaternion& orientation); 00208 00212 int getType() const; 00213 00218 void setType(int type); 00219 00228 static bool getCollision(Body* bodyA, Body* bodyB); 00229 private: 00230 GameObject* _gameObject; 00231 std::vector<Shape*> _shapes; 00232 std::vector<Shape*> _worldShapes; 00233 Ogre::Vector3 _position; 00234 Ogre::Vector3 _scale; 00235 Ogre::Quaternion _orientation; 00236 int _type; 00237 00238 void updateWorldShapes(); 00239 void createWorldShapes(); 00240 }; 00241 00242 00243 #endif // SIONTOWER_TRUNK_SRC_INCLUDE_BODY_H_ 00244