📄 oasismovable.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 : oasisMovable.h
* DESCRIPTION : If it moves, kick it
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
/// Avoid double inclusion
#ifndef __MOVABLE_H__
#define __MOVABLE_H__
/// Include common stuff
#include "oasisCommon.h"
/// Include the rest of the needed oasis stuff
#include "oasisVector3.h"
#include "oasisQuaternion.h"
namespace Oasis {
/// A movable object
class _oasisExport movable {
public:
/// Constructor
movable( );
/// Destructor
virtual ~movable( );
/// Set the position
void setPosition( real x, real y, real z );
/// Set the position
virtual void setPosition( const vector3 &position );
/// Get the position
const vector3 &getPosition( void ) const;
/// Move the object
void move( real x, real y, real z );
/// Move the object
void move( const vector3 &moveVector );
/// Move the object relative to the axis
void moveRelative( real x, real y, real z );
/// Move the object relative to the axis
void moveRelative( const vector3 &moveVector );
/// Rotate object
void rotate( real x, real y, real z, real degrees );
/// Rotate object
void rotate( const vector3 &axis, real degrees );
/// Rotate object
void rotate( const quaternion &rotation );
/// Set the orientation of this object
virtual void setOrientation( const quaternion &newOrientation );
/// Get orientation of this object
const quaternion &getOrientation( void ) const;
/// Get the direction vector of the movable
vector3 getDirection( void ) const;
protected:
/// The position of the object
vector3 position;
/// The orientation of the object
quaternion orientation;
/// If a position change happens, this will be triggered
virtual void _updatePosition( void ) = 0;
/// If an orientation change happens, this will be triggered
virtual void _updateOrientation( void ) = 0;
};
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -