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

📄 oasisobject.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    : oasisObject.cpp

 * DESCRIPTION : The object

 * AUTHOR      : Zephie Greyvenstein

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



#include "oasisObject.h"

#include "oasisObjectResource.h"



// Include Ogre stuff

#include "OgreSceneNode.h"

#include "OgreEntity.h"

#include "OgreSceneManager.h"



namespace Oasis {

  

  object::object( ) {      

   

  }

  

  object::~object( ) {

    clear( );

  }



  void object::setup( resource *parent ) {

    objectResource *op = ( objectResource* )parent;

    

    // Setup entity

    if ( op->getEntity( ) != "" ) {

      setEntity( op->getEntity( ) );

    }



    // Set the scale

    setScale( op->getScale( ) );



    // Setup sounds

    objectResource::soundEventIterator it = op->getSoundEventIterator( );

   

    while ( !it.isEmpty( ) ) {

      addSound( it.getCurrentKey( ), it.getCurrentValue( ) );

      it.getNextKey( );

    }

   

    setPosition( vector3::ZERO );

    setOrientation( quaternion::IDENTITY );



    if ( op->getPhysics( ) != "" ) {

      setPhysics( op->getPhysics( ) );

    }

  }



  void object::clear( void ) {

    // Reset scenenode

    removeAndDestroyEntity( );

    removeAndDestroyAllSounds( );

    removeAndDestroyPhysics( );

    removeAllCollisionListeners( );

  }



  void object::_processNewSound( sound *newSound ) {

    // We just need it to take on our position

    _setSoundPosition( newSound, position );

  }



  void object::_updatePosition( void ) {

    _setVisiblePosition( position );

    _setAllSoundPositions( position );

  }



  void object::_updateOrientation( void ) {

    _setVisibleOrientation( orientation );

  }



  Ogre::SceneNode *object::_getSceneNode( void ) {

    return node;

  }

}

⌨️ 快捷键说明

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