コード例 #1
0
void VehicleManagerDemo::buildLandscape()
{

	if (1)
	{
		//
		// Create the ground we'll drive on.
		//
		{
			hkpRigidBodyCinfo groundInfo;

			//
			//	Set the if condition to 0 if you want to test the heightfield
			//
			if ( 1 )
			{
				FlatLand* fl = new FlatLand();
				m_track = fl;
				groundInfo.m_shape = fl->createMoppShapeForSpu();
				groundInfo.m_position.set(5.0f, -2.0f, 5.0f);
				groundInfo.m_collisionFilterInfo = hkpGroupFilter::calcFilterInfo( GROUND_LAYER, 0 );
			}

			{
				groundInfo.m_motionType = hkpMotion::MOTION_FIXED;
				groundInfo.m_friction = 0.5f;
				hkpRigidBody* groundbody = new hkpRigidBody(groundInfo);
				m_world->addEntity(groundbody);
				groundbody->removeReference();
			}

			groundInfo.m_shape->removeReference();
		}
	}

	if (1)
	{
		hkVector4 halfExtents(10.0f, 0.1f, 10.0f);
		hkVector4 startPos(-240.0f, -7.8f, 0.0f);
		hkVector4 diffPos (30.0f, 0.0f, 0.0f);
		createDodgeBoxes(5, halfExtents, startPos, diffPos);
	}

	if (1)
	{
		hkVector4 halfExtents(10.0f, 0.05f, 10.0f);
		hkVector4 startPos(-240.0f, -7.85f, 30.0f);
		hkVector4 diffPos (30.0f, 0.0f, 0.0f);
		createDodgeBoxes(5, halfExtents, startPos, diffPos);
	}

	if (1)
	{
		int gridSize = 1 + int(hkMath::sqrt( hkReal(m_env->m_cpuMhz/100) ));
		createRagdollGrid( m_world, gridSize, gridSize, 4.0f, 4.0f, m_ragdolls );
	}
}
コード例 #2
0
//this function allocates and precomputes the data structures that doesn't depend on the a,k0,k1,k2
genome mkGenome(const std::vector<perChr> &pc,const para &p){
  genome g;
  //prep datastructures
  for(size_t i=0;i<pc.size();i++){
    hmmRes res;
    res.pos = pc[i].pos;
    res.nSites = pc[i].nSites;
    res.trans = new double*[9];
    for(int j=0;j<9;j++)
      res.trans[j] = new double[pc[i].nSites+1];
    res.emis = new double*[3];
    for(int j=0;j<3;j++)
      res.emis[j] = new double[pc[i].nSites];
    emis(p.pair[0],p.pair[1],pc[i],res.emis);

    res.dpos = diffPos(pc[i].pos,pc[i].nSites);

    g.results.push_back(res);

  }
  return g;
}