Show
Ignore:
Timestamp:
11/26/07 22:53:32 (1 year ago)
Author:
vossg
Message:

changed: more flexible navigators, allow user navigator (thanks to M. Spindler for the code)

: add _d when pulling windows dlls

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/System/Window/Utilities/OSGWalkEngine.cpp

    r106 r1021  
    33 *                                                                           * 
    44 *                                                                           * 
    5  *             Copyright (C) 2000,2001 by the OpenSG Forum                   * 
     5 *             Copyright (C) 2000-2002 by the OpenSG Forum                   * 
    66 *                                                                           * 
    77 *                            www.opensg.org                                 * 
     
    3737\*---------------------------------------------------------------------------*/ 
    3838 
    39 #include "OSGWalkNavigator.h" 
    40  
    41 //#include "OSGSimpleGeometry.h" 
     39#include "OSGConfig.h" 
     40#include "OSGBaseTypes.h" 
     41#include "OSGMatrix.h" 
     42#include "OSGMatrixUtility.h" 
     43 
     44#include "OSGWalkEngine.h" 
     45 
    4246#include "OSGNode.h" 
    43 #include "OSGNodeCore.h" 
     47#include "OSGCamera.h" 
     48#include "OSGBackground.h" 
    4449 
    4550OSG_USING_NAMESPACE 
    46  
    4751 
    4852/***************************************************************************\ 
     
    5054\***************************************************************************/ 
    5155 
    52 /*! \class OSG::WalkNavigator 
     56/*! \class OSG::WalkEngine 
    5357    \ingroup GrpSystemWindowNavigators 
    5458 
     59\dev  
     60 
     61\enddev 
    5562 
    5663*/ 
    5764 
     65 
    5866/*------------------------- constructors ----------------------------------*/ 
    5967 
    60 /*! Constructor 
    61  */ 
    62  
    63 WalkNavigator::WalkNavigator(): FlyNavigator(), 
     68WalkEngine::WalkEngine(void) :  
     69    Inherited(), 
    6470    _ground(NullFC), 
    6571    _world(NullFC), 
     
    6874    _height(0.85), 
    6975    _width(0.5), 
    70     _fatness(0.5) 
    71 
    72     _act = IntersectAction::create(); 
     76    _fatness(0.5), 
     77    _act(IntersectAction::create()) 
     78
    7379} 
    7480 
    7581/*-------------------------- destructors ----------------------------------*/ 
    7682 
    77 /*! Destructor 
    78  */ 
    79  
    80 WalkNavigator::~WalkNavigator() 
     83WalkEngine::~WalkEngine() 
    8184{ 
    8285    delete _act; 
    8386} 
    8487 
    85  
    8688/*------------------------------ get --------------------------------------*/ 
    8789 
    88  
    8990/*------------------------------ set --------------------------------------*/ 
    9091 
    91  
    92 void WalkNavigator::setGround(const NodePtr &new_ground) 
     92void WalkEngine::setGround(const NodePtr &new_ground) 
    9393{ 
    9494    _ground=new_ground; 
    9595} 
    9696 
    97 void WalkNavigator::setWorld(const NodePtr &new_world) 
     97void WalkEngine::setWorld(const NodePtr &new_world) 
    9898{ 
    9999    _world=new_world; 
    100100} 
    101101 
    102 void WalkNavigator::setGroundDistance(Real32 groundDistance) 
     102void WalkEngine::setGroundDistance(Real32 groundDistance) 
    103103{ 
    104104    _groundDistance=groundDistance; 
    105105} 
    106106 
    107 void WalkNavigator::setMinWallDistance (Real32 wallDistance) 
     107void WalkEngine::setMinWallDistance (Real32 wallDistance) 
    108108{ 
    109109    _wallDistance=wallDistance; 
    110110} 
    111111     
    112 void WalkNavigator::setPersonDimensions(Real32 height,Real32 width,Real32 fatness) 
     112void WalkEngine::setPersonDimensions(Real32 height,Real32 width,Real32 fatness) 
    113113{ 
    114114    _height  = height; 
     
    117117} 
    118118 
     119/*---------------------- navigator engine callbacks ------------------------*/ 
     120void WalkEngine::idle(Int16 buttons, Int16 x, Int16 y, Navigator* nav) 
     121{ 
     122    if (buttons) moveTo(x, y, nav); 
     123} 
     124 
     125void WalkEngine::onViewportChanged(ViewportPtr new_viewport) 
     126{ 
     127    setGround(new_viewport->getRoot()); 
     128    setWorld (new_viewport->getRoot()); 
     129} 
     130 
    119131/*---------------------- Walker Transformations ----------------------------*/ 
    120132 
     
    122134 */ 
    123135 
    124 void WalkNavigator::rotate (Real32 deltaX, Real32 deltaY) 
    125 { 
    126     FlyNavigator::rotate(deltaX, deltaY); 
     136void WalkEngine::rotate (Real32 deltaX, Real32 deltaY) 
     137{ 
     138    Inherited::rotate(deltaX, deltaY); 
    127139} 
    128140    
     
    130142 */ 
    131143 
    132 Real32 WalkNavigator::forward(Real32 step) 
     144Real32 WalkEngine::forward(Real32 step) 
    133145{ 
    134146    Vec3f lv = _rFrom - _rAt; 
     
    187199 */ 
    188200 
    189 Real32 WalkNavigator::right(Real32 step) 
     201Real32 WalkEngine::right(Real32 step) 
    190202{ 
    191203//    Int16 sign = (step >= 0) ? -1 : 1; 
     
    246258    return step; 
    247259} 
     260