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

📄 oasisjoints.h

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

 * 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    : oasisJoints.h

 * DESCRIPTION : Define the different joints

 * AUTHOR      : Zephie Greyvenstein

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



/// Avoid double inclusion

#ifndef __JOINTS_H__

#define __JOINTS_H__



/// Include common stuff

#include "oasisCommon.h"

/// Include the rest of the needed oasis stuff

#include "oasisJoint.h"



/// Forward declare ODE stuff

struct dWorld;



namespace Oasis {

  /// Ball joint

  class _oasisExport ballJoint : public joint {

  public:

    /// Constructor

    ballJoint( const dWorld *worldParent,

	       physics *first,

	       physics *second );

    /// Deconstructor

    ~ballJoint( );



    /// Set the anchor position for the ball joint

    void setAnchorPosition( const vector3 &origin );



    /// Sets the axes for the joint, which is meaningless for this joint

    void setAxes( const vector3 &primary,

		  const vector3 &secondary = vector3::ZERO ) {}



    /// Sets a parameter, meaningless here

    void setParameter( JointParam param, real value ) {}

    /// Gets a paramater, meaningless here

    const real getParameter( JointParam param ) { return 0; }



    /// Get the angle of a axis

    const real getAxisAngle( JointAxis axis ) const { return 0; }

  };



  /// Slider joint

  class _oasisExport sliderJoint : public joint {

  public:

    /// Constructor

    sliderJoint( const dWorld *worldParent,

		 physics *first,

		 physics *second );

    /// Deconstructor

    ~sliderJoint( );



    /// Set the anchor position, which is meaningless for this joint

    void setAnchorPosition( const vector3 &origin ) {}



    /// Sets the axes for the joint

    void setAxes( const vector3 &primary,

		  const vector3 &secondary = vector3::ZERO );



    /// Sets a parameter

    void setParameter( JointParam param, real value );

    /// Gets a paramater

    const real getParameter( JointParam param );



    /// Get the angle of a axis

    const real getAxisAngle( JointAxis axis ) const { return 0; }

  };



  /// Hinge joint

  class _oasisExport hingeJoint : public joint {

  public:

    /// Constructor

    hingeJoint( const dWorld *worldParent,

		physics *first, 

		physics *second );

    /// Deconstructor

    ~hingeJoint( );



    /// Set the anchor position

    void setAnchorPosition( const vector3 &origin );



    /// Sets the axes for the joint

    void setAxes( const vector3 &primary,

		  const vector3 &secondary = vector3::ZERO );



    /// Sets a parameter

    void setParameter( JointParam param, real value );

    /// Gets a paramater

    const real getParameter( JointParam param );

    

    /// Get the angle of a axis

    const real getAxisAngle( JointAxis axis ) const;

  };  



  /// Hinge2 joint

  class _oasisExport hinge2Joint : public joint {

  public:

    /// Constructor

    hinge2Joint( const dWorld *worldParent,

		 physics *first, 

		 physics *second );

    /// Deconstructor

    ~hinge2Joint( );



    /// Set the anchor position

    void setAnchorPosition( const vector3 &origin );



    /// Sets the axes for the joint

    void setAxes( const vector3 &primary,

		  const vector3 &secondary = vector3::ZERO );



    /// Sets a parameter

    void setParameter( JointParam param, real value );

    /// Gets a paramater

    const real getParameter( JointParam param );



    /// Get the angle of a axis

    const real getAxisAngle( JointAxis axis ) const;

  };  



  /// Universal joint

  class _oasisExport universalJoint : public joint {

  public:

    /// Constructor

    universalJoint( const dWorld *worldParent,

		    physics *first, 

		    physics *second );

    /// Deconstructor

    ~universalJoint( );



    /// Set the anchor position

    void setAnchorPosition( const vector3 &origin );



    /// Sets the axes for the joint

    void setAxes( const vector3 &primary,

		  const vector3 &secondary = vector3::ZERO );



    /// Sets a parameter

    void setParameter( JointParam param, real value );

    /// Gets a paramater

    const real getParameter( JointParam param );



    /// Get the angle of a axis

    const real getAxisAngle( JointAxis axis ) const { return 0; }

  };

};



#endif

⌨️ 快捷键说明

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