本文整理汇总了C++中setCameraDistance函数的典型用法代码示例。如果您正苦于以下问题:C++ setCameraDistance函数的具体用法?C++ setCameraDistance怎么用?C++ setCameraDistance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCameraDistance函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTexturing
void BasicDemo::initPhysics() {
setTexturing(true);
setShadows(false);
setCameraDistance(btScalar(100.));
// _app = new QApplication(myargc,myargv);
/* this function ( in src/coordinator/coordinator/coorcinator.cpp )
* creates 4 wheels, one robot's body and merges them together.
*
*
*/
m_wheelShape = new btCylinderShapeX(btVector3(1,3,3));
m_dynamicsWorld =(cdn->getPhysicalCalculatorInstance()).getScene();
//cdn->getPhysicalCalculatorInstance().simple_scene_walls(200);
//Mesh::buildBox(QVector3D(10,10,10), 1000, PositionData(0,30,0,0,0,0));
/*
pc->simple_scene_walls(100);
*/
//m_dynamicsWorld = cdn->getPhysicalCalculatorScene();
/*_robot = new Robot(pc->addBox(btVector3(2,0.5,2), btVector3(0,0,0), 8), pc->getScene());
pc->getScene()->addVehicle(_robot);*/
// _MD = new Wheel(_robot, btVector3(1.5,-0.1,0),btVector3(0,-1,0),.5,true);
// _MG = new Wheel(_robot, btVector3(-1.5,-0.1,0),btVector3(0,-1,0),.5,true);
// _ED = new Wheel(_robot, btVector3(1.9,-0.1,0),btVector3(0,-1,0),.5,false);
// _EG = new Wheel(_robot, btVector3(-1.9,-0.1,0),btVector3(0,-1,0),.5,false);
}
示例2: createTest6
void BenchmarkDemo::createTest7()
{
createTest6();
setCameraDistance(btScalar(150.));
initRays();
}
示例3: setTexturing
void GpuDemo::initPhysics(const ConstructionInfo& ci)
{
setTexturing(true);
setShadows(false);
setCameraDistance(btScalar(SCALING*250.));
///collision configuration contains default setup for memory, collision setup
if (ci.useOpenCL)
{
m_dynamicsWorld = new btGpuDynamicsWorld(ci.preferredOpenCLPlatformIndex,ci.preferredOpenCLDeviceIndex);
} else
{
m_dynamicsWorld = new btCpuDynamicsWorld();
}
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
///create a few basic rigid bodies
setupScene(ci);
}
示例4: setCameraDistance
void BenchmarkDemo::createTest3()
{
setCameraDistance(btScalar(50.));
int size = 16;
float sizeX = 1.f;
float sizeY = 1.f;
//int rc=0;
btScalar scale(3.5);
btVector3 pos(0.0f, sizeY, 0.0f);
while(size) {
float offset = -size * (sizeX * 6.0f) * 0.5f;
for(int i=0;i<size;i++) {
pos[0] = offset + (float)i * (sizeX * 6.0f);
RagDoll* ragDoll = new RagDoll (m_dynamicsWorld,pos,scale);
m_ragdolls.push_back(ragDoll);
}
offset += sizeX;
pos[1] += (sizeY * 7.0f);
pos[2] -= sizeX * 2.0f;
size--;
}
}
示例5: setCameraDistance
BasicGpuDemo::BasicGpuDemo()
{
m_np=0;
m_bp=0;
m_clData = new btInternalData;
setCameraDistance(btScalar(SCALING*60.));
this->setAzi(45);
this->setEle(45);
}
示例6: setTexturing
void RagdollDemo::initPhysics()
{
// Setup the basic world
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(5.));
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
m_broadphase = new btAxisSweep3 (worldAabbMin, worldAabbMax);
m_solver = new btSequentialImpulseConstraintSolver;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
//m_dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
//m_dynamicsWorld->getDispatchInfo().m_convexConservativeDistanceThreshold = 0.01f;
// Setup a big ground box
{
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(200.),btScalar(10.),btScalar(200.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-10,0));
#define CREATE_GROUND_COLLISION_OBJECT 1
#ifdef CREATE_GROUND_COLLISION_OBJECT
btCollisionObject* fixedGround = new btCollisionObject();
fixedGround->setCollisionShape(groundShape);
fixedGround->setWorldTransform(groundTransform);
m_dynamicsWorld->addCollisionObject(fixedGround);
#else
localCreateRigidBody(btScalar(0.),groundTransform,groundShape);
#endif //CREATE_GROUND_COLLISION_OBJECT
}
// Spawn one ragdoll
btVector3 startOffset(1,0.5,0);
spawnRagdoll(startOffset);
startOffset.setValue(-1,0.5,0);
spawnRagdoll(startOffset);
clientResetScene();
}
示例7: setTexturing
/** Initializes the physics world and simulation
*
**/
void Physics::initPhysics(){
dead=false;
totaltime=0;
currentBoxIndex=0;
currentJointIndex=0;
noBoxes =0;
fitness=0;
enableEffectors=true;
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(20.));
///collision configuration contains default setup for memory, collision setup
m_collisionConfiguration = new btDefaultCollisionConfiguration();
///use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_broadphase = new btDbvtBroadphase();
///the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
btSequentialImpulseConstraintSolver* sol = new btSequentialImpulseConstraintSolver;
m_solver = sol;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
m_dynamicsWorld->setDebugDrawer(&gDebugDraw);
m_dynamicsWorld->setGravity(btVector3(0,-10,0));
//create ground body
btBoxShape* groundShape = new btBoxShape(btVector3(btScalar(1000.),btScalar(10.),btScalar(1000.)));
int* userP = new int();
*userP = 0;
groundShape->setUserPointer2((void*)userP);
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,0,0));
btRigidBody* ground = localCreateRigidBody(0.,groundTransform,groundShape,COL_GROUND,COL_BOX); //ground collides with boxes only
ground->setUserPointer((void*)(-1));;
groundY = ground->getWorldTransform().getOrigin().getY()+groundShape->getHalfExtentsWithMargin().getY();
currentBoxIndex++;
theNet=NULL;
}
示例8: setTexturing
void BasicDemo::initPhysics()
{
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(SCALING*50.));
m_physicsSetup.initPhysics();
m_dynamicsWorld = m_physicsSetup.m_dynamicsWorld;
m_dynamicsWorld->setDebugDrawer(&gDebugDraw);
}
示例9: MIN
void GlassViewer::fitCameraToModel(int pad) {
float sw = MIN(getWidth()*0.5f-pad, getHeight()*0.5f-pad);
model_t *m = Res_GetModel(model);
float bw = m->bSphere.r;
float ez = 1/tan(DEG2RAD(fov/2.0));
float Az = m->bSphere.r*2+(bw/sw)*ez;
setCameraPosition(0,-1,m->bmax[AXIS_Z]*0.45f);
setCameraTarget(0,0,camPos[AXIS_Z]);
setCameraDistance(Az+pad+m->bSphere.r);
}
示例10: setTexturing
void RagdollApp::initPhysics()
{
// Setup the basic world
m_time = 0;
m_CycPerKnee = 2000.f; // in milliseconds
m_CycPerHip = 3000.f; // in milliseconds
m_fMuscleStrength = 0.5f;
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(5.));
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
m_broadphase = new btAxisSweep3 (worldAabbMin, worldAabbMax);
m_solver = new btSequentialImpulseConstraintSolver;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
//m_dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
//m_dynamicsWorld->getDispatchInfo().m_convexConservativeDistanceThreshold = 0.01f;
m_dynamicsWorld->setInternalTickCallback( forcePreTickCB, this, true );
m_dynamicsWorld->setGravity( btVector3(0,-0,0) );
// create surface
//createSurface();
//// Setup a big ground box
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(200.),btScalar(10.),btScalar(200.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-10,0));
btCollisionObject* fixedGround = new btCollisionObject();
fixedGround->setCollisionShape(groundShape);
fixedGround->setWorldTransform(groundTransform);
m_dynamicsWorld->addCollisionObject(fixedGround);
// Spawn one ragdoll
btVector3 startOffset(1,0.5,0);
spawnRagdoll(startOffset);
startOffset.setValue(-1,0.1,0);
spawnRagdoll(startOffset);
clientResetScene();
}
示例11: setTexturing
void ArtificialBirdsDemoApp::initPhysics()
{
// Setup the basic world
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(5.));
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
m_broadphase = new btAxisSweep3 (worldAabbMin, worldAabbMax);
m_solver = new btSequentialImpulseConstraintSolver;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
//m_dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true;
//m_dynamicsWorld->getDispatchInfo().m_convexConservativeDistanceThreshold = 0.01f;
m_dynamicsWorld->setInternalTickCallback(pickingPreTickCallback, this, true);
m_dynamicsWorld->getSolverInfo().m_numIterations = kSolverNumIterations;
m_dynamicsWorld->setGravity(btVector3(0,kGravity,0));
// Setup a big ground box
{
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(200.),btScalar(10.),btScalar(200.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-10,0));
#define CREATE_GROUND_COLLISION_OBJECT 1
#ifdef CREATE_GROUND_COLLISION_OBJECT
btCollisionObject* fixedGround = new btCollisionObject();
fixedGround->setCollisionShape(groundShape);
fixedGround->setWorldTransform(groundTransform);
m_dynamicsWorld->addCollisionObject(fixedGround);
#else
localCreateRigidBody(btScalar(0.),groundTransform,groundShape);
#endif //CREATE_GROUND_COLLISION_OBJECT
}
m_birdOpt = 0;
m_birdDemo = 0;
//m_birdOpt = new BirdOptimizer(m_dynamicsWorld);
m_birdDemo = new BirdDemo(m_dynamicsWorld);
clientResetScene();
}
示例12: setTexturing
void MotorDemo::initPhysics()
{
setTexturing(true);
setShadows(true);
// Setup the basic world
m_Time = 0;
m_fCyclePeriod = 2000.f; // in milliseconds
// m_fMuscleStrength = 0.05f;
// new SIMD solver for joints clips accumulated impulse, so the new limits for the motor
// should be (numberOfsolverIterations * oldLimits)
// currently solver uses 10 iterations, so:
m_fMuscleStrength = 0.5f;
setCameraDistance(btScalar(5.));
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
btVector3 worldAabbMin(-10000,-10000,-10000);
btVector3 worldAabbMax(10000,10000,10000);
m_broadphase = new btAxisSweep3 (worldAabbMin, worldAabbMax);
m_solver = new btSequentialImpulseConstraintSolver;
m_dynamicsWorld = new btDiscreteDynamicsWorld(m_dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
m_dynamicsWorld->setInternalTickCallback(motorPreTickCallback,this,true);
// Setup a big ground box
{
btCollisionShape* groundShape = new btBoxShape(btVector3(btScalar(200.),btScalar(10.),btScalar(200.)));
m_collisionShapes.push_back(groundShape);
btTransform groundTransform;
groundTransform.setIdentity();
groundTransform.setOrigin(btVector3(0,-10,0));
localCreateRigidBody(btScalar(0.),groundTransform,groundShape);
}
// Spawn one ragdoll
btVector3 startOffset(1,0.5,0);
spawnTestRig(startOffset, false);
startOffset.setValue(-2,0.5,0);
spawnTestRig(startOffset, true);
clientResetScene();
}
示例13: setCameraDistance
void SimpleRenderContext::showFull(const Ogre::MovableObject* object)
{
//only do this if there's an active object
if (object) {
mEntityNode->_update(true, true);
Ogre::Real distance = object->getBoundingRadius() / Ogre::Math::Tan(mCamera->getFOVy() / 2);
//we can't have a distance of 0
if (distance == 0) {
distance = 1;
}
Ogre::Real distanceNudge = distance / 100;
distance += distanceNudge;
mDefaultCameraDistance = distance;
setCameraDistance(distance);
}
}
示例14: setTexturing
void SerializeDemo::initPhysics()
{
setTexturing(true);
setShadows(true);
setCameraDistance(btScalar(SCALING*50.));
setupEmptyDynamicsWorld();
#ifdef DESERIALIZE_SOFT_BODIES
btBulletWorldImporter* fileLoader = new MySoftBulletWorldImporter((btSoftRigidDynamicsWorld*)m_dynamicsWorld);
#else
btBulletWorldImporter* fileLoader = new btBulletWorldImporter(m_dynamicsWorld);
#endif //DESERIALIZE_SOFT_BODIES
// fileLoader->setVerboseMode(true);
if (!fileLoader->loadFile("testFile.bullet"))
{
btAssert(0);
exit(0);
}
}
示例15: SIMDYNAMICS_ASSERT
BulletOpenGLViewer::BulletOpenGLViewer(DynamicsWorldPtr world)
{
SIMDYNAMICS_ASSERT(world);
m_sundirection = btVector3(1, 1, -2) * 1000;
bulletEngine = boost::dynamic_pointer_cast<BulletEngine>(world->getEngine());
SIMDYNAMICS_ASSERT(bulletEngine);
setTexturing(true);
setShadows(true);
// set Bullet world (defined in bullet's OpenGL helpers)
m_dynamicsWorld = bulletEngine->getBulletWorld();
m_dynamicsWorld->setDebugDrawer(&debugDrawer);
// set up vector for camera
setCameraDistance(btScalar(3.));
setCameraForwardAxis(1);
btVector3 up(0, 0, btScalar(1.));
setCameraUp(up);
clientResetScene();
}