00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of the OGRE Reference Application, a layer built 00004 on top of OGRE(Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #include "OgreRefAppPlane.h" 00026 #include "OgreRefAppWorld.h" 00027 00028 namespace OgreRefApp 00029 { 00030 //------------------------------------------------------------------------- 00031 FinitePlane::FinitePlane(const String& name, Real width, Real height) : ApplicationObject(name) 00032 { 00033 mWidth = width; 00034 mHeight = height; 00035 setUp(name); 00036 } 00037 //------------------------------------------------------------------------- 00038 FinitePlane::~FinitePlane() 00039 { 00040 00041 } 00042 //------------------------------------------------------------------------- 00043 void FinitePlane::setUp(const String& name) 00044 { 00045 // Create visual presence 00046 SceneManager* sm = World::getSingleton().getSceneManager(); 00047 mEntity = sm->createEntity(name, "Prefab_Plane"); 00048 mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name); 00049 mSceneNode->attachObject(mEntity); 00050 // Add reverse reference 00051 mEntity->setUserObject(this); 00052 00053 // Default plane is 100x100 00054 mSceneNode->scale(mWidth / 100.0f, mHeight / 100.0f, 1.0); 00055 00056 // No mass body (considered static) 00057 00058 // Create collision proxy 00059 // SpaceID is irrelevant, we're doing our own spacial partitioning 00060 00061 // WARNING: an ODE dPlane seems to barf badly when you setPosition on it! Use a box. 00062 // The other benefit here is that it reflects the width / height of the plane, not infinite 00063 dBox* odeBox = new dBox(0, mWidth*2, mHeight*2, 1); 00064 mCollisionProxies.push_back(odeBox); 00065 updateCollisionProxies(); 00066 00067 00068 00069 } 00070 00071 }
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:38 2004