Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreRefAppOgreHead.cpp

Go to the documentation of this file.
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 "OgreRefAppOgreHead.h"
00026 #include "OgreRefAppWorld.h"
00027 
00028 namespace OgreRefApp
00029 {
00030 
00031     //-------------------------------------------------------------------------
00032     OgreHead::OgreHead(const String& name) : ApplicationObject(name)
00033     {
00034         setUp(name);
00035     }
00036     //-------------------------------------------------------------------------
00037     OgreHead::~OgreHead()
00038     {
00039 
00040     }
00041     //-------------------------------------------------------------------------
00042     void OgreHead::setUp(const String& name)
00043     {
00044         // Create visual presence
00045         SceneManager* sm = World::getSingleton().getSceneManager();
00046         mEntity = sm->createEntity(name, "OgreHead.mesh");
00047         mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name);
00048         mSceneNode->attachObject(mEntity);
00049         // Add reverse reference
00050         mEntity->setUserObject(this);
00051 
00052         // Create mass body
00053         mOdeBody = new dBody(World::getSingleton().getOdeWorld()->id());
00054         // Set reverse reference
00055         mOdeBody->setData(this);
00056         // Set mass 
00057         setMassSphere(0.1, 25); // TODO change to more realistic values
00058 
00059         this->setBounceParameters(0.3, 0.1);
00060         this->setSoftness(0.0f);
00061         this->setFriction(Math::POS_INFINITY);
00062 
00063         // Create collision proxy
00064         dSphere* odeSphere = new dSphere(0, 25);
00065         mCollisionProxies.push_back(odeSphere);
00066         updateCollisionProxies();
00067 
00068 
00069     }
00070 
00071 
00072 }

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:38 2004