00001 /* -*- mode: c++ -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2003 Koblenz University 00006 $Id: world.cpp,v 1.5 2004/03/22 10:59:02 rollmark Exp $ 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; version 2 of the License. 00011 00012 This program 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 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 00022 #include "world.h" 00023 00024 using namespace oxygen; 00025 using namespace salt; 00026 00027 World::World() : mODEWorld(0) 00028 { 00029 } 00030 00031 World::~World() 00032 { 00033 // release the ODE world 00034 if (mODEWorld) 00035 { 00036 dWorldDestroy(mODEWorld); 00037 mODEWorld = 0; 00038 } 00039 } 00040 00041 dWorldID World::GetODEWorld() const 00042 { 00043 return mODEWorld; 00044 } 00045 00046 void World::SetGravity(const Vector3f& gravity) 00047 { 00048 dWorldSetGravity(mODEWorld, 00049 gravity.x(), 00050 gravity.y(), 00051 gravity.z() 00052 ); 00053 } 00054 00055 void World::SetERP(float erp) 00056 { 00057 dWorldSetERP(mODEWorld, erp); 00058 } 00059 00060 float World::GetERP() const 00061 { 00062 return dWorldGetERP(mODEWorld); 00063 } 00064 00065 void World::SetCFM(float cfm) 00066 { 00067 dWorldSetCFM(mODEWorld, cfm); 00068 } 00069 00070 float World::GetCFM() const 00071 { 00072 return dWorldGetCFM(mODEWorld); 00073 } 00074 00075 void World::Step(float deltaTime) 00076 { 00077 dWorldStep(mODEWorld, deltaTime); 00078 } 00079 00080 bool World::ConstructInternal() 00081 { 00082 // create an ode world 00083 mODEWorld = dWorldCreate(); 00084 00085 return (mODEWorld != 0); 00086 }