⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oasisproxies.cpp

📁 使用stl技术,(还没看,是听说的)
💻 CPP
字号:
/******************************************************************************

 * This source file is part of Bad Camel Gaming

 * Copyright (C) 2003  Zephie Greyvenstein

 * See Readme.html for acknowledgements

 *

 * This library is free software; you can redistribute it and/or

 * modify it under the terms of the GNU Lesser General Public

 * License as published by the Free Software Foundation; either

 * version 2.1 of the License, or (at your option) any later version.

 *

 * This library is distributed in the hope that it will be useful,

 * but WITHOUT ANY WARRANTY; without even the implied warranty of

 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU

 * Lesser General Public License for more details.

 *

 * You should have received a copy of the GNU Lesser General Public

 * License along with this library; if not, write to the Free Software

 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 *****************************************************************************/



/******************************************************************************

 * FILENAME    : oasisProxies.cpp

 * DESCRIPTION : Define the different proxies

 * AUTHOR      : Zephie Greyvenstein

 *****************************************************************************/



#include "oasisProxies.h"

#include "oasisPhysicsCommon.h"



namespace Oasis {

  

  boxProxy::boxProxy( const dSpace *space,

          real newLength,

          real newHeight,

          real newDepth ) : proxy( PT_BOX ) {

    odeProxy = new dBox( space->id( ), newLength, newHeight, newDepth );

    setEnabled( false );

   

    length = newLength;

    height = newHeight;

    depth = newDepth;

  }



  boxProxy::~boxProxy( ) {

    

  }

 

  const real boxProxy::getLength( void ) const {

    return length;

  }



  const real boxProxy::getHeight( void ) const {

    return height;

  }

  

  const real boxProxy::getDepth( void ) const {

    return depth;

  }

    

  void boxProxy::setBox( real newLength, real newHeight, real newDepth ) {

    dBox *box = static_cast< dBox* >( odeProxy );

   

    box->setLengths( newLength, newHeight, newDepth );



    length = newLength;

    height = newHeight;

    depth = newDepth;  

  }



  void boxProxy::copyParameters( const boxProxy *otherProxy ) {  

    setOffset( otherProxy->getOffset( ), true );

    setBox( otherProxy->getLength( ), 

      otherProxy->getHeight( ),

      otherProxy->getDepth( ) );

  }



  sphereProxy::sphereProxy( const dSpace *space,

          real newRadius ) : proxy( PT_SPHERE ) {

    odeProxy = new dSphere( space->id( ), newRadius );

    setEnabled( false );



    radius = newRadius;

  }

  

  sphereProxy::~sphereProxy( ) {

    

  }

  

  const real sphereProxy::getRadius( void ) const {

    return radius;

  }

  

  void sphereProxy::setSphere( real newRadius ) {

    dSphere *sphere = static_cast< dSphere* >( odeProxy );



    sphere->setRadius( newRadius );



    radius = newRadius;

  }



  void sphereProxy::copyParameters( const sphereProxy *otherProxy ) {

    setOffset( otherProxy->getOffset( ), true );

    setSphere( otherProxy->getRadius( ) );

  }



  ccylinderProxy::ccylinderProxy( const dSpace *space,

          real newRadius, 

          real newLength ) : proxy( PT_CCYLINDER ) {

    odeProxy = new dCCylinder( space->id( ), newRadius, newLength );

    setEnabled( false );



    radius = newRadius;

    length = newLength;

  }

  

  ccylinderProxy::~ccylinderProxy( ) {

    

  }



  const real ccylinderProxy::getRadius( void ) const {

    return radius;

  }



  const real ccylinderProxy::getLength( void ) const {

    return length;

  }



  void ccylinderProxy::setCCylinder( real newRadius, real newLength ) {

    dCCylinder *ccylinder = static_cast< dCCylinder* >( odeProxy );

    

    ccylinder->setParams( newRadius, newLength );



    radius = newRadius;

    length = newLength;

  } 



  void ccylinderProxy::copyParameters( const ccylinderProxy *otherProxy ) {

    setOffset( otherProxy->getOffset( ), true );

    setCCylinder( otherProxy->getRadius( ), otherProxy->getLength( ) );

  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -