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

OgreRefAppJointSubtypes.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 "OgreRefAppJointSubtypes.h"
00026 #include "OgreRefAppWorld.h"
00027 
00028 namespace OgreRefApp {
00029 
00030     //-------------------------------------------------------------------------
00031     BallJoint::BallJoint(Joint::JointType jtype, ApplicationObject* obj1, ApplicationObject* obj2)
00032         : Joint(jtype)
00033     {
00034         mOdeJoint = new dBallJoint(World::getSingleton().getOdeWorld()->id());
00035         setAttachments(obj1, obj2);
00036     }
00037     //-------------------------------------------------------------------------
00038     void BallJoint::setAnchorPosition(const Vector3& point)
00039     {
00040         dBallJoint* ballJoint = static_cast<dBallJoint*>(mOdeJoint);
00041 
00042         ballJoint->setAnchor(point.x, point.y, point.z);
00043         mAnchor = point;
00044     }
00045     //-------------------------------------------------------------------------
00046     //-------------------------------------------------------------------------
00047     SliderJoint::SliderJoint(Joint::JointType jtype, ApplicationObject* obj1, ApplicationObject* obj2)
00048         : Joint(jtype)
00049     {
00050         mOdeJoint = new dSliderJoint(World::getSingleton().getOdeWorld()->id());
00051         setAttachments(obj1, obj2);
00052 
00053     }
00054     //-------------------------------------------------------------------------
00055     void SliderJoint::setAxes(const Vector3& a1, const Vector3& na)
00056     {
00057         dSliderJoint* sliderJoint = static_cast<dSliderJoint*>(mOdeJoint);
00058         sliderJoint->setAxis(a1.x, a1.y, a1.z);
00059         mAxes.first = a1;
00060 
00061     }
00062     //-------------------------------------------------------------------------
00063     //-------------------------------------------------------------------------
00064     HingeJoint::HingeJoint(Joint::JointType jtype, ApplicationObject* obj1, ApplicationObject* obj2)
00065         : Joint(jtype)
00066     {
00067         mOdeJoint = new dHingeJoint(World::getSingleton().getOdeWorld()->id());
00068         setAttachments(obj1, obj2);
00069     }
00070     //-------------------------------------------------------------------------
00071     void HingeJoint::setAnchorPosition(const Vector3& point)
00072     {
00073         dHingeJoint* hinge = static_cast<dHingeJoint*>(mOdeJoint);
00074         hinge->setAnchor(point.x, point.y, point.z);
00075         mAnchor = point;
00076     }
00077     //-------------------------------------------------------------------------
00078     void HingeJoint::setAxes(const Vector3& a1, const Vector3& na)
00079     {
00080         dHingeJoint* hinge = static_cast<dHingeJoint*>(mOdeJoint);
00081         hinge->setAxis(a1.x, a1.y, a1.z);
00082         mAxes.first = a1;
00083     }
00084     //-------------------------------------------------------------------------
00085     //-------------------------------------------------------------------------
00086     UniversalJoint::UniversalJoint(Joint::JointType jtype, ApplicationObject* obj1, ApplicationObject* obj2)
00087         : Joint(jtype)
00088     {
00089         mOdeJoint = new dUniversalJoint(World::getSingleton().getOdeWorld()->id());
00090         setAttachments(obj1, obj2);
00091     }
00092     //-------------------------------------------------------------------------
00093     void UniversalJoint::setAnchorPosition(const Vector3& point)
00094     {
00095         dUniversalJoint* univ = static_cast<dUniversalJoint*>(mOdeJoint);
00096         univ->setAnchor(point.x, point.y, point.z);
00097         mAnchor = point;
00098     }
00099     //-------------------------------------------------------------------------
00100     void UniversalJoint::setAxes(const Vector3& a1, const Vector3& a2)
00101     {
00102         dUniversalJoint* univ = static_cast<dUniversalJoint*>(mOdeJoint);
00103         univ->setAxis1(a1.x, a1.y, a1.z);
00104         univ->setAxis2(a2.x, a2.y, a2.z);
00105         mAxes.first = a1;
00106         mAxes.second = a2;
00107     }
00108     //-------------------------------------------------------------------------
00109     //-------------------------------------------------------------------------
00110     Hinge2Joint::Hinge2Joint(Joint::JointType jtype, ApplicationObject* obj1, ApplicationObject* obj2)
00111         : Joint(jtype)
00112     {
00113         mOdeJoint = new dHinge2Joint(World::getSingleton().getOdeWorld()->id());
00114         setAttachments(obj1, obj2);
00115     }
00116     //-------------------------------------------------------------------------
00117     void Hinge2Joint::setAnchorPosition(const Vector3& point)
00118     {
00119         dHinge2Joint* hinge = static_cast<dHinge2Joint*>(mOdeJoint);
00120         hinge->setAnchor(point.x, point.y, point.z);
00121         mAnchor = point;
00122     }
00123     //-------------------------------------------------------------------------
00124     void Hinge2Joint::setAxes(const Vector3& a1, const Vector3& a2)
00125     {
00126         dHinge2Joint* hinge = static_cast<dHinge2Joint*>(mOdeJoint);
00127         hinge->setAxis1(a1.x, a1.y, a1.z);
00128         hinge->setAxis2(a2.x, a2.y, a2.z);
00129         mAxes.first = a1;
00130         mAxes.second = a2;
00131     }
00132 
00133 
00134 
00135 }

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:24 2004