yake-svn Mailing List for Yake Engine (Page 18)
Status: Beta
Brought to you by:
psyclonist
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(51) |
Oct
(2) |
Nov
(18) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(44) |
Feb
(13) |
Mar
(73) |
Apr
(61) |
May
|
Jun
(4) |
Jul
(19) |
Aug
(50) |
Sep
(47) |
Oct
(7) |
Nov
(7) |
Dec
(14) |
2008 |
Jan
(2) |
Feb
|
Mar
(4) |
Apr
(4) |
May
(5) |
Jun
(7) |
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(4) |
2009 |
Jan
|
Feb
(22) |
Mar
(12) |
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
(4) |
Aug
|
Sep
|
Oct
(17) |
Nov
(3) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
(12) |
Apr
(11) |
May
|
Jun
(5) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <psy...@us...> - 2007-02-07 23:26:41
|
Revision: 1612 http://svn.sourceforge.net/yake/?rev=1612&view=rev Author: psyclonist Date: 2007-02-07 15:26:34 -0800 (Wed, 07 Feb 2007) Log Message: ----------- fixed logging in demo applications, move demos, interface cleanups, added samples to premake scripts, use of YAKE_DYNLIB_NAME(), safe initialisation Modified Paths: -------------- trunk/yake/samples/ent/sampleEntFsm/demo.cpp trunk/yake/samples/gui/console/yakeConsoleDemo.cpp trunk/yake/samples/net/roserver/ROServer.cpp trunk/yake/samples/net/roserver/ROServer.h trunk/yake/scripts/premake/samples.lua trunk/yake/src/raf/yakeApplication.cpp trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h trunk/yake/yake/netsvc/netSvc.h trunk/yake/yake/netsvc/service/netTimeServiceMessages.h Added Paths: ----------- trunk/yake/samples/cmdrmayhem/ trunk/yake/samples/cmdrmayhem/yakeDemo.cpp trunk/yake/samples/cmdrmayhem/yakePCH.cpp trunk/yake/samples/cmdrmayhem/yakePCH.h Copied: trunk/yake/samples/cmdrmayhem/yakeDemo.cpp (from rev 1603, trunk/yake/samples/misc/cmdrmayhem/yakeDemo.cpp) =================================================================== --- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp (rev 0) +++ trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -0,0 +1,713 @@ +#include <samples/cmdrmayhem/yakePCH.h> +#include <yake/audio/yakeAudio.h> +#include <yake/raf/yakeRaf.h> +#include <yake/model/model.h> +#include <yake/input/yakeInput.h> +#include <yake/common/yakeCameraControllers.h> +#ifdef DEMO_USES_CEGUI +#include <CEGUISystem.h> +#include <CEGUISchemeManager.h> +#include <CEGUIWindowManager.h> +#include <CEGUIWindow.h> +#include <CEGUIExceptions.h> +#include <CEGUIString.h> +#endif + +#define DEMO_USES_SPHERE + +using namespace yake; + +const input::ActionId ACTIONID_ZOOM_INOUT( input::ACTIONID_USER + 1, "zoom_inout" ); +const input::ActionId ACTIONID_MOUSE_MOVE( input::ACTIONID_USER + 2, "mouse_move" ); +const input::ActionId ACTIONID_NEXT_CAMERA( input::ACTIONID_USER + 3, "next_camera" ); + +struct CoordSys : public Movable +{ +private: + CoordSys(const CoordSys&); + CoordSys& operator=(const CoordSys&); +public: + CoordSys(graphics::IWorld& w) + { + sn_.reset( w.createSceneNode() ); + for (size_t i=0; i<3; ++i) + { + graphics::ISceneNode* sn = sn_->createChildNode(); + //graphics::IEntity* ent = w.createEntity("pyramid_1x1x1.mesh"); + graphics::IEntity* ent = w.createEntity("box_1x1x1.mesh"); + sn->attachEntity( ent ); + Quaternion q; + if (i==0) // x + { + q.FromAngleAxis( 0.5*3.14, Vector3::kUnitY ); + ent->setMaterial( "pyramid_red" ); + } + else if (i==1) // y + { + q.FromAngleAxis( -0.5*3.14, Vector3::kUnitX ); + ent->setMaterial( "pyramid_green" ); + } + else // z + { + q.FromAngleAxis( 0, Vector3::kUnitY ); + ent->setMaterial( "pyramid_blue" ); + } + sn->setOrientation( q ); + sn->setScale(Vector3(1,1,5)); + } + } + ~CoordSys() + { + sn_.reset(); + } + virtual void setPosition( const Vector3& rPosition ) + { + sn_->setPosition( rPosition ); + } + virtual void setOrientation( const Quaternion& rOrientation ) + { + std::cout << "cs.x=" << rOrientation * Vector3::kUnitX << " "; + std::cout << "cs.y=" << rOrientation * Vector3::kUnitY << " "; + std::cout << "cs.z=" << rOrientation * Vector3::kUnitZ << "\n"; + sn_->setOrientation( rOrientation ); + } + virtual Vector3 getPosition() const + { + return sn_->getPosition(); + } + virtual Quaternion getOrientation() const + { + return sn_->getOrientation(); + } + virtual Vector3 getDerivedPosition() const + { + return sn_->getDerivedPosition(); + } + virtual Quaternion getDerivedOrientation() const + { + return sn_->getDerivedOrientation(); + } +private: + SharedPtr<graphics::ISceneNode> sn_; +}; + +/** Configuration of the application */ +struct TheConfiguration : public raf::ApplicationConfiguration +{ + virtual StringVector getLibraries() + { return MakeStringVector() << YAKE_DYNLIB_NAME("graphicsOgre") << YAKE_DYNLIB_NAME("inputOgre") << YAKE_DYNLIB_NAME("physicsODE"); } + + //virtual StringVector getScriptingSystems() + //{ return MakeStringVector() << "lua"; } + + virtual StringVector getGraphicsSystems() + { return MakeStringVector() << "ogre3d"; } + + virtual StringVector getInputSystems() + { return MakeStringVector() << "ogre"; } + + virtual StringVector getPhysicsSystems() + { return MakeStringVector() << "ode"; } + + virtual bool loadCEGUI() +#ifdef DEMO_USES_CEGUI + { return true; } +#else + { return false; } +#endif +}; + + +class CharacterController +{ +}; + + +struct Env +{ + SharedPtr<model::Model> model_; +}; +void loadEnvironment(Env& env, graphics::IWorld* pGWorld, physics::IWorld* pPWorld, const String& dotSceneFn, const String& dotXodeFn, const String& dotLinkFn) +{ + YAKE_ASSERT( pGWorld ); + YAKE_ASSERT( pPWorld ); + + YAKE_ASSERT( 0 ); +} + +// struct AvatarPhysicsComponent : public ModelComponent +// struct HumanAvatarController : public ModelComponent +// struct AvatarGraphicsComponent : public ModelComponent + +struct ControllableCharacter +{ +public: + ControllableCharacter(model::CentralControllerBase&, graphics::IWorld&, physics::IWorld&); + ~ControllableCharacter(); + void bindInput(input::ActionMap&, input::KeyboardDevice*, input::MouseDevice*); + void unbindInput(); + void update(const real dt); + void setDirection(const Vector3&); + Point3 getPosition() const; + void setPosition(const Point3&); + Quaternion getOrientation() const; +private: + ControllableCharacter(const ControllableCharacter&); + ControllableCharacter& operator=(const ControllableCharacter&); +private: + void addInputSignalConnection(const SignalConnection&); + void addInputConditionConnection(const input::ConditionConnection&); +private: + void onForward() + { mActiveActions.insert( input::ACTIONID_FORWARD ); } + void onReverse() + { mActiveActions.insert( input::ACTIONID_REVERSE ); } + void onUp() + { mActiveActions.insert( input::ACTIONID_UP ); } + void onLeft() + { mActiveActions.insert( input::ACTIONID_LEFT ); } + void onRight() + { mActiveActions.insert( input::ACTIONID_RIGHT ); } + void onCrouch() + { mActiveActions.insert( input::ACTIONID_DOWN ); } + void onRotateLeft() + { mActiveActions.insert( input::ACTIONID_ROTATE_LEFT ); } + void onRotateRight() + { mActiveActions.insert( input::ACTIONID_ROTATE_RIGHT ); } +private: + physics::IAvatarPtr mPlayerRep; + model::Model* mPlayerModel; + + typedef std::deque<SignalConnection> SignalConnectionList; + SignalConnectionList mInputSignalConnections; + + typedef std::deque<input::ConditionConnection> ConditionConnectionList; + ConditionConnectionList mInputConditionConnections; + + typedef std::set<input::ActionId> ActionIdList; + ActionIdList mActiveActions; + Vector3 mMouseMovement; + Quaternion mProjViewRot; + + SharedPtr<CoordSys> mCoordSys; +}; +ControllableCharacter::ControllableCharacter( + model::CentralControllerBase& centralCtrlr, + yake::graphics::IWorld & gworld, + yake::physics::IWorld & pworld) +{ + mPlayerRep = pworld.createAvatar( + physics::IAvatar::Desc( + Vector3(0.5,2,0), // dimensions + Vector3(0,real(0.1),0) // initial position (relative to stable position) + ) + ); + YAKE_ASSERT( mPlayerRep ); + { + mPlayerModel = new model::Model(); + model::Graphical* pG = new model::Graphical(); + mPlayerModel->addComponent( pG ); + graphics::ISceneNode* pSN = gworld.createSceneNode(); + pG->addSceneNode( pSN, "playerSN" ); + graphics::IEntity* pE = gworld.createEntity("sphere_d1.mesh"); + pSN->attachEntity( pE ); + pSN->setScale( 0.5 * Vector3::kUnitScale ); + + model::ModelMovableDirectLink* pLink = new model::ModelMovableDirectLink(); + mPlayerModel->addLink( pLink ); + pLink->setSource( mPlayerRep ); + pLink->subscribeToPositionChanged( pSN ); + pLink->subscribeToOrientationChanged( pSN ); + centralCtrlr.subscribeToGraphicsUpdate( Bind2(&model::ModelMovableDirectLink::update,pLink) ); + } + mCoordSys.reset( new CoordSys(gworld) ); +} +ControllableCharacter::~ControllableCharacter() +{ + unbindInput(); + if (mPlayerRep) + { + mPlayerRep->getCreator().destroyAvatar( mPlayerRep ); + mPlayerRep = 0; + } + YAKE_SAFE_DELETE( mPlayerModel ); +} +void ControllableCharacter::setPosition(const Point3& pos) +{ + YAKE_ASSERT( mPlayerRep ); + mPlayerRep->setPosition( pos ); +} +void ControllableCharacter::bindInput(input::ActionMap& actionMap, + input::KeyboardDevice* keyboard, + input::MouseDevice* mouse) +{ + YAKE_ASSERT( keyboard ); + YAKE_ASSERT( mouse ); + + using namespace input; + + // load key<->action bindings + ActionMap::loadFromFile( actionMap, "../../media/samples/character/demo.actionmap.txt", keyboard, + boost::bind(&ControllableCharacter::addInputConditionConnection,this,_1) ); + + // bind functions/callbacks to input actions + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_LEFT, boost::bind(&ControllableCharacter::onLeft,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_RIGHT, boost::bind(&ControllableCharacter::onRight,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_ROTATE_LEFT, boost::bind(&ControllableCharacter::onRotateLeft,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_ROTATE_RIGHT, boost::bind(&ControllableCharacter::onRotateRight,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_FORWARD, boost::bind(&ControllableCharacter::onForward,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_REVERSE, boost::bind(&ControllableCharacter::onReverse,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_UP, boost::bind(&ControllableCharacter::onUp,this) ) ); + this->addInputSignalConnection( + actionMap.subscribeToActionIdV( ACTIONID_DOWN, boost::bind(&ControllableCharacter::onCrouch,this) ) ); +} +void ControllableCharacter::unbindInput() +{ + for( SignalConnectionList::iterator it = mInputSignalConnections.begin(); it != mInputSignalConnections.end(); ++it ) + it->disconnect(); + mInputSignalConnections.clear(); + + for( ConditionConnectionList::iterator it = mInputConditionConnections.begin(); it != mInputConditionConnections.end(); ++it ) + it->disconnect(); + mInputConditionConnections.clear(); +} +void ControllableCharacter::addInputSignalConnection(const SignalConnection& conn) +{ + mInputSignalConnections.push_back( conn ); +} +void ControllableCharacter::addInputConditionConnection(const input::ConditionConnection& conn) +{ + mInputConditionConnections.push_back( conn ); +} +void ControllableCharacter::setDirection(const Vector3& dir) +{ + const Vector3 normalisedDir = dir.normalisedCopy(); + mProjViewRot.FromAxes( normalisedDir.crossProduct( Vector3::kUnitY ), Vector3::kUnitY, -normalisedDir ); +} +void ControllableCharacter::update(const real dt) +{ + // + const real maxAng = 3.14; + real ang = 0.; + Vector3 playerTargetVel; + ConstDequeIterator< ActionIdList > itAction( mActiveActions ); + while (itAction.hasMoreElements()) + { + const input::ActionId activeId = itAction.getNext(); + if (activeId == input::ACTIONID_FORWARD) + playerTargetVel += Vector3(0,0,+1); + else if (activeId == input::ACTIONID_REVERSE) + playerTargetVel += Vector3(0,0,-1); + else if (activeId == input::ACTIONID_LEFT) + playerTargetVel += Vector3(+1,0,0); //x=1 is left vector! + else if (activeId == input::ACTIONID_RIGHT) + playerTargetVel += Vector3(-1,0,0); + else if (activeId == input::ACTIONID_UP) + mPlayerRep->jump(); + else if (activeId == input::ACTIONID_ROTATE_LEFT) + ang += maxAng; + else if (activeId == input::ACTIONID_ROTATE_RIGHT) + ang -= maxAng; + else if (activeId == input::ACTIONID_DOWN) + { + mPlayerRep->duck( !mPlayerRep->isDucking() ); + } + } + if (playerTargetVel.length() > 0.001) + { + playerTargetVel.normalise(); + mPlayerRep->move( playerTargetVel ); // velocity relative to player's orientation + } + else + mPlayerRep->move( Vector3::kZero ); + + // newUp = gravity_source to position +#ifdef DEMO_USES_SPHERE + const Vector3 newGravityVector = (Vector3::kZero/*source of gravity*/ - mPlayerRep->getPosition()).normalisedCopy(); + mPlayerRep->setGravityDirection( newGravityVector ); +#else + mPlayerRep->setGravityDirection( Vector3(0,1,0) ); +#endif + if (fabs(ang) > 0.001) + { + Quaternion rot( ang * dt, mPlayerRep->getOrientation() * Vector3::kUnitY ); + rot = rot * mPlayerRep->getOrientation(); + mPlayerRep->setOrientation( rot ); + } + + // prepare for next step + mActiveActions.clear(); + mMouseMovement = Vector3::kZero; + + // + mCoordSys->setPosition( mPlayerRep->getPosition() ); + mCoordSys->setOrientation( mPlayerRep->getOrientation() ); +} +Vector3 ControllableCharacter::getPosition() const +{ + YAKE_ASSERT( mPlayerRep ); + return mPlayerRep->getPosition(); +} +Quaternion ControllableCharacter::getOrientation() const +{ + YAKE_ASSERT( mPlayerRep ); + return mPlayerRep->getOrientation(); +} + +/** Main application state */ +class TheMainState : public raf::RtMainState +{ +public: + TheMainState(raf::Application& owner) : + raf::RtMainState(owner), + mGround(0), + mEnv(0) + { + enableInstantQuitByKey( input::KC_ESCAPE ); + } + ~TheMainState() + { + } +private: + //@todo cleanup code! + void setupGUI() + { +#ifdef DEMO_USES_CEGUI + using namespace CEGUI; + try { + WindowManager& wmgr = WindowManager::getSingleton(); + Window* sheet = wmgr.loadWindowLayout( "cmdr_main.layout" ); + System::getSingleton().setGUISheet(sheet); + } + catch (CEGUI::Exception& ex) + { + YAKE_EXCEPT(yake::String("CEGUI Exception:\n") + ex.getMessage().c_str() ); + } +#endif + } +protected: + virtual void onCreateScene() + { + YAKE_LOG_INFORMATION("demo","Creating scene"); + + //getPhysicalWorld()->setGlobalGravity(Vector3(0,real(-9.8),0)); + + // create a light + graphics::ILight* pLight = getGraphicalWorld()->createLight(); + pLight->setType( graphics::ILight::LT_DIRECTIONAL ); + pLight->setDirection( Vector3(0,-1,1) ); + getGraphicalWorld()->createSceneNode("lightnode0")->attachLight( pLight ); + + getGraphicalWorld()->setShadowsEnabled( true ); + + // position camera and look at the ninja + getDefaultCamera()->setNearClipDistance( 1 ); + getDefaultCamera()->setFixedYawAxis(Vector3::kUnitY); + getDefaultCamera()->setPosition(Vector3(7,4,-7)); + + // create ground + mGround = new model::Model(); + { + const real groundHeight = 50; + // visual +#ifndef DEMO_USES_SPHERE + graphics::ISceneNode* pGroundSN = getGraphicalWorld()->createSceneNode(); + graphics::IEntity* pGroundE = getGraphicalWorld()->createEntity("plane_1x1.mesh"); + pGroundE->setMaterial("box"); + pGroundE->setCastsShadow( false ); + pGroundSN->attachEntity( pGroundE ); + pGroundSN->setScale( Vector3(100,1,100) ); + pGroundSN->setPosition( Vector3(0,-groundHeight,0) ); + + model::Graphical* pG = new model::Graphical(); + pG->addSceneNode( pGroundSN, "ground", true ); + mGround->addComponent( pG, "p" ); +#endif + + // physical + physics::IActorPtr pGroundPlane = getPhysicalWorld()->createActor( physics::ACTOR_STATIC ); +#ifdef DEMO_USES_SPHERE + pGroundPlane->createShape( physics::IShape::SphereDesc( real(groundHeight) ) ); +#else + pGroundPlane->createShape( physics::IShape::PlaneDesc( Vector3(0,-1,0), groundHeight ) ); +#endif + + model::Physical* pP = new model::Physical(); + pP->addActor( pGroundPlane, "groundPlane" ); + mGround->addComponent( pP, "g" ); + } + // +#ifdef DEMO_USES_SPHERE + getGraphicalWorld()->load("osm","C:/Programme/Autodesk/3dsMax8/OSM/geo1.osm"); +#endif + + // sky box + getGraphicalWorld()->setSkyBox("Examples/SpaceSkyBox"); + + // graphics / physics environment + mEnv = new Env(); + //const String dirMediaRoot = "../../media/samples/dotLink/DynTest/"; + //const String sceneBaseName = "DotScene1"; + //loadEnvironment( *mEnv, getGraphicalWorld(), getPhysicalWorld(), + // dirMediaRoot+sceneBaseName+".scene", dirMediaRoot+sceneBaseName+".xode", dirMediaRoot+sceneBaseName+".link" ); + + // create player/avatar + mPlayer.reset( new ControllableCharacter(*this,*getGraphicalWorld(),*getPhysicalWorld()) ); + //mPlayer->setPosition( Point3(0,-52,0) ); // 2 meters above the 50 m radius sphere + mPlayer->setPosition( Point3(-25.967,44.376,0.9326) ); + + // camera controllers + { // top-down camera controller + TopDownCameraController* ctrlr = new TopDownCameraController(); + ctrlr->setCamera( getDefaultCamera() ); + ctrlr->setOffset( Vector3(40,0,0) ); + ctrlr->setTargetOffset( Vector3(40,0,0) ); + mCamControllers.push_back( CameraControllerPtr(ctrlr) ); + } + { // 3rd person camera controller + ThirdPersonCameraController* ctrlr = new ThirdPersonCameraController(); + ctrlr->setCamera( getDefaultCamera() ); + + ctrlr->setOffsetFromTarget( Vector3(0,1.5,2) ); + ctrlr->setCurrentOffsetFromTarget( ctrlr->getOffsetFromTarget() ); + + // slightly downwards + ctrlr->setOffsetOrientation( Quaternion( -0.5, Vector3::kUnitX ) ); + ctrlr->setCurrentOffsetOrientation( ctrlr->getOffsetOrientation() ); + + mCamControllers.push_back( CameraControllerPtr(ctrlr) ); + } + mCurrentCamController = 0; + + } + virtual void onDestroyScene() + { + mCamControllers.clear(); + mPlayer.reset(); + YAKE_SAFE_DELETE( mGround ); + YAKE_SAFE_DELETE( mEnv ); + } + virtual void onEnter() + { + RtMainState::onEnter(); + using namespace input; + + // controls + if (mPlayer) + mPlayer->bindInput( mActionMap, getApp().getKeyboard(), getApp().getMouse() ); + + YAKE_ASSERT( !mCamControllers.empty() ); + + // + mActionMap.reg( ACTIONID_NEXT_CAMERA, new KeyboardActionCondition( getApp().getKeyboard(), input::KC_1, input::KAM_RELEASED ) ); + mActionMap.subscribeToActionIdV( ACTIONID_NEXT_CAMERA, BindX(&TheMainState::onNextCamera,this) ); + + // top-down controller + // @todo unsubscribe; move out into top down controller's bindInput() + mActionMap.reg( ACTIONID_ZOOM_INOUT, new MouseMoveActionCondition( getApp().getMouse(), input::MMA_WHEEL, input::MMD_BOTH ) ); + mActionMap.subscribeToActionIdR( ACTIONID_ZOOM_INOUT, Bind1(&TheMainState::onMouseWheel,this) ); + + mActionMap.reg( ACTIONID_MOUSE_MOVE, new MouseMoveActionCondition( getApp().getMouse(), input::MMA_X_AND_Y, input::MMD_BOTH ) ); + mActionMap.subscribeToActionIdR( ACTIONID_MOUSE_MOVE, Bind1(&TheMainState::onMouseMoveXY,this) ); + + // for cursor +#ifdef DEMO_USES_CEGUI + getApp().enableMouseInputForCEGUI(true); + getApp().enableKeyboardInputForCEGUI(true); +#endif + setupGUI(); + + mActionMap.start(); + } + virtual void onExit() + { + mActionMap.stop(); + + if (mPlayer) + mPlayer->unbindInput(); + +#ifdef DEMO_USES_CEGUI + getApp().enableKeyboardInputForCEGUI(false); + getApp().enableMouseInputForCEGUI(false); +#endif + RtMainState::onExit(); + } + virtual void onFrame(const real timeElapsed) + { + // + mActionMap.update(); + + // + if (mPlayer) + { + /* + Vector3 projViewDir = mTopDownCtrlr.getOffset(); + projViewDir.y = 0.; + if (projViewDir.length() <= 0.01) + projViewDir = Vector3::kUnitZ; + projViewDir.normalise(); + mPlayer->setDirection( projViewDir ); + */ + mPlayer->update( timeElapsed ); + } + + CameraControllerPtr currCamCtrlr = mCamControllers.at(mCurrentCamController); + YAKE_ASSERT( currCamCtrlr.get() ); + + //@todo hide properly + if (TopDownCameraController* topdownCtrlr = dynamic_cast<TopDownCameraController*>(currCamCtrlr.get())) + { // top-down controller + const real dist = timeElapsed * real(4.); + Vector3 offset; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_I)) + offset += dist * Vector3::kUnitZ; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_K)) + offset += - dist * Vector3::kUnitZ; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_J)) + offset += dist * Vector3::kUnitX; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_L)) + offset += - dist * Vector3::kUnitX; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_R)) + offset += dist * Vector3::kUnitY; + if (this->getApp().getKeyboard()->isKeyDown(input::KC_F)) + offset += - dist * Vector3::kUnitY; + topdownCtrlr->setOffset( topdownCtrlr->getOffset() + offset ); + topdownCtrlr->setTargetOffset( topdownCtrlr->getTargetOffset() + offset ); + + topdownCtrlr->setTarget( mPlayer->getPosition() ); + + // Rotate camera around camera's 'up' axis + // when user presses RMB and moves the mouse. + if (this->getApp().getMouse()->isButtonDown( input::MB_RIGHT )) + { + // @todo adjust rotation over several frames for smoother rotation. + const real angle = mMouseMovement.x * real(100.) * timeElapsed; + Matrix3 rot; + rot.FromAxisAngle( Vector3::kUnitY, angle ); + + // NB rotate both 'target offset' and 'current offset' so that + // relative to each other they stay the same. + + Vector3 offset = rot * topdownCtrlr->getTargetOffset(); + topdownCtrlr->setTargetOffset( offset ); + + offset = rot * topdownCtrlr->getOffset(); + topdownCtrlr->setOffset( offset ); + } + } + else if (ThirdPersonCameraController* ctrlr = dynamic_cast<ThirdPersonCameraController*>(currCamCtrlr.get())) + { + ctrlr->setTargetPosition( mPlayer->getPosition() ); + ctrlr->setTargetOrientation( mPlayer->getOrientation() ); + } + + // + currCamCtrlr->update( timeElapsed ); + + // prepare for next step + mActiveActions.clear(); + mMouseMovement = Vector3::kZero; + + //std::cout << this->mPlayerRep->getPosition() << "\n"; + + if (this->getApp().getKeyboard()->isKeyDown(input::KC_ADD)) + { + real physicsTimeFactor = this->getPhysicsTimeFactor(); + physicsTimeFactor += real(0.1) * timeElapsed; + this->setPhysicsTimeFactor( physicsTimeFactor ); + std::cout << "factor = " << this->getPhysicsTimeFactor() << "\n"; + } + if (this->getApp().getKeyboard()->isKeyDown(input::KC_SUBTRACT)) + { + real physicsTimeFactor = this->getPhysicsTimeFactor(); + physicsTimeFactor -= real(0.1) * timeElapsed; + if (physicsTimeFactor < 0.) physicsTimeFactor = 0.; + this->setPhysicsTimeFactor( physicsTimeFactor ); + std::cout << "factor = " << this->getPhysicsTimeFactor() << "\n"; + } + } +private: + void onNextCamera() + { + ++mCurrentCamController; + if (mCurrentCamController >= mCamControllers.size()) + mCurrentCamController = 0; + } + void onMouseMoveXY(const input::ActionMap::ActionResult& ar) + { + mMouseMovement = ar.signal * 10.; + std::swap( mMouseMovement.y, mMouseMovement.z ); + mMouseMovement.y = 0.; + } + void onMouseWheel(const input::ActionMap::ActionResult& ar) + { + /** @todo move out into CameraControllerBase::init() ... + if (fabs(ar.signal.z) < std::numeric_limits<real>::epsilon()) + return; + + const real fac = real(1.0 - 0.1 * ar.signal.z); // either 0.9 or 1.1 + + // scale the target offset + Vector3 targetOffset = mTopDownCtrlr.getTargetOffset() * fac; + + // keep a minimum length + if (targetOffset.length() < 5.) // min length + targetOffset = targetOffset.normalisedCopy() * 5.; + + // apply + mTopDownCtrlr.setTargetOffset( targetOffset ); + */ + } +private: + model::Model* mGround; + input::ActionMap mActionMap; + + typedef std::set<input::ActionId> ActionIdList; + ActionIdList mActiveActions; + + Env* mEnv; + + typedef SharedPtr<CameraControllerBase> CameraControllerPtr; + typedef std::deque<CameraControllerPtr> CameraControllerList; + CameraControllerList mCamControllers; + int mCurrentCamController; + + Vector3 mMouseMovement; + + SharedPtr<ControllableCharacter> mPlayer; +}; + +/** The mighty application itself! */ +class TheApp : public raf::ExampleApplication<TheConfiguration> +{ +public: + TheApp() {} +protected: + virtual raf::MainState* createMainState() + { + return new TheMainState(*this); + } +}; + +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +int main( int argc, char** argv ) +{ + // @todo fixme: Workaround on windows because of different timers on different cores... + ::SetProcessAffinityMask( ::GetCurrentProcess(), 0x01 ); + ::SetThreadAffinityMask( ::GetCurrentThread(), 0x01 ); + + // Use default executor for convenience. + // It's always possible to manually execute TheApp::initialise() etc. + TheApp theApp; + return (raf::runApplication( theApp )) ? 0 : 1; +} + Copied: trunk/yake/samples/cmdrmayhem/yakePCH.cpp (from rev 1603, trunk/yake/samples/misc/cmdrmayhem/yakePCH.cpp) =================================================================== --- trunk/yake/samples/cmdrmayhem/yakePCH.cpp (rev 0) +++ trunk/yake/samples/cmdrmayhem/yakePCH.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -0,0 +1 @@ +//#include <samples/cmdrmayhem/yakePCH.h> Copied: trunk/yake/samples/cmdrmayhem/yakePCH.h (from rev 1603, trunk/yake/samples/misc/cmdrmayhem/yakePCH.h) =================================================================== --- trunk/yake/samples/cmdrmayhem/yakePCH.h (rev 0) +++ trunk/yake/samples/cmdrmayhem/yakePCH.h 2007-02-07 23:26:34 UTC (rev 1612) @@ -0,0 +1,10 @@ +//============================================================================ +// IMPLEMENTATION HEADERS +//============================================================================ +// STL +#include <iostream> +// Yake +#include <yake/base/yake.h> +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/yappbase/yapp.h> +#include <yake/ent/ent.h> Modified: trunk/yake/samples/ent/sampleEntFsm/demo.cpp =================================================================== --- trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/samples/ent/sampleEntFsm/demo.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -20,7 +20,7 @@ {} virtual void onObjectCreated(ent::Object* obj) { - YAKE_LOG( "exappOML::onObjectCreated: class is '" + obj->isA()->name() + "'" ); + YAKE_LOG( "exappOML", "onObjectCreated: class is '" + obj->isA()->name() + "'" ); scripting::IVM* vm = scriptingSys_.createVM(); YAKE_ASSERT( vm ); Modified: trunk/yake/samples/gui/console/yakeConsoleDemo.cpp =================================================================== --- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -144,7 +144,9 @@ false /*script bindings*/, false /*audio*/), mGuiRendererAdapter( NULL ), - mConsole( ConsoleHolder::instance().getConsole() ) + mConsole( ConsoleHolder::instance().getConsole() ), + mEditBox( 0 ), + mListBox( 0 ) {} /** @@ -311,8 +313,10 @@ */ void setupConsole() { - mConsole.setInputWidget( mEditBox ); - mConsole.setOutputWidget( mListBox ); + if (mEditBox) + mConsole.setInputWidget( mEditBox ); + if (mListBox) + mConsole.setOutputWidget( mListBox ); yake::scripting::IVM* pVM = getScriptingSystem().createVM(); YAKE_ASSERT( pVM ); @@ -376,12 +380,12 @@ YAKE_LOG("demo", "Loading scheme..." ); - SchemeManager::getSingleton().loadScheme("VanillaSkin.scheme"); - System::getSingleton().setDefaultMouseCursor("Vanilla-Images","MouseArrow"); + SchemeManager::getSingleton().loadScheme("yake1skin.scheme"); + System::getSingleton().setDefaultMouseCursor("yake1-images","MouseArrow"); FontManager::getSingleton().createFont("Iconified-12.font"); WindowManager& winMgr = WindowManager::getSingleton(); - Window* background = winMgr.createWindow("Vanilla/StaticImage"); + Window* background = winMgr.createWindow("yake1/StaticImage"); background->setArea(URect(cegui_reldim(0), cegui_reldim(0), cegui_reldim(1), cegui_reldim(1))); background->setProperty("FrameEnabled", "false"); background->setProperty("BackgroundEnabled", "false"); @@ -392,15 +396,16 @@ background->activate(); - +#if 0 mEditBox = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingleton().getWindow("/Console/Wnd/Edit")); mListBox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().getWindow("/Console/Wnd/History")); +#endif } // catch to prevent exit (errors will be logged). catch( CEGUI::Exception& e) { - YAKE_LOG_ERROR( "demo", yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); + YAKE_EXCEPT( yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); } setupConsole(); Modified: trunk/yake/samples/net/roserver/ROServer.cpp =================================================================== --- trunk/yake/samples/net/roserver/ROServer.cpp 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/samples/net/roserver/ROServer.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -1,5 +1,6 @@ #include <samples/net/inprocess/common.h> #include <samples/net/roserver/ROServer.h> +#include <boost/lexical_cast.hpp> namespace yake { namespace ro { @@ -83,17 +84,17 @@ outEvtQ_.push_back( EventQEntry(id,evt,cId) ); } */ - SignalConnection server::subscribeToClientSimulationStarted(const ClientSimulationStartedSignal::slot_type& slot) + SignalConnection server::subscribeToClientAccepted(const ClientAcceptedSignal::slot_type& slot) { - return sigClientSimulationStarted_.connect(slot); + return sigClientAccepted_.connect(slot); } SignalConnection server::subscribeToClientDisconnected(const ClientDisconnectedSignal::slot_type& slot) { return sigClientDisconnected_.connect(slot); } - void server::onClientSimStarted(iclient&c) + void server::onClientAccepted(iclient&c) { - sigClientSimulationStarted_(c.getPeerId()); + sigClientAccepted_(c.getPeerId()); } bool server::onStart() { @@ -102,6 +103,9 @@ const size_t maxClients = 32; + const String strServer = bindInterface_.ip() + ":" + boost::lexical_cast<String>(bindInterface_.port()); + YAKE_LOG_INFORMATION("serv-host","starting server at '" << strServer << "' with max. " << maxClients << " clients..."); + conn_.reset( net::createServerPacketConnection() ); YAKE_ASSERT( conn_ ); @@ -109,7 +113,6 @@ conn_->addPacketReceivedCallback( boost::bind(&server::onReceivePacket,this,_1,_2,_3) ); conn_->addClientDisconnectedCallback( boost::bind(&server::onClientDisconnected,this,_1) ); - COUTLN("starting server at '" << bindInterface_.ip() << ":" << bindInterface_.port() << "' with max. " << maxClients << " clients..."); conn_->start( bindInterface_, maxClients ); // wait until net object is up @@ -119,6 +122,7 @@ net::update(); net::native::sleep(0); } + YAKE_LOG_INFORMATION("serv-host","server is up at '" << strServer << "'"); return true; } void server::onStop() @@ -248,7 +252,7 @@ this->stage = CS_RUNNING; // replicate objects - this->svr.onClientSimStarted( *this ); + this->svr.onClientAccepted( *this ); } } void client::running_onProcessEvent(const net::NetEvent& evt, const net::ChannelId channel) Modified: trunk/yake/samples/net/roserver/ROServer.h =================================================================== --- trunk/yake/samples/net/roserver/ROServer.h 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/samples/net/roserver/ROServer.h 2007-02-07 23:26:34 UTC (rev 1612) @@ -48,9 +48,9 @@ //void queueEventBroadcast(net::NetEvent*, const net::ChannelId); typedef SignalX<void(const net::PeerId)> PeerIdSignal; - typedef PeerIdSignal ClientSimulationStartedSignal; + typedef PeerIdSignal ClientAcceptedSignal; typedef PeerIdSignal ClientDisconnectedSignal; - yake::SignalConnection subscribeToClientSimulationStarted(const ClientSimulationStartedSignal::slot_type&); + yake::SignalConnection subscribeToClientAccepted(const ClientAcceptedSignal::slot_type&); yake::SignalConnection subscribeToClientDisconnected(const ClientDisconnectedSignal::slot_type&); //private: @@ -68,7 +68,7 @@ void onProcessEvent(const net::PeerId, const net::NetEvent&, const net::ChannelId); void onClientDisconnected(const net::PeerId); private: // internal callback - void onClientSimStarted(iclient&); + void onClientAccepted(iclient&); private: net::Address bindInterface_; @@ -96,7 +96,7 @@ //mutable boost::mutex outEvtQMtx_; //InitEvtClassTableFn initEvtClassTableFn_; - ClientSimulationStartedSignal sigClientSimulationStarted_; + ClientAcceptedSignal sigClientAccepted_; ClientDisconnectedSignal sigClientDisconnected_; }; Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/scripts/premake/samples.lua 2007-02-07 23:26:34 UTC (rev 1612) @@ -40,6 +40,27 @@ useComponent("graphics") -------------------------------------- +makeSample("sampleVehicle","samples/vehicle") +useComponent("base") +useComponent("physics") +useComponent("graphics") +useComponent("input") +useComponent("model") +useComponent("ent") +useComponent("raf") +useComponent("vehicle") + +-------------------------------------- +makeSample("sampleCmdrMayhem","samples/cmdrmayhem") +useComponent("base") +useComponent("physics") +useComponent("graphics") +useComponent("input") +useComponent("model") +useComponent("raf") +useDep("cegui") + +-------------------------------------- makeSample("sampleRafMinimal","samples/raf/minimal") useComponent("base") useComponent("raf") Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/src/raf/yakeApplication.cpp 2007-02-07 23:26:34 UTC (rev 1612) @@ -177,7 +177,7 @@ void Application::initCEGUI() { //const String file = "CEGUIOgreAdapter"; - const String file = "CEGUIOgreRendererAdapter"; + const String file = YAKE_DYNLIB_NAME("CEGUIOgreRendererAdapter"); yake::base::Library* pDynLib = new yake::base::Library( file ); //@FIXME. MEMORY LEAK. YAKE_ASSERT( pDynLib ).debug( "Out of memory" ); Modified: trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h =================================================================== --- trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h 2007-02-07 23:26:34 UTC (rev 1612) @@ -75,6 +75,9 @@ */ void addMessage( const MessageType& msg ) { + if (!outputBox_) + return; + CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem( (CEGUI::utf8*)msg.text_.c_str() ); outputBox_->addItem( item ); @@ -90,6 +93,9 @@ */ void scrollUp( std::size_t lines ) { + if (!outputBox_) + return; + if ( visibleItemIndex_ == 0 ) return; @@ -110,6 +116,9 @@ */ void scrollDown( std::size_t lines ) { + if (!outputBox_) + return; + if ( visibleItemIndex_ == 0 ) lines *= 2; @@ -127,10 +136,15 @@ */ void clearScroll() { + if (!outputBox_) + return; visibleItemIndex_ = outputBox_->getItemCount(); outputBox_->ensureItemIsVisible( visibleItemIndex_ ); } + CEGUIOutputArea() : outputBox_(0), visibleItemIndex_(0) + { + } private: /// CEGUI widget representing output area CEGUI::Listbox* outputBox_; Modified: trunk/yake/yake/netsvc/netSvc.h =================================================================== --- trunk/yake/yake/netsvc/netSvc.h 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/yake/netsvc/netSvc.h 2007-02-07 23:26:34 UTC (rev 1612) @@ -5,11 +5,4 @@ #include <yake/netsvc/netService.h> #include <yake/netsvc/netServiceHost.h> -namespace yake { -namespace net { - - -} // namespace net -} // namespace yake - #endif Modified: trunk/yake/yake/netsvc/service/netTimeServiceMessages.h =================================================================== --- trunk/yake/yake/netsvc/service/netTimeServiceMessages.h 2007-01-22 21:41:10 UTC (rev 1611) +++ trunk/yake/yake/netsvc/service/netTimeServiceMessages.h 2007-02-07 23:26:34 UTC (rev 1612) @@ -3,13 +3,13 @@ #include <yake/netsvc/netPrerequisites.h> +#if YAKE_COMPILER == COMPILER_MSVC #pragma warning(push) #pragma warning(disable: 4275) // C4275: non dll-interface class 'X' used as base for dll-interface 'Y' +#endif namespace yake { namespace net { -//namespace svc { -//namespace comm { struct s2cEvtPing : public yake::net::NetEvent { @@ -69,11 +69,11 @@ yake::uint32 clientTime_; }; -//} // namespace comm -//} // namespace svc } // namespace net } // namespace yake +#if YAKE_COMPILER == COMPILER_MSVC #pragma warning(pop) +#endif #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:41:11
|
Revision: 1611 http://svn.sourceforge.net/yake/?rev=1611&view=rev Author: psyclonist Date: 2007-01-22 13:41:10 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/yake/samples/README.TXT Modified: trunk/yake/samples/README.TXT =================================================================== --- trunk/yake/samples/README.TXT 2007-01-22 21:38:27 UTC (rev 1610) +++ trunk/yake/samples/README.TXT 2007-01-22 21:41:10 UTC (rev 1611) @@ -5,10 +5,11 @@ sampleLog - basic logging net/packet - network packet connections net/inprocess - client/server: replication objects, communication service, ... -gui/console - Graphical scripting console -raf/minimal -raf/demo1 -ent/sampleEntFsm +gui/console - graphical scripting console +raf/minimal - bare-bones RAF application +raf/demo1 - initialisation of graphics and creation of a very basic scene +ent/sampleEntFsm - entity scripting +physics/demo - basic physics demo (multiple viewports, simplistic objects) ---- in flux: (i.e. in process of being added to the main build scripts) @@ -20,9 +21,6 @@ dotlink fsm audio3d -raf_simple -raf_most_systems -gui_console sampleDebug - debug output @@ -35,7 +33,6 @@ sampleFSM - simple finite state machine demo sampleAudio3d - how to use the audio system for playing 3D sounds -sampleRafSimple - bare-bones RAF application sampleRafMostSystems - initialisation of most systems (graphics, physics, scripting etc) sampleGuiConsole - a CEGUI-based console with history to script Yake applications using Lua This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:38:28
|
Revision: 1610 http://svn.sourceforge.net/yake/?rev=1610&view=rev Author: psyclonist Date: 2007-01-22 13:38:27 -0800 (Mon, 22 Jan 2007) Log Message: ----------- moved replication services out of the prototype into 'netrepsvc', Added Paths: ----------- trunk/yake/src/netrepsvc/ trunk/yake/src/netrepsvc/detail/ trunk/yake/src/netrepsvc/netClientRepService.cpp trunk/yake/src/netrepsvc/netRepSvc.cpp trunk/yake/src/netrepsvc/netServerRepService.cpp trunk/yake/yake/netrepsvc/ trunk/yake/yake/netrepsvc/detail/ trunk/yake/yake/netrepsvc/netClientReplicationService.h trunk/yake/yake/netrepsvc/netEvents.h trunk/yake/yake/netrepsvc/netPrerequisites.h trunk/yake/yake/netrepsvc/netRepSvc.h trunk/yake/yake/netrepsvc/netServerReplicationService.h Added: trunk/yake/src/netrepsvc/netClientRepService.cpp =================================================================== --- trunk/yake/src/netrepsvc/netClientRepService.cpp (rev 0) +++ trunk/yake/src/netrepsvc/netClientRepService.cpp 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,102 @@ +#include <yake/netrepsvc/netPrerequisites.h> +#include <yake/netrepsvc/netClientReplicationService.h> + +namespace yake { +namespace net { + + ClientReplicationService::ClientReplicationService(const ChannelId cid) : + sendOptions_( net::SendOptions().channel(cid).ordered().reliable() ), evtClassTblReceived_(false) + {} + ClientReplicationService::~ClientReplicationService() + { + eventConn_.reset(); + } + void ClientReplicationService::onStart(net::IServiceHost& host) + { + YAKE_LOG_INFORMATION("client-rep","starting replication client..."); + eventConn_ = host.getEventConnection(); + + eventConn_->registerEvent( s2cEvtClassTable::ID, NetEvent::DIR_ANY, s2cEvtClassTable::create, s2cEvtClassTable::destroy ); + eventConn_->registerEvent( s2cEvtCreateObject::ID, NetEvent::DIR_ANY, s2cEvtCreateObject::create, s2cEvtCreateObject::destroy ); + eventConn_->registerEvent( s2cEvtDestroyObject::ID, NetEvent::DIR_ANY, s2cEvtDestroyObject::create, s2cEvtDestroyObject::destroy ); + + host.subscribeToNetEvent( s2cEvtClassTable::ID, sendOptions_.getChannel(), + boost::bind(&ClientReplicationService::onRecvClassTable,this,_1,_2,_3)); + host.subscribeToNetEvent( s2cEvtCreateObject::ID, sendOptions_.getChannel(), + boost::bind(&ClientReplicationService::onRecvPublishObject,this,_1,_2,_3)); + host.subscribeToNetEvent( s2cEvtDestroyObject::ID, sendOptions_.getChannel(), + boost::bind(&ClientReplicationService::onRecvUnpublishObject,this,_1,_2,_3)); + + evtClassTblReceived_ = false; + } + void ClientReplicationService::onStop(net::IServiceHost&) + { + //@todo unbind + eventConn_.reset(); + + evtClassTblReceived_ = false; + } + void ClientReplicationService::onRecvClassTable(const PeerId, const NetEvent& evt, const ChannelId) + { + YAKE_LOG_INFORMATION("client-rep","received class table"); + try { + const s2cEvtClassTable& evtClsTbl = dynamic_cast<const s2cEvtClassTable&>(evt); + evtClsTbl.copyTo( evtClassTbl_ ); + evtClassTblReceived_ = true; + } + catch (std::bad_cast&) + { + YAKE_LOG_ERROR("client-rep","invalid event type"); + } + } + void ClientReplicationService::onRecvPublishObject(const PeerId, const NetEvent& evt, const ChannelId) + { + YAKE_LOG_INFORMATION("client-rep","onRecvPublishObject"); + const s2cEvtCreateObject& evtCreate = static_cast<const s2cEvtCreateObject&>(evt); + qForPublish_.insert( evtCreate.objId_ ); + } + void ClientReplicationService::onRecvUnpublishObject(const PeerId, const NetEvent& evt, const ChannelId) + { + YAKE_LOG_INFORMATION("client-rep","onRecvUnpublishObject"); + const s2cEvtCreateObject& evtCreate = static_cast<const s2cEvtCreateObject&>(evt); + qForUnpublish_.insert( evtCreate.objId_ ); + } + void ClientReplicationService::update() + { + if (evtClassTblReceived_) + { + evtClassTblReceived_ = false; + sigClassTblReceived_( evtClassTbl_ ); + } + YAKE_FOR_EACH(ObjectEntryList::const_iterator,it,qForPublish_) + { + if (objs_.find( *it ) != objs_.end()) // already published? + continue; + objs_.insert( *it ); + sigPublish_( *it ); + } + qForPublish_.clear(); + YAKE_FOR_EACH(ObjectEntryList::const_iterator,it,qForUnpublish_) + { + if (objs_.find( *it ) == objs_.end()) + continue; + sigUnpublish_( *it ); + objs_.erase( *it ); + } + qForUnpublish_.clear(); + } + SignalConnection ClientReplicationService::connectToUpdateClassTable(const ClassTableSignal::slot_type& slot) + { + return sigClassTblReceived_.connect(slot); + } + SignalConnection ClientReplicationService::connectToObjectPublished(const ObjectIdSignal::slot_type& slot) + { + return sigPublish_.connect(slot); + } + SignalConnection ClientReplicationService::connectToObjectUnpublished(const ObjectIdSignal::slot_type& slot) + { + return sigUnpublish_.connect(slot); + } + +} // namespace net +} // namespace yake Added: trunk/yake/src/netrepsvc/netRepSvc.cpp =================================================================== --- trunk/yake/src/netrepsvc/netRepSvc.cpp (rev 0) +++ trunk/yake/src/netrepsvc/netRepSvc.cpp 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,10 @@ +#include <yake/netrepsvc/netPrerequisites.h> +#include <yake/netrepsvc/netEvents.h> +//#include <yake/netrepsvc/netClientReplicationService.h> +//#include <yake/netrepsvc/netServerReplicationService.h> + +namespace yake { +namespace net { + +} // namespace net +} // namespace yake Added: trunk/yake/src/netrepsvc/netServerRepService.cpp =================================================================== --- trunk/yake/src/netrepsvc/netServerRepService.cpp (rev 0) +++ trunk/yake/src/netrepsvc/netServerRepService.cpp 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,124 @@ +#include <yake/netrepsvc/netPrerequisites.h> +#include <yake/netrepsvc/netServerReplicationService.h> + +namespace yake { +namespace net { + + ServerReplicationService::ServerReplicationService(const ChannelId cId) : + cId_(cId), sendOptions_(SendOptions().channel(cId).ordered().reliable()) + { + } + ServerReplicationService::~ServerReplicationService() + { + YAKE_ASSERT( !eventConn_.get() ); + } + void ServerReplicationService::onStart(net::IServiceHost& host) + { + YAKE_LOG_INFORMATION("netrepsvc","starting replication service"); + eventConn_ = host.getEventConnection(); + } + void ServerReplicationService::onStop(net::IServiceHost&) + { + YAKE_LOG_INFORMATION("netrepsvc","stopping replication service"); + this->unpublishAll(); + eventConn_.reset(); + } + void ServerReplicationService::unpublishAll() + { + YAKE_LOG_WARNING("netrepsvc","unpublishAll() not implemented"); + } + void ServerReplicationService::setClassTableData(const s2cEvtClassTable& evt) + { + evt.copyTo( evtClassTbl_ ); + } + void ServerReplicationService::startReplicationToClient(const PeerId pid) + { + if (clients_.find(pid) != clients_.end()) + { + YAKE_LOG_WARNING("netrepsvc","replication to this client already started"); + return; + } + + // replicate class table + clients_.insert( pid ); + eventConn_->sendEvent( pid, evtClassTbl_, sendOptions_ ); + + //@todo replicate global objects + /* + ent::ObjectManager::const_object_iterator itEnd = objMgr_->endObjects(); + for (ent::ObjectManager::const_object_iterator it = objMgr_->beginObjects(); it != itEnd; ++it) + */ + } + void ServerReplicationService::publish(const ent::ObjectId& oid) + { + YAKE_FOR_EACH(PeerIdList::const_iterator,itId,clients_) + { + this->publish( *itId, oid ); + } + } + void ServerReplicationService::publish(PeerId pid, const ent::ObjectId& oid) + { + // test whether object is already q'd for replication + PublishedObjectsMap::iterator it = clientObjects_.find(pid); + if (it != clientObjects_.end()) + { + ObjectEntryList::iterator itObj = it->second.find(oid); + if (itObj != it->second.end()) + { + YAKE_LOG_WARNING("netrepsvc","object with this id already queued for replication this client"); + return; //already replicated + } + } + // add to q + qForPublish_[pid].insert(oid); + } + void ServerReplicationService::unpublish(const ent::ObjectId& oid) + { + YAKE_FOR_EACH(PeerIdList::const_iterator,itId,clients_) + { + this->unpublish( *itId, oid ); + } + } + void ServerReplicationService::unpublish(PeerId pid, const ent::ObjectId& oid) + { + // if q'd for publish then remove from q + qForPublish_[pid].erase(oid); + + // if alrady published add to 'unpublish' q + ObjectEntryList& clientObjs = clientObjects_[pid]; + if (clientObjs.find(oid) != clientObjs.end()) + clientObjs.insert(oid); + } + void ServerReplicationService::update() + { + // send 'create object' messages + YAKE_FOR_EACH(PublishedObjectsMap::const_iterator,it,qForPublish_) + { + const PeerId pid = it->first; + const ObjectEntryList& objs = it->second; + s2cEvtCreateObject createObjEvt; + YAKE_FOR_EACH(ObjectEntryList::const_iterator,itObj,objs) + { + createObjEvt.objId_ = *itObj; + eventConn_->sendEvent( pid, createObjEvt, sendOptions_ ); + } + } + qForPublish_.clear(); + + // send 'destroy object' messages + YAKE_FOR_EACH(PublishedObjectsMap::const_iterator,it,qForUnpublish_) + { + const PeerId pid = it->first; + const ObjectEntryList& objs = it->second; + s2cEvtDestroyObject destroyObjEvt; + YAKE_FOR_EACH(ObjectEntryList::const_iterator,itObj,objs) + { + destroyObjEvt.objId_ = *itObj; + eventConn_->sendEvent( pid, destroyObjEvt, sendOptions_ ); + } + } + qForUnpublish_.clear(); + } + +} // namespace net +} // namespace yake Added: trunk/yake/yake/netrepsvc/netClientReplicationService.h =================================================================== --- trunk/yake/yake/netrepsvc/netClientReplicationService.h (rev 0) +++ trunk/yake/yake/netrepsvc/netClientReplicationService.h 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,90 @@ +#ifndef YAKE_NETREPSVC_CLIENTREPLICATIONSERVICE_H +#define YAKE_NETREPSVC_CLIENTREPLICATIONSERVICE_H + +#include <yake/netrepsvc/netPrerequisites.h> +//#include <yake/base/templates/yakeSignals.h> +#include <yake/netrepsvc/netEvents.h> + +#pragma warning(push) +#pragma warning(disable: 4275) // C4275: non dll-interface class 'X' used as base for dll-interface 'Y' + +namespace yake { +namespace net { + + /** The ClientReplicationService manages remotely created objects on the client side. + It gets notified by the remote server when class tables are updated, when global + objects are created or destroyed. + Furthermore it provides callbacks for applications so that they can react on these events. + @note Only the object ids and basic binary information is used by this service. No actual + C++ object classes are created or used for the replicated objects. It expects other + managing objects to handle this. For this it provides various callbacks. + @note update() needs to be called regularly so that the server can handle queued requests. + @note Like most net::IServices the ClientReplicationService needs to be attached to + an IHost and started before it can do its work. + */ + struct NETREPSVC_API ClientReplicationService : public net::IService//, yake::ListenerManager<ClientReplicationListener> + { + /** Creates the ClientReplicationService and let's it use the given channel id. + @note The given channel needs to be identical to the one used on the server. + */ + ClientReplicationService(const ChannelId); + + /** Destroys the service object. + */ + virtual ~ClientReplicationService(); + + /** Called when the service is to be started. */ + virtual void onStart(net::IServiceHost&); + /** Called when the service is to be shut down. */ + virtual void onStop(net::IServiceHost&); + + /** Call this regularly to let the service do it's work. */ + void update(); + + typedef SignalX<void(const s2cEvtClassTable&)> ClassTableSignal; + + /** Subscribe to signal that is fired whenever the 'global' class table + is sent/updated by the server. + @note The signal can only triggered from within a call to update(). + */ + SignalConnection connectToUpdateClassTable(const ClassTableSignal::slot_type&); + + typedef SignalX<void(const ent::ObjectId&)> ObjectIdSignal; + + /** Subscribe to a signal that is fired whenever a global object has been + created by the remote server. + @note The signal can only triggered from within a call to update(). + */ + SignalConnection connectToObjectPublished(const ObjectIdSignal::slot_type&); + + /** Subscribe to a signal that is fired whenever a global object has been + destroyed by the remote server. + @note The signal can only triggered from within a call to update(). + */ + SignalConnection connectToObjectUnpublished(const ObjectIdSignal::slot_type&); + private: + void onRecvClassTable(const PeerId, const NetEvent&, const ChannelId); + void onRecvPublishObject(const PeerId, const NetEvent&, const ChannelId); + void onRecvUnpublishObject(const PeerId, const NetEvent&, const ChannelId); + private: + net::NetEventConnectionPtr eventConn_; + + typedef std::set<ent::ObjectId> ObjectEntryList; + ObjectEntryList qForPublish_; + ObjectEntryList qForUnpublish_; + ObjectEntryList objs_; + ObjectIdSignal sigPublish_; + ObjectIdSignal sigUnpublish_; + + s2cEvtClassTable evtClassTbl_; + bool evtClassTblReceived_; + ClassTableSignal sigClassTblReceived_; + const SendOptions sendOptions_; + }; + +} // namespace net +} // namespace yake + +#pragma warning(pop) + +#endif Added: trunk/yake/yake/netrepsvc/netEvents.h =================================================================== --- trunk/yake/yake/netrepsvc/netEvents.h (rev 0) +++ trunk/yake/yake/netrepsvc/netEvents.h 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,81 @@ +#ifndef YAKE_NETREPSVC_EVENTS_H +#define YAKE_NETREPSVC_EVENTS_H + +#include <yake/netrepsvc/netPrerequisites.h> + +#pragma warning(push) +#pragma warning(disable: 4275) // C4275: non dll-interface class 'X' used as base for dll-interface 'Y' + +namespace yake { +namespace net { + + struct NETREPSVC_API s2cEvtClassTable : public yake::net::NetEvent + { + DECLARE_EVENT( s2cEvtClassTable, 10 ); + virtual bool pack(yake::net::obitstream& out) const + { + std::map<int,int> c; + c[1] = 2; + c[3] = 46; + out << c; + out << globalClassIds_; + return true; + } + virtual bool unpack(yake::net::ibitstream& in) + { + std::map<int,int> c; + in >> c; + in >> globalClassIds_; + return true; + } + //uint8 numClassIdBits_; + std::map<std::string,yake::ent::ClassId> globalClassIds_; + void copyTo(s2cEvtClassTable& other) const + { + if (&other != this) + other.globalClassIds_ = this->globalClassIds_; + } + }; + struct NETREPSVC_API s2cEvtCreateObject : public yake::net::NetEvent + { + DECLARE_EVENT( s2cEvtCreateObject, 20 ); + virtual bool pack(yake::net::obitstream& out) const + { + out << objId_.classId() << objId_.serialNo(); + return true; + } + virtual bool unpack(yake::net::ibitstream& in) + { + yake::ent::ObjectId::ClassId clsId; + yake::ent::ObjectId::SerialNo serNo; + in >> clsId >> serNo; + objId_ = yake::ent::ObjectId(clsId,serNo); + return true; + } + yake::ent::ObjectId objId_; + }; + struct s2cEvtDestroyObject : public yake::net::NetEvent + { + DECLARE_EVENT( s2cEvtDestroyObject, 21 ); + virtual bool pack(yake::net::obitstream& out) const + { + out << objId_.classId() << objId_.serialNo(); + return true; + } + virtual bool unpack(yake::net::ibitstream& in) + { + yake::ent::ObjectId::ClassId clsId; + yake::ent::ObjectId::SerialNo serNo; + in >> clsId >> serNo; + objId_ = yake::ent::ObjectId(clsId,serNo); + return true; + } + yake::ent::ObjectId objId_; + }; + +} // namespace net +} // namespace yake + +#pragma warning(pop) + +#endif Added: trunk/yake/yake/netrepsvc/netPrerequisites.h =================================================================== --- trunk/yake/yake/netrepsvc/netPrerequisites.h (rev 0) +++ trunk/yake/yake/netrepsvc/netPrerequisites.h 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,31 @@ +#ifndef YAKE_NETREPSVC_PREREQUISITES_H +#define YAKE_NETREPSVC_PREREQUISITES_H + +#include <yake/base/yakePrerequisites.h> +#include <yake/base/yakeString.h> +#include <yake/net/net.h> +#include <yake/netsvc/netsvc.h> +#include <yake/ent/ent.h> + +#if YAKE_PLATFORM == PLATFORM_WIN32 && defined(_USRDLL) +# define YAKE_NETREPSVC_DLL +#endif + +#ifdef YAKE_NETREPSVC_EXPORTS +# ifdef YAKE_NETREPSVC_DLL +# pragma message("dllexport") +# define NETREPSVC_API DLLEXPORT +# else +# pragma message("lib") +# define NETREPSVC_API +# endif +#else +# ifdef YAKE_NETREPSVC_DLL +# define NETREPSVC_API DLLIMPORT +# else +# define NETREPSVC_API +# endif +#endif + +#endif + Added: trunk/yake/yake/netrepsvc/netRepSvc.h =================================================================== --- trunk/yake/yake/netrepsvc/netRepSvc.h (rev 0) +++ trunk/yake/yake/netrepsvc/netRepSvc.h 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,15 @@ +#ifndef YAKE_NETREPSVC_H +#define YAKE_NETREPSVC_H + +#include <yake/netrepsvc/netPrerequisites.h> +#include <yake/netrepsvc/netClientReplicationService.h> +#include <yake/netrepsvc/netServerReplicationService.h> + +namespace yake { +namespace net { + + +} // namespace net +} // namespace yake + +#endif Added: trunk/yake/yake/netrepsvc/netServerReplicationService.h =================================================================== --- trunk/yake/yake/netrepsvc/netServerReplicationService.h (rev 0) +++ trunk/yake/yake/netrepsvc/netServerReplicationService.h 2007-01-22 21:38:27 UTC (rev 1610) @@ -0,0 +1,103 @@ +#ifndef YAKE_NETREPSVC_SERVERREPLICATIONSERVICE_H +#define YAKE_NETREPSVC_SERVERREPLICATIONSERVICE_H + +#include <yake/netrepsvc/netPrerequisites.h> +//#include <yake/base/templates/yakeSignals.h> +#include <yake/netrepsvc/netEvents.h> + +#pragma warning(push) +#pragma warning(disable: 4275) // C4275: non dll-interface class 'X' used as base for dll-interface 'Y' + +namespace yake { +namespace net { + + /** The ServerReplicationService manages replicated objects (by id). + + */ + struct NETREPSVC_API ServerReplicationService : public net::IService + { + /** + @note The channel ids on the clients have to be identical to the + givenb channel id. + */ + ServerReplicationService(const ChannelId); + virtual ~ServerReplicationService(); + + /** Called by an IHost when the service is started. */ + virtual void onStart(net::IServiceHost&); + + /** Called by an IHost when the service is stopped. */ + virtual void onStop(net::IServiceHost&); + + /** Sets the class table that is to be replicated to the clients. + The class table maps names to class ids. Object ids contain the + class id and make replication and identification on remote clients + possible. + @note At the moment, the class table has to be set prior to the start + of the service OR prior to the first replication attempt. + It may NOT change after that! + */ + void setClassTableData(const s2cEvtClassTable&); + + // sends immediately! + void startReplicationToClient(const PeerId); + + // Q'd actions + /** Queues an object for replication to all clients. + @note This is action is queued and then executed from within a call to update(). + Therefore it is possible to undo this action by calling unpublish() + prior to update(). + */ + void publish(const ent::ObjectId&); + /** Queues an object for replication to a specific client. + @note This is action is queued and then executed from within a call to update(). + Therefore it is possible to undo this action by calling unpublish() + prior to update(). + */ + void publish(PeerId, const ent::ObjectId&); + /** Queues an object for destruction on all clients it was replicated to. + @note This is action is queued and then executed from within a call to update(). + Therefore it is possible to undo this action by calling publish() + prior to update(). + */ + void unpublish(const ent::ObjectId&); + /** Queues an object for destruction on a specific client it was replicated to. + @note This is action is queued and then executed from within a call to update(). + Therefore it is possible to undo this action by calling publish() + prior to update(). + */ + void unpublish(PeerId, const ent::ObjectId&); + + void unpublishAll(); + + /** This is to be regularly called so that this service can do its magic. + */ + void update(); + private: + net::NetEventConnectionPtr eventConn_; + + typedef std::set<PeerId> PeerIdList; + PeerIdList clients_; + + /*struct ObjectEntry + { + ent::ObjectId objId_; + }; + */ + typedef std::set<ent::ObjectId> ObjectEntryList; + typedef std::map<PeerId,ObjectEntryList> PublishedObjectsMap; + PublishedObjectsMap clientObjects_; + PublishedObjectsMap qForPublish_; + PublishedObjectsMap qForUnpublish_; + + s2cEvtClassTable evtClassTbl_; + ChannelId cId_; + const SendOptions sendOptions_; + }; + +} // namespace net +} // namespace yake + +#pragma warning(pop) + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:37:52
|
Revision: 1609 http://svn.sourceforge.net/yake/?rev=1609&view=rev Author: psyclonist Date: 2007-01-22 13:37:49 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/yake/samples/physics/demo/yakeDemo.cpp Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-01-22 21:37:23 UTC (rev 1608) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-01-22 21:37:49 UTC (rev 1609) @@ -196,7 +196,7 @@ } void onCollisionEntered() { - YAKE_LOG("demo: collision!"); + //YAKE_LOG("demo","collision!"); } void setupLights() { @@ -225,7 +225,7 @@ // physics 1 - SharedPtr<base::Library> pLib = loadLib("physicsOde" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("physicsOde") ); YAKE_ASSERT( pLib ).debug("Cannot load physics plugin 1."); mPhysics1 = templates::create< physics::IPhysicsSystem >("ode"); @@ -249,7 +249,7 @@ #endif // graphics - pLib = loadLib("graphicsOgre" ); + pLib = loadLib(YAKE_DYNLIB_NAME("graphicsOgre")); YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); mGraphics = templates::create_default< graphics::IGraphicsSystem >(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:37:24
|
Revision: 1608 http://svn.sourceforge.net/yake/?rev=1608&view=rev Author: psyclonist Date: 2007-01-22 13:37:23 -0800 (Mon, 22 Jan 2007) Log Message: ----------- various tidy ups in the networking system, moved replication services out of the prototype into 'netrepsvc', modified logging API, added IServerPacketConnection::sendToAllExcept() Modified Paths: -------------- trunk/yake/samples/net/inprocess/common.h trunk/yake/samples/net/roclient/ROClient.cpp trunk/yake/samples/net/roclient/ROClient.h trunk/yake/samples/net/roserver/ROServer.cpp trunk/yake/samples/net/roserver/ROServer.h trunk/yake/src/net/detail/netEnetServerPacketConnection.cpp trunk/yake/src/net/detail/netEventConnection.cpp trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp trunk/yake/src/netsvc/service/netClientCommService.cpp trunk/yake/src/netsvc/service/netClientTimeService.cpp trunk/yake/src/netsvc/service/netServerCommService.cpp trunk/yake/src/netsvc/service/netServerTimeService.cpp trunk/yake/yake/net/detail/netEnetServerPacketConnection.h trunk/yake/yake/net/detail/netInternal.h trunk/yake/yake/net/netPacket.h trunk/yake/yake/netsvc/netPrerequisites.h trunk/yake/yake/samples/common/yakeExampleApplication.h trunk/yake/yake/samples/net/common/commonEvents.h Modified: trunk/yake/samples/net/inprocess/common.h =================================================================== --- trunk/yake/samples/net/inprocess/common.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/samples/net/inprocess/common.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -7,4 +7,5 @@ #include <yake/net/net.h> #include <yake/samples/net/common/common.h> +#define COUTLN(X) YAKE_LOG_INFORMATION("app",X) #endif Modified: trunk/yake/samples/net/roclient/ROClient.cpp =================================================================== --- trunk/yake/samples/net/roclient/ROClient.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/samples/net/roclient/ROClient.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -1,21 +1,18 @@ #include <samples/net/inprocess/common.h> +#include <yake/netrepsvc/netEvents.h> #include <samples/net/roclient/ROClient.h> namespace yake { namespace ro { client::client(const net::Address& serverAddr) : - timedOut_(false), stage_(CS_JOINING), objMgr_(0), serverAddr_(serverAddr), packetConnStarted_(false) + timedOut_(false), stage_(CS_JOINING), serverAddr_(serverAddr), packetConnStarted_(false) { } client::~client() { stop(); } - void client::setObjectManager(ent::ObjectManager* objMgr) - { - objMgr_ = objMgr; - } bool client::onStart() { try { @@ -68,10 +65,6 @@ c2sEvtJoinReq::create, c2sEvtJoinReq::destroy ); evtConn_->registerEvent( s2cEvtJoinReqReply::ID, net::NetEvent::DIR_ANY, s2cEvtJoinReqReply::create, s2cEvtJoinReqReply::destroy ); - evtConn_->registerEvent( s2cEvtClassTable::ID, net::NetEvent::DIR_ANY, - s2cEvtClassTable::create, s2cEvtClassTable::destroy ); - evtConn_->registerEvent( s2cEvtCreateObject::ID, net::NetEvent::DIR_ANY, - s2cEvtCreateObject::create, s2cEvtCreateObject::destroy ); evtConn_->setProcessEventCallback( boost::bind(&client::onProcessEvent,this,_1,_2,_3) ); evtConn_->setPacketConnection( conn_.get(), net::NetEvent::DIR_ANY ); @@ -149,70 +142,6 @@ void client::running_onProcessEvent(const net::PeerId, const net::NetEvent& evt, const net::ChannelId) { COUTLN("client (running) received event (" << (int)evt.id() << ")."); - if (evt.id() == s2cEvtClassTable::ID) - { - COUTLN("client: starting sim " << int(evt.id())); - const s2cEvtClassTable& reply = static_cast<const s2cEvtClassTable&>( evt ); - COUTLN(" " << int(reply.globalClassIds_.size()) << " class(es)"); - for (std::map<std::string,ent::ClassId>::const_iterator it = reply.globalClassIds_.begin(); - it != reply.globalClassIds_.end(); ++it) - { - const std::string& clsName = it->first; - const ent::ClassId globalClsId = it->second; - COUTLN(" ['" << clsName << "'] = " << int(globalClsId)); - if (!objMgr_) - { - COUTLN(" -> no object manager"); - } - else - { - ent::ObjectManager::ClassIdLookupResult ret = objMgr_->getClassId( clsName ); - if (ret.first) - { - const ent::ClassId localClsId = ret.second; - if (localClsId != it->second) - { - if (objMgr_->registerClassAlias( globalClsId, localClsId )) - { - COUTLN(" -> successfully registered alias"); - } - else - { - COUTLN(" -> failed to register alias"); - } - } - else - { - COUTLN(" -> no need to register an alias (global id = local id; and names match)"); - } - } - else - { - COUTLN(" -> class with this name not registered locally!"); - } - } - } - } - else if (evt.id() == s2cEvtCreateObject::ID) - { - COUTLN("client: creating object"); - const s2cEvtCreateObject& reply = static_cast<const s2cEvtCreateObject&>( evt ); - COUTLN(" object class='" << int(reply.objId_.classId()) << "' serNo='" << int(reply.objId_.serialNo()) << "'"); - if (objMgr_) - { - ent::Object* o = objMgr_->makeObject( reply.objId_ ); - if (o) - { - COUTLN(" successfully created! (class='" << o->isA()->name() << "')"); - objMgr_->destroyObject( o ); - } - else - COUTLN(" failed to create!"); - } - } - //else if (evt.id() == s2cUpdateObject::ID) - { - } } void client::init_onProcessEvent(const net::PeerId, const net::NetEvent& evt, const net::ChannelId) { Modified: trunk/yake/samples/net/roclient/ROClient.h =================================================================== --- trunk/yake/samples/net/roclient/ROClient.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/samples/net/roclient/ROClient.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -18,8 +18,6 @@ virtual net::NetEventConnectionPtr getEventConnection() const { return evtConn_; } - void setObjectManager(yake::ent::ObjectManager*); - void waitForStart(); void step(); private: @@ -40,8 +38,6 @@ }; stage_t stage_; - yake::ent::ObjectManager* objMgr_; - typedef net::INetEventConnection::EvtProcessEventFn ProcessEventFn; ProcessEventFn currEvtProcessFn_; private: Modified: trunk/yake/samples/net/roserver/ROServer.cpp =================================================================== --- trunk/yake/samples/net/roserver/ROServer.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/samples/net/roserver/ROServer.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -91,18 +91,10 @@ { return sigClientDisconnected_.connect(slot); } - const s2cEvtClassTable& server::getClassTableMessage() const - { - return evtClassTbl_; - } void server::onClientSimStarted(iclient&c) { sigClientSimulationStarted_(c.getPeerId()); } - void server::setClassTableMessage(const s2cEvtClassTable& msg) - { - msg.copyTo( evtClassTbl_ ); - } bool server::onStart() { if (conn_) @@ -166,9 +158,9 @@ evtConn_->registerEvent( c2sEvtJoinReq::ID, net::NetEvent::DIR_ANY, c2sEvtJoinReq::create, c2sEvtJoinReq::destroy ); evtConn_->registerEvent( s2cEvtJoinReqReply::ID, net::NetEvent::DIR_ANY, s2cEvtJoinReqReply::create, s2cEvtJoinReqReply::destroy ); - evtConn_->registerEvent( s2cEvtClassTable::ID, net::NetEvent::DIR_ANY, s2cEvtClassTable::create, s2cEvtClassTable::destroy ); + evtConn_->registerEvent( net::s2cEvtClassTable::ID, net::NetEvent::DIR_ANY, net::s2cEvtClassTable::create, net::s2cEvtClassTable::destroy ); evtConn_->registerEvent( c2sEvtSimOk::ID, net::NetEvent::DIR_ANY, c2sEvtSimOk::create, c2sEvtSimOk::destroy ); - evtConn_->registerEvent( s2cEvtCreateObject::ID, net::NetEvent::DIR_ANY, s2cEvtCreateObject::create, s2cEvtCreateObject::destroy ); + evtConn_->registerEvent( net::s2cEvtCreateObject::ID, net::NetEvent::DIR_ANY, net::s2cEvtCreateObject::create, net::s2cEvtCreateObject::destroy ); evtConn_->setProcessEventCallback( boost::bind(&server::onProcessEvent,this,_1,_2,_3) ); evtConn_->setPacketConnection( conn_.get(), net::NetEvent::DIR_ANY ); @@ -250,10 +242,6 @@ evtConn->sendEvent( this->id, joinReply, net::SendOptions().channel(CHANNELID_CONTROL) ); #endif - // replicate class table - evtConn->sendEvent( this->id, this->svr.getClassTableMessage(), - net::SendOptions().channel(CHANNELID_CONTROL).ordered().reliable() ); - // use different event callback for the CS_RUNNING stage: COUTLN("server: => CLIENT: RUNNING"); processEventFn_ = boost::bind(&client::running_onProcessEvent,this,_1,_2); Modified: trunk/yake/samples/net/roserver/ROServer.h =================================================================== --- trunk/yake/samples/net/roserver/ROServer.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/samples/net/roserver/ROServer.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -2,6 +2,7 @@ #define RO_SERVER_H #include <yake/netsvc/netSvc.h> +#include <yake/netrepsvc/netEvents.h> #include <yake/samples/net/common/common.h> #include <yake/samples/net/common/commonEvents.h> #include <yake/samples/net/common/roCommon.h> @@ -46,10 +47,6 @@ //void queueEvent(const net::PeerId, net::NetEvent*, const net::ChannelId); //void queueEventBroadcast(net::NetEvent*, const net::ChannelId); - //typedef boost::function<void(s2cEvtClassTable&)> InitEvtClassTableFn; - //void setInitClassTableMessageFn(const InitEvtClassTableFn&); - void setClassTableMessage(const s2cEvtClassTable&); - typedef SignalX<void(const net::PeerId)> PeerIdSignal; typedef PeerIdSignal ClientSimulationStartedSignal; typedef PeerIdSignal ClientDisconnectedSignal; @@ -57,7 +54,7 @@ yake::SignalConnection subscribeToClientDisconnected(const ClientDisconnectedSignal::slot_type&); //private: - const s2cEvtClassTable& getClassTableMessage() const; + const net::s2cEvtClassTable& getClassTableMessage() const; private: server(const server&); server& operator=(const server&); @@ -99,7 +96,6 @@ //mutable boost::mutex outEvtQMtx_; //InitEvtClassTableFn initEvtClassTableFn_; - s2cEvtClassTable evtClassTbl_; ClientSimulationStartedSignal sigClientSimulationStarted_; ClientDisconnectedSignal sigClientDisconnected_; }; Modified: trunk/yake/src/net/detail/netEnetServerPacketConnection.cpp =================================================================== --- trunk/yake/src/net/detail/netEnetServerPacketConnection.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/net/detail/netEnetServerPacketConnection.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -398,21 +398,53 @@ } void EnetServerPacketConnection::sendOutgoingPacketQ() { + //@todo Only send if the target client is CS_CONNECTED + for (OutgoingPacketQ::const_iterator it = m_outgoingPacketQ.begin(); it != m_outgoingPacketQ.end(); ++it) //YAKE_FOR_EACH(OutgoingPacketQ::const_iterator,it,m_outgoingPacketQ) { const SendOptions& opt = it->opt_; const PacketPtr& pckt = it->pckt_; YAKE_ASSERT( pckt.get() ); - if (it->target_ == PEERID_BROADCAST) + if (it->sendToAllExcept_) + { + // to all clients except peerId + IdToClientMap::const_iterator itIdEnd = m_id2client.end(); + for (IdToClientMap::const_iterator itId = m_id2client.begin(); itId!=itIdEnd; ++itId) + { + if (itId->first == it->target_) + continue; + this->sendTo( itId->first, pckt->payload().data(), pckt->payload().size(), + opt.getReliability(), opt.getOrdering(), opt.getChannel() ); + } + } + else if (it->target_ == PEERID_BROADCAST) + { + // to all clients this->sendBroadcast( pckt->payload().data(), pckt->payload().size(), opt.getReliability(), opt.getOrdering(), opt.getChannel() ); + } else + { + // to a single client this->sendTo( it->target_, pckt->payload().data(), pckt->payload().size(), opt.getReliability(), opt.getOrdering(), opt.getChannel() ); + } } m_outgoingPacketQ.clear(); } + void EnetServerPacketConnection::sendToAllExcept(const PeerId peerId, const PacketPtr& pckt, const SendOptions& opt ) + { + YAKE_ASSERT( pckt ); + if (!pckt) + return; + OutgoingPacket pcktEntry; + pcktEntry.opt_ = opt; + pcktEntry.pckt_ = pckt; + pcktEntry.target_ = opt.getPeerId(); + pcktEntry.sendToAllExcept_ = true; + m_outgoingPacketQ.push_back( pcktEntry ); + } void EnetServerPacketConnection::send( const PacketPtr& pckt, const SendOptions& opt ) { YAKE_ASSERT( pckt ); Modified: trunk/yake/src/net/detail/netEventConnection.cpp =================================================================== --- trunk/yake/src/net/detail/netEventConnection.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/net/detail/netEventConnection.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -34,7 +34,7 @@ EventConnection::~EventConnection() { stop(); -#ifdef _DEBUG +#ifdef YAKE_DEBUG std::cout << "\nnet::EventConnection statistics:\n"; std::cout << " total errors : " << stats_.totalErrors() << "\n"; std::cout << " total events processed : " << stats_.numEventsProcessed << "\n"; @@ -121,9 +121,18 @@ NET_ASSERT( !fnDestroy.empty() ); if (fnDestroy.empty()) return; - NET_ASSERT( !map_contains(eventIds_,id) ); + // NB It is OK to register a single id multiple times + //NET_ASSERT( !map_contains(eventIds_,id) ); +#ifdef YAKE_DEBUG if (map_contains(eventIds_,id)) + { + YAKE_LOG_WARNING("net","event id registered multiple times on event connection"); return; + } +#endif + + if (map_contains(eventIds_,id)) + return; IdEntry entry; entry.dir = dir; entry.fnCreate = fnCreate; Modified: trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp =================================================================== --- trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/netsvc/detail/netPeerRttCalculator.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -57,7 +57,7 @@ is_time_sent(origTime)); if (itPing == sentPings_.end()) { - COUTLN("(cannot find ping for time " << origTime << ")"); + YAKE_LOG_INFORMATION("rtt","(cannot find ping for time " << origTime << ")"); return false; } @@ -68,10 +68,10 @@ PingInfo& pingInfo = receivedPings_.back(); pingInfo.timeRecvd_ = currTimeMs; pingInfo.rtt_ = (double(pingInfo.timeRecvd_) - double(pingInfo.timeSent_)); - COUTLN(pingInfo.rtt_); + YAKE_LOG_INFORMATION("rtt",pingInfo.rtt_); if (pingInfo.rtt_ < 0.) { - COUTLN("(ignoring rtt < 0; rtt=" << pingInfo.rtt_ << ")\n"); + YAKE_LOG_INFORMATION("rtt","(ignoring rtt < 0; rtt=" << pingInfo.rtt_ << ")\n"); receivedPings_.pop_back(); return false; } Modified: trunk/yake/src/netsvc/service/netClientCommService.cpp =================================================================== --- trunk/yake/src/netsvc/service/netClientCommService.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/netsvc/service/netClientCommService.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -12,7 +12,7 @@ } void ClientCommService::onStart(IServiceHost& host) { - COUTLN("client: starting comm service"); + YAKE_LOG_INFORMATION("client-comm", "client: starting comm service"); evtConn_ = host.getEventConnection(); evtConn_->registerEvent( s2cEvtCommMsg::ID, NetEvent::DIR_ANY, s2cEvtCommMsg::create, s2cEvtCommMsg::destroy ); host.subscribeToNetEvent( s2cEvtCommMsg::ID, commChannelId_, @@ -22,7 +22,7 @@ } void ClientCommService::onStop(IServiceHost&) { - COUTLN("client: stopping comm service"); + YAKE_LOG_INFORMATION("client-comm", "client: stopping comm service"); } void ClientCommService::joinChannel(const String& cId) { @@ -38,7 +38,7 @@ void ClientCommService::onProcessMsg(const PeerId pId, const NetEvent& evt, const ChannelId) { const s2cEvtCommMsg& msg = static_cast<const s2cEvtCommMsg&>(evt); - COUTLN("client-comm: received message: cid=" << msg.cId_ << " from=" << msg.from_ << " to=" << msg.to_ << " text=" << msg.msg_); + YAKE_LOG_INFORMATION("client-comm", "client-comm: received message: cid=" << msg.cId_ << " from=" << msg.from_ << " to=" << msg.to_ << " text=" << msg.msg_); activeChannels_[ msg.cId_ ].outstandingMessages_.push_back(MsgEntry(msg.from_,msg.msg_)); } Modified: trunk/yake/src/netsvc/service/netClientTimeService.cpp =================================================================== --- trunk/yake/src/netsvc/service/netClientTimeService.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/netsvc/service/netClientTimeService.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -12,7 +12,7 @@ } void ClientTimeService::onStart(IServiceHost& host) { - COUTLN("starting time service"); + YAKE_LOG_INFORMATION("client-time", "starting time service"); evtConn_ = host.getEventConnection(); evtConn_->registerEvent( s2cEvtPing::ID, NetEvent::DIR_ANY, s2cEvtPing::create, s2cEvtPing::destroy ); @@ -25,11 +25,11 @@ boost::bind(&ClientTimeService::onPong,this,_1,_2,_3)); firstTime_ = true; - COUTLN("time service is up"); + YAKE_LOG_INFORMATION("client-time", "time service is up"); } void ClientTimeService::onStop(IServiceHost&) { - COUTLN("stopping time service"); + YAKE_LOG_INFORMATION("client-time", "stopping time service"); timer_.stop(); firstTime_ = false; @@ -37,7 +37,7 @@ } void ClientTimeService::onPing(const PeerId pId, const NetEvent& evt, const ChannelId cId) { - COUTLN("client-time: received PING with cId='" << int(cId) << "'"); + YAKE_LOG_INFORMATION("client-time", "client-time: received PING with cId='" << int(cId) << "'"); const s2cEvtPing& ping = static_cast<const s2cEvtPing&>(evt); @@ -51,7 +51,7 @@ { //clockDelta_ = 0.; clockDelta_ = 0.001 * double(ping.serverTime_) - currTime; - COUTLN("initial clock delta = " << clockDelta_); + YAKE_LOG_INFORMATION("client-time", "initial clock delta = " << clockDelta_); firstTime_ = false; } currTime += clockDelta_; @@ -67,7 +67,7 @@ } void ClientTimeService::onPong(const PeerId pId, const NetEvent& evt, const ChannelId cId) { - COUTLN("client-time: received PONG with cId='" << int(cId) << "'"); + YAKE_LOG_INFORMATION("client-time", "client-time: received PONG with cId='" << int(cId) << "'"); const s2cEvtPong& msg = static_cast<const s2cEvtPong&>(evt); @@ -79,20 +79,20 @@ // recalc RTT rttCalc_.processPong( currTimeMs, msg.clientTime_ ); - COUTLN("client-time: RTT=" << rttCalc_.getMeanRtt() << " over " << int(rttCalc_.sizeReceivedPings()) << " samples"); + YAKE_LOG_INFORMATION("client-time", "client-time: RTT=" << rttCalc_.getMeanRtt() << " over " << int(rttCalc_.sizeReceivedPings()) << " samples"); // adjust clock if (rttCalc_.getMeanRtt() > 0.) { - //COUTLN("current clock=" << (timerVal+clockDelta_) << " clockdelta=" << clockDelta_); + //YAKE_LOG_INFORMATION("client-time", "current clock=" << (timerVal+clockDelta_) << " clockdelta=" << clockDelta_); const double halfLatency = 0.001 * .5 * rttCalc_.getMeanRtt(); const double serverTime = 0.001 * double(msg.serverTime2_); // in sec const double deltaToServer = serverTime - currTime + halfLatency; clockDelta_ += deltaToServer; // @todo use a factor? (e.g. 0.6) - COUTLN("server t1=" << msg.serverTime_ << " t2=" << msg.serverTime2_); - //COUTLN("client sent=" << msg.clientTime_ << " curr(ms)=" << currTimeMs); - COUTLN("current clock=" << (timerVal+clockDelta_) << " clockdelta=" << clockDelta_); - COUTLN("deltaToServer=" << deltaToServer); + YAKE_LOG_INFORMATION("client-time", "server t1=" << msg.serverTime_ << " t2=" << msg.serverTime2_); + //YAKE_LOG_INFORMATION("client-time", "client sent=" << msg.clientTime_ << " curr(ms)=" << currTimeMs); + YAKE_LOG_INFORMATION("client-time", "current clock=" << (timerVal+clockDelta_) << " clockdelta=" << clockDelta_); + YAKE_LOG_INFORMATION("client-time", "deltaToServer=" << deltaToServer); } } double ClientTimeService::getClientTime() const Modified: trunk/yake/src/netsvc/service/netServerCommService.cpp =================================================================== --- trunk/yake/src/netsvc/service/netServerCommService.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/netsvc/service/netServerCommService.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -13,7 +13,7 @@ } void ServerCommService::onStart(IServiceHost& host) { - COUTLN("starting comm service"); + YAKE_LOG_INFORMATION("server-comm", "starting comm service"); evtConn_ = host.getEventConnection(); evtConn_->registerEvent( s2cEvtCommMsg::ID, NetEvent::DIR_ANY, s2cEvtCommMsg::create, s2cEvtCommMsg::destroy ); @@ -27,7 +27,7 @@ } void ServerCommService::onStop(IServiceHost&) { - COUTLN("stopping comm service"); + YAKE_LOG_INFORMATION("server-comm", "stopping comm service"); } void ServerCommService::onClientConnected(const PeerId pId) { @@ -36,7 +36,7 @@ } void ServerCommService::onClientDisconnected(const PeerId pId) { - COUTLN("server-comm: user '" << pId << "' disconnected."); + YAKE_LOG_INFORMATION("server-comm", "server-comm: user '" << pId << "' disconnected."); // remove user from all channels YAKE_FOR_EACH(ChannelList::iterator,itChannel,channels_) @@ -49,7 +49,7 @@ if (channels_.find( name ) != channels_.end()) YAKE_EXCEPT("channel with this name already exists"); channels_[ name ].description_ = description; - COUTLN("server-comm: channel '" << name << "' created."); + YAKE_LOG_INFORMATION("server-comm", "server-comm: channel '" << name << "' created."); } void ServerCommService::destroyChannel(const String& name) { @@ -67,7 +67,7 @@ void ServerCommService::onProcessJoinRequest(const PeerId pId, const NetEvent& evt, const ChannelId) { const c2sEvtCommJoinChannel& msg = static_cast<const c2sEvtCommJoinChannel&>(evt); - COUTLN("server-comm: user " << int(pId) << " likes to join '" << msg.cId_ << "'"); + YAKE_LOG_INFORMATION("server-comm", "server-comm: user " << int(pId) << " likes to join '" << msg.cId_ << "'"); ChannelList::iterator itC = channels_.find( msg.cId_ ); if (itC == channels_.end()) @@ -91,7 +91,7 @@ void ServerCommService::onProcessMsg(const PeerId pId, const NetEvent& evt, const ChannelId) { const s2cEvtCommMsg& msg = static_cast<const s2cEvtCommMsg&>(evt); - COUTLN("server-comm: received: pId=" << int(pId) + YAKE_LOG_INFORMATION("server-comm", "server-comm: received: pId=" << int(pId) << " cId=" << msg.cId_ << " from=" << msg.from_ << " to=" << msg.to_ << " text=" << msg.msg_); // special command channel: Modified: trunk/yake/src/netsvc/service/netServerTimeService.cpp =================================================================== --- trunk/yake/src/netsvc/service/netServerTimeService.cpp 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/src/netsvc/service/netServerTimeService.cpp 2007-01-22 21:37:23 UTC (rev 1608) @@ -12,7 +12,7 @@ } void ServerTimeService::onStart(IServiceHost& host) { - COUTLN("starting time service"); + YAKE_LOG_INFORMATION("server-time", "starting time service"); evtConn_ = host.getEventConnection(); evtConn_->registerEvent( s2cEvtPing::ID, NetEvent::DIR_ANY, s2cEvtPing::create, s2cEvtPing::destroy ); @@ -26,7 +26,7 @@ } void ServerTimeService::onStop(IServiceHost&) { - COUTLN("stopping time service"); + YAKE_LOG_INFORMATION("server-time", "stopping time service"); timer_.stop(); timer_.reset(); } @@ -40,7 +40,7 @@ } void ServerTimeService::onClientDisconnected(const PeerId pId) { - COUTLN("server-time: user '" << pId << "' disconnected."); + YAKE_LOG_INFORMATION("server-time", "server-time: user '" << pId << "' disconnected."); users_.erase( pId ); } @@ -69,10 +69,10 @@ if (timeSinceSent > 950) { //@todo force recalc of RTT - COUTLN("server-time: client timed out?"); + YAKE_LOG_INFORMATION("server-time", "server-time: client timed out?"); //itUser->second.processPong( timeMs, // itPing->timeSent_ - itUser->second.meanRtt_ * 2 ); - //COUTLN("server-time: new RTT = " << itUser->second.meanRtt_); + //YAKE_LOG_INFORMATION("server-time", "server-time: new RTT = " << itUser->second.meanRtt_); } } // clear list and add new ping info @@ -90,7 +90,7 @@ { //@todo handle bad cast! const c2sEvtPong& msg = static_cast<const c2sEvtPong&>(evt); - COUTLN("server-time: user " << int(pId) << " pong'd with '" << msg.serverTime_ << "'"); + YAKE_LOG_INFORMATION("server-time", "server-time: user " << int(pId) << " pong'd with '" << msg.serverTime_ << "'"); const uint32 timeMs = uint32(1000. * timer_.getTime()); @@ -113,10 +113,10 @@ // if (!peerInfo.processPong(timeMs,msg.serverTime_)) { - COUTLN("server-time: could not handle PONG.\n"); + YAKE_LOG_INFORMATION("server-time", "server-time: could not handle PONG.\n"); return; } - COUTLN("server-time: client '" << pId << "' RTT=" << peerInfo.getMeanRtt() + YAKE_LOG_INFORMATION("server-time", "server-time: client '" << pId << "' RTT=" << peerInfo.getMeanRtt() << " over " << int(peerInfo.sizeReceivedPings()) << " samples"); for(detail::PeerRttCalculator::const_pinginfo_iterator pi = peerInfo.beginReceivedPings(); pi != peerInfo.endReceivedPings(); ++pi) Modified: trunk/yake/yake/net/detail/netEnetServerPacketConnection.h =================================================================== --- trunk/yake/yake/net/detail/netEnetServerPacketConnection.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/net/detail/netEnetServerPacketConnection.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -33,6 +33,7 @@ virtual void send(const PacketPtr&, const SendOptions& opt = SendOptions()); virtual void send(const PeerId, const PacketPtr&, const SendOptions& opt = SendOptions()); + virtual void sendToAllExcept(const PeerId, const PacketPtr&, const SendOptions& opt = SendOptions()); virtual void addStartedCallback(const OnStartedFn&); virtual void addClientConnectedCallback(const OnClientConnectedFn&); @@ -163,6 +164,9 @@ PeerId target_; PacketPtr pckt_; SendOptions opt_; + bool sendToAllExcept_; + OutgoingPacket() : sendToAllExcept_(false) + {} }; typedef std::deque<OutgoingPacket> OutgoingPacketQ; OutgoingPacketQ m_outgoingPacketQ; Modified: trunk/yake/yake/net/detail/netInternal.h =================================================================== --- trunk/yake/yake/net/detail/netInternal.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/net/detail/netInternal.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -13,19 +13,9 @@ #include <boost/thread/mutex.hpp> #include <boost/bind.hpp> -#define NET_ERROR( X ) \ - { \ - std::stringstream s; \ - s << "net_error: " << X << "\n"; \ - std::cerr << s.str().c_str(); \ - } +#define NET_ERROR( X ) YAKE_LOG_ERROR("net",X) -#define NET_LOG( X ) \ - { \ - std::stringstream s; \ - s << "net: " << X << "\n"; \ - std::cout << s.str().c_str(); \ - } +#define NET_LOG( X ) YAKE_LOG_INFORMATION("net",X) #define NET_THROW(MSG) \ throw Exception(MSG,__FILE__,__LINE__) Modified: trunk/yake/yake/net/netPacket.h =================================================================== --- trunk/yake/yake/net/netPacket.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/net/netPacket.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -124,6 +124,10 @@ virtual void addClientConnectedCallback(const OnClientConnectedFn&) = 0; /** Set callback to be called when a client disconnected. */ virtual void addClientDisconnectedCallback(const OnClientDisconnectedFn&) = 0; + + /** Sends a packet to all connected clients except the specified one. + */ + virtual void sendToAllExcept(const PeerId, const PacketPtr&, const SendOptions& opt = SendOptions()) = 0; }; /** A packet connection interface specific to packet clients. Modified: trunk/yake/yake/netsvc/netPrerequisites.h =================================================================== --- trunk/yake/yake/netsvc/netPrerequisites.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/netsvc/netPrerequisites.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -36,14 +36,6 @@ CLASS() : ::yake::net::NetEvent(ID) \ {} -/** @todo replace with real logging */ -#define COUTLN(X) \ -{ \ - std::stringstream ss; \ - ss << X; \ - yake::logging::log( yake::logging::S_INFORMATION, ss.str() ); \ -} - /** @todo move the streaming operators */ namespace yake { namespace net { Modified: trunk/yake/yake/samples/common/yakeExampleApplication.h =================================================================== --- trunk/yake/yake/samples/common/yakeExampleApplication.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/samples/common/yakeExampleApplication.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -122,15 +122,6 @@ // scripting if ( mLoadScriptingSystem ) { - -#ifdef YAKE_DEBUG -# define YAKE_DYNLIB_POSTFIX "_d" -#else -# define YAKE_DYNLIB_POSTFIX -#endif -#define YAKE_DYNLIB_NAME(X) \ - yake::String("yake_" X YAKE_DYNLIB_POSTFIX).c_str() - SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("scriptingLua")); YAKE_ASSERT( pLib ).debug("Cannot load scripting system"); Modified: trunk/yake/yake/samples/net/common/commonEvents.h =================================================================== --- trunk/yake/yake/samples/net/common/commonEvents.h 2007-01-22 21:34:15 UTC (rev 1607) +++ trunk/yake/yake/samples/net/common/commonEvents.h 2007-01-22 21:37:23 UTC (rev 1608) @@ -108,48 +108,21 @@ virtual bool pack(yake::net::obitstream& out) const { out.write( accepted ); - std::string msg("i wanna join!"); - out << msg; + //std::string msg("i wanna join!"); + //out << msg; return true; } virtual bool unpack(yake::net::ibitstream& in) { in.read( accepted ); - std::string msg; - in >> msg; - COUTLN("MSG: " << msg.c_str()); + //std::string msg; + //in >> msg; + //COUTLN("MSG: " << msg.c_str()); return true; } bool accepted; }; -struct s2cEvtClassTable : public yake::net::NetEvent -{ - DECLARE_EVENT( s2cEvtClassTable, 10 ); - virtual bool pack(yake::net::obitstream& out) const - { - std::map<int,int> c; - c[1] = 2; - c[3] = 46; - out << c; - out << globalClassIds_; - return true; - } - virtual bool unpack(yake::net::ibitstream& in) - { - std::map<int,int> c; - in >> c; - in >> globalClassIds_; - return true; - } - //uint8 numClassIdBits_; - std::map<std::string,yake::ent::ClassId> globalClassIds_; - void copyTo(s2cEvtClassTable& other) const - { - if (&other != this) - other.globalClassIds_ = this->globalClassIds_; - } -}; struct c2sEvtSimOk : public yake::net::NetEvent { DECLARE_EVENT( c2sEvtSimOk, 11 ); @@ -162,22 +135,4 @@ return true; } }; -struct s2cEvtCreateObject : public yake::net::NetEvent -{ - DECLARE_EVENT( s2cEvtCreateObject, 20 ); - virtual bool pack(yake::net::obitstream& out) const - { - out << objId_.classId() << objId_.serialNo(); - return true; - } - virtual bool unpack(yake::net::ibitstream& in) - { - yake::ent::ObjectId::ClassId clsId; - yake::ent::ObjectId::SerialNo serNo; - in >> clsId >> serNo; - objId_ = yake::ent::ObjectId(clsId,serNo); - return true; - } - yake::ent::ObjectId objId_; -}; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:34:15
|
Revision: 1607 http://svn.sourceforge.net/yake/?rev=1607&view=rev Author: psyclonist Date: 2007-01-22 13:34:15 -0800 (Mon, 22 Jan 2007) Log Message: ----------- added beginObjects() and endObjects() for iterating over contained objects Modified Paths: -------------- trunk/yake/src/ent/object_mgr.cpp trunk/yake/yake/ent/object_mgr.h Modified: trunk/yake/src/ent/object_mgr.cpp =================================================================== --- trunk/yake/src/ent/object_mgr.cpp 2007-01-22 21:33:25 UTC (rev 1606) +++ trunk/yake/src/ent/object_mgr.cpp 2007-01-22 21:34:15 UTC (rev 1607) @@ -148,6 +148,14 @@ { return objMgr_.getObject( objId ); } + ObjectManager::const_object_iterator ObjectManager::beginObjects() const + { + return objs_.begin(); + } + ObjectManager::const_object_iterator ObjectManager::endObjects() const + { + return objs_.end(); + } } } Modified: trunk/yake/yake/ent/object_mgr.h =================================================================== --- trunk/yake/yake/ent/object_mgr.h 2007-01-22 21:33:25 UTC (rev 1606) +++ trunk/yake/yake/ent/object_mgr.h 2007-01-22 21:34:15 UTC (rev 1607) @@ -160,6 +160,11 @@ bool registerClassAlias(const String& aliasName, const ClassId targetClsId); bool registerClassAlias(const ClassId aliasClsId, const ClassId targetClsId); void setClassIdGenerationRange(const ClassId min, const ClassId max); + + typedef std::deque<Object*> object_ptr_list; + typedef object_ptr_list::const_iterator const_object_iterator; + const_object_iterator beginObjects() const; + const_object_iterator endObjects() const; private: // typedef ListenerManager<ObjectManagerListener> listener_mgr_type; @@ -169,7 +174,6 @@ private: void setupObjectPostCreate(Object*); - typedef std::deque<Object*> object_ptr_list; object_ptr_list objs_; typedef object::ObjectManager<Object> obj_mgr_type; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:33:27
|
Revision: 1606 http://svn.sourceforge.net/yake/?rev=1606&view=rev Author: psyclonist Date: 2007-01-22 13:33:25 -0800 (Mon, 22 Jan 2007) Log Message: ----------- added another sample to premake build script, provided global macro for building dynamic link library names Modified Paths: -------------- trunk/yake/scripts/premake/samples.lua trunk/yake/yake/base/yakePrerequisites.h Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-01-22 21:32:50 UTC (rev 1605) +++ trunk/yake/scripts/premake/samples.lua 2007-01-22 21:33:25 UTC (rev 1606) @@ -34,6 +34,12 @@ useComponent("entLua") -------------------------------------- +makeSample("samplePhysics1","samples/physics/demo") +useComponent("base") +useComponent("physics") +useComponent("graphics") + +-------------------------------------- makeSample("sampleRafMinimal","samples/raf/minimal") useComponent("base") useComponent("raf") Modified: trunk/yake/yake/base/yakePrerequisites.h =================================================================== --- trunk/yake/yake/base/yakePrerequisites.h 2007-01-22 21:32:50 UTC (rev 1605) +++ trunk/yake/yake/base/yakePrerequisites.h 2007-01-22 21:33:25 UTC (rev 1606) @@ -149,4 +149,13 @@ #define YAKE_FOR_EACH(ITER_TYPE,ITER_NAME,CTR) \ for (ITER_TYPE ITER_NAME = CTR.begin(); ITER_NAME != CTR.end(); ++ITER_NAME) + +#ifdef YAKE_DEBUG +# define YAKE_DYNLIB_POSTFIX "_d" +#else +# define YAKE_DYNLIB_POSTFIX +#endif +#define YAKE_DYNLIB_NAME(X) \ + yake::String("yake_" X YAKE_DYNLIB_POSTFIX).c_str() + #endif // YAKE_BASE_PREREQUISITES_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:32:52
|
Revision: 1605 http://svn.sourceforge.net/yake/?rev=1605&view=rev Author: psyclonist Date: 2007-01-22 13:32:50 -0800 (Mon, 22 Jan 2007) Log Message: ----------- added sample configurations Added Paths: ----------- trunk/yake/samples/bin/ trunk/yake/samples/bin/debug/ trunk/yake/samples/bin/debug/roclient.cfg trunk/yake/samples/bin/debug/rodemo.cfg trunk/yake/samples/bin/debug/roserver.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg Added: trunk/yake/samples/bin/debug/roclient.cfg =================================================================== --- trunk/yake/samples/bin/debug/roclient.cfg (rev 0) +++ trunk/yake/samples/bin/debug/roclient.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,12 @@ +rodemo +{ + server + { + start 0 + } + client + { + count 1 + server 192.168.1.33:40000 + } +} Added: trunk/yake/samples/bin/debug/rodemo.cfg =================================================================== --- trunk/yake/samples/bin/debug/rodemo.cfg (rev 0) +++ trunk/yake/samples/bin/debug/rodemo.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,13 @@ +rodemo +{ + server + { + start 0 + bind 192.168.1.33:40000 + } + client + { + server 192.168.1.33:40000 + count 1 + } +} Added: trunk/yake/samples/bin/debug/roserver.cfg =================================================================== --- trunk/yake/samples/bin/debug/roserver.cfg (rev 0) +++ trunk/yake/samples/bin/debug/roserver.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,12 @@ +rodemo +{ + server + { + start 1 + bind 192.168.1.33:40000 + } + client + { + count 0 + } +} Added: trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg =================================================================== --- trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg (rev 0) +++ trunk/yake/samples/bin/debug/yake.graphics.ogre_config.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,4 @@ +;scenemanager=exterior_close +;world=terrain.cfg +shadowtype=modulated_texture +;show_config_dialog=no Added: trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg =================================================================== --- trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg (rev 0) +++ trunk/yake/samples/bin/debug/yake.graphics.ogre_plugins.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,7 @@ +PluginFolder=OgrePlugins +Plugin=RenderSystem_Direct3D9.dll +#Plugin=RenderSystem_Direct3D7.dll +Plugin=RenderSystem_GL.dll +Plugin=Plugin_OctreeSceneManager.dll +Plugin=Plugin_ParticleFX.dll +Plugin=Plugin_CgProgramManager.dll Added: trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg =================================================================== --- trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg (rev 0) +++ trunk/yake/samples/bin/debug/yake.graphics.ogre_resources.cfg 2007-01-22 21:32:50 UTC (rev 1605) @@ -0,0 +1,27 @@ +# Resource locations to be added to the 'boostrap' path +# This also contains the minimum you need to use the Ogre example framework +[Bootstrap] +Zip=../../../common/media/OgreCore.zip + +# Resource locations to be added to the default path +[General] +FileSystem=../../../common/media/ +FileSystem=../../../common/media/graphics.delorean/ +FileSystem=../../../common/media/graphics.meshes/ +FileSystem=../../../common/media/graphics.scenes/r2t/ +FileSystem=../../../common/media/graphics.scenes/arena0/ +FileSystem=../../../common/media/graphics.textures/ +FileSystem=../../../common/media/graphics.materials/programs/ +FileSystem=../../../common/media/graphics.materials/scripts/ +FileSystem=../../../common/media/graphics.materials/textures/ +FileSystem=../../../common/media/graphics.fx/ +FileSystem=../../../common/media/samples/dotLink/DynTest/ +FileSystem=../../../common/media/samples/dotScene/ +FileSystem=../../../common/media/gui/configs/ +FileSystem=../../../common/media/gui/fonts/ +FileSystem=../../../common/media/gui/imagesets/ +FileSystem=../../../common/media/gui/layouts/ +FileSystem=../../../common/media/gui/looknfeel/ +FileSystem=../../../common/media/gui/lua_scripts/ +FileSystem=../../../common/media/gui/schemes/ +Zip=../../../common/media/skybox.zip This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:27:27
|
Revision: 1604 http://svn.sourceforge.net/yake/?rev=1604&view=rev Author: psyclonist Date: 2007-01-22 13:27:26 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Removed Paths: ------------- trunk/yake/samples/base/physics/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:25:01
|
Revision: 1603 http://svn.sourceforge.net/yake/?rev=1603&view=rev Author: psyclonist Date: 2007-01-22 13:24:58 -0800 (Mon, 22 Jan 2007) Log Message: ----------- moved demo Removed Paths: ------------- trunk/yake/samples/base/physics/demo/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:24:32
|
Revision: 1602 http://svn.sourceforge.net/yake/?rev=1602&view=rev Author: psyclonist Date: 2007-01-22 13:24:30 -0800 (Mon, 22 Jan 2007) Log Message: ----------- moved demo Added Paths: ----------- trunk/yake/samples/physics/demo/ Copied: trunk/yake/samples/physics/demo (from rev 1597, trunk/yake/samples/base/physics/demo) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:23:34
|
Revision: 1601 http://svn.sourceforge.net/yake/?rev=1601&view=rev Author: psyclonist Date: 2007-01-22 13:23:31 -0800 (Mon, 22 Jan 2007) Log Message: ----------- modified logging API, physicsOde: avoid collision detection between static objects Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeActor.cpp trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp trunk/yake/src/plugins/physicsODE/OdeShapes.cpp trunk/yake/src/plugins/physicsODE/OdeWorld.cpp trunk/yake/yake/plugins/physicsODE/OdeActor.h Modified: trunk/yake/src/plugins/physicsODE/OdeActor.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeActor.cpp 2007-01-22 21:21:46 UTC (rev 1600) +++ trunk/yake/src/plugins/physicsODE/OdeActor.cpp 2007-01-22 21:23:31 UTC (rev 1601) @@ -39,13 +39,14 @@ //----------------------------------------------------- //----------------------------------------------------- - OdeActor::OdeActor( OdeWorld* pWorld, bool bDynamic ) : + OdeActor::OdeActor( OdeWorld* pWorld, const ActorType type ) : mOdeWorld(pWorld), mBody(0), actorSpace(0), - actorSpaceID(0) + actorSpaceID(0), + type_(type) { - if (bDynamic) + if (type_ == ACTOR_DYNAMIC) { mBody = new OdeBody( mOdeWorld, *this ); YAKE_ASSERT( mBody ).error( "Failed to create body!" ); @@ -105,7 +106,7 @@ //----------------------------------------------------- OdeGeom* OdeActor::createShapeFromDesc( const IShape::Desc& rShapeDesc ) { - YAKE_LOG_INFORMATION( String( "OdeActor | creating geom. Position " ) << rShapeDesc.position ); + YAKE_LOG_INFORMATION("physicsOde", String( "OdeActor | creating geom. Position " ) << rShapeDesc.position ); const IShape::Desc* pShapeDesc = &( rShapeDesc ); IMaterial* pMaterial = this->getCreator()->getMaterial( pShapeDesc->material ); @@ -242,7 +243,7 @@ setupOdeSpace(); YAKE_ASSERT( actorSpaceID && actorSpace ); - YAKE_LOG( "Adding geom to the actor space"); + YAKE_LOG( "physicsOde", "Adding geom to the actor space"); if( geom->_getOdeSpaceID() == actorSpaceID) // geom already in the actor space return; @@ -256,7 +257,7 @@ // and insert it to the actor space dSpaceAdd( actorSpaceID, geom->_getOdeGeomID()); - YAKE_LOG( String("Objects in Actor ODE Space = ")<< dSpaceGetNumGeoms( actorSpaceID)); + YAKE_LOG( "physicsOde", String("Objects in Actor ODE Space = ")<< dSpaceGetNumGeoms( actorSpaceID)); } //----------------------------------------------------- Modified: trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-01-22 21:21:46 UTC (rev 1600) +++ trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-01-22 21:23:31 UTC (rev 1601) @@ -204,8 +204,8 @@ localTargetVel = (localTargetVel - localCurrLinVel); localTargetVel.y = 0.; if (mJumping) - localTargetVel *= 0.2; // player is less able to control direction during jump - so scale influence - if (localTargetVel.length() > 0.001) + localTargetVel *= real(0.2); // player is less able to control direction during jump - so scale influence + if (localTargetVel.length() > real(0.001)) { Vector3 forceInLocalPlane = mActor->getBody().getMass() * (localTargetVel); forceInLocalPlane = mOrientation * forceInLocalPlane; Modified: trunk/yake/src/plugins/physicsODE/OdeShapes.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeShapes.cpp 2007-01-22 21:21:46 UTC (rev 1600) +++ trunk/yake/src/plugins/physicsODE/OdeShapes.cpp 2007-01-22 21:23:31 UTC (rev 1601) @@ -211,7 +211,7 @@ // enabling collisions with spheres and boxes dGeomTriMeshEnableTC( mOdeGeomID, dSphereClass, 1 ); dGeomTriMeshEnableTC( mOdeGeomID, dBoxClass, 1 ); - YAKE_LOG_INFORMATION("physicsOde: enabled sphere+box collisions for trimesh"); + YAKE_LOG_INFORMATION("physicsOde","enabled sphere+box collisions for trimesh"); _setData( this ); } Modified: trunk/yake/src/plugins/physicsODE/OdeWorld.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeWorld.cpp 2007-01-22 21:21:46 UTC (rev 1600) +++ trunk/yake/src/plugins/physicsODE/OdeWorld.cpp 2007-01-22 21:23:31 UTC (rev 1601) @@ -316,7 +316,7 @@ //----------------------------------------------------- IActorPtr OdeWorld::createActor( const IActor::Desc& rActorDesc ) { - OdeActor* pActor = new OdeActor( this, (rActorDesc.type == ACTOR_DYNAMIC) ); + OdeActor* pActor = new OdeActor( this, rActorDesc.type ); YAKE_ASSERT( pActor ); typedef Deque< SharedPtr<IShape::Desc> > ActorShapesCollection; @@ -451,7 +451,7 @@ mMeshDataMap.insert( MeshDataMap::value_type( mNextMeshId, data ) ); - YAKE_LOG(String("TriangleMeshes in the scene - ")<<mMeshDataMap.size()); + YAKE_LOG("physicsOde", String("TriangleMeshes in the scene - ")<<mMeshDataMap.size()); return mNextMeshId++; } @@ -490,7 +490,7 @@ //----------------------------------------------------- void OdeWorld::_OdeNearCallback ( void* data, dGeomID o1, dGeomID o2 ) { - //YAKE_LOG("OdeWorld::->NearCallBack()"); + //YAKE_LOG("physicsOde", "OdeWorld::->NearCallBack()"); // make sure we traverse through all spaces and sub-spaces if ( dGeomIsSpace (o1) || dGeomIsSpace (o2) ) { @@ -533,12 +533,24 @@ { OdeActor* pA = static_cast<OdeGeom*>( data1 )->getOwner(); OdeActor* pB = static_cast<OdeGeom*>( data2 )->getOwner(); - if ( pA && pB ) + + if (!pA || !pB) + return; + + // collision between two static objects: do nothing + if ((pA->getType() == ACTOR_STATIC) && (pA->getType() == ACTOR_STATIC)) { - // collide - pA->_collide( pB, o1, o2, odeContactGroup ); return; } + else // at least one object is 'dynamic' or 'moving' + { + if ( pA && pB ) + { + // collide + pA->_collide( pB, o1, o2, odeContactGroup ); + return; + } + } } } Modified: trunk/yake/yake/plugins/physicsODE/OdeActor.h =================================================================== --- trunk/yake/yake/plugins/physicsODE/OdeActor.h 2007-01-22 21:21:46 UTC (rev 1600) +++ trunk/yake/yake/plugins/physicsODE/OdeActor.h 2007-01-22 21:23:31 UTC (rev 1601) @@ -39,7 +39,7 @@ class YAKE_PHYSICSODE_API OdeActor : public IActor { public: - OdeActor( OdeWorld* pOdeWorld, bool bDynamic ); + OdeActor( OdeWorld* pOdeWorld, const ActorType type ); virtual ~OdeActor(); IBody& getBody() const; @@ -76,6 +76,9 @@ void _collide( OdeActor* pOther, dGeomID geomA, dGeomID geomB, dJointGroup* pContactJointGroup ); bool isSpaceEmpty(); + + ActorType getType() const + { return type_; } protected: IBody::MassDesc* createMassDescFromShapeDesc( const IShape::Desc& rShapeDesc, real massOrDensity, IBody::quantityType qType ); @@ -119,6 +122,8 @@ dSpaceID actorSpaceID; dSpace * actorSpace; + + ActorType type_; }; } // physics This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:21:46
|
Revision: 1600 http://svn.sourceforge.net/yake/?rev=1600&view=rev Author: psyclonist Date: 2007-01-22 13:21:46 -0800 (Mon, 22 Jan 2007) Log Message: ----------- modified logging API Modified Paths: -------------- trunk/yake/samples/raf/demo1/yakeDemo.cpp trunk/yake/samples/sampleLog/demo.cpp trunk/yake/src/base/yakeLog.cpp trunk/yake/src/loader/yakeDotScene.cpp trunk/yake/src/loader/yakeXODEParser.cpp trunk/yake/src/model/yakeComponentCreatorManager.cpp trunk/yake/src/model/yakeDotLinkLoader.cpp trunk/yake/src/model/yakeDotModelParser.cpp trunk/yake/src/model/yakeGraphical.cpp trunk/yake/src/model/yakeGraphicalDotSceneLoader.cpp trunk/yake/src/model/yakeModelManager.cpp trunk/yake/src/model/yakePhysical.cpp trunk/yake/src/model/yakeXODEListener.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp trunk/yake/src/plugins/graphicsOgre/yakeGraphicsWorld.cpp trunk/yake/src/raf/yakeApplication.cpp trunk/yake/src/raf/yakeApplicationState.cpp trunk/yake/src/raf/yakeRtApplicationState.cpp trunk/yake/src/vehicle/yakeNativeOde.cpp trunk/yake/yake/base/yakeLog.h Modified: trunk/yake/samples/raf/demo1/yakeDemo.cpp =================================================================== --- trunk/yake/samples/raf/demo1/yakeDemo.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/samples/raf/demo1/yakeDemo.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -32,7 +32,7 @@ protected: virtual void onCreateScene() { - YAKE_LOG_INFORMATION("Creating scene"); + YAKE_LOG_INFORMATION("demo","Creating scene"); // create movable ninja graphics::ISceneNode* pSN = getGraphicalWorld()->createSceneNode("root"); pSN->attachEntity( getGraphicalWorld()->createEntity("ninja.mesh") ); Modified: trunk/yake/samples/sampleLog/demo.cpp =================================================================== --- trunk/yake/samples/sampleLog/demo.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/samples/sampleLog/demo.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -7,10 +7,10 @@ try { yake::logging::setProcessId("demo"); - YAKE_LOG_INFORMATION("aloha"); - YAKE_LOG_WARNING("aloha"); - yake::logging::log( yake::logging::S_ERROR, "Batman, help! ", 42 ); - yake::logging::log( 99, "custom severity" ); + YAKE_LOG_INFORMATION("demo","aloha"); + YAKE_LOG_WARNING("demo","aloha"); + yake::logging::log( yake::logging::S_ERROR, "demo", "Batman, help! ", 42 ); + yake::logging::log( 99, "demo", "custom severity" ); } catch (yake::Exception& ex) { Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/base/yakeLog.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -31,12 +31,14 @@ namespace yake { namespace logging { - void toStdErr(const severity_t sev, const char* procId, threadid_t threadId, const char* msg) + void toStdErr(const severity_t sev, const char* logId, const char* procId, threadid_t threadId, const char* msg) { std::ostringstream ss; ss << "[" << (procId ? procId : "") << "]"; - ss << "[thread:"; + ss << "[" << (logId ? logId : "") << "]"; + + ss << "["; ss << std::hex << threadId; ss << "] "; @@ -49,8 +51,9 @@ ss << ")"; } ss << "]"; - ss << "\t" << msg << "\n"; + ss << " " << msg << "\n"; + native::debug_Log( ss.str(), sev ); } @@ -83,17 +86,22 @@ scoped_lock lock; instance().enabledSeverities_[ sev ] = on; } + void logger::enableLog(const char* logId, const bool on) + { + scoped_lock lock; + instance().enabledLogs_[ std::string(logId ? logId : "") ] = on; + } int logger::addTarget(const LogFn fn) { scoped_lock lock; instance().targets_.push_back( fn ); return 1; } - void logger::log(const severity_t sev, const char *tid, const char *msg) + void logger::log(const severity_t sev, const char *logId, const char *msg) { - instance().doLog(sev, tid, msg); + instance().doLog(sev, logId, msg); } - void logger::doLog(const severity_t sev, const char *tid, const char *msg) + void logger::doLog(const severity_t sev, const char *logId, const char *msg) { scoped_lock lock; @@ -101,11 +109,15 @@ if (itEnabled != instance_.enabledSeverities_.end() && !itEnabled->second) return; + EnableLogIdMap::const_iterator itLogEnabled = instance_.enabledLogs_.find( logId ); + if (itLogEnabled != instance_.enabledLogs_.end() && !itLogEnabled->second) + return; + const threadid_t threadId = native::getCurrentThreadId(); TargetFnList::const_iterator itEnd = targets_.end(); for (TargetFnList::const_iterator it = targets_.begin(); it != itEnd; ++it) { - (**it)(sev,instance().procId_.c_str(),threadId,msg); + (**it)(sev,logId,instance().procId_.c_str(),threadId,msg); } } void logger::setProcessId(const String& pId) @@ -116,6 +128,7 @@ logger::logger() { scoped_lock lock; + enableLog(0,true); for (severity_t i=0; i<S_LAST; ++i) enableSeverity( i, true ); addTarget(&toStdErr); Modified: trunk/yake/src/loader/yakeDotScene.cpp =================================================================== --- trunk/yake/src/loader/yakeDotScene.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/loader/yakeDotScene.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -45,7 +45,7 @@ //------------------------------------------------------ bool DotSceneParser::load( const SharedPtr<dom::INode>& docNode ) { - YAKE_LOG( "DotSceneParser::load()" ); + YAKE_LOG("dotscene", "DotSceneParser::load()" ); YAKE_ASSERT( docNode.get() ); @@ -54,7 +54,7 @@ mDocNode = docNode; - YAKE_LOG( "DotSceneParser: parsing scene..." ); + YAKE_LOG("dotscene", "DotSceneParser: parsing scene..." ); readScene( mDocNode ); @@ -65,12 +65,12 @@ void DotSceneParser::readScene( const SharedPtr<dom::INode>& pNode ) { //const String name = pNode->getAttributeValueAs<String>( "name" ); - //YAKE_LOG( "DotSceneParser: readScene() [" + name + "]" ); + //YAKE_LOG("dotscene", "DotSceneParser: readScene() [" + name + "]" ); YAKE_ASSERT( pNode ); SharedPtr<dom::INode> pNodes = pNode->getNodeByName("nodes"); - YAKE_LOG( "DotSceneParser: scene: found nodes = " + String( pNodes.get() ? "yes" : "no" ) ); + YAKE_LOG("dotscene", "DotSceneParser: scene: found nodes = " + String( pNodes.get() ? "yes" : "no" ) ); if ( pNodes.get() ) readNodes( pNodes, _T("") ); @@ -79,7 +79,7 @@ //------------------------------------------------------ void DotSceneParser::readNodes( const SharedPtr<dom::INode>& pNodes, const String& path ) { - YAKE_LOG( "DotSceneParser: readNodes()" ); + YAKE_LOG("dotscene", "DotSceneParser: readNodes()" ); YAKE_ASSERT( pNodes ); const dom::NodeList& nodes = pNodes->getNodes(); @@ -98,7 +98,7 @@ { String nodeName = pNode->getAttributeValueAs<String>( "name" ); - YAKE_LOG( "DotSceneParser: readNode() [name=" + nodeName + "]" ); + YAKE_LOG("dotscene", "DotSceneParser: readNode() [name=" + nodeName + "]" ); YAKE_ASSERT( pNode ); if ( nodeName.empty() ) @@ -190,7 +190,7 @@ desc.parentNodeName = parentNodeName; desc.path = appendToPath(path, name); - YAKE_LOG( "DotSceneParser: readEntity() [name = " + name + "]" ); + YAKE_LOG("dotscene", "DotSceneParser: readEntity() [name = " + name + "]" ); desc.meshFile = pNode->getAttributeValueAs<String>( "meshFile" ); @@ -263,7 +263,7 @@ String g = pNode->getAttributeValueAs<String>("g"); String b = pNode->getAttributeValueAs<String>("b"); - //YAKE_LOG( "DotSceneParser: readColour: r=" + r + ", g=" + g + ", b=" + b ); + //YAKE_LOG("dotscene", "DotSceneParser: readColour: r=" + r + ", g=" + g + ", b=" + b ); colour.r = StringUtil::parseReal( r ); colour.g = StringUtil::parseReal( g ); @@ -302,7 +302,7 @@ desc.parentNodeName = parentNodeName; desc.path = appendToPath(path, name); - YAKE_LOG( "DotSceneParser: readLight() [name=" + name + "]" ); + YAKE_LOG("dotscene", "DotSceneParser: readLight() [name=" + name + "]" ); YAKE_ASSERT( pNode ); String lightType = pNode->getAttributeValueAs<String>( "type" ); @@ -321,7 +321,7 @@ { String childNodeName = (*it)->getName(); - //YAKE_LOG( "DotSceneParser: node child: " + StringUtil::toLowerCase( childNodeName ) ); + //YAKE_LOG("dotscene", "DotSceneParser: node child: " + StringUtil::toLowerCase( childNodeName ) ); const SharedPtr<dom::INode>& pChild = *it; @@ -336,7 +336,7 @@ else if ( childNodeName == "lightAttenuation" ) readLightAttenuation( pChild, desc ); else - YAKE_LOG_ERROR(String("DotSceneParser: Unhandled node child '") + childNodeName + _T("'")); + YAKE_LOG_ERROR("dotscene","DotSceneParser: Unhandled node child '" << childNodeName << "'"); } // Light description ready. Fire! @@ -366,7 +366,7 @@ desc.parentNodeName = parentNodeName; desc.path = appendToPath(path, name); - YAKE_LOG( "DotSceneParser: readCamera() [name=" + name + "]" ); + YAKE_LOG("dotscene", "DotSceneParser: readCamera() [name=" + name + "]" ); YAKE_ASSERT( pNode ); String projectionType = pNode->getAttributeValueAs<String>( "projectionType" ); @@ -389,7 +389,7 @@ { String childNodeName = (*it)->getName(); - //YAKE_LOG( "DotSceneParser: node child: " + StringUtil::toLowerCase( childNodeName ) ); + //YAKE_LOG("dotscene", "DotSceneParser: node child: " + StringUtil::toLowerCase( childNodeName ) ); const SharedPtr<dom::INode>& pChild = *it; @@ -400,7 +400,7 @@ else if ( childNodeName == "trackTarget" ) desc.trackTargetName = pChild->getAttributeValueAs<String>( "nodeName" ); else - YAKE_LOG_ERROR(String("DotSceneParser: Unhandled node child '") + childNodeName + _T("'")); + YAKE_LOG_ERROR("dotscene","DotSceneParser: Unhandled node child '" << childNodeName << "'"); } // Camera description ready. Fire! Modified: trunk/yake/src/loader/yakeXODEParser.cpp =================================================================== --- trunk/yake/src/loader/yakeXODEParser.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/loader/yakeXODEParser.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -40,15 +40,15 @@ //------------------------------------------------------ bool XODEParser::load( const NodeSharedPtr docNode ) { - YAKE_LOG( "XODE: load()" ); + YAKE_LOG("xode", "XODE: load()" ); YAKE_ASSERT( docNode.get() ); mDocNode = docNode; - YAKE_LOG( "*******************" ); - YAKE_LOG( "* Parsing xode... *" ); - YAKE_LOG( "*******************" ); + YAKE_LOG("xode", "*******************" ); + YAKE_LOG("xode", "* Parsing xode... *" ); + YAKE_LOG("xode", "*******************" ); readXODE( mDocNode ); @@ -61,13 +61,13 @@ YAKE_ASSERT( pNode ); const String name = pNode->getAttributeValueAs<String>( "name" ); - YAKE_LOG( "XODE: parsing " + name ); + YAKE_LOG("xode", "XODE: parsing " + name ); // Assuming single world in .xode NodeSharedPtr pWorldNode = pNode->getNodeByName( "world" ); YAKE_ASSERT( pWorldNode ); - YAKE_LOG( "XODE: finding world ... " + String( pWorldNode.get() ? "Yes!" : "No :(" ) ); + YAKE_LOG("xode", "XODE: finding world ... " + String( pWorldNode.get() ? "Yes!" : "No :(" ) ); readWorld( pWorldNode ); @@ -82,7 +82,7 @@ NodeSharedPtr pSpaceNode = pWorldNode->getNodeByName( "space" ); YAKE_ASSERT( pSpaceNode ); - YAKE_LOG( "XODE: finding space... " + String( pSpaceNode.get() ? "Yes!" : "No :(" ) ); + YAKE_LOG("xode", "XODE: finding space... " + String( pSpaceNode.get() ? "Yes!" : "No :(" ) ); readSpace( pSpaceNode, "world" ); } @@ -97,7 +97,7 @@ //------------------------------------------------------ void XODEParser::readSpace( const NodeSharedPtr pSpaceNode, const String& parent ) { - YAKE_LOG( "XODE: reading space ..." ); + YAKE_LOG("xode", "XODE: reading space ..." ); const dom::NodeList& nodes = pSpaceNode->getNodes(); for (dom::NodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) @@ -116,7 +116,7 @@ else if ( nodeName == "bodygroup" ) { //TODO bodygroup reading here - YAKE_LOG( "XODE: Bodygroup is not yet implemented in parser" ); + YAKE_LOG("xode", "XODE: Bodygroup is not yet implemented in parser" ); } else if ( nodeName == "joint" ) { @@ -263,7 +263,7 @@ if ( !strQuantity.empty() ) { quantity = StringUtil::parseReal( strQuantity ); - YAKE_LOG( "XODE: reading mass_struct with density = " + strQuantity + " " ); + YAKE_LOG("xode", "XODE: reading mass_struct with density = " + strQuantity + " " ); } else { @@ -271,7 +271,7 @@ if ( !strQuantity.empty() ) { quantity = StringUtil::parseReal( strQuantity ); - YAKE_LOG( "XODE: reading mass_sstruct with total mass = " + strQuantity + " " ); + YAKE_LOG("xode", "XODE: reading mass_sstruct with total mass = " + strQuantity + " " ); qt = IBody::QT_MASS; } } @@ -330,7 +330,7 @@ if ( !strDensity.empty() ) { density = StringUtil::parseReal( strDensity ); - YAKE_LOG( "XODE: reading mass_shape with density = " + strDensity + " " ); + YAKE_LOG("xode", "XODE: reading mass_shape with density = " + strDensity + " " ); } const dom::NodeList& nodes = pMShapeNode->getNodes(); @@ -338,7 +338,7 @@ { String nodeName = StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG( "XODE: reading mass_shape that is " + nodeName + " " ); + YAKE_LOG("xode", "XODE: reading mass_shape that is " + nodeName + " " ); IBody::MassDesc* physicsMassDesc = NULL; @@ -398,7 +398,7 @@ { real total = StringUtil::parseReal( pMAdjustNode->getAttributeValueAs<String>( "total" ) ); - YAKE_LOG_INFORMATION( "XODE: read mass adjust - " + pMAdjustNode->getAttributeValueAs<String>( "total" ) ); + YAKE_LOG_INFORMATION("xode","XODE: read mass adjust - " << pMAdjustNode->getAttributeValueAs<String>( "total" ) ); MassDesc desc; desc.parentName_ = parent; @@ -467,7 +467,7 @@ void XODEParser::readBody( const NodeSharedPtr pBodyNode, const String& parent ) { const String name = pBodyNode->getAttributeValueAs<String>( "name" ); - YAKE_LOG( "XODE: reading body " + name ); + YAKE_LOG("xode", "XODE: reading body " + name ); // Setting up body description... BodyDesc desc; @@ -484,7 +484,7 @@ Transform bodyTransform; if ( iTrans != nodes.end() ) { - YAKE_LOG( "XODE: body " + name + " has transform " ); + YAKE_LOG("xode", "XODE: body " + name + " has transform " ); readTransform( *iTrans, bodyTransform ); @@ -502,7 +502,7 @@ { String nodeName = StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG( "XODE: body " + name + " has node #" + nodeName ); + YAKE_LOG("xode", "XODE: body " + name + " has node #" + nodeName ); if ( nodeName == "geom" ) { @@ -531,7 +531,7 @@ */ void XODEParser::readMaterialExt( const NodeSharedPtr pNode, const String& parent ) { - YAKE_LOG( "XODE: entered readMaterialExt..." ); + YAKE_LOG("xode", "XODE: entered readMaterialExt..." ); const dom::NodeList& nodes = pNode->getNodes(); @@ -545,18 +545,18 @@ if ( iExt == nodes.end() ) { - YAKE_LOG( "XODE: didn't find extension... " ); + YAKE_LOG("xode", "XODE: didn't find extension... " ); return; } - YAKE_LOG( "XODE: found extension... processing... :) " ); + YAKE_LOG("xode", "XODE: found extension... processing... :) " ); if ( (*iExt)->getAttributeValueAs<String>( "name" ) != "material" ) { - YAKE_LOG( "XODE: extension is not material" ); + YAKE_LOG("xode", "XODE: extension is not material" ); } - YAKE_LOG( "XODE: the extension IS material! Parsing..." ); + YAKE_LOG("xode", "XODE: the extension IS material! Parsing..." ); const dom::NodeList& extNodes = (*iExt)->getNodes(); //HACK assuming first node is "params" @@ -569,9 +569,9 @@ String strRestitution = pParamsNode->getAttributeValueAs<String>( "bouncecoeff" ); String strSoftness = pParamsNode->getAttributeValueAs<String>( "soften" ); - YAKE_LOG( "XODE: read friction = " + strFriction ); - YAKE_LOG( "XODE: read restitution = " + strRestitution ); - YAKE_LOG( "XODE: read softness = " + strSoftness ); + YAKE_LOG("xode", "XODE: read friction = " + strFriction ); + YAKE_LOG("xode", "XODE: read restitution = " + strRestitution ); + YAKE_LOG("xode", "XODE: read softness = " + strSoftness ); desc.mFriction = StringUtil::parseReal( strFriction ); desc.mRestitution = StringUtil::parseReal( strRestitution ); @@ -598,7 +598,7 @@ const Transform& rParentTransform, bool absoluteTransform ) { const String name = pGeomNode->getAttributeValueAs<String>( "name" ); - YAKE_LOG( "XODE: reading geom " + name ); + YAKE_LOG("xode", "XODE: reading geom " + name ); const dom::NodeList& nodes = pGeomNode->getNodes(); @@ -611,7 +611,7 @@ if ( iTrans != nodes.end() ) { - YAKE_LOG( "XODE: readGeom() [" + name + "] : geom has transform " ); + YAKE_LOG("xode", "XODE: readGeom() [" + name + "] : geom has transform " ); readTransform( *iTrans, geomTransform ); } @@ -620,13 +620,13 @@ if ( absoluteTransform ) geomTransform = geomTransform.getDerivedTransform( rParentTransform ); - YAKE_LOG( "XODE: scanning other geom properties..." ); + YAKE_LOG("xode", "XODE: scanning other geom properties..." ); for (dom::NodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { String nodeName = StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG( "XODE: geom [" + name + "] has node #" + nodeName ); + YAKE_LOG("xode", "XODE: geom [" + name + "] has node #" + nodeName ); IShape::Desc* shapeDesc = NULL; @@ -649,7 +649,7 @@ String strSizeY; strSizeY << sizeY; String strSizeZ; strSizeZ << sizeZ; - YAKE_LOG( "XODE: box with sizes: " + strSizeX + ", " + strSizeY + ", " + strSizeZ ); + YAKE_LOG("xode", "XODE: box with sizes: " + strSizeX + ", " + strSizeY + ", " + strSizeZ ); shapeDesc = new IShape::BoxDesc( math::Vector3( sizeX, sizeY, sizeZ ), "", geomTransform.position_, geomTransform.rotation_ ); @@ -789,7 +789,7 @@ } } - YAKE_LOG( "XODE: Leaving readGeom()" ); + YAKE_LOG("xode", "XODE: Leaving readGeom()" ); } //------------------------------------------------------ @@ -853,7 +853,7 @@ { String nodeName = StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG( "XODE: reading " + nodeName + " trimesh now..." ); + YAKE_LOG("xode", "XODE: reading " + nodeName + " trimesh now..." ); if ( nodeName == "vertices" ) { @@ -927,7 +927,7 @@ desc.name_ = name; - YAKE_LOG( "XODE: reading joint '" + name + "' ..." ); + YAKE_LOG("xode", "XODE: reading joint '" + name + "' ..." ); // Looking for link1 NodeHunter link1Hunter( "link1" ); @@ -956,9 +956,9 @@ desc.body2_ = body2Name; - YAKE_LOG( "XODE: the joint connects two actors:" ); - YAKE_LOG( "XODE: 1:" + body1Name ); - YAKE_LOG( "XODE: 2:" + body2Name ); + YAKE_LOG("xode", "XODE: the joint connects two actors:" ); + YAKE_LOG("xode", "XODE: 1:" + body1Name ); + YAKE_LOG("xode", "XODE: 2:" + body2Name ); // Looking for transform NodeHunter hunter( "transform" ); @@ -968,7 +968,7 @@ Transform jointTransform; if ( iTrans != nodes.end() ) { - YAKE_LOG( "XODE: joint has transform " ); + YAKE_LOG("xode", "XODE: joint has transform " ); readTransform( *iTrans, jointTransform ); } @@ -984,7 +984,7 @@ IJoint::DescBase* jointDesc = NULL; - YAKE_LOG( "XODE: reading " + nodeName + " now..." ); + YAKE_LOG("xode", "XODE: reading " + nodeName + " now..." ); if ( nodeName == "ball" ) { @@ -1028,7 +1028,7 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readBall( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "XODE: reading ball joint description..." ); + YAKE_LOG("xode", "XODE: reading ball joint description..." ); const dom::NodeList& nodes = pJointNode->getNodes(); @@ -1047,7 +1047,7 @@ IJoint::DescBase* desc = new IJoint::DescBall( NULL, NULL, anchor ); - YAKE_LOG( "XODE: Finished processing ball joint description." ); + YAKE_LOG("xode", "XODE: Finished processing ball joint description." ); return desc; } @@ -1055,11 +1055,11 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readFixed( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "Reading fixed joint description..." ); + YAKE_LOG("xode", "Reading fixed joint description..." ); IJoint::DescBase* desc = new IJoint::DescFixed( NULL, NULL ); - YAKE_LOG( "Finished processing fixed joint description." ); + YAKE_LOG("xode", "Finished processing fixed joint description." ); return desc; } @@ -1067,7 +1067,7 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readHinge( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "Reading hinge joint description..." ); + YAKE_LOG("xode", "Reading hinge joint description..." ); const dom::NodeList& nodes = pJointNode->getNodes(); @@ -1093,7 +1093,7 @@ IJoint::DescBase* desc = new IJoint::DescHinge( NULL, NULL, axis, anchor ); - YAKE_LOG( "Finished processing hinge joint description." ); + YAKE_LOG("xode", "Finished processing hinge joint description." ); return desc; } @@ -1101,7 +1101,7 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readHinge2( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "Reading hinge2 joint description..." ); + YAKE_LOG("xode", "Reading hinge2 joint description..." ); const dom::NodeList& nodes = pJointNode->getNodes(); @@ -1134,7 +1134,7 @@ IJoint::DescBase* desc = new IJoint::DescHinge2( NULL, NULL, axis0, axis1, anchor ); - YAKE_LOG( "XODE: finished processing hinge2 joint description." ); + YAKE_LOG("xode", "XODE: finished processing hinge2 joint description." ); return desc; } @@ -1142,7 +1142,7 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readSlider( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "XODE: reading slider joint description..." ); + YAKE_LOG("xode", "XODE: reading slider joint description..." ); const dom::NodeList& nodes = pJointNode->getNodes(); @@ -1159,7 +1159,7 @@ IJoint::DescBase* desc = new IJoint::DescSlider( NULL, NULL, axis ); - YAKE_LOG( "XODE: finished processing slider joint description." ); + YAKE_LOG("xode", "XODE: finished processing slider joint description." ); return desc; } @@ -1167,7 +1167,7 @@ //------------------------------------------------------ IJoint::DescBase* XODEParser::readUniversal( const NodeSharedPtr pJointNode, const Transform& rJointTransform ) { - YAKE_LOG( "XODE: reading universal joint description..." ); + YAKE_LOG("xode", "XODE: reading universal joint description..." ); const dom::NodeList& nodes = pJointNode->getNodes(); @@ -1200,7 +1200,7 @@ IJoint::DescBase* desc = new IJoint::DescUniversal( NULL, NULL, axis0, axis1, anchor ); - YAKE_LOG( "XODE: finished processing universal joint description." ); + YAKE_LOG("xode", "XODE: finished processing universal joint description." ); return desc; } @@ -1210,7 +1210,7 @@ math::Vector3& rAnchor, const Transform& rJointTransform ) { - YAKE_LOG( "XODE: reading anchor..." ); + YAKE_LOG("xode", "XODE: reading anchor..." ); rAnchor.x = StringUtil::parseReal( pAnchorNode->getAttributeValueAs<String>( "x" ) ); rAnchor.y = StringUtil::parseReal( pAnchorNode->getAttributeValueAs<String>( "y" ) ); @@ -1224,7 +1224,7 @@ math::Vector3& rAxis, const Transform& rJointTransform ) { - YAKE_LOG( "XODE: reading axis..." ); + YAKE_LOG("xode", "XODE: reading axis..." ); rAxis.x = StringUtil::parseReal( pAxisNode->getAttributeValueAs<String>( "x" ) ); rAxis.y = StringUtil::parseReal( pAxisNode->getAttributeValueAs<String>( "y" ) ); Modified: trunk/yake/src/model/yakeComponentCreatorManager.cpp =================================================================== --- trunk/yake/src/model/yakeComponentCreatorManager.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeComponentCreatorManager.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -56,7 +56,7 @@ } catch (...) { - YAKE_LOG_ERROR("Unregistered ComponentCreator type!"); + YAKE_LOG_ERROR("model","Unregistered ComponentCreator type!"); } YAKE_ASSERT( creator.get() )(type)(params).debug("Failed to create component creator! Probably it has not been registered/loaded."); if (!creator.get()) Modified: trunk/yake/src/model/yakeDotLinkLoader.cpp =================================================================== --- trunk/yake/src/model/yakeDotLinkLoader.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeDotLinkLoader.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -86,18 +86,18 @@ String sourceMovableType = StringUtil::toLowerCase(rNode.getAttributeValueAs<String>("elementtype")); String sourceMovableName = (rNode.getAttributeValueAs<String>("element")); - YAKE_LOG( "Searching model '" + rModel.getName() + "' for movable: " ); - YAKE_LOG( " type: " + sourceType ); - YAKE_LOG( " submodel: " + sourceModelName ); - YAKE_LOG( " movable type: " + sourceMovableType ); - YAKE_LOG( " movable name: " + sourceMovableName ); + YAKE_LOG( "model", "Searching model '" + rModel.getName() + "' for movable: " ); + YAKE_LOG( "model", " type: " + sourceType ); + YAKE_LOG( "model", " submodel: " + sourceModelName ); + YAKE_LOG( "model", " movable type: " + sourceMovableType ); + YAKE_LOG( "model", " movable name: " + sourceMovableName ); // retrieve source movable Movable* pMovable = 0; if ( sourceType == "graphical" ) { YAKE_ASSERT( sourceMovableType == "graphics.scenenode" ); - YAKE_LOG( "Searching for graphical named '" + sourceModelName + "'" ); + YAKE_LOG( "model", "Searching for graphical named '" + sourceModelName + "'" ); Graphical* pG = dynamic_cast<Graphical*>(rModel.getComponentByTag( sourceModelName )); YAKE_ASSERT( pG )( sourceModelName ); @@ -106,7 +106,7 @@ } else if ( sourceType == "physical" ) { - YAKE_LOG( "Searching for physical named '" + sourceModelName + "'" ); + YAKE_LOG( "model", "Searching for physical named '" + sourceModelName + "'" ); Physical* pP = dynamic_cast<Physical*>(rModel.getComponentByTag( sourceModelName )); YAKE_ASSERT( pP )( sourceModelName ); @@ -163,7 +163,7 @@ Movable* from = getMovableFromModel(*mpModel,*pSourceNode); Movable* to = getMovableFromModel(*mpModel,*pTargetNode); - YAKE_LOG( "Found source and target. Adding controller to model..." ); + YAKE_LOG( "model", "Found source and target. Adding controller to model..." ); ModelMovableLink* link = mpModel->createLink( from, to, linkType ); YAKE_ASSERT( link ); Modified: trunk/yake/src/model/yakeDotModelParser.cpp =================================================================== --- trunk/yake/src/model/yakeDotModelParser.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeDotModelParser.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -40,15 +40,15 @@ //------------------------------------------------------ bool DotModelParser::load( const NodeSharedPtr docNode ) { - YAKE_LOG( "dotModel: load()" ); + YAKE_LOG("model", "dotModel: load()" ); YAKE_ASSERT( docNode.get() ); mDocNode = docNode; - YAKE_LOG( "***********************" ); - YAKE_LOG( "* Parsing dotModel... *" ); - YAKE_LOG( "***********************" ); + YAKE_LOG("model", "***********************" ); + YAKE_LOG("model", "* Parsing dotModel... *" ); + YAKE_LOG("model", "***********************" ); readDotModel( mDocNode ); @@ -81,7 +81,7 @@ { ModelDesc desc; desc.name_ = yake::StringUtil::toLowerCase( pModelNode->getAttributeValueAs<String>("name") ); - YAKE_LOG("xode: model '" << desc.name_ << "' found!"); + YAKE_LOG("model", "xode: model '" << desc.name_ << "' found!"); this->sigModel_( desc ); @@ -89,13 +89,13 @@ for (dom::NodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { const String name = yake::StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG("xode: item '" << name << "' found!"); + YAKE_LOG("model", "xode: item '" << name << "' found!"); if (name == "component") { this->readModelComponent( *it, desc ); } else - YAKE_LOG_WARNING("xode: unhandled item '" << name << "'!"); + YAKE_LOG_WARNING("model", "xode: unhandled item '" << name << "'!"); } this->sigModelFinished_( desc ); @@ -112,7 +112,7 @@ for (dom::NodeList::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { const String name = yake::StringUtil::toLowerCase( (*it)->getName() ); - YAKE_LOG("xode: item '" << name << "' found!"); + YAKE_LOG("model", "xode: item '" << name << "' found!"); if (name == "parameter") { String name; @@ -121,7 +121,7 @@ desc.params[name] = value; } else - YAKE_LOG_WARNING("xode: unhandled item '" << name << "'!"); + YAKE_LOG_WARNING("model", "xode: unhandled item '" << name << "'!"); } desc.params["name"] = desc.name; Modified: trunk/yake/src/model/yakeGraphical.cpp =================================================================== --- trunk/yake/src/model/yakeGraphical.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeGraphical.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -82,17 +82,17 @@ */ void Graphical::addSceneNode(graphics::ISceneNode* node, const String& xpath, const bool owned) { - YAKE_LOG(String("Graphical::addSceneNode(") + xpath + _T(")")); + YAKE_LOG_INFORMATION("model",String("Graphical::addSceneNode(") + xpath + _T(")")); this->_add(node,nodes_,xpath,owned); } void Graphical::addEntity(graphics::IEntity* ent, const String& xpath, const bool owned) { - YAKE_LOG(String("Graphical::addEntity(") + xpath + _T(")")); + YAKE_LOG_INFORMATION("model",String("Graphical::addEntity(") + xpath + _T(")")); this->_add(ent,entities_,xpath,owned); } void Graphical::addLight(graphics::ILight* light, const String& xpath, const bool owned) { - YAKE_LOG(String("Graphical::addLight(") + xpath + _T(")")); + YAKE_LOG_INFORMATION("model",String("Graphical::addLight(") + xpath + _T(")")); this->_add(light,lights_,xpath,owned); } graphics::ISceneNode* Graphical::getSceneNode(const String& xpath) const Modified: trunk/yake/src/model/yakeGraphicalDotSceneLoader.cpp =================================================================== --- trunk/yake/src/model/yakeGraphicalDotSceneLoader.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeGraphicalDotSceneLoader.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -37,7 +37,7 @@ { const String fullName = mNamePrefix + desc.path; const String fullParentNodeName = mNamePrefix + desc.parentNodeName; - YAKE_LOG( "Processing scene node " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); + YAKE_LOG("model", "Processing scene node " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); // create scene node graphics::ISceneNode* pSN = mGWorld->createSceneNode( fullName ); @@ -68,19 +68,19 @@ { if ( trackRecord->second == desc.name ) { - YAKE_LOG( "Setting track target for camera " + trackRecord->first + " ..." ); + YAKE_LOG("model", "Setting track target for camera " + trackRecord->first + " ..." ); CameraInfo info = mCameras[ trackRecord->first ]; - YAKE_LOG( "Camera info found. Acquiring camera..." ); + YAKE_LOG("model", "Camera info found. Acquiring camera..." ); graphics::ICamera* tracker = info.camera; - YAKE_LOG( "Got camera. Setting orientation..." ); + YAKE_LOG("model", "Got camera. Setting orientation..." ); tracker->lookAt( pSN->getPosition( graphics::ISceneNode::TS_WORLD ) ); - YAKE_LOG( "Orientation was set up..." ); + YAKE_LOG("model", "Orientation was set up..." ); // cleaning up mTrackersTargets.erase( trackRecord ); @@ -94,7 +94,7 @@ { const String fullName = mNamePrefix + desc.name; const String fullParentNodeName = mNamePrefix + desc.parentNodeName; - YAKE_LOG( "Processing entity " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); + YAKE_LOG("model", "Processing entity " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); // create entity graphics::IEntity* pEntity = mGWorld->createEntity( desc.meshFile ); @@ -128,7 +128,7 @@ //----------------------------------------------------- void DotSceneListener::processCamera( const CameraDesc& desc ) { - YAKE_LOG( "Processing camera " + desc.name + " with parent node " + desc.parentNodeName ); + YAKE_LOG("model", "Processing camera " + desc.name + " with parent node " + desc.parentNodeName ); graphics::ICamera* pCamera = mGWorld->createCamera(); @@ -154,7 +154,7 @@ if ( desc.trackTargetName != "" ) { - YAKE_LOG( "Saving tracking record for camera " + desc.name + " ... " ); + YAKE_LOG("model", "Saving tracking record for camera " + desc.name + " ... " ); mTrackersTargets.insert( TrackerMap::value_type( desc.name, desc.trackTargetName ) ); } @@ -172,7 +172,7 @@ { const String fullName = mNamePrefix + desc.name; const String fullParentNodeName = mNamePrefix + desc.parentNodeName; - YAKE_LOG( "Processing light " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); + YAKE_LOG("model", "Processing light " + desc.name + " (" + fullName + ") with parent node " + desc.parentNodeName + " (" + fullParentNodeName + ")" ); // create light graphics::ILight* pLight = mGWorld->createLight(); @@ -198,11 +198,11 @@ if ( desc.castsShadows ) { - YAKE_LOG( " light casts shadows" ); + YAKE_LOG("model", " light casts shadows" ); } else { - YAKE_LOG( " light doesn't cast shadows" ); + YAKE_LOG("model", " light doesn't cast shadows" ); } pLight->setDiffuseColour( desc.diffuseColor ); Modified: trunk/yake/src/model/yakeModelManager.cpp =================================================================== --- trunk/yake/src/model/yakeModelManager.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeModelManager.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -92,7 +92,7 @@ */ ModelPtr ModelManager::createModel(const String& modelName, const ModelComponentDescList& compDescList) { - YAKE_LOG_INFORMATION( "MODEL: Creating model with name: " + modelName ); + YAKE_LOG_INFORMATION("model","Creating model with name: " + modelName ); // Validate name YAKE_ASSERT( !modelName.empty() ); @@ -122,7 +122,7 @@ const String name = (itParam == params.end()) ? _T("") : itParam->second; // Create component. - YAKE_LOG_INFORMATION( "MODEL: Creating component with name: " + name ); + YAKE_LOG_INFORMATION("model"," Creating component with name: " + name ); #ifdef YAKE_DEBUG if (!name.empty()) { Modified: trunk/yake/src/model/yakePhysical.cpp =================================================================== --- trunk/yake/src/model/yakePhysical.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakePhysical.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -54,22 +54,22 @@ } void Physical::addActor(physics::IActor* actor, const String& xpath) { - YAKE_LOG(String("Physical::addActor(") + xpath + _T(")")); + YAKE_LOG("model",String("Physical::addActor(") + xpath + _T(")")); this->_add<physics::IActor>(actor,actors_,xpath); } void Physical::addJoint(physics::IJoint* joint, const String& xpath) { - YAKE_LOG(String("Physical::addJoint(") + xpath + _T(")")); + YAKE_LOG("model",String("Physical::addJoint(") + xpath + _T(")")); this->_add<physics::IJoint>(joint,joints_,xpath); } void Physical::addBody(physics::IBody* body, const String& xpath) { - YAKE_LOG(String("Physical::addBody(") + xpath + _T(")")); + YAKE_LOG("model",String("Physical::addBody(") + xpath + _T(")")); this->_add<physics::IBody>(body,bodies_,xpath); } void Physical::addAffector(physics::IBodyAffector* affector, const String& xpath) { - YAKE_LOG(String("Physical::addAffector(") + xpath + _T(")")); + YAKE_LOG("model",String("Physical::addAffector(") + xpath + _T(")")); this->_add<physics::IBodyAffector>(affector,affectors_,xpath); } physics::IActor* Physical::getActor(const yake::String& xpath) const Modified: trunk/yake/src/model/yakeXODEListener.cpp =================================================================== --- trunk/yake/src/model/yakeXODEListener.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/model/yakeXODEListener.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -35,7 +35,7 @@ //----------------------------------------------------- void XODEListener::processBody( const parser_t::BodyDesc& desc ) { - YAKE_LOG( "XODE listener: processing body description..." ); + YAKE_LOG("model.xodelistener", "XODE listener: processing body description..." ); // create actor physics::IActorPtr pDynActor = physicalWorld_->createActor( physics::ACTOR_DYNAMIC ); @@ -59,13 +59,13 @@ // filling owner model owner_.addActor( pDynActor, desc.name_ ); - YAKE_LOG( "XODE listener: Success." ); + YAKE_LOG("model.xodelistener", "XODE listener: Success." ); } //----------------------------------------------------- void XODEListener::processGeom( const parser_t::GeomDesc& desc ) { - YAKE_LOG( "XODE listener: processing geom description..." ); + YAKE_LOG("model.xodelistener", "XODE listener: processing geom description..." ); physics::IActorPtr parentActor = NULL; @@ -79,7 +79,7 @@ } else { - YAKE_LOG( "XODE listener: geom parent not found... creating static actor. " ); + YAKE_LOG("model.xodelistener", "XODE listener: geom parent not found... creating static actor. " ); // create static actor parentActor = physicalWorld_->createActor( physics::ACTOR_STATIC ); @@ -101,13 +101,13 @@ // add to collection geoms_[ desc.name_ ] = info; - YAKE_LOG( "XODE listener: Success." ); + YAKE_LOG("model.xodelistener", "XODE listener: Success." ); } //----------------------------------------------------- void XODEListener::processMaterial( const parser_t::MaterialDesc& desc ) { - YAKE_LOG( "XODE listener: processing material description..." ); + YAKE_LOG("model.xodelistener", "XODE listener: processing material description..." ); physics::IMaterial* material = physicalWorld_->createMaterial( desc.material_, desc.name_ ); @@ -116,7 +116,7 @@ if ( shape != geoms_.end() ) { - YAKE_LOG( "XODE listener: shape found! Applying material..." ); + YAKE_LOG("model.xodelistener", "XODE listener: shape found! Applying material..." ); // apply material to shape shape->second.shape_->setMaterial( material ); @@ -129,13 +129,13 @@ // add to collection materials_[ desc.name_ ] = info; - YAKE_LOG( "XODE listener: Success." ); + YAKE_LOG("model.xodelistener", "XODE listener: Success." ); } //----------------------------------------------------- void XODEListener::processMass( const parser_t::MassDesc& desc ) { - YAKE_LOG( "XODE listener: processing mass description..." ); + YAKE_LOG("model.xodelistener", "XODE listener: processing mass description..." ); // search for parent in actors ActorMap::iterator actor = actors_.find( desc.parentName_ ); @@ -145,32 +145,32 @@ // parent actor found! physics::IBody& body = actor->second.actor_->getBody(); - YAKE_LOG( "XODE listener: owner body found. Adding mass..." ); + YAKE_LOG("model.xodelistener", "XODE listener: owner body found. Adding mass..." ); body.addMass( *desc.mass_ ); // TODO process mass... add to collection etc. } - YAKE_LOG( "XODE listener: Success." ); + YAKE_LOG("model.xodelistener", "XODE listener: Success." ); } //----------------------------------------------------- void XODEListener::processJoint( const parser_t::JointDesc& desc ) { - YAKE_LOG( "XODE listener: processing joint description..." ); + YAKE_LOG("model.xodelistener", "XODE listener: processing joint description..." ); // storing joint description for further processing... jointDescriptions_.push_back( desc ); - YAKE_LOG( "XODE listener: Success." ); + YAKE_LOG("model.xodelistener", "XODE listener: Success." ); } //----------------------------------------------------- void XODEListener::postprocess() { // create joints here - YAKE_LOG( "XODE listener: postprocessing..." ); + YAKE_LOG("model.xodelistener", "XODE listener: postprocessing..." ); // TODO only implemented creation of joint connecting dynamic objects @@ -181,15 +181,15 @@ // search for connected actors - YAKE_LOG( "XODE listener: processing " + desc.name_ + " ... " ); - YAKE_LOG( "XODE listener: searching for actors [0]: " + desc.body1_ + ", [1]: " + desc.body2_ ); + YAKE_LOG("model.xodelistener", "XODE listener: processing " + desc.name_ + " ... " ); + YAKE_LOG("model.xodelistener", "XODE listener: searching for actors [0]: " + desc.body1_ + ", [1]: " + desc.body2_ ); ActorMap::iterator actor0 = actors_.find( desc.body1_ ); ActorMap::iterator actor1 = actors_.find( desc.body2_ ); if ( actor0 == actors_.end() || actor1 == actors_.end() ) { - YAKE_LOG( "XODE listener: Failed to find actors... :( " ); + YAKE_LOG("model.xodelistener", "XODE listener: Failed to find actors... :( " ); continue; } @@ -206,7 +206,7 @@ joints_[ desc.name_ ] = info; } - YAKE_LOG( "XODE listener: finished postprocessing." ); + YAKE_LOG("model.xodelistener", "XODE listener: finished postprocessing." ); } } //model Modified: trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -231,7 +231,7 @@ Ogre::SceneNode::ObjectIterator itObj = pSN->getAttachedObjectIterator(); while (itObj.hasMoreElements()) { - YAKE_LOG_WARNING( "gfx rootnode.obj '" + itObj.getNext()->getName() + "'" ); + YAKE_LOG_WARNING( "graphicsOgre", "gfx rootnode.obj '" + itObj.getNext()->getName() + "'" ); } } if (pSN->numChildren() > 0) @@ -239,7 +239,7 @@ Ogre::SceneNode::ChildNodeIterator itN = pSN->getChildIterator(); while (itN.hasMoreElements()) { - YAKE_LOG_WARNING( "gfx rootnode.node '" + itN.getNext()->getName() + "'" ); + YAKE_LOG_WARNING( "graphicsOgre", "gfx rootnode.node '" + itN.getNext()->getName() + "'" ); } } @@ -270,7 +270,7 @@ } catch (Ogre::Exception& e) { - YAKE_LOG( "[yake.graphics.ogre] OGRE EXCEPTION\n" + e.getFullDescription() + "\n"); + YAKE_LOG( "graphicsOgre", "OGRE EXCEPTION\n" + e.getFullDescription() + "\n"); mReady = false; } } @@ -366,9 +366,9 @@ } catch (Ogre::Exception& e) { - String rMsg = "[yake.graphics.ogre] OGRE EXCEPTION\n" + e.getFullDescription() + "\n"; + String rMsg = "OGRE EXCEPTION\n" + e.getFullDescription() + "\n"; - YAKE_LOG( rMsg ); + YAKE_LOG( "graphicsOgre", rMsg ); YAKE_EXCEPT( rMsg ); Modified: trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/plugins/graphicsOgre/graphicsOgreNode.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -291,7 +291,7 @@ if (e.getNumber() == Ogre::Exception::ERR_ITEM_NOT_FOUND) mSceneNode->attachObject( pCam->getCamera_() ); else - YAKE_LOG(String("Ogre Exception: ") + e.getFullDescription()); + YAKE_LOG("graphicsOgre", String("Ogre Exception: ") + e.getFullDescription()); } mCameras.push_back( pCamera ); } @@ -338,7 +338,7 @@ if (e.getNumber() == Ogre::Exception::ERR_ITEM_NOT_FOUND) mSceneNode->attachObject( pE->getEntity_() ); else - YAKE_LOG(String("Ogre Exception: ") + e.getFullDescription()); + YAKE_LOG("graphicsOgre", String("Ogre Exception: ") + e.getFullDescription()); } mEntities.push_back( pEntity ); } Modified: trunk/yake/src/plugins/graphicsOgre/yakeGraphicsWorld.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/yakeGraphicsWorld.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/plugins/graphicsOgre/yakeGraphicsWorld.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -117,7 +117,7 @@ YAKE_SAFE_DELETE( mRootNode ); while (mWrapped.size() > 0) { - YAKE_LOG_INFORMATION(String("graphicsOgre: trying to destroy wrapped object...")); + YAKE_LOG_INFORMATION("graphicsOgre", String("graphicsOgre: trying to destroy wrapped object...")); //delete *mWrapped.begin(); delete mWrapped.begin()->second; mWrapped.erase( mWrapped.begin() ); Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/raf/yakeApplication.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -97,15 +97,15 @@ } catch (yake::Exception& e) { - YAKE_LOG_ERROR("RAF caught a Yake exception!\nException Message: " + e.getMessage()); + YAKE_LOG_ERROR("raf","RAF caught a Yake exception!\nException Message: " + e.getMessage()); } catch (std::exception& e) { - YAKE_LOG_ERROR(String("RAF caught a std::exception!\nException Message: ") + e.what()); + YAKE_LOG_ERROR("raf",String("RAF caught a std::exception!\nException Message: ") + e.what()); } catch (...) { - YAKE_LOG_ERROR("RAF caught an unhandled exception!"); + YAKE_LOG_ERROR("raf","RAF caught an unhandled exception!"); } return false; } @@ -181,7 +181,7 @@ yake::base::Library* pDynLib = new yake::base::Library( file ); //@FIXME. MEMORY LEAK. YAKE_ASSERT( pDynLib ).debug( "Out of memory" ); - YAKE_LOG( "Loading plugin " + file ); + YAKE_LOG("raf", "Loading plugin " + file ); yake::base::YakeDynLibStartPluginFn pfnStartPlugin = (yake::base::YakeDynLibStartPluginFn)pDynLib->getSymbol( "dynlibStartPlugin" ); YAKE_ASSERT( pfnStartPlugin ).debug( "Cannot find export in dynamic library" ); @@ -201,17 +201,17 @@ //---- Stating CEGUI - YAKE_LOG( "Initialising CEGUI..." ); + YAKE_LOG("raf", "Initialising CEGUI..." ); CEGUI::System* ceguiSys = new CEGUI::System( mCeguiRendererAdapter->getRenderer() ); using namespace CEGUI; - YAKE_LOG( "Setting CEGUI logging level..." ); + YAKE_LOG( "raf", "Setting CEGUI logging level..." ); Logger::getSingleton().setLoggingLevel( Informative ); try { - YAKE_LOG( "Loading scheme..." ); + YAKE_LOG( "raf", "Loading scheme..." ); // load scheme and set up defaults SchemeManager::getSingleton().loadScheme((utf8*)"TaharezLook.scheme"); System::getSingleton().setDefaultMouseCursor((utf8*)"TaharezLook", (utf8*)"MouseArrow"); @@ -230,7 +230,7 @@ // catch to prevent exit (errors will be logged). catch( CEGUI::Exception& e) { - YAKE_LOG( yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); + YAKE_LOG( "raf", yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); YAKE_EXCEPT(yake::String( "Caught CEGUI Exception:\n") + e.getMessage().c_str() ); } } Modified: trunk/yake/src/raf/yakeApplicationState.cpp =================================================================== --- trunk/yake/src/raf/yakeApplicationState.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/raf/yakeApplicationState.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -58,15 +58,15 @@ } void MainState::onEnter() { - YAKE_LOG_INFORMATION("MainState::onEnter()"); + YAKE_LOG_INFORMATION("raf","MainState::onEnter()"); } void MainState::onExit() { - YAKE_LOG_INFORMATION("MainState::onExit()"); + YAKE_LOG_INFORMATION("raf","MainState::onExit()"); } void MainState::onStep() { - YAKE_LOG_INFORMATION("MainState::onStep()"); + YAKE_LOG_INFORMATION("raf","MainState::onStep()"); } //----------------------------------------------------- Modified: trunk/yake/src/raf/yakeRtApplicationState.cpp =================================================================== --- trunk/yake/src/raf/yakeRtApplicationState.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/raf/yakeRtApplicationState.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -55,7 +55,7 @@ YAKE_ASSERT( pVP ); if (!pVP) { - YAKE_LOG_WARNING("Could not create the default viewport!"); + YAKE_LOG_WARNING("raf","Could not create the default viewport!"); return 0; } // default is a fullscreen viewport @@ -142,7 +142,7 @@ YAKE_ASSERT( mDefaultCamera ); if (!mDefaultCamera) { - YAKE_LOG_WARNING("No default camera available."); + YAKE_LOG_WARNING("raf","No default camera available."); } else { @@ -152,7 +152,7 @@ YAKE_ASSERT( pVP ); if (!pVP) { - YAKE_LOG_WARNING("Could not get/create default viewport!"); + YAKE_LOG_WARNING("raf","Could not get/create default viewport!"); } else if (!onGetDefaultViewport()) { Modified: trunk/yake/src/vehicle/yakeNativeOde.cpp =================================================================== --- trunk/yake/src/vehicle/yakeNativeOde.cpp 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/src/vehicle/yakeNativeOde.cpp 2007-01-22 21:21:46 UTC (rev 1600) @@ -106,7 +106,7 @@ } void GenericVehicleSystem::_onVehicleTpl(vehicle::DotVehicleParser& parser, const String& tplId) { - YAKE_LOG("GenericVehicleSystem: loaded vehicle template'" + tplId + "'."); + YAKE_LOG("vehicle","GenericVehicleSystem: loaded vehicle template'" + tplId + "'."); mVehicleTemplates[ tplId ] = SharedPtr<vehicle::VehicleTemplate>( parser.detachCurrentVehicleTpl() ); YAKE_ASSERT( mVehicleTemplates[ tplId ] ); } @@ -269,10 +269,10 @@ } void GenericVehicle::_create(const VehicleTemplate& tpl, physics::IWorld& PWorld, model::Physical& physModel ) { - YAKE_LOG( "Creating vehicle from template..." ); + YAKE_LOG("vehicle", "Creating vehicle from template..." ); if ( tpl.mChassis.mPhysicsBody != "" ) // i.e. chassis is defined as reference to physical body { - YAKE_LOG( "External physical body found. Searching provided model for it..." ); + YAKE_LOG("vehicle", "External physical body found. Searching provided model for it..." ); // searching for actor in provided model physics::IActorPtr actor = physModel.getActor( tpl.mChassis.mPhysicsBody ); @@ -280,13 +280,13 @@ YAKE_ASSERT( actor != NULL ).error( "Actor '" + tpl.mChassis.mPhysicsBody + "' was not found in physical model! Are you sure you provided the right model???" ); - YAKE_LOG( "Found. OK." ); + YAKE_LOG("vehicle", "Found. OK." ); // initial position is determined by body position mpChassis = actor; } else // chassis is defined in .vehicle itself { - YAKE_LOG( "External physical body not found. Looking for body definition in .vehicle file." ); + YAKE_LOG("vehicle", "External physical body not found. Looking for body definition in .vehicle file." ); // chassis mpChassis = PWorld.createActor( physics::ACTOR_DYNAMIC ); Modified: trunk/yake/yake/base/yakeLog.h =================================================================== --- trunk/yake/yake/base/yakeLog.h 2007-01-22 21:19:05 UTC (rev 1599) +++ trunk/yake/yake/base/yakeLog.h 2007-01-22 21:21:46 UTC (rev 1600) @@ -59,7 +59,7 @@ YAKE_BASE_API const char* toString(const Severity sev); /** severity, processId, threadId, message */ - typedef void(*LogFn)(const severity_t, const char*, threadid_t, const char*); + typedef void(*LogFn)(const severity_t, const char*, const char*, threadid_t, const char*); struct YAKE_BASE_API logger : public boost::noncopyable { //YAKE_BUILD_PHOENIX_SINGLETON(logger) //public @@ -68,18 +68,23 @@ static logger& instance(); static logger instance_; public: - static void log(const severity_t, const char* tid, const char* msg); + //static void log(const severity_t, const char* env, const char* src, const char* msg); + static void log(const severity_t, const char* logId, const char* msg); static void setProcessId(const String&); static int addTarget(const LogFn); static void enableSeverity(const severity_t, const bool); + static void enableLog(const char* logId, const bool); private: - void doLog(const severity_t, const char* tid, const char* msg); + //void doLog(const severity_t, const char* env, const char* msg); + void doLog(const severity_t, const char* logId, const char* msg); private: String procId_; typedef std::vector<LogFn> TargetFnList; TargetFnList targets_; typedef std::map<severity_t,bool> EnableMap; EnableMap enabledSeverities_; + typedef std::map<std::string,bool> EnableLogIdMap; + EnableLogIdMap enabledLogs_; boost::mutex mtx_; struct scoped_lock; friend struct scoped_lock; @@ -99,28 +104,28 @@ #endif template<typename T1> - inline void log(const severity_t sev, const T1& rhs) + inline void log(const severity_t sev, const char* logId, const T1& rhs) { std::stringstream ss; ss << LOG_TYPE(rhs); - logger::log(sev, "[threadid]", ss.str().c_str()); + logger::log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2> - inline void log(const severity_t sev, const T1& rhs1, const T2& rhs2) + inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2) { std::stringstream ss; ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); - logger::log(sev, "[threadid]", ss.str().c_str()); + logger::log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2, typename T3> - inline void log(const severity_t sev, const T1& rhs1, const T2& rhs2, const T3& rhs3) + inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2, const T3& rhs3) { std::stringstream ss; ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); ss << LOG_TYPE(rhs3); - logger::log(sev, "[threadid]", ss.str().c_str()); + logger::log(sev, logId, ss.str().c_str()); } // short cuts @@ -132,6 +137,10 @@ { logger::enableSeverity(sev,on); } + inline void enableLog(const char* logId, const bool on) + { + logger::enableLog(logId,on); + } inline void addTarget(const LogFn fn) { logger::addTarget(fn); @@ -169,10 +178,16 @@ #define YAKE_LOG_ERROR( what ) yake::logging::log( yake::logging::S_ERROR, "[File: \"__FILE__\"@\"TOSTRING(__LINE__)+\"] ", what ); #define YAKE_LOG( what ) yake::logging::log( yake::logging::S_INFORMATION, "[File: \"__FILE__\"@\"TOSTRING(__LINE__)+\"] ", what ); #else - #define YAKE_LOG_INFORMATION( what ) yake::logging::log( yake::logging::S_INFORMATION, "[File: "__FILE__"@"TOSTRING(__LINE__)+"] ", what ); - #define YAKE_LOG_WARNING( what ) yake::logging::log( yake::logging::S_WARNING, "[File: "__FILE__"@"TOSTRING(__LINE__)+"] ", what ); - #define YAKE_LOG_ERROR( what ) yake::logging::log( yake::logging::S_ERROR, "[File: "__FILE__"@"TOSTRING(__LINE__)+"] ", what ); - #define YAKE_LOG( what ) yake::logging::log( yake::logging::S_INFORMATION, "[File: "__FILE__"@"TOSTRING(__LINE__)+"] ", what ); + //#define YAKE_LOG_INFORMATION( what ) yake::logging::log( yake::logging::S_INFORMATION, std:"[File: "__FILE__"@"TOSTRING(__LINE__)+"] ", what ); + #define YAKE_LOG_X_BASE( LOGID, LOGLVL, WHAT ) \ + { \ + std::stringstream ss; ss << WHAT; \ + yake::logging::log( LOGLVL, LOGID, ss.str() ); \ + } + #define YAKE_LOG_INFORMATION( LOGID, WHAT ) YAKE_LOG_X_BASE( LOGID, yake::logging::S_INFORMATION, WHAT ) + #define YAKE_LOG_WARNING( LOGID, WHAT ) YAKE_LOG_X_BASE( LOGID, yake::logging::S_WARNING, WHAT ) + #define YAKE_LOG_ERROR( LOGID, WHAT ) YAKE_LOG_X_BASE( LOGID, yake::logging::S_ERROR, WHAT ) + #define YAKE_LOG( LOGID, WHAT ) YAKE_LOG_X_BASE( LOGID, yake::logging::S_INFORMATION, WHAT ); #endif } // namespace logging } // namespace yake This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:21:02
|
Revision: 1599 http://svn.sourceforge.net/yake/?rev=1599&view=rev Author: psyclonist Date: 2007-01-22 13:19:05 -0800 (Mon, 22 Jan 2007) Log Message: ----------- removed deprecated (0.4.x) cegui files, added 0.5.x cegui files Added Paths: ----------- trunk/yake/common/media/gui/ trunk/yake/common/media/gui/layouts/ trunk/yake/common/media/gui/layouts/GUILayout.xsd trunk/yake/common/media/gui/layouts/VanillaConsole.layout Removed Paths: ------------- trunk/yake/common/media/gui.cegui.fonts/ trunk/yake/common/media/gui.cegui.imagesets/ trunk/yake/common/media/gui.cegui.layouts/ trunk/yake/common/media/gui.cegui.schemes/ Added: trunk/yake/common/media/gui/layouts/GUILayout.xsd =================================================================== --- trunk/yake/common/media/gui/layouts/GUILayout.xsd (rev 0) +++ trunk/yake/common/media/gui/layouts/GUILayout.xsd 2007-01-22 21:19:05 UTC (rev 1599) @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + + <xsd:element name="GUILayout" type="GUILayoutType"/> + + <xsd:complexType name="GUILayoutType"> + <xsd:sequence> + <xsd:element name="Window" type="WindowType" /> + </xsd:sequence> + <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/> + </xsd:complexType> + + <xsd:complexType name="WindowType"> + <xsd:sequence> + <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Window" type="WindowType" /> + <xsd:element name="AutoWindow" type="AutoWindowType" /> + </xsd:choice> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="Type" type="xsd:string" use="required"/> + <xsd:attribute name="Name" type="xsd:string" use="optional" default="" /> + </xsd:complexType> + + <xsd:complexType name="AutoWindowType"> + <xsd:sequence> + <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element name="Window" type="WindowType" /> + <xsd:element name="AutoWindow" type="AutoWindowType" /> + </xsd:choice> + <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> + </xsd:sequence> + <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/> + </xsd:complexType> + + <xsd:complexType name="PropertyType"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + <xsd:attribute name="Value" type="xsd:string" use="optional"/> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <xsd:complexType name="LayoutImportType"> + <xsd:attribute name="Filename" type="xsd:string" use="required"/> + <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" /> + <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" /> + </xsd:complexType> + + <xsd:complexType name="EventType"> + <xsd:attribute name="Name" type="xsd:string" use="required"/> + <xsd:attribute name="Function" type="xsd:string" use="required"/> + </xsd:complexType> + +</xsd:schema> + Added: trunk/yake/common/media/gui/layouts/VanillaConsole.layout =================================================================== --- trunk/yake/common/media/gui/layouts/VanillaConsole.layout (rev 0) +++ trunk/yake/common/media/gui/layouts/VanillaConsole.layout 2007-01-22 21:19:05 UTC (rev 1599) @@ -0,0 +1,29 @@ +<?xml version="1.0" ?> +<GUILayout> + <Window Type="Vanilla/FrameWindow" Name="/Console"> + <Property Name="AlwaysOnTop" Value="True" /> + <Property Name="UnifiedMinSize" Value="{{0.2,0},{0.2,0}}" /> + <Property Name="UnifiedMaxSize" Value="{{0.8,0},{0.8,0}}" /> + <Property Name="UnifiedPosition" Value="{{0.5,0},{0.5,0}}" /> + <Property Name="UnifiedSize" Value="{{0.5,0},{0.45,0}}" /> + <Property Name="Text" Value="Console" /> + <Property Name="CloseButtonEnabled" Value="False" /> + + <Window Type="Vanilla/Editbox" Name="/Console/Wnd/Edit"> + <Property Name="ID" Value="2" /> + <Property Name="VerticalAlignment" Value="Bottom" /> + <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> + <Property Name="UnifiedPosition" Value="{{0,7},{0,-7}}" /> + <Property Name="UnifiedSize" Value="{{1,-21},{0,30}}" /> + <Property Name="Text" Value="" /> + </Window> + + <Window Type="Vanilla/Listbox" Name="/Console/Wnd/History"> + <Property Name="ID" Value="3" /> + <Property Name="ReadOnly" Value="True" /> + <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> + <Property Name="UnifiedPosition" Value="{{0,7},{0,35}}" /> + <Property Name="UnifiedSize" Value="{{1,-14},{1,-75}}" /> + </Window> + </Window> +</GUILayout> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:20:29
|
Revision: 1596 http://svn.sourceforge.net/yake/?rev=1596&view=rev Author: psyclonist Date: 2007-01-22 13:11:30 -0800 (Mon, 22 Jan 2007) Log Message: ----------- Modified Paths: -------------- trunk/yake/common/media/gui.addons.scripts/console_redirect.lua Modified: trunk/yake/common/media/gui.addons.scripts/console_redirect.lua =================================================================== --- trunk/yake/common/media/gui.addons.scripts/console_redirect.lua 2007-01-18 00:22:08 UTC (rev 1595) +++ trunk/yake/common/media/gui.addons.scripts/console_redirect.lua 2007-01-22 21:11:30 UTC (rev 1596) @@ -1,10 +1,9 @@ -- Here is implementation of override to 'print' function -- -- --- --- +print("redirecting output...") function print( message ) app.addConsoleMessage( tostring( message ) ); end; - +print("If you can read this text, then the redirection code succeeded.") \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:20:26
|
Revision: 1597 http://svn.sourceforge.net/yake/?rev=1597&view=rev Author: psyclonist Date: 2007-01-22 13:14:00 -0800 (Mon, 22 Jan 2007) Log Message: ----------- fixed gui scripting console demo Modified Paths: -------------- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIInputArea.h trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h Modified: trunk/yake/samples/gui/console/yakeConsoleDemo.cpp =================================================================== --- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-01-22 21:11:30 UTC (rev 1596) +++ trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-01-22 21:14:00 UTC (rev 1597) @@ -25,19 +25,18 @@ ------------------------------------------------------------------------------------ */ -#include <CEGUI/CEGUI.h> -#include <CEGUI/CEGUIImageset.h> -#include <CEGUI/CEGUISystem.h> -#include <CEGUI/CEGUILogger.h> -#include <CEGUI/CEGUISchemeManager.h> -#include <CEGUI/CEGUIWindowManager.h> -#include <CEGUI/CEGUIWindow.h> -#include <CEGUI/elements/CEGUICombobox.h> -#include <CEGUI/elements/CEGUIListbox.h> -#include <CEGUI/elements/CEGUIListboxTextItem.h> -#include <CEGUI/elements/CEGUIPushButton.h> -#include <CEGUI/elements/CEGUIScrollbar.h> -#include <CEGUI/elements/CEGUIStaticImage.h> +#include <CEGUI.h> +#include <CEGUIImageset.h> +#include <CEGUISystem.h> +#include <CEGUILogger.h> +#include <CEGUISchemeManager.h> +#include <CEGUIWindowManager.h> +#include <CEGUIWindow.h> +#include <elements/CEGUICombobox.h> +#include <elements/CEGUIListbox.h> +#include <elements/CEGUIListboxTextItem.h> +#include <elements/CEGUIPushButton.h> +#include <elements/CEGUIScrollbar.h> // Yake #include <yake/base/yake.h> @@ -50,16 +49,16 @@ #include <yake/samples/common/yakeExampleApplication.h> #include <yake/data/yakeData.h> -#include <yapp/common/yakeCEGUIRendererAdapter.h> -#include <yapp/common/yakeCEGUIHelpers.h> +#include <yake/common/yakeCEGUIRendererAdapter.h> +#include <yake/common/yakeCEGUIHelpers.h> #include <yake/model/model.h> // console -#include <yapp/gui_addons/console/yakeGenericConsole.h> -#include <yapp/gui_addons/console/yakeDefaultHistory.h> -#include <yapp/gui_addons/console/yakeConsoleLuaProcessor.h> -#include <yapp/gui_addons/console/cegui/yakeCEGUIInputArea.h> -#include <yapp/gui_addons/console/cegui/yakeCEGUIOutputArea.h> +#include <yake/gui_addons/console/yakeGenericConsole.h> +#include <yake/gui_addons/console/yakeDefaultHistory.h> +#include <yake/gui_addons/console/yakeConsoleLuaProcessor.h> +#include <yake/gui_addons/console/cegui/yakeCEGUIInputArea.h> +#include <yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h> // boost #include <boost/lexical_cast.hpp> @@ -121,12 +120,12 @@ }; /// Viewport/Camera pairs - Vector< std::pair<IViewport*,ICamera*> > mVPs; + Vector< std::pair<IViewport*,ICamera*> > mVPs; /// Graphical world SharedPtr< IWorld > mGWorld; /// CEGUI renderer adapter handle - ceguiadapter::RendererAdapterPlugin* mGuiRendererAdapter; + ceguiadapter::RendererAdapterPlugin* mGuiRendererAdapter; /// Editbox representing console input area CEGUI::Editbox* mEditBox; @@ -158,7 +157,7 @@ yake::base::Library* pDynLib = new yake::base::Library( file ); YAKE_ASSERT( pDynLib ).debug( "Out of memory" ); - YAKE_LOG( "Loading plugin " + file ); + YAKE_LOG("demo","Loading plugin " + file ); yake::base::YakeDynLibStartPluginFn pfnStartPlugin = (yake::base::YakeDynLibStartPluginFn)pDynLib->getSymbol( "dynlibStartPlugin" ); YAKE_ASSERT( pfnStartPlugin ).debug( "Cannot find export in dynamic library" ); @@ -186,7 +185,7 @@ */ void onKeyDown( const yake::input::KeyboardEvent& rEvent ) { - YAKE_LOG( "KEY: " + boost::lexical_cast<String>( rEvent.keyCode ) ); + YAKE_LOG("demo", "KEY: " + boost::lexical_cast<String>( rEvent.keyCode ) ); if ( rEvent.keyCode == input::KC_ESCAPE ) requestShutdown(); @@ -228,7 +227,7 @@ */ void onKeyUp( const yake::input::KeyboardEvent& rEvent ) { - YAKE_LOG( "KEY released: " + boost::lexical_cast<String>( rEvent.keyCode ) ); + YAKE_LOG("demo", "KEY released: " + boost::lexical_cast<String>( rEvent.keyCode ) ); CEGUI::System::getSingleton().injectKeyUp( rEvent.keyCode ); } @@ -239,7 +238,7 @@ */ void onMBDown( uint8 btn ) { - YAKE_LOG( "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); + YAKE_LOG("demo", "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); CEGUI::System::getSingleton().injectMouseButtonDown( convertYakeButtonToCegui( btn ) ); } @@ -249,7 +248,7 @@ */ void onMBUp( uint8 btn ) { - YAKE_LOG( "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); + YAKE_LOG("demo", "MB: " + boost::lexical_cast<String>( static_cast<int>( btn ) ) ); CEGUI::System::getSingleton().injectMouseButtonUp( convertYakeButtonToCegui( btn ) ); } @@ -331,10 +330,10 @@ module( pL->getLuaState() ) [ class_<TheApp>( "app" ) - .scope - [ - def( "addConsoleMessage", &TheApp::addConsoleMessage ) - ] + .scope + [ + def( "addConsoleMessage", &TheApp::addConsoleMessage ) + ] ]; } catch (luabind::error& e) @@ -342,11 +341,13 @@ YAKE_EXCEPT(String("LUABIND Exception:\n") + e.what()); } - YAKE_LOG( "Executing console init script... " ); + YAKE_LOG("demo", "Executing console init script... " ); // executing console initialisation script - pL->execute( "dofile( '../../media/gui.addons.scripts/console_redirect.lua' );" ); + //pL->execute( "dofile( '../../../media/gui.addons.scripts/console_redirect.lua' );" ); + SharedPtr<scripting::IScript> script( getScriptingSystem().createScriptFromFile("../../../common/media/gui.addons.scripts/console_redirect.lua")); + pL->execute( script.get() ); } /** @@ -356,44 +357,50 @@ void initGui() { //mGuiRendererAdapter = loadPlugin( "CEGUIOgreAdapter" ); - mGuiRendererAdapter = loadPlugin( "ceguiOgreRendererAdapter" ); + mGuiRendererAdapter = loadPlugin( YAKE_DYNLIB_NAME("ceguiOgreRendererAdapter") ); YAKE_ASSERT( mGuiRendererAdapter ); - YAKE_LOG( "Starting adapter version " + mGuiRendererAdapter->getName() ); - YAKE_LOG( "Initialising CEGUI..." ); + YAKE_LOG("demo", "Starting adapter version " + mGuiRendererAdapter->getName() ); + YAKE_LOG("demo", "Initialising CEGUI..." ); - CEGUI::System* ceguiSys = new CEGUI::System( mGuiRendererAdapter->getRenderer() ); - ceguiSys = 0; // we don't use sys pointer but want to avoid unused variable warning + try + { + CEGUI::System* ceguiSys = new CEGUI::System( mGuiRendererAdapter->getRenderer() ); + ceguiSys = 0; // we don't use sys pointer but want to avoid unused variable warning - using namespace CEGUI; + using namespace CEGUI; - YAKE_LOG( "Setting CEGUI logging level..." ); + YAKE_LOG("demo", "Setting CEGUI logging level..." ); - Logger::getSingleton().setLoggingLevel( Informative ); + Logger::getSingleton().setLoggingLevel( Informative ); - try - { - YAKE_LOG( "Loading scheme..." ); - // load scheme and set up defaults - SchemeManager::getSingleton().loadScheme((utf8*)"TaharezLook.scheme"); - System::getSingleton().setDefaultMouseCursor((utf8*)"TaharezLook", (utf8*)"MouseArrow"); - CEGUI::MouseCursor::getSingleton().setImage(CEGUI::System::getSingleton().getDefaultMouseCursor()); - System::getSingleton().setDefaultFont((utf8*)"Tahoma-12"); + YAKE_LOG("demo", "Loading scheme..." ); - WindowManager& wmgr = WindowManager::getSingleton(); + SchemeManager::getSingleton().loadScheme("VanillaSkin.scheme"); + System::getSingleton().setDefaultMouseCursor("Vanilla-Images","MouseArrow"); + FontManager::getSingleton().createFont("Iconified-12.font"); + WindowManager& winMgr = WindowManager::getSingleton(); - Window* sheet = wmgr.loadWindowLayout( "console.layout" ); - System::getSingleton().setGUISheet(sheet); + Window* background = winMgr.createWindow("Vanilla/StaticImage"); + background->setArea(URect(cegui_reldim(0), cegui_reldim(0), cegui_reldim(1), cegui_reldim(1))); + background->setProperty("FrameEnabled", "false"); + background->setProperty("BackgroundEnabled", "false"); + background->setProperty("Image", "set:BackgroundImage image:full_image"); + System::getSingleton().setGUISheet(background); - CEGUI::Window* pEditBoxWnd = CEGUI::WindowManager::getSingleton().getWindow((CEGUI::utf8*)"/Console/Wnd/Edit"); + background->addChildWindow(winMgr.loadWindowLayout("VanillaConsole.layout")); + + background->activate(); + + mEditBox = static_cast<CEGUI::Editbox*>(CEGUI::WindowManager::getSingleton().getWindow("/Console/Wnd/Edit")); - mListBox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().getWindow("/Console/Wnd/List")); + mListBox = static_cast<CEGUI::Listbox*>(CEGUI::WindowManager::getSingleton().getWindow("/Console/Wnd/History")); } // catch to prevent exit (errors will be logged). catch( CEGUI::Exception& e) { - YAKE_LOG( yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); + YAKE_LOG_ERROR( "demo", yake::String( "CEGUI Exception: " ) + e.getMessage().c_str() ); } setupConsole(); @@ -493,7 +500,8 @@ } catch ( const yake::Exception& rException ) { - YAKE_LOG( rException.what() ); + YAKE_LOG_ERROR( "demo", rException.what() ); + std::cin.get(); } return 0; Modified: trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIInputArea.h =================================================================== --- trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIInputArea.h 2007-01-22 21:11:30 UTC (rev 1596) +++ trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIInputArea.h 2007-01-22 21:14:00 UTC (rev 1597) @@ -27,9 +27,9 @@ #ifndef YAKE_CEGUI_INPUT_AREA_H #define YAKE_CEGUI_INPUT_AREA_H -#include <CEGUI/CEGUI.h> -#include <CEGUI/CEGUISystem.h> -#include <CEGUI/CEGUIWindow.h> +#include <CEGUI.h> +#include <CEGUISystem.h> +#include <CEGUIWindow.h> namespace yake Modified: trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h =================================================================== --- trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h 2007-01-22 21:11:30 UTC (rev 1596) +++ trunk/yake/yake/gui_addons/console/cegui/yakeCEGUIOutputArea.h 2007-01-22 21:14:00 UTC (rev 1597) @@ -27,10 +27,10 @@ #ifndef YAKE_CEGUI_OUTPUT_AREA_H #define YAKE_CEGUI_OUTPUT_AREA_H -#include <CEGUI/CEGUI.h> -#include <CEGUI/CEGUIWindow.h> -#include <CEGUI/elements/CEGUIListbox.h> -#include <CEGUI/elements/CEGUIListboxTextItem.h> +#include <CEGUI.h> +#include <CEGUIWindow.h> +#include <elements/CEGUIListbox.h> +#include <elements/CEGUIListboxTextItem.h> namespace yake { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-22 21:20:25
|
Revision: 1598 http://svn.sourceforge.net/yake/?rev=1598&view=rev Author: psyclonist Date: 2007-01-22 13:17:32 -0800 (Mon, 22 Jan 2007) Log Message: ----------- updated demo list, added samples to premake script, updated build scripts, fixed ExampleApplication framework Modified Paths: -------------- trunk/yake/samples/README.TXT trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua trunk/yake/yake/samples/common/yakeExampleApplication.h Modified: trunk/yake/samples/README.TXT =================================================================== --- trunk/yake/samples/README.TXT 2007-01-22 21:14:00 UTC (rev 1597) +++ trunk/yake/samples/README.TXT 2007-01-22 21:17:32 UTC (rev 1598) @@ -1,6 +1,17 @@ Overview over the sampels +---- supported: +sampleLog - basic logging +net/packet - network packet connections +net/inprocess - client/server: replication objects, communication service, ... +gui/console - Graphical scripting console +raf/minimal +raf/demo1 +ent/sampleEntFsm + +---- in flux: (i.e. in process of being added to the main build scripts) + debug scripted_entity custom_entity Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-01-22 21:14:00 UTC (rev 1597) +++ trunk/yake/scripts/premake/samples.lua 2007-01-22 21:17:32 UTC (rev 1598) @@ -18,16 +18,6 @@ dofile("deps.lua") -function useComponent(name) - local STATIC_LINKING_STR = "" - if (SAMPLES_USE_STATIC_LINKING) then - STATIC_LINKING_STR = "_s" - end - addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR..DEBUG_DLL_SUFFIX,"Debug") - addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR,"Release") - addDependency(LIBFILE_PREFIX..name.."_sym","ReleaseWithSymbols") -- dynamic linking only -end - -------------------------------------- -- create samples/demos -------------------------------------- @@ -52,3 +42,37 @@ makeSample("sampleRafDemo1","samples/raf/demo1") useComponent("base") useComponent("raf") + +-------------------------------------- +makeSample("sampleGuiConsole","samples/gui/console") +useComponent("base") +useComponent("input") +useComponent("scripting") +useComponent("scriptingLua") +useComponent("graphics") +useComponent("audio") +useComponent("physics") +useDep("cegui") +useDep("lua") +useDep("luabind") + +-------------------------------------- +makeSample("sampleNetPacket","samples/net/packet") +addDefine("YAKE_MODEL_LUA_EXPORTS") +useComponent("base") +useComponent("net") + +-------------------------------------- +makeSample("sampleNetInprocess","samples/net/inprocess") +useComponent("base") +useComponent("scripting") +useComponent("net") +useComponent("netsvc") +useComponent("netrepsvc") +useComponent("model") +useComponent("modelLua") +useComponent("ent") +useComponent("entLua") +addIncludePath("dependencies/boost") +addMatching("samples/net/roclient/roclient*") +addMatching("samples/net/roserver/roserver*") Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-01-22 21:14:00 UTC (rev 1597) +++ trunk/yake/scripts/premake/tools.lua 2007-01-22 21:17:32 UTC (rev 1598) @@ -164,13 +164,14 @@ end if not cfg then tinsert(deps[name].libdir,path) - elseif project.configs[cfg] then - tinsert(deps[name].configs[cfg].libdir,path) + else + if deps[name].configs[cfg] ~= nil then + tinsert(deps[name].configs[cfg].libdir,path) + end end end function defDepLibrary(name,lib,cfg) if not lib then - print("defDepLibrary() failed to specify lib for dep '" .. name .. "'!") return end if not cfg then @@ -192,15 +193,15 @@ end -- paths/libs for specific targets - for k,v in project.configs do - for tmp,path in deps[name].configs[v].incdir do - addIncludePath(path,v) + for k,cfg in project.configs do + for tmp,path in deps[name].configs[cfg].incdir do + addIncludePath(path,cfg) end - for tmp,path in deps[name].configs[v].libdir do - addLibraryPath(path,v) + for tmp,path in deps[name].configs[cfg].libdir do + addLibraryPath(path,cfg) end - for tmp,lib in deps[name].configs[v].libs do - addDependency(lib,v) + for tmp,lib in deps[name].configs[cfg].libs do + addDependency(lib,cfg) end end end @@ -290,3 +291,14 @@ addMatching(path.."/*.h") addMatching(path.."/*.inl") end + +-- Mostly used in samples.lua and custom.lua +function useComponent(name) + local STATIC_LINKING_STR = "" + if (SAMPLES_USE_STATIC_LINKING) then + STATIC_LINKING_STR = "_s" + end + addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR..DEBUG_DLL_SUFFIX,"Debug") + addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR,"Release") + addDependency(LIBFILE_PREFIX..name.."_sym","ReleaseWithSymbols") -- dynamic linking only +end Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-01-22 21:14:00 UTC (rev 1597) +++ trunk/yake/scripts/premake/yake.lua 2007-01-22 21:17:32 UTC (rev 1598) @@ -89,6 +89,11 @@ addDependency("data") -------------------------------------- +makeComponent("ent","YAKE_ENT_EXPORTS") +addDependency("base") +addDependency("model") + +-------------------------------------- makeComponent("net","YAKE_NET_EXPORTS") addDependency("base") @@ -103,9 +108,11 @@ addDependency("net") -------------------------------------- -makeComponent("ent","YAKE_ENT_EXPORTS") +makeComponent("netrepsvc","YAKE_NETREPSVC_EXPORTS") addDependency("base") -addDependency("model") +addDependency("ent") +addDependency("net") +addDependency("netsvc") -------------------------------------- makeComponent("vehicle","YAKE_VEHICLE_EXPORTS") Modified: trunk/yake/yake/samples/common/yakeExampleApplication.h =================================================================== --- trunk/yake/yake/samples/common/yakeExampleApplication.h 2007-01-22 21:14:00 UTC (rev 1597) +++ trunk/yake/yake/samples/common/yakeExampleApplication.h 2007-01-22 21:17:32 UTC (rev 1598) @@ -122,7 +122,16 @@ // scripting if ( mLoadScriptingSystem ) { - SharedPtr<base::Library> pLib = loadLib("scriptingLua" ); + +#ifdef YAKE_DEBUG +# define YAKE_DYNLIB_POSTFIX "_d" +#else +# define YAKE_DYNLIB_POSTFIX +#endif +#define YAKE_DYNLIB_NAME(X) \ + yake::String("yake_" X YAKE_DYNLIB_POSTFIX).c_str() + + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("scriptingLua")); YAKE_ASSERT( pLib ).debug("Cannot load scripting system"); mScriptingSystem = create_default< scripting::IScriptingSystem >(); @@ -132,7 +141,7 @@ // scripting bindings if ( mLoadScriptingBindings ) { - SharedPtr<base::Library> pLib = loadLib("scriptingBindingsLua" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("scriptingBindingsLua")); YAKE_ASSERT( pLib ).debug("Cannot load scripting bindings plugin."); mScriptingBindings = create_default< scripting::IBinder >(); @@ -142,7 +151,7 @@ // graphics if (mLoadGraphicsSystem) { - SharedPtr<base::Library> pLib = loadLib("graphicsOgre" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("graphicsOgre" )); YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); mGraphicsSystem = create_default< graphics::IGraphicsSystem >(); @@ -155,7 +164,7 @@ // physics if (mLoadPhysicsSystem) { - SharedPtr<base::Library> pLib = loadLib("physicsODE" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("physicsODE" )); YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); mPhysicsSystem = create_default< physics::IPhysicsSystem >(); @@ -165,7 +174,7 @@ // input if (mLoadInputSystem) { - SharedPtr<base::Library> pLib = loadLib("inputOgre" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("inputOgre" )); YAKE_ASSERT( pLib ).debug("Cannot load input plugin."); mInputSystem = create_default< input::IInputSystem >(); @@ -177,7 +186,7 @@ // audio if (mLoadAudioSystem) { - SharedPtr<base::Library> pLib = loadLib( "audioOpenAL" ); + SharedPtr<base::Library> pLib = loadLib(YAKE_DYNLIB_NAME("audioOpenAL" )); YAKE_ASSERT( pLib ).debug("Cannot load audio plugin."); mAudioSystem = create_default< audio::IAudioSystem >(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-18 00:22:07
|
Revision: 1595 http://svn.sourceforge.net/yake/?rev=1595&view=rev Author: psyclonist Date: 2007-01-17 16:22:08 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Linux related fixes Modified Paths: -------------- trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-01-18 00:21:50 UTC (rev 1594) +++ trunk/yake/scripts/premake/yake.lua 2007-01-18 00:22:08 UTC (rev 1595) @@ -41,6 +41,8 @@ addDependency("winmm") addDependency("user32") addDependency("gdi32") + elseif (linux) then + addMatching("src/base/native/Linux/*.cpp") end @@ -126,10 +128,10 @@ addDependency("model") addDependency("ent") addDependency("scripting") - --- @todo FIXME works on linux, too... + +-- @todo FIXME works on linux, too... if not linux then - useDep("cegui") + useDep("cegui") end -------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-18 00:21:50
|
Revision: 1594 http://svn.sourceforge.net/yake/?rev=1594&view=rev Author: psyclonist Date: 2007-01-17 16:21:50 -0800 (Wed, 17 Jan 2007) Log Message: ----------- Linux related fixes Modified Paths: -------------- trunk/yake/scripts/premake/tools.lua Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-01-18 00:17:57 UTC (rev 1593) +++ trunk/yake/scripts/premake/tools.lua 2007-01-18 00:21:50 UTC (rev 1594) @@ -256,6 +256,8 @@ if (windows) then addDefine("_CRT_SECURE_NO_DEPRECATE") addDefine("WIN32") + elseif (linux) then + addDefine("_REENTRANT") end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-18 00:17:56
|
Revision: 1593 http://svn.sourceforge.net/yake/?rev=1593&view=rev Author: psyclonist Date: 2007-01-17 16:17:57 -0800 (Wed, 17 Jan 2007) Log Message: ----------- updated Linux instructions Modified Paths: -------------- trunk/yake/BUILD Modified: trunk/yake/BUILD =================================================================== --- trunk/yake/BUILD 2007-01-18 00:17:06 UTC (rev 1592) +++ trunk/yake/BUILD 2007-01-18 00:17:57 UTC (rev 1593) @@ -89,14 +89,28 @@ ------------------------------------------ * Install premake + + Note: The build script generation below expects the 'premake' executable + to be available in the path. * Set up the dependency directory (see 2.2 below) -* Create makefiles & compile Yake - # cd yake/scripts/premake - # ./build_linux_gnu.sh +* Build Yake's libraries including plugins: + + * Open a console and move to the Yake root directory + + # cd scripts/linux + # ./build.sh # make + + * Build Yake demos: + + We suppose your in the directory: yake/scripts/linux + + # ./build_samples.sh + # make + >> More instructions to come << 2.2 Building Yake with SCons This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-18 00:17:09
|
Revision: 1592 http://svn.sourceforge.net/yake/?rev=1592&view=rev Author: psyclonist Date: 2007-01-17 16:17:06 -0800 (Wed, 17 Jan 2007) Log Message: ----------- resolve gcc issue with duplicate file names and other issues Modified Paths: -------------- trunk/yake/src/base/native/Linux/yakeCriticalSection.cpp trunk/yake/src/base/native/Linux/yakeDebug.cpp trunk/yake/src/base/native/Linux/yakeTime.cpp Added Paths: ----------- trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp Removed Paths: ------------- trunk/yake/src/base/native/Linux/yakeLibrary.cpp Modified: trunk/yake/src/base/native/Linux/yakeCriticalSection.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeCriticalSection.cpp 2007-01-17 23:30:01 UTC (rev 1591) +++ trunk/yake/src/base/native/Linux/yakeCriticalSection.cpp 2007-01-18 00:17:06 UTC (rev 1592) @@ -39,20 +39,20 @@ namespace native { -YAKE_BASE_NATIVE_API CriticalSectionHandle criticalSection_Create() +CriticalSectionHandle criticalSection_Create() { return ( CriticalSectionHandle )0; } -YAKE_BASE_NATIVE_API void criticalSection_Enter( CriticalSectionHandle criticalSection ) +void criticalSection_Enter( CriticalSectionHandle criticalSection ) { } -YAKE_BASE_NATIVE_API void criticalSection_Leave( CriticalSectionHandle criticalSection ) +void criticalSection_Leave( CriticalSectionHandle criticalSection ) { } -YAKE_BASE_NATIVE_API void criticalSection_Delete( CriticalSectionHandle criticalSection ) +void criticalSection_Delete( CriticalSectionHandle criticalSection ) { } Modified: trunk/yake/src/base/native/Linux/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-01-17 23:30:01 UTC (rev 1591) +++ trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-01-18 00:17:06 UTC (rev 1592) @@ -65,7 +65,7 @@ static bool consoleApp_; } logConsole_g; -YAKE_BASE_NATIVE_API void debug_Log( const char* what, DebugLog::Severity eSeverity, const char* source ) +void debug_Log( const char* what, logging::Severity eSeverity, const char* source ) { static char szBuffer[ 1024 ]; @@ -75,12 +75,12 @@ logConsole_g.Print( "\n" ); } -YAKE_BASE_NATIVE_API void debug_Print( const char* string ) +void debug_Print( const char* string ) { logConsole_g.Print( string ); } -YAKE_BASE_NATIVE_API bool debug_AssertFailed( const char* pszMessage, +bool debug_AssertFailed( const char* pszMessage, const char* pszCondition, const char* pszFile, int nLine, Deleted: trunk/yake/src/base/native/Linux/yakeLibrary.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeLibrary.cpp 2007-01-17 23:30:01 UTC (rev 1591) +++ trunk/yake/src/base/native/Linux/yakeLibrary.cpp 2007-01-18 00:17:06 UTC (rev 1592) @@ -1,129 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright 2004 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program 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 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 Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser 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, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Stl -#include <cassert> -#include <locale> - -extern "C" -{ -#include <dlfcn.h> -#include <assert.h> -} - -// Yake -#include <yake/base/yakePCH.h> -#include <yake/base/native/yakeNative.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace native -{ - -YAKE_BASE_NATIVE_API LibraryHandle library_Load( const char* pFilename ) -{ - assert( pFilename && "Invalid filename." ); - - // Due to Linux libraries naming we decided to add some "brand" prefix - String yakeLibPrefix( "libyake" ); - String yappLibPrefix( "libyapp" ); - - String yakeName( yakeLibPrefix + String( pFilename ) ); - String yappName( yappLibPrefix + String( pFilename ) ); - - // dlopen() does not add .so to the filename, like windows does for .dll - if ( yakeName.substr( yakeName.length() - 3, 3 ) != ".so" ) - yakeName += ".so"; - - // the same for other prefix - if ( yappName.substr( yappName.length() - 3, 3 ) != ".so" ) - yappName += ".so"; - - String name = yakeName; - -#ifdef YAKE_DEBUG - debug_Print( String( "Trying to load " + name ).c_str() ); -#endif - - LibraryHandle handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); - - // trying to load library with libyapp prefix - if ( handle == NULL ) - { -#ifdef YAKE_DEBUG - debug_Print( String( "dlerror returned:" + String( dlerror() ) ).c_str() ); -#endif - - name = yappName; - -#ifdef YAKE_DEBUG - debug_Print( String( "Now trying to load " + name ).c_str() ); -#endif - - handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); - } - - if ( handle == NULL ) - throw "Failed to load " + String( pFilename ) - + String( " with both libyake and libyapp prefixes due to " ) - + String( dlerror() ); - -#ifdef YAKE_DEBUG - debug_Print( String( "successfully loaded " + name ).c_str() ); -#endif - - return handle; -} - -YAKE_BASE_NATIVE_API void* library_GetSymbol( LibraryHandle library, const char* pFunction ) -{ - assert( library && "Invalid library handle." ); - assert( pFunction && "Invalid library function." ); - - // Get the Procedure's Address. - void* address = dlsym( const_cast< void* >( library ), pFunction ); - - return address; -} - -YAKE_BASE_NATIVE_API void library_Free( LibraryHandle library ) -{ - assert( library && "Invalid library handle" ); - - dlclose( const_cast< void* >( library ) ); -} - - -} // native -} // yake - Copied: trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp (from rev 1588, trunk/yake/src/base/native/Linux/yakeLibrary.cpp) =================================================================== --- trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp (rev 0) +++ trunk/yake/src/base/native/Linux/yakeNativeLibrary.cpp 2007-01-18 00:17:06 UTC (rev 1592) @@ -0,0 +1,129 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright 2004 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program 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 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser 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, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ + +//============================================================================ +// IMPLEMENTATION HEADERS +//============================================================================ +// Stl +#include <cassert> +#include <locale> + +extern "C" +{ +#include <dlfcn.h> +#include <assert.h> +} + +// Yake +#include <yake/base/yakePCH.h> +#include <yake/base/native/yakeNative.h> + +//============================================================================ +// INTERFACE STRUCTURES / UTILITY CLASSES +//============================================================================ +namespace yake +{ +namespace native +{ + +LibraryHandle library_Load( const char* pFilename ) +{ + assert( pFilename && "Invalid filename." ); + + // Due to Linux libraries naming we decided to add some "brand" prefix + String yakeLibPrefix( "libyake" ); + String yappLibPrefix( "libyapp" ); + + String yakeName( yakeLibPrefix + String( pFilename ) ); + String yappName( yappLibPrefix + String( pFilename ) ); + + // dlopen() does not add .so to the filename, like windows does for .dll + if ( yakeName.substr( yakeName.length() - 3, 3 ) != ".so" ) + yakeName += ".so"; + + // the same for other prefix + if ( yappName.substr( yappName.length() - 3, 3 ) != ".so" ) + yappName += ".so"; + + String name = yakeName; + +#ifdef YAKE_DEBUG + debug_Print( String( "Trying to load " + name ).c_str() ); +#endif + + LibraryHandle handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); + + // trying to load library with libyapp prefix + if ( handle == NULL ) + { +#ifdef YAKE_DEBUG + debug_Print( String( "dlerror returned:" + String( dlerror() ) ).c_str() ); +#endif + + name = yappName; + +#ifdef YAKE_DEBUG + debug_Print( String( "Now trying to load " + name ).c_str() ); +#endif + + handle = ( LibraryHandle )dlopen( name.c_str(), RTLD_LAZY ); + } + + if ( handle == NULL ) + throw "Failed to load " + String( pFilename ) + + String( " with both libyake and libyapp prefixes due to " ) + + String( dlerror() ); + +#ifdef YAKE_DEBUG + debug_Print( String( "successfully loaded " + name ).c_str() ); +#endif + + return handle; +} + +void* library_GetSymbol( LibraryHandle library, const char* pFunction ) +{ + assert( library && "Invalid library handle." ); + assert( pFunction && "Invalid library function." ); + + // Get the Procedure's Address. + void* address = dlsym( const_cast< void* >( library ), pFunction ); + + return address; +} + +void library_Free( LibraryHandle library ) +{ + assert( library && "Invalid library handle" ); + + dlclose( const_cast< void* >( library ) ); +} + + +} // native +} // yake + Modified: trunk/yake/src/base/native/Linux/yakeTime.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeTime.cpp 2007-01-17 23:30:01 UTC (rev 1591) +++ trunk/yake/src/base/native/Linux/yakeTime.cpp 2007-01-18 00:17:06 UTC (rev 1592) @@ -64,7 +64,7 @@ } TimerInit_g; - float YAKE_BASE_NATIVE_API getTime() + float getTime() { struct timeval t_now; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-17 23:30:05
|
Revision: 1591 http://svn.sourceforge.net/yake/?rev=1591&view=rev Author: psyclonist Date: 2007-01-17 15:30:01 -0800 (Wed, 17 Jan 2007) Log Message: ----------- removed deprecated files Removed Paths: ------------- trunk/yake/scripts/premake/clean_linux.gnu.sh Deleted: trunk/yake/scripts/premake/clean_linux.gnu.sh =================================================================== --- trunk/yake/scripts/premake/clean_linux.gnu.sh 2007-01-17 23:29:28 UTC (rev 1590) +++ trunk/yake/scripts/premake/clean_linux.gnu.sh 2007-01-17 23:30:01 UTC (rev 1591) @@ -1,3 +0,0 @@ -#!/bin/bash -export SOLUTION_TARGET_DIR=linux -./premake --file yake.lua --os linux clean This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-17 23:29:33
|
Revision: 1590 http://svn.sourceforge.net/yake/?rev=1590&view=rev Author: psyclonist Date: 2007-01-17 15:29:28 -0800 (Wed, 17 Jan 2007) Log Message: ----------- removed deprecated files Removed Paths: ------------- trunk/yake/scripts/premake/build_linux_gnu.sh Deleted: trunk/yake/scripts/premake/build_linux_gnu.sh =================================================================== --- trunk/yake/scripts/premake/build_linux_gnu.sh 2007-01-17 23:27:58 UTC (rev 1589) +++ trunk/yake/scripts/premake/build_linux_gnu.sh 2007-01-17 23:29:28 UTC (rev 1590) @@ -1,3 +0,0 @@ -#!/bin/bash -export SOLUTION_TARGET_DIR=linux -./premake --file yake.lua --target gnu --os linux -cc gcc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-17 23:28:00
|
Revision: 1589 http://svn.sourceforge.net/yake/?rev=1589&view=rev Author: psyclonist Date: 2007-01-17 15:27:58 -0800 (Wed, 17 Jan 2007) Log Message: ----------- fixed Modified Paths: -------------- trunk/yake/scripts/linux/build.sh Modified: trunk/yake/scripts/linux/build.sh =================================================================== --- trunk/yake/scripts/linux/build.sh 2007-01-15 18:25:20 UTC (rev 1588) +++ trunk/yake/scripts/linux/build.sh 2007-01-17 23:27:58 UTC (rev 1589) @@ -1,6 +1,6 @@ #!/bin/bash -#cd .. -#cd ../premake -export SOLUTION_TARGET_DIR=linux -./premake --file yake.lua --target gnu --os linux -cc gcc -#cd ../linux +cd .. +cd premake +export SOLUTION_TARGET_DIR=linux +premake --file yake.lua --target gnu --os linux -cc gcc +cd ../linux This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-01-15 18:25:22
|
Revision: 1588 http://svn.sourceforge.net/yake/?rev=1588&view=rev Author: psyclonist Date: 2007-01-15 10:25:20 -0800 (Mon, 15 Jan 2007) Log Message: ----------- added audio::ISource::getState() similarly to what brainless suggested in #0000015 Modified Paths: -------------- trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp trunk/yake/yake/audio/yakeAudioSystem.h trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h Modified: trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp =================================================================== --- trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp 2007-01-15 18:06:35 UTC (rev 1587) +++ trunk/yake/src/plugins/audioOpenAL/yakeAudioSourceOpenAL.cpp 2007-01-15 18:25:20 UTC (rev 1588) @@ -140,5 +140,20 @@ mSource->pause(); } + SourceOpenAL::State SourceOpenAL::getState() const + { + YAKE_ASSERT( mSource.valid() ); + switch (mSource->getState()) + { + case openalpp::Playing: + return ISource::Playing; + case openalpp::Paused: + return ISource::Paused; + case openalpp::Stopped: + case openalpp::Initial: + default: + return ISource::Stopped; + } + } } } Modified: trunk/yake/yake/audio/yakeAudioSystem.h =================================================================== --- trunk/yake/yake/audio/yakeAudioSystem.h 2007-01-15 18:06:35 UTC (rev 1587) +++ trunk/yake/yake/audio/yakeAudioSystem.h 2007-01-15 18:25:20 UTC (rev 1588) @@ -84,6 +84,13 @@ virtual void stop() = 0; virtual void pause() = 0; + enum State { + Playing = 0, + Paused, + Stopped, + }; + virtual State getState() const = 0; + virtual Vector3 getDerivedPosition() const { return this->getPosition(); } virtual Quaternion getDerivedOrientation() const Modified: trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h =================================================================== --- trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-01-15 18:06:35 UTC (rev 1587) +++ trunk/yake/yake/plugins/audioOpenAL/yakeAudioSystemOpenAL.h 2007-01-15 18:25:20 UTC (rev 1588) @@ -98,6 +98,8 @@ virtual void stop(); virtual void pause(); + virtual State getState() const; + virtual void setOrientation( const Quaternion & orientation ); virtual Quaternion getOrientation() const; virtual void setPosition( const Vector3 & position ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |