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

📄 oasislua_export_wrap_luabind.cpp

📁 赫赫大名的 OGRE 游戏引擎
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    &objectResource::setScale )
    .def( "setScale", ( void( objectResource::* )( const vector3& ) )
    &objectResource::setScale )
    .def( "getScale", &objectResource::getScale )
    .def( "setEntity", &objectResource::setEntity )
    .def( "getEntity", &objectResource::getEntity )
    .def( "addSound", &objectResource::addSound )
    .def( "removeAllSounds", &objectResource::removeAllSounds )
    .def( "removeSound", &objectResource::removeSound )
    .def( "setPhysics", &objectResource::setPhysics )
    .def( "getPhysics", &objectResource::getPhysics )
    .def( "removePhysics", &objectResource::removePhysics )
  ];
 luabind::module( engine ) [
    luabind::class_< object, luabind::bases< audible, physical, visible > >( "object" )
  ];

  luabind::module( engine ) [
    luabind::def( "getObjectSystem", &objectSystem::get )
  ];

// oasisPhysicsSystem
  luabind::module( engine ) [
    luabind::class_< physicsSystem >( "physicsSystem" )
    .def( "reset", &physicsSystem::reset )
    .def( "getPhysicsTemplate", &physicsSystem::getPhysicsTemplate )
    .def( "createPhysicsTemplate", &physicsSystem::createPhysicsTemplate )
    .def( "createPhysics", &physicsSystem::createPhysics )
    .def( "removePhysics", ( void( physicsSystem::* )( physics* ) )
   &physicsSystem::removePhysics )
    .def( "removePhysics", ( void( physicsSystem::* )( const string& ) )
   &physicsSystem::removePhysics )
    .def( "getPhysics", &physicsSystem::getPhysics )
    .def( "createJoint", &physicsSystem::createJoint )
    .def( "getJoint", &physicsSystem::getJoint )
    .def( "removeJoint", &physicsSystem::removeJoint )
    .def( "removeAllJoints", &physicsSystem::removeAllJoints )
    .def( "setGravity", ( void( physicsSystem::* )( real, real, real ) )
   &physicsSystem::setGravity )
    .def( "setGravity", ( void( physicsSystem::* )( const vector3& ) )
   &physicsSystem::setGravity )
    .def( "getGravity", &physicsSystem::getGravity )
    .def( "setStepSize", &physicsSystem::setStepSize )
    .def( "getStepSize", &physicsSystem::getStepSize )
    .def( "setERP", &physicsSystem::setERP )
    .def( "getERP", &physicsSystem::getERP )
    .def( "setCFM", &physicsSystem::setCFM )
    .def( "getCFM", &physicsSystem::getCFM )
  ];
   luabind::module( engine ) [
    luabind::class_< joint >( "joint" )
    .enum_( "JointAxis" ) [
    luabind::value( "JA_PRIMARY", 0 ),
  luabind::value( "JT_SECONDARY", 1 )
    ]
    .enum_( "JointType" ) [
      luabind::value( "JT_BALL", 0 ),
  luabind::value( "JT_SLIDER", 1 ),
  luabind::value( "JT_HINGE", 2 ),
  luabind::value( "JT_HINGE2", 3 ),
  luabind::value( "JT_UNIVERSAL", 4 )
    ]
    .enum_( "JointParam" ) [
      luabind::value( "JP_LOSTOP", 0 ),
  luabind::value( "JP_HISTOP", 1 ),
  luabind::value( "JP_VELOCITY", 2 ),
  luabind::value( "JP_VELOCITY2", 3 ),
  luabind::value( "JP_FMAX", 4 ),
  luabind::value( "JP_FMAX2", 5 ),
  luabind::value( "JP_SUSPENSIONERP", 6 ),
  luabind::value( "JP_SUSPENSIONCFM", 7 )
    ]
    .def( "getType", &joint::getType )
    .def( "setAnchorPosition", ( void( joint::* )( real, real, real ) )
   &joint::setAnchorPosition )
    .def( "setAnchorPosition", ( void( joint::* )( const vector3& ) )
   &joint::setAnchorPosition )
    .def( "getAnchorPosition", &joint::getAnchorPosition )     
    .def( "setAxes", &joint::setAxes )
    .def( "setParameter", &joint::setParameter )
    .def( "getParameter", &joint::getParameter )
    .def( "getAxisAngle", &joint::getAxisAngle )
  ];
   luabind::module( engine ) [
    luabind::class_< ballJoint, joint >( "ballJoint" )
  ];
   luabind::module( engine ) [
    luabind::class_< sliderJoint, joint >( "sliderJoint" )
  ];

  luabind::module( engine ) [
    luabind::class_< hingeJoint, joint >( "hingeJoint" )
  ];

  luabind::module( engine ) [
    luabind::class_< hinge2Joint, joint >( "hinge2Joint" )
  ];

  luabind::module( engine ) [
    luabind::class_< universalJoint, joint >( "universalJoint" )
  ];

  luabind::module( engine ) [
    luabind::class_< proxy >( "proxy" )
    .enum_( "ProxyType" ) [
      luabind::value( "PT_BOX", 0 ),
  luabind::value( "PT_SPHERE", 1 ),
  luabind::value( "PT_CCYLINDER", 2 )
    ]
    .def( "getType", &proxy::getType )
    .def( "getOffset", &proxy::getOffset )
    .def( "setOffset", ( void( proxy::* )( real, real, real, bool ) )
   &proxy::setOffset )
    .def( "setOffset", ( void( proxy::* )( const vector3&, bool ) )
   &proxy::setOffset )
    .def( "setEnabled", &proxy::setEnabled )
    .def( "getEnabled", &proxy::getEnabled )
  ];

  luabind::module( engine ) [
    luabind::class_< boxProxy, proxy >( "boxProxy" )
    .def( "getLength", &boxProxy::getLength )
    .def( "getHeight", &boxProxy::getHeight )
    .def( "getDepth", &boxProxy::getDepth )
    .def( "setBox", &boxProxy::setBox )
  ];

  luabind::module( engine ) [
    luabind::class_< sphereProxy, proxy >( "sphereProxy" )
    .def( "getRadius", &sphereProxy::getRadius )    
    .def( "setSphere", &sphereProxy::setSphere )
  ];
   luabind::module( engine ) [
    luabind::class_< ccylinderProxy, proxy >( "ccylinderProxy" )
    .def( "getRadius", &ccylinderProxy::getLength )
    .def( "getLength", &ccylinderProxy::getLength )  
    .def( "setCCylinder", &ccylinderProxy::setCCylinder )
  ];

  luabind::module( engine ) [
    luabind::class_< mass >( "mass" )
    .enum_( "MassType" ) [
      luabind::value( "MT_BOX", 0 ),
  luabind::value( "MT_SPHERE", 1 ),
  luabind::value( "MT_CCYLINDER", 2 ),
  luabind::value( "MT_CYLINDER", 3 )
    ]
    .def( "getType", &mass::getType )
    .def( "setBox", &mass::setBox )
    .def( "setSphere", &mass::setSphere )
    .def( "setCCylinder", &mass::setCCylinder )
    .def( "setCylinder", &mass::setCylinder )
    .def( "getLength", &mass::getLength )
    .def( "getHeight", &mass::getHeight )
    .def( "getDepth", &mass::getDepth )
    .def( "getDensity", &mass::getDensity )
    .def( "getRadius", &mass::getRadius )
  ];

  luabind::module( engine ) [
    luabind::class_< physicsResource >( "physicsResource" )
    .def( "getMass", &physicsResource::getMass )
    .def( "addBoxProxy", &physicsResource::addBoxProxy )
    .def( "addSphereProxy", &physicsResource::addSphereProxy )
    .def( "addCCylinderProxy", &physicsResource::addCCylinderProxy )
    .def( "removeProxy", ( void( physicsResource::* )( uint8 ) )
   &physicsResource::removeProxy )
    .def( "removeProxy", ( void( physicsResource::* )( proxy* ) )
   &physicsResource::removeProxy )
    .def( "removeAllProxies", &physicsResource::removeAllProxies )
    .def( "setSoftness", &physicsResource::setSoftness )
    .def( "getSoftness", &physicsResource::getSoftness )
    .def( "setFriction", &physicsResource::setFriction )    
    .def( "getFriction", &physicsResource::getFriction )
    .def( "setGravity", &physicsResource::setGravity )
    .def( "getGravity", &physicsResource::getGravity )
    .def( "setBounce", &physicsResource::setBounce )
    .def( "getBounceCoEff", &physicsResource::getBounceCoEff )
    .def( "getBounceVelThreshold", &physicsResource::getBounceVelThreshold )
   
  ];
   luabind::module( engine ) [
    luabind::class_< physics >( "physics" )
    .def( "updateProxies", &physics::updateProxies )
    .def( "setDynamicsEnabled", &physics::setDynamicsEnabled )
    .def( "getDynamicsEnabled", &physics::getDynamicsEnabled )
    .def( "setCollisionEnabled", &physics::setCollisionEnabled )
    .def( "getCollisionEnabled", &physics::getCollisionEnabled )        
    .def( "getMass", &physics::getMass )
    .def( "addBoxProxy", &physics::addBoxProxy )
    .def( "addSphereProxy", &physics::addSphereProxy )
    .def( "addCCylinderProxy", &physics::addCCylinderProxy )
    .def( "removeProxy", ( void( physics::* )( uint8 ) )
   &physics::removeProxy )
    .def( "removeProxy", ( void( physics::* )( proxy* ) )
   &physics::removeProxy )
    .def( "removeAllProxies", &physics::removeAllProxies )
    .def( "setSoftness", &physics::setSoftness )
    .def( "getSoftness", &physics::getSoftness )
    .def( "setFriction", &physics::setFriction )    
    .def( "getFriction", &physics::getFriction )
    .def( "setGravity", &physics::setGravity )
    .def( "getGravity", &physics::getGravity )
    .def( "setBounce", &physics::setBounce )
    .def( "getBounceCoEff", &physics::getBounceCoEff )
    .def( "getBounceVelThreshold", &physics::getBounceVelThreshold )
    .def( "setLinearVelocity", ( void( physics::* )( real, real, real ) )
   &physics::setLinearVelocity )
    .def( "setLinearVelocity", ( void( physics::* )( const vector3& ) )
   &physics::setLinearVelocity )
    .def( "getLinearVelocity", &physics::getLinearVelocity )
    .def( "setAngularVelocity", ( void( physics::* )( real, real, real ) )
   &physics::setAngularVelocity )
    .def( "setAngularVelocity", ( void( physics::* )( const vector3& ) )
   &physics::setAngularVelocity )   
    .def( "getAngularVelocity", &physics::getAngularVelocity )
    .def( "addForce", ( void( physics::* )( const vector3&, const vector3& ) )
   &physics::addForce )      
    .def( "addForceWorld", ( void( physics::* )( const vector3&, const vector3& ) )
   &physics::addForceWorld )
    .def( "addTorque", ( void( physics::* )( real, real, real ) )
   &physics::addTorque )
    .def( "addTorque", ( void( physics::* )( const vector3& ) )
   &physics::addTorque )
    .def( "addTorqueWorld", ( void( physics::* )( real, real, real ) )
   &physics::addTorqueWorld )
    .def( "addTorqueWorld", ( void( physics::* )( const vector3& ) )
   &physics::addTorqueWorld )
  ];
   luabind::module( engine ) [
    luabind::def( "getPhysicsSystem", &physicsSystem::get )
  ];
  

