/* * PVVMUD a 3D MUD * Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef _WORLDOBJECT_H #define _WORLDOBJECT_H #include "worldhierarchy.H" #include "position.H" #include "direction.H" #include "bbox.H" #include "bsdtree.H" #include "matrix.H" #include "doublearray.H" #include "beam.H" #include "geometry.H" #include "cellpvs.H" class CWorldWorld; class CWorldObject : public CWorldHierarchy { friend class CWAUpdatePosition; friend class CWAUpdateDirection; friend class CWACreateObject; friend class CWARotate; ////////////////////////////////////////////////////// // Visual atributes DWORD m_geometryId; CPosition m_position; CDirection m_direction; ////////////////////////////////////////////////////// // Physical atributes BYTE m_collidable; CBBox * m_bBox; CBSDTree * m_BSDTree; ////////////////////////////////////////////////////// // Hierarchical atributes CCellPVS * m_cellPVS; public: ////////////////////////////////////////////////////// // Constructor and destructor CWorldObject(DWORD objectId, CWorldHierarchy * parent, DWORD geometryId, const CPosition & position, const CDirection & direction); virtual ~CWorldObject(); ////////////////////////////////////////////////////// // Visual functions virtual CGeometry * getGeometry(); DWORD getGeometryId(); CPosition & getPosition(); CDirection & getDirection(); virtual void updatePosition( const CPosition & position ); virtual void updateDirection( const CDirection & direction ); virtual void rotate( const CDirection & angleSpeed ); private: void _updatePosition( const CPosition & position ); void _updateDirection( const CDirection & direction ); public: ////////////////////////////////////////////////////// // Hierarchical functions virtual char * getObjectType(); virtual CWorldObject * getMasterCell(); CPVCell* addPVCell(DWORD PVCellId, const CPosition & position); CCellPVS * getPVS(); CWorldObject * createObject(char * objectName, DWORD objectId, DWORD geometryId, const CPosition & position, const CDirection & direction ); virtual int moveTo( CWorldObject * parent ); ////////////////////////////////////////////////////// // Physical functions void setBBox( CBBox * bBox ); CBBox * getBBox(); void setCollidable(BYTE coll); BYTE getCollidable(); void setBSDTree( CBSDTree * tree ); CBSDTree * getBSDTree(); int checkPosition( const CPosition & position ); void getGlobalTransform( CMatrix & transform ); void getTransform( CMatrix & transform ); void getInvGlobalTransform( CMatrix & transform ); void getInvTransform( CMatrix & transform ); void distances(CDoubleArray & distArray, const CBeam & beam, double min, double max); ////////////////////////////////////////////////////// // Utility functions virtual void dump(int tab); }; #endif // _WORLDOBJECT_H