//oasisSoundSystem
  luabind::module( engine ) [
      luabind::class_< soundSystem >( "soundSystem" )
      .def( "reset", &soundSystem::reset )  
      .def( "getSoundTemplate", &soundSystem::getSoundTemplate )
      .def( "createSoundTemplate", &soundSystem::createSoundTemplate )
      .def( "createSound", &soundSystem::createSound )
      .def( "removeSound", ( void( soundSystem::* )( sound* ) )
      &soundSystem::removeSound )
      .def( "removeSound", ( void( soundSystem::* )( const string& ) )
      &soundSystem::removeSound )
      .def( "stopAllSounds", &soundSystem::stopAllSounds )
      .def( "setListenerPosition", &soundSystem::setListenerPosition )
    ];

    luabind::module( engine ) [
      luabind::class_< soundResource >( "soundResource" )
      .def( "setFileName", &soundResource::setFileName )
      .def( "getFileName", &soundResource::getFileName )  
      .def( "setVolume", &soundResource::setVolume )
      .def( "getVolume", &soundResource::getVolume )
      .def( "setLooping", &soundResource::setLooping )
      .def( "getLooping", &soundResource::getLooping )     
      .def( "setAttenuationMax", &soundResource::setAttenuationMax )
      .def( "getAttenuationMax", &soundResource::getAttenuationMax )
    ];

    luabind::module( engine ) [
      luabind::class_< sound >( "sound" )
      .def( "setVolume", &sound::setVolume )
      .def( "getVolume", &sound::getVolume )
      .def( "setLooping", &sound::setLooping )
      .def( "getLooping", &sound::getLooping )
      //.def( "setPosition", ( void( sound::* )( real, real, real ) )
      //&sound::setPosition )
      .def( "play", &sound::play )
      .def( "stop", &sound::stop )
      .def( "isPlaying", &sound::isPlaying )
    ];*/
  return 1;
}

#endif

⌨️ 快捷键说明

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