Пример #1
0
/*
void scene()
{
    int i;
    glPushMatrix();
    glPushMatrix();
    glTranslatef(8.0,0.0,0.0);
    enstabcha();
    glPopMatrix();
    glPushMatrix();
    glTranslatef(-8.0,0.0,0.0);
    enstabcha();
    glPopMatrix();
    glPushMatrix();
    enstabcha();
    glPopMatrix();
    glPopMatrix();
    glPushMatrix();
    glPushMatrix();
    glTranslatef(4.0,0.0,12.0);
    ensbanqtab();
    glPopMatrix();
    glPushMatrix();
    glTranslatef(-8.0,0.0,12.0);
    ensbanqtab();
    glPopMatrix();
    glPopMatrix();
    glPushMatrix();
    glTranslatef(2.0,4.0,-15.0);
    bar();
    glPopMatrix();
    glPushMatrix();
    sol();
    mur();
    plafond();
    glPopMatrix();
    glPushMatrix();
    glScalef( 0.75, 0.75, 0.75);
    glTranslatef(-19.0,1.0,-11.0);
    for(i=0; i<9; i++)
    {
        chaise2();
        glTranslatef(5.0*1.25,0.0,0.0);
    }
    glPopMatrix();
    glPushMatrix();
    glTranslatef(20.0,5.1,15.0);
    baril_cigarette();
    glPopMatrix();
    glPushMatrix();
    glTranslatef(21.5,1.0,5.0);
    tas_de_parpaing();
    glPopMatrix();
    glPushMatrix();
    mur_fond();
    mur_porte();
    glPopMatrix();
}*/
Object* banquette(glm::vec3 pos)
{
	Mesh* m;
	Texture* t1 = ObjectAccessor::getObjMgr()->getTexture("../../src/img/banquette.bmp");
	Texture* t2 = ObjectAccessor::getObjMgr()->getTexture("../../src/img/cousin banquette.bmp");
	Container* c = new Container(pos); 


	m = CreateBox(4.0,8.0,2.0);
	m->setTexture(t1);
	c->addObject(m);


	m = CreateBox(1.0,8.0,3.0);
	m->setPosition(1.5,0.0,2.0);
	m->setTexture(t1);
	c->addObject(m);

	m = CreateBox(0.8*3.5,0.8*8.0,0.8*0.5);
	m->setPosition(-0.5,0.0,1.0);
	m->setTexture(t2);
	c->addObject(m);

	m = CreateBox(0.8,0.8*8.0,0.8*2.2);
	m->setPosition(1.3,0.0,2.3);
	m->setTexture(t2);
	c->addObject(m);

	return c;
}
Пример #2
0
void SetupTearingScene()
{
    sprintf(gTitleString, "Tearing Demo");

	// Create the objects in the scene
	groundPlane = CreateGroundPlane();
	NxActor* bar = CreateBox(NxVec3(0,12,0), NxVec3(3,0.5,0.5), 0);
	NxActor* box = CreateBox(NxVec3(-2.3,4.0,0), NxVec3(0.5,0.5,0.5), 10); 

	// Cloth
	NxClothDesc clothDesc;
	clothDesc.globalPose.t = NxVec3(2.5,12,0);
	clothDesc.globalPose.M.rotX(-NxHalfPiF32);
	clothDesc.thickness = 0.1;
	clothDesc.tearFactor = 2;
	clothDesc.flags |= NX_CLF_BENDING;
	clothDesc.flags |= NX_CLF_COLLISION_TWOWAY;
	clothDesc.flags |= NX_CLF_TEARABLE | NX_CLF_VISUALIZATION; // Tearable cloth

	if (gHardwareCloth)
		clothDesc.flags |= NX_CLF_HARDWARE;

	MyCloth* regularCloth = new MyCloth(gScene, clothDesc, 5, 8, 0.1, "rug512.bmp", gTearLines);
	gCloths.push_back(regularCloth);

	regularCloth->getNxCloth()->attachToShape(*bar->getShapes(), 0);
	regularCloth->getNxCloth()->attachToShape(*box->getShapes(), NX_CLOTH_ATTACHMENT_TWOWAY);
}
Пример #3
0
osg::Node* CreateScene()
{
	osg::Group* pGroup = new osg::Group;
	pGroup->addChild( CreateBox( osg::Vec3(-2,0,0), "box0" ) );
	pGroup->addChild( CreateBox( osg::Vec3(0,0,0), "box1" ) );
	pGroup->addChild( CreateBox( osg::Vec3(2,0,0), "box2" ) );
    return pGroup;
}
Пример #4
0
void SetupAttachmentScene()
{
    sprintf(gTitleString, "Attachment Demo");

	// Create objects in scene
	groundPlane = CreateGroundPlane();
	NxActor* box1 = CreateBox(NxVec3(-7,12.25,0), NxVec3(2.5,1,1), 0);
	NxActor* box2 = CreateBox(NxVec3(0,12.25,0), NxVec3(2.5,1,1), 0);
	NxActor* box3 = CreateBox(NxVec3(7,12.25,0), NxVec3(2.5,1,1), 0);	

	NxActor* attachedBox = CreateBox(NxVec3(-7.2,4.5,1.6), NxVec3(1.25,1,1), 1);
	NxActor* attachedSphere = CreateSphere(NxVec3(-0.25,4.0,2.0), 1.3, 1);
	NxActor* attachedCapsule = CreateCapsule(NxVec3(9.0,5.5,2.0),2.0, 1, 1); 

	NxReal damping = 0.3;
	attachedBox->setAngularDamping(damping);
	attachedBox->setLinearDamping(damping);
	attachedSphere->setAngularDamping(damping);
	attachedSphere->setLinearDamping(damping);
	attachedCapsule->setAngularDamping(damping);
	attachedCapsule->setLinearDamping(damping);

	NxQuat q;
	q.fromAngleAxis(90,NxVec3(0,0,1));
	attachedCapsule->setGlobalOrientationQuat(q);

	// Cloth
	NxClothDesc clothDesc;
	clothDesc.globalPose.M.rotX(1.3);
	clothDesc.thickness = 0.3;	
	clothDesc.attachmentResponseCoefficient = 1;
	clothDesc.flags |= NX_CLF_BENDING;
	clothDesc.flags |= NX_CLF_BENDING_ORTHO;
	clothDesc.flags |= NX_CLF_DAMPING | NX_CLF_VISUALIZATION;

	if (gHardwareCloth)
		clothDesc.flags |= NX_CLF_HARDWARE;

	// Cloth attaching to sphere
	clothDesc.globalPose.t = NxVec3(0.75,5,2);
	MyCloth* regularCloth1 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
	regularCloth1->getNxCloth()->attachToCollidingShapes(NX_CLOTH_ATTACHMENT_TWOWAY);
	gCloths.push_back(regularCloth1);

	// Cloth attaching to box
	clothDesc.globalPose.t = NxVec3(-6.2,5,2);
	MyCloth* regularCloth2 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
	regularCloth2->getNxCloth()->attachToCollidingShapes(NX_CLOTH_ATTACHMENT_TWOWAY);
	gCloths.push_back(regularCloth2);

	// Cloth attaching to capsule
	clothDesc.globalPose.t = NxVec3(8.0,5,2);
	clothDesc.attachmentTearFactor = 2.0;
	MyCloth* regularCloth3 = new MyCloth(gScene, clothDesc, 2, 8, 0.4);
	regularCloth3->getNxCloth()->attachToShape(box3->getShapes()[0], NX_CLOTH_ATTACHMENT_TEARABLE);
	regularCloth3->getNxCloth()->attachToShape(attachedCapsule->getShapes()[0], NX_CLOTH_ATTACHMENT_TWOWAY);
	gCloths.push_back(regularCloth3);
}
Пример #5
0
void AddHinge (DemoEntityManager* const scene, const dVector& origin)
{
    dVector size (1.5f, 4.0f, 0.125f);

    NewtonBody* const box0 = CreateBox (scene, origin + dVector (0.0f, 4.0f, 0.0f, 0.0f), size);
    NewtonBody* const box1 = CreateBox (scene, origin + dVector (1.5f, 4.0f, 0.0f, 0.0f), size);
    NewtonBody* const box2 = CreateBox (scene, origin + dVector (3.0f, 4.0f, 0.0f, 0.0f), size);

    //the joint pin is the first row of the matrix, to make a upright pin we
    //take the x axis and rotate by 90 degree around the y axis
    dMatrix localPin (dRollMatrix(90.0f * 3.141592f / 180.0f));

    // connect first box to the world
    dMatrix matrix;
    NewtonBodyGetMatrix (box0, & matrix[0][0]);
    matrix.m_posit += dVector (-size.m_x * 0.5f, 0.0f, 0.0f);
    matrix = localPin * matrix;

    // add hinge with limit and friction
    CustomHinge* const hinge0 = new CustomHinge (matrix, box0, NULL);
    hinge0->EnableLimits (true);
    hinge0->SetLimis(-45.0f * 3.141592f / 180.0f, 45.0f * 3.141592f / 180.0f);
    hinge0->SetFriction (20.0f);

    // link the two boxes
    NewtonBodyGetMatrix (box1, &matrix[0][0]);
    matrix.m_posit += dVector (-size.m_x * 0.5f, 0.0f, 0.0f);
    matrix = localPin * matrix;
    CustomHinge* const hinge1 = new CustomHinge (matrix, box1, box0);
    hinge1->EnableLimits (true);
    hinge1->SetLimis (-45.0f * 3.141592f / 180.0f, 45.0f * 3.141592f / 180.0f);
    hinge1->SetFriction (20.0f);

    // link the two boxes
    NewtonBodyGetMatrix (box2, &matrix[0][0]);
    matrix.m_posit += dVector (-size.m_x * 0.5f, 0.0f, 0.0f);
    matrix = localPin * matrix;
    CustomHinge* const hinge2 = new CustomHinge (matrix, box2, box1);
    hinge2->EnableLimits (true);
    hinge2->SetLimis (-45.0f * 3.141592f / 180.0f, 45.0f * 3.141592f / 180.0f);
	hinge2->SetFriction (20.0f);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate (scene->GetNewton(), NULL, NULL);
//	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate (scene->GetNewton(), box0, NULL);
	NewtonSkeletonContainerAttachBone (skeleton, box0, NULL);	
	NewtonSkeletonContainerAttachBone (skeleton, box1, box0);
	NewtonSkeletonContainerAttachBone (skeleton, box2, box1);
	NewtonSkeletonContainerFinalize (skeleton);
#endif
}
Пример #6
0
void Init() {
	world->tileMap.Load("test.fmp", 100);

	textures.gunAnim = renderer.CreateTextureFromFile("darkwalltile.bmp");
	textures.anim = renderer.CreateTextureFromFile("plane.bmp");
	textures.dude = renderer.CreateTextureFromFile("idkmonster.bmp");
	textures.sawblade = renderer.CreateTextureFromFile("sawblade.bmp");


	world->dude = CreateMainPlayer(0, 5);
	world->AddEntity(world->dude);


	Entity *floor = CreateBox(-20.0f, 0.0f, 40.0f, 2.0f);
	world->AddEntity(floor);
	Entity *leftWall = CreateBox(-22.0f, 0.0f, 2.0f, 42.0f);
	world->AddEntity(leftWall);
	Entity *ceiling = CreateBox(-20.0f, 40.0f, 40.0f, 2.0f);
	world->AddEntity(ceiling);
	Entity *rightWall = CreateBox(20.0f, 0.0f, 2.0f, 42.0f);
	world->AddEntity(rightWall);
		
	for(int i = 1; i < 12; i++)	{	
		Entity *e = CreateBox(-12.0f + float(i)*1.1f, 13.2f, 1.0f, 1.0f);
		Entity* q = CreateDude(-12.0f + float(i)*1.1f, 15.0f);
		world->AddEntity(e);
		world->AddEntity(q);
	}


	Entity *platform = CreateUpDownMovingPlatform(0, 2, 6, 1);
	world->AddEntity(platform);

	platform = CreateUpDownMovingConveyerPlatform(-8, 2, 6, 1);
	world->AddEntity(platform);

	platform = CreateUpDownMovingConveyerPlatform(0, 12, 6, 1); 
	world->AddEntity(platform);


	Entity * saw = CreateSaw(15, 15);
	world->AddEntity(saw);

	editor.LoadLevelFromFile("level1.txt");
	camera.halfSize = Vector2(12.0f, 12.0f);
	renderer.SetCamera(&camera);
	camera.position = ScreenToWorld(Vector2(mouse.posX,mouse.posY), camera, window);
}
Пример #7
0
ezResult ezRendererTestBasics::InitializeSubTest(ezInt32 iIdentifier)
{
  m_iFrame = -1;

  if (ezGraphicsTest::InitializeSubTest(iIdentifier).Failed())
    return EZ_FAILURE;

  if (iIdentifier == SubTests::ST_ClearScreen)
  {
    return SetupRenderer(320, 240);
  }

  if (SetupRenderer().Failed())
    return EZ_FAILURE;

  m_hSphere = CreateSphere(3, 1.0f);
  m_hSphere2 = CreateSphere(1, 0.75f);
  m_hTorus = CreateTorus(16, 0.5f, 0.75f);
  m_hLongBox = CreateBox(0.4f, 0.2f, 2.0f);
  m_hLineBox = CreateLineBox(0.4f, 0.2f, 2.0f);



  return EZ_SUCCESS;
}
Пример #8
0
void KeyboardUpCallback(unsigned char key, int x, int y)
{
	gKeys[key] = false;

	switch (key)
	{
		case 'p': { bPause = !bPause; 
					if (bPause)
						hud.SetDisplayString(1, "Paused - Hit \"p\" to Unpause", 0.3f, 0.55f);
					else
						hud.SetDisplayString(1, "", 0.0f, 0.0f);	
					getElapsedTime(); 
					break; }
	
		case 'f': { bForceMode = !bForceMode; break; }
	    case 'b': 
			{
				box = CreateBox(NxVec3(2,5-0.75,7), NxVec3(0.75,0.75,0.75), 1);
	  			sphere = CreateSphere(NxVec3(0,4-0.4,1), 0.4, 1);
	  			capsule = CreateCapsule(NxVec3(3,0-(1+0.5),8), 1, 1, 1);
		 		break; 
	  		  }	
		case 27 : { exit(0); break; }
		default : { break; }
	}
}
Пример #9
0
static void AddSlider (DemoEntityManager* const scene, const dVector& origin)
{
    // make a reel static
    NewtonBody* const box0 = CreateBox (scene, origin + dVector (0.0f, 4.0f, 0.0f, 0.0f), dVector (8.0f, 0.25f, 0.25f, 0.0f));
    NewtonBody* const box1 = CreateWheel (scene, origin + dVector (0.0f, 4.0f, 0.0f, 0.0f), 1.0f, 0.5f);

	dMatrix matrix;
	NewtonBodySetMassMatrix(box0, 0.0f, 0.0f, 0.0f, 0.0f);

	// connect the bodies by a Slider joint
    NewtonBodyGetMatrix (box1, &matrix[0][0]);
    CustomSlider* const slider = new CustomSlider (matrix, box1, box0);

    // enable limit of first axis
    slider->EnableLimits(true);

    // set limit on second axis
    slider->SetLimits (-4.0f, 4.0f);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), box0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box1, box0);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #10
0
static void Add6DOF (DemoEntityManager* const scene, const dVector& origin)
{
	dVector size (1.0f, 1.0f, 1.0f);
	NewtonBody* const base = CreateBox(scene, origin + dVector (0.0f,  5.0f + size.m_y + 0.25f, 0.0f, 0.0f), size.Scale (0.2f));
	NewtonBody* const box0 = CreateCapule (scene, origin + dVector (0.0f,  5.0f, 0.0f, 0.0f), size);
	NewtonBody* const box1 = CreateCapule (scene, origin + dVector (0.0f,  5.0 - size.m_y * 2.0f, 0.0f, 0.0f), size);

	const dFloat angle = 60.0f * 3.1415592f / 180.0f;
	NewtonBodySetMassMatrix(base, 0.0f, 0.0f, 0.0f, 0.0f);
	dMatrix pinMatrix (dGrammSchmidt (dVector (0.0f, -1.0f, 0.0f, 0.0f)));

	// connect first box to the world
	dMatrix matrix0;
	NewtonBodyGetMatrix (box0, & matrix0[0][0]);
	pinMatrix.m_posit = matrix0.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f);
	Custom6DOF* const joint0 = new Custom6DOF (pinMatrix, pinMatrix, box0, base);
	joint0->SetAngularLimits (dVector (-angle, -angle, -angle, 0.0f), dVector (angle, angle, angle, 0.0f));

	// link the two boxes
	dMatrix matrix1;
	NewtonBodyGetMatrix (box1, &matrix1[0][0]);
	pinMatrix.m_posit = (matrix0.m_posit + matrix1.m_posit).Scale (0.5f);
	Custom6DOF* const joint1 = new Custom6DOF (pinMatrix, pinMatrix, box1, box0);
	joint1->SetAngularLimits (dVector (-angle, -angle, -angle, 0.0f), dVector (angle, angle, angle, 0.0f));

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), base, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box0, base);
	NewtonSkeletonContainerAttachBone(skeleton, box1, box0);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #11
0
static void AddBallAndSockectWithFriction (DemoEntityManager* const scene, const dVector& origin)
{
	dVector size (1.0f, 1.0f, 1.0f);
	NewtonBody* const base = CreateBox(scene, origin + dVector (0.0f,  5.0f + size.m_y + 0.25f, 0.0f, 0.0f), size.Scale (0.2f));
	NewtonBody* const box0 = CreateCapule (scene, origin + dVector (0.0f,  5.0f, 0.0f, 0.0f), size);
	NewtonBody* const box1 = CreateCapule (scene, origin + dVector (0.0f,  5.0 - size.m_y * 2.0f, 0.0f, 0.0f), size);

	NewtonBodySetMassMatrix(base, 0.0f, 0.0f, 0.0f, 0.0f);
	dMatrix pinMatrix (dGrammSchmidt (dVector (0.0f, -1.0f, 0.0f, 0.0f)));

	// connect first box to the world
	dMatrix matrix0;
	NewtonBodyGetMatrix (box0, &matrix0[0][0]);
	pinMatrix.m_posit = matrix0.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f);
	new CustomBallAndSocketWithFriction (pinMatrix, box0, base, 20.0f);

	// link the two boxes
	dMatrix matrix1;
	NewtonBodyGetMatrix (box1, & matrix1[0][0]);
	pinMatrix.m_posit = (matrix0.m_posit + matrix1.m_posit).Scale (0.5f);
	new CustomBallAndSocketWithFriction (pinMatrix, box1, box0, 10.0f);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), base, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box0, base);
	NewtonSkeletonContainerAttachBone(skeleton, box1, box0);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #12
0
static void AddDistance (DemoEntityManager* const scene, const dVector& origin)
{
	dVector size (1.0f, 1.0f, 1.0f);
	NewtonBody* const box0 = CreateBox(scene, origin + dVector (0.0f,  5.0f + size.m_y + 0.25f, 0.0f, 0.0f), size.Scale (0.2f));
	NewtonBody* const box1 = CreateCapule (scene, origin + dVector (0.0f,  5.0f, 0.0f, 0.0f), size);
	NewtonBody* const box2 = CreateCapule (scene, origin + dVector (0.0f,  5.0 - size.m_y * 4.0f, 0.0f, 0.0f), size);

	dMatrix pinMatrix (dGrammSchmidt (dVector (0.0f, -1.0f, 0.0f, 0.0f)));
	NewtonBodySetMassMatrix(box0, 0.0f, 0.0f, 0.0f, 0.0f);

	// connect first box to the world
	dMatrix matrix0;
	NewtonBodyGetMatrix (box1, &matrix0[0][0]);
	pinMatrix.m_posit = matrix0.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f);
	new CustomBallAndSocket (pinMatrix, box1, box0);

	// link the two boxes with a distance joint
	dMatrix matrix1;
	NewtonBodyGetMatrix (box2, &matrix1[0][0]);

	// get the origins
	dVector pivot0 (matrix0.m_posit - dVector (0.0f, size.m_y, 0.0f, 0.0f));
	dVector pivot1 (matrix1.m_posit + dVector (0.0f, size.m_y, 0.0f, 0.0f));

	// connect bodies at a corner
	new CustomPointToPoint (pivot1, pivot0, box2, box1);
	
#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), box0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box1, box0);
	NewtonSkeletonContainerAttachBone(skeleton, box2, box1);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #13
0
static void AddSlidingContact(DemoEntityManager* const scene, const dVector& origin)
{
	// make a reel static
	NewtonBody* const box0 = CreateBox(scene, origin + dVector(0.0f, 4.0f, 0.0f, 0.0f), dVector(8.0f, 0.25f, 0.25f, 0.0f));
	NewtonBody* const box1 = CreateWheel(scene, origin + dVector(0.0f, 4.0f, 0.0f, 0.0f), 1.0f, 0.5f);

	dMatrix matrix;

	//connect the box0 to the base by a fix joint (a hinge with zero limit)
	NewtonBodyGetMatrix(box0, &matrix[0][0]);
	CustomHinge* const hinge = new CustomHinge(matrix, box0, NULL);
	hinge->EnableLimits(true);
	hinge->SetLimis(0.0f, 0.0f);

	// connect the bodies by a Slider joint
	NewtonBodyGetMatrix(box1, &matrix[0][0]);
	CustomSlidingContact* const slider = new CustomSlidingContact(matrix, box1, box0);
	slider->EnableLinearLimits (true);
	slider->SetLinearLimis (-4.0f, 4.0f);

	// enable limit of first axis
	slider->EnableAngularLimits(true);
	slider->SetAngularLimis (-60.0f * 3.1416f / 180.0f, 60.0f * 3.1416f / 180.0f);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), NULL, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, box1, box0);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #14
0
void AddPulley (DemoEntityManager* const scene, const dVector& origin)
{
    NewtonBody* const reel0 = CreateBox(scene, origin + dVector (0.0f, 4.0f, 2.0f), dVector(4.0f, 0.25f, 0.25f));
    NewtonBody* const reel1 = CreateBox(scene, origin + dVector (0.0f, 4.0f, 0.0f), dVector(4.0f, 0.25f, 0.25f));
//  NewtonBodySetMassMatrix (reel0, 0.0f, 0.0f, 0.0f, 0.0f);
//  NewtonBodySetMassMatrix (reel1, 0.0f, 0.0f, 0.0f, 0.0f);
    
	dMatrix matrix;
	//connect the box0 to the base by a fix joint (a hinge with zero limit)
	NewtonBodyGetMatrix(reel0, &matrix[0][0]);
	CustomHinge* const fixJoint0 = new CustomHinge(matrix, reel0, NULL);
	fixJoint0->EnableLimits(true);
	fixJoint0->SetLimis(0.0f, 0.0f);

	NewtonBodyGetMatrix(reel1, &matrix[0][0]);
	CustomHinge* const fixJoint1 = new CustomHinge(matrix, reel1, NULL);
	fixJoint1->EnableLimits(true);
	fixJoint1->SetLimis(0.0f, 0.0f);

    CustomSlider* const slider0 = AddSliderWheel (scene, origin + dVector (0.0f, 4.0f, 2.0f), 0.5f, 1.0f, reel0);
    CustomSlider* const slider1 = AddSliderWheel (scene, origin + dVector (0.0f, 4.0f, 0.0f), 0.5f, 0.5f, reel1);

    slider0->EnableLimits(true);
    slider0->SetLimis (-2.0f, 2.0f);

    NewtonBody* const body0 = slider0->GetBody0();
    NewtonBody* const body1 = slider1->GetBody0();

    dMatrix matrix0;
    dMatrix matrix1;
    NewtonBodyGetMatrix (body0, &matrix0[0][0]);
    NewtonBodyGetMatrix (body1, &matrix1[0][0]);

    dVector pin0 (matrix0.RotateVector(dVector (1.0f, 0.0f, 0.0f)));
    dVector pin1 (matrix1.RotateVector(dVector (1.0f, 0.0f, 0.0f)));
    new CustomPulley (4.0f, pin0, pin1, body0, body1);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), NULL, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, reel0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, slider0->GetBody0(), reel0);

	NewtonSkeletonContainerAttachBone(skeleton, reel1, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, slider1->GetBody0(), reel1);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #15
0
/*
void futBiere()
{
    GLUquadric* params;
    params = gluNewQuadric();
    glPushMatrix();
    glRotatef(270.0, 1.0, 0.0 ,0.0);
    glTranslatef(0.0,0.0,1.5);
    glutSolidTorus(0.1,1.5,100.0,100.0);
    gluCylinder(params,1.5,1.0,1.5,100.0,1.0);
    glTranslatef(0.0,0.0,-1.5);
    glutSolidTorus(0.1,1.6,100.0,100.0);
    gluCylinder(params,1.5,1.5,1.5,100.0,1.0);
    glRotatef(180, 1.0, 0.0 ,0.0);
    gluCylinder(params,1.5,1.0,1.5,100.0,1.0);
    glPushMatrix();
    glTranslatef(0.0,0.0,-3.0);
    glScalef( 1.0, 1.0, 0.0);
    //attention
    glutSolidSphere(1.0,20.0,20.0);
    glPopMatrix();
    glPushMatrix();
    glTranslatef(0.0,0.0,1.5);
    glScalef( 1.0, 1.0, 0.0);
    //attention
    glutSolidSphere(1.0,20.0,20.0);
    glPopMatrix();
    glTranslatef(0.0,0.0,-3.3);
    glTranslatef(0.0,0.7,0.0);
    gluCylinder(params,0.1,0.1,0.5,100.0,1.0);
    glTranslatef(0.0,-0.7,0.0);
    glScalef( 0.2,0.2,0.2);
    robinet();
    glPopMatrix();
}
void robinet()
{
    GLUquadric* params;
    params = gluNewQuadric();
    glutSolidTorus(0.5,1.5,100.0,8.0);
    gluCylinder(params,0.2,0.2,4.0,100.0,1.0);
    glPushMatrix();
    glTranslatef(0.0,1.0,0.0);
    glRotatef(90, 1.0, 0.0 ,0.0);
    gluCylinder(params,0.2,0.2,2.0,100.0,1.0);
    glPopMatrix();
    glPushMatrix();
    glTranslatef(-1.0,0.0,0.0);
    glRotatef(90, 1.0, 0.0 ,0.0);
    glRotatef(90, 0.0, 1.0 ,0.0);
    gluCylinder(params,0.2,0.2,2.0,100.0,1.0);
    glPopMatrix();
}

void cigarette()
{
    GLUquadric* params;
    params = gluNewQuadric();
    glColor3f(0.2,0.2,0.2);
    gluCylinder(params,0.25,0.25,0.2,100.0,1.0);
    glTranslatef(0.0,0.0,0.2);
    glColor3f(1.0,1.0,1.0);
    gluCylinder(params,0.25,0.25,3.0,100.0,1.0);
    glTranslatef(0.0,0.0,3.0);
    glColor3f(1.0,0.5,0.0);
    gluCylinder(params,0.25,0.25,1.0,100.0,1.0);
    glTranslatef(0.0,0.0,1.0);
    glPushMatrix();
    glScalef( 1.0, 1.0, 0.0);
    glColor3f(1.0,1.0,1.0);
    //glutSolidSphere(0.25,20.0,20.0);
    Sphere(0.25,20.0,20.0);
    glPopMatrix();
    glColor3f(1.0,0.0,0.0);
    glTranslatef(0.0,0.0,-4.2);
    glScalef( 1.0, 1.0, 0.5);
    glutSolidSphere(0.25,20.0,20.0);
    glColor3f(1.0,1.0,1.0);
}*/
Object* chaise(glm::vec3 pos)
{
	Texture* t1 = ObjectAccessor::getObjMgr()->getTexture("../../src/img/chaise1.bmp");
	Mesh* m;
	Container* c = new Container(pos); 

	//siege
	m = CreateBox(2.0,2.0,0.4);
	m->setTexture(t1);
	m->setPosition(0.0,0.0,1.7);
	c->addObject(m);

	//dossier
	m = CreateBox(2.0,0.4,1.0);
	m->setTexture(t1);
	m->setPosition(0.0,-0.75,3.9);
	c->addObject(m);

	//support dossier
	m = CreateCylinder(0.2,0.2,1.5,20.0,1.0);
	m->setTexture(t1);
	m->setPosition(0.0,-0.75,1.9);
	c->addObject(m);
	//pied

	m = CreateCylinder(0.2,0.2,1.5,20.0,1.0);
	m->setPosition(0.75,0.75,0);
	m->setTexture(t1);
	c->addObject(m);

	m = CreateCylinder(0.2,0.2,1.5,20.0,1.0);
	m->setPosition(0.75,-0.75,0);
	m->setTexture(t1);
	c->addObject(m);

	m = CreateCylinder(0.2,0.2,1.5,20.0,1.0);
	m->setPosition(-0.75,0.75,0);
	m->setTexture(t1);
	c->addObject(m);

	m = CreateCylinder(0.2,0.2,1.5,20.0,1.0);
	m->setPosition(-0.75,-0.75,0);
	m->setTexture(t1);
	c->addObject(m);

	return c;
}
Пример #16
0
Entity *CreateUpDownMovingPlatform(float posX, float posY, float width, float height)
{
	Entity *e = CreateBox(posX, posY, width, height);

	e->body.SetType( eKinematic );
	e->body.UpdateVelocity = UpDownVelocityFunc;

	return e;
}
Пример #17
0
void MP4StblBox::Generate()
{
    // as usual
    MP4Box::Generate();

    // but we also need one of the chunk offset atoms
    MP4Box* pChunkOffsetBox;
    if (m_File.Use64Bits(GetType())) {
        pChunkOffsetBox = CreateBox(m_File, this, "co64");
    } else {
        pChunkOffsetBox = CreateBox(m_File, this, "stco");
    }

    AddChildBox(pChunkOffsetBox);

    // and ask it to self generate
    pChunkOffsetBox->Generate();
}
Пример #18
0
Object* mur()
{
	
	Texture* t = TextureMgr::getTextureMgr()->getTexture("../../src/img/interieur.bmp");
	Container* c = new Container();
	Mesh* m;

	m = CreateBox(1.0,53.0,25.0);
	m->setPosition(-22.5,-8.5,12.5);
	m->setTexture(t);
	c->addObject(m);

	m = CreateBox(1.0,53.0,25.0);
	m->setPosition(26.5,-8.5,12.5);
	m->setTexture(t);
	c->addObject(m);
	return c;
}
Пример #19
0
void InitNx()
{
	// Create a memory allocator
    gAllocator = new UserAllocator;

    // Create the physics SDK
	gPhysicsSDK = CreatePhysics();

    // Create the scene
    NxSceneDesc sceneDesc;
    sceneDesc.gravity               = gDefaultGravity;
	sceneDesc.simType				= NX_SIMULATION_HW;
    gScene = gPhysicsSDK->createScene(sceneDesc);	
	if(!gScene){ 
		sceneDesc.simType				= NX_SIMULATION_SW; 
		gScene = gPhysicsSDK->createScene(sceneDesc);  
		if(!gScene) return;
	}

	// Create the default material
	NxMaterial* defaultMaterial = gScene->getMaterialFromIndex(0); 
	defaultMaterial->setRestitution(0.5);
	defaultMaterial->setStaticFriction(0.5);
	defaultMaterial->setDynamicFriction(0.5);

    // Set Core Dump directory
	char buff[512];
	FindMediaFile(fnameCD, buff);
#ifdef WIN32
	SetCurrentDirectory(buff);
#elif LINUX
	chdir(buff);
#endif

	// Create the objects in the scene
	NxActor* groundPlane = CreateGroundPlane();

	NxActor* box = CreateBox(NxVec3(5,0,0), NxVec3(0.5,1,0.5), 20);
	NxActor* sphere = CreateSphere(NxVec3(0,0,0), 1, 10);
	NxActor* capsule = CreateCapsule(NxVec3(-5,0,0), 2, 0.5, 10);
//	pyramid = CreatePyramid(NxVec3(0,0,0), NxVec3(1,0.5,1.5), 10);

	AddUserDataToActors(gScene);

	gSelectedActor = capsule;
//	gSelectedActor = pyramid;

	// Initialize HUD
	InitializeHUD();

	// Get the current time
	getElapsedTime();

	// Start the first frame of the simulation
	if (gScene)  StartPhysics();
}
Пример #20
0
NxActor* CreateBoard(const NxVec3& pos)
{
	NxActor* actor = CreateBox(pos + NxVec3(0,0.5,0), NxVec3(1,0.25,0.5), 10);
	actor->raiseBodyFlag(NX_BF_FROZEN_ROT_X);
	actor->setAngularDamping(0.5);

	// Left wheel
	NxWheelDesc wheelDesc;
	//wheelDesc.wheelAxis.set(0,0,1);
	//wheelDesc.downAxis.set(0,-1,0);
    wheelDesc.wheelApproximation = 10;
	wheelDesc.wheelRadius = 0.5;
	wheelDesc.wheelWidth = 0.1;
	wheelDesc.wheelSuspension = 0.5;
//	wheelDesc.wheelSuspension = 1.0;
	wheelDesc.springRestitution = 7000;
	wheelDesc.springDamping = 0;
	wheelDesc.springBias = 0;  
//	wheelDesc.springRestitution = 20;
//	wheelDesc.springDamping = 0.5;
//	wheelDesc.springBias = 0; 
	wheelDesc.maxBrakeForce = 1;
	wheelDesc.frictionToFront = 0.1;
	wheelDesc.frictionToSide = 0.99;
	wheelDesc.position = NxVec3(1.5,0.5,0);
	wheelDesc.wheelFlags = NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF | NX_WF_ACCELERATED | 
		                   NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_STEERABLE_INPUT;

    wheel1 = AddWheelToActor(actor, &wheelDesc);

	// Right wheel
	NxWheelDesc wheelDesc2;
	//wheelDesc2.wheelAxis.set(0,0,1);
	//wheelDesc2.downAxis.set(0,-1,0);
    wheelDesc2.wheelApproximation = 10;
	wheelDesc2.wheelRadius = 0.5;
	wheelDesc2.wheelWidth = 0.1;
	wheelDesc2.wheelSuspension = 0.5;
//	wheelDesc2.wheelSuspension = 1.0;  
	wheelDesc2.springRestitution = 7000;
	wheelDesc2.springDamping = 0;
	wheelDesc2.springBias = 0;
//	wheelDesc2.springRestitution = 20;
//	wheelDesc2.springDamping = 0.5;
//	wheelDesc2.springBias = 0;  
	wheelDesc2.maxBrakeForce = 1;
	wheelDesc2.frictionToFront = 0.1;
	wheelDesc2.frictionToSide = 0.99;
	wheelDesc2.position = NxVec3(-1.5,0.5,0);
	wheelDesc2.wheelFlags = NX_WF_USE_WHEELSHAPE | NX_WF_BUILD_LOWER_HALF | NX_WF_ACCELERATED | 
		                    NX_WF_AFFECTED_BY_HANDBRAKE | NX_WF_STEERABLE_INPUT;

    wheel2 = AddWheelToActor(actor, &wheelDesc2);

	return actor;
}
Пример #21
0
void World::SetupBunnyScene()
{
	NxSoftBodyDesc softBodyDesc;
	softBodyDesc.globalPose.t = NxVec3(0,35,-1);
	softBodyDesc.particleRadius = 0.2f;
	softBodyDesc.volumeStiffness = 1.0f;
	softBodyDesc.stretchingStiffness = 0.07f;
	softBodyDesc.friction = 1.0f;

	char *fileName = "bunny";	
	char tetFileName[256], objFileName[256], s[256];
	sprintf(tetFileName, "%s.tet", fileName);
	sprintf(objFileName, "%s.obj", fileName);

	ObjMesh *objMesh = new ObjMesh(); // it is for mesh surface rendering
	objMesh->loadFromObjFile(FindMediaFile(objFileName, s));  

	MySoftBody *softBody = new MySoftBody(gScene, softBodyDesc, FindMediaFile(tetFileName,s), objMesh);

	if (!softBody->getNxSoftBody())
	{
		printf("Error: Unable to create the SoftBody for the current scene.\n");
		delete softBody;
	} else
	{
		gSoftBodies.push_back(softBody);  // soft body is pushed to list.
		gObjMeshes.push_back(objMesh);  // surface mesh is pushed to list.
	}

	NxMat33 rot;
	NxActor *plate0 = CreateBox(NxVec3(-2.5,10,0), NxVec3(20.0f, 1.0f, 10.0f), 0,0.0f);
	rot.rotZ(1.5f);
	plate0->setGlobalOrientation(rot);
	NxActor *plate1 = CreateBox(NxVec3(2.5,10,0), NxVec3(20.0f, 1.0f, 10.0f), 0,0.0f);
	rot.rotZ(1.5f);
	plate1->setGlobalOrientation(rot);

	// set camera position and direction
	gCameraPos.set(-5.0f, 40.0f, 35.0f);
	gCameraForward.set(0.2,-1.1,-2);
	gCameraForward.normalize();
}
Пример #22
0
void AddPulley (DemoEntityManager* const scene, const dVector& origin)
{
    NewtonBody* const reel0 = CreateBox(scene, origin + dVector (0.0f, 4.0f, 2.0f), dVector(4.0f, 0.25f, 0.25f));
	// this is just for show
    NewtonBody* const reel1 = CreateBox(scene, origin + dVector (0.0f, 4.0f, 0.0f), dVector(4.0f, 0.25f, 0.25f));
	NewtonBodySetMassMatrix (reel0, 0.0f, 0.0f, 0.0f, 0.0f);
	NewtonBodySetMassMatrix (reel1, 0.0f, 0.0f, 0.0f, 0.0f);
    
	dMatrix matrix;
    CustomSlider* const slider0 = AddSliderWheel (scene, origin + dVector (0.0f, 4.0f, 2.0f), 0.5f, 1.0f, reel0);
    CustomSlider* const slider1 = AddSliderWheel (scene, origin + dVector (0.0f, 4.0f, 0.0f), 0.5f, 0.5f, reel0);

    slider0->EnableLimits(true);
    slider0->SetLimits (-2.0f, 2.0f);

    NewtonBody* const body0 = slider0->GetBody0();
    NewtonBody* const body1 = slider1->GetBody0();

    dMatrix matrix0;
    dMatrix matrix1;
    NewtonBodyGetMatrix (body0, &matrix0[0][0]);
    NewtonBodyGetMatrix (body1, &matrix1[0][0]);

    dVector pin0 (matrix0.RotateVector(dVector (1.0f, 0.0f, 0.0f)));
    dVector pin1 (matrix1.RotateVector(dVector (1.0f, 0.0f, 0.0f)));
    new CustomPulley (4.0f, pin0, pin1, body0, body1);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), reel0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, slider0->GetBody0(), reel0);
	NewtonSkeletonContainerAttachBone(skeleton, slider1->GetBody0(), reel0);
	NewtonSkeletonContainerFinalize(skeleton);
#endif

	// make an aggregate for disabling collisions
	void* const aggregate = NewtonCollisionAggregateCreate (scene->GetNewton());
	NewtonCollisionAggregateSetSelfCollision (aggregate, 0);
	NewtonCollisionAggregateAddBody (aggregate, reel0);
	NewtonCollisionAggregateAddBody (aggregate, reel1);
	NewtonCollisionAggregateAddBody (aggregate, body0);
	NewtonCollisionAggregateAddBody (aggregate, body1);
}
Пример #23
0
Object* porte(glm::vec3 pos)
{
	Container* c = new Container(pos);
	Mesh* m;
	Texture* t = TextureMgr::getTextureMgr()->getTexture("../../src/img/interieur.bmp");
	m = CreateBox(5.0, 0.8, 10.0);
	m->setPosition(0.0,0.0,5.0);
	
	c->addObject(m);

	m = CreateCylinder(0.1,0.1,1.2,20.0,1.0);
	m->rotate(-90,glm::vec3(1,0,0));
	m->setPosition(2.0,-0.6,5.0);
	c->addObject(m);

	//glScalef(1.0,1.0,0.5);
	m = CreateSphere(0.2,20.0,20.0);
	m->setPosition(2.0,0.6,5.0);
	c->addObject(m);

	//glScalef(1.0,1.0,0.5);
	m = CreateSphere(0.2,20.0,20.0);
	m->setPosition(2.0,-0.6,5.0);
	c->addObject(m);

	m = CreateBox(1.0, 1.0, 25.0);
	m->setPosition(-3.0,0.0,12.5);
	m->setTexture(t);
	c->addObject(m);

	m = CreateBox(1.0, 1.0, 25.0);
	m->setPosition(3.0,0.0,12.5);
	m->setTexture(t);
	c->addObject(m);

	m = CreateBox(6.0, 1.0, 15.0);
	m->setPosition(0.0,0.0,17.5);
	m->setTexture(t);
	c->addObject(m);

	return c;
}
Пример #24
0
//----------------------------------------------------------------------------
void GelatinCube::CreateScene ()
{
    mScene = new0 Node();
    mTrnNode = new0 Node();
    mScene->AttachChild(mTrnNode);
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    CreateSprings();
    CreateBox();
}
Пример #25
0
void MyFrame::OnToggleMulti(wxCommandEvent& WXUNUSED(event))
{
    wxWindow *old = m_hlbox;

    // we need to recreate the listbox
    CreateBox();
    GetSizer()->Replace(old, m_hlbox);
    delete old;

    GetSizer()->Layout();
}
Пример #26
0
static void AddGearAndRack (DemoEntityManager* const scene, const dVector& origin)
{
    NewtonBody* const reel0 = CreateCylinder(scene, origin + dVector (0.0f, 4.0f, 0.0f), 0.25f, 4.0f);
    NewtonBody* const reel1 = CreateBox(scene, origin + dVector (0.0f, 4.0f, 2.0f), dVector(4.0f, 0.25f, 0.25f));
    
	dMatrix matrix;
	//connect the box0 to the base by a fix joint (a hinge with zero limit)
	NewtonBodyGetMatrix(reel0, &matrix[0][0]);
	CustomHinge* const fixJoint0 = new CustomHinge(matrix, reel0, NULL);
	fixJoint0->EnableLimits(true);
	fixJoint0->SetLimis(0.0f, 0.0f);

	NewtonBodyGetMatrix(reel1, &matrix[0][0]);
	CustomHinge* const fixJoint1 = new CustomHinge(matrix, reel1, NULL);
	fixJoint1->EnableLimits(true);
	fixJoint1->SetLimis(0.0f, 0.0f);

    CustomHinge* const hinge0 = AddHingeWheel (scene, origin + dVector (-1.0f, 4.0f, 0.0f), 0.5f, 0.5f, reel0);
    CustomHinge* const hinge1 = AddHingeWheel (scene, origin + dVector ( 1.0f, 4.0f, 0.0f), 0.5f, 0.5f, reel0);
    CustomCorkScrew* const cylinder = AddCylindricalWheel(scene, origin + dVector (0.0f, 4.0f, 2.0f), 0.5f, 1.0f, reel1);

    cylinder->EnableLinearLimits(true);
    cylinder->SetLinearLimis(-2.0f, 2.0f);

    NewtonBody* const body0 = hinge0->GetBody0();
    NewtonBody* const body1 = hinge1->GetBody0();
    NewtonBody* const body2 = cylinder->GetBody0();

    dMatrix matrix0;
    dMatrix matrix1;
    dMatrix matrix2;

    NewtonBodyGetMatrix (body0, &matrix0[0][0]);
    NewtonBodyGetMatrix (body1, &matrix1[0][0]);
    NewtonBodyGetMatrix (body2, &matrix2[0][0]);

    dVector pin0 (matrix0.RotateVector(dVector( 1.0f, 0.0f, 0.0f)));
    dVector pin1 (matrix1.RotateVector(dVector( 1.0f, 0.0f, 0.0f)));
    dVector pin2 (matrix2.RotateVector(dVector( 1.0f, 0.0f, 0.0f)));

    new CustomGear (1.0f, pin0, pin2, body0, body2);
    new CustomRackAndPinion (1.0f, pin1, pin2, body1, body2);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), NULL, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, reel0, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, hinge0->GetBody0(), reel0);
	NewtonSkeletonContainerAttachBone(skeleton, hinge1->GetBody0(), reel0);

	NewtonSkeletonContainerAttachBone(skeleton, reel1, NULL);
	NewtonSkeletonContainerAttachBone(skeleton, cylinder->GetBody0(), reel1);
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}
Пример #27
0
bool Application::OnEvent(const SEvent &TEvent) {
	static int ph = 0; 
	
	if(TEvent.EventType == EET_KEY_INPUT_EVENT && !TEvent.KeyInput.PressedDown) {
		switch(TEvent.KeyInput.Key) {
			case KEY_ESCAPE:
				Done = true;
			break;
			case KEY_KEY_Q: 
				paused = ~paused; 
				break; 
			case KEY_KEY_T:
				mRCThrottle += 10;
				break;
			case KEY_KEY_G:
				mRCThrottle -= 10;
				break;
			case KEY_LEFT:
				mRCRoll -= 10;
				break;
			case KEY_RIGHT:
				mRCRoll += 10; 
				break;
			case KEY_UP:
				ph+=1; 
				mRCPitch += 10;
				break;
			case KEY_DOWN:
				ph-=1; 
				mRCPitch -= 10;
				break; 
			case KEY_KEY_F:
				mRCYaw -= 1;
				break; 
			case KEY_KEY_H:
				mRCYaw += 1;
				break; 
			case KEY_KEY_1:
				CreateBox(btVector3(GetRandInt(10) - 5.0f, 7.0f, GetRandInt(10) - 5.0f), vector3df(GetRandInt(3) + 0.5f, GetRandInt(3) + 0.5f, GetRandInt(3) + 0.5f), 500.0f);
			break;
			case KEY_KEY_X:
				CreateStartScene();
			break;
			default:
				return false;
			break;
		}
		
		return true;
	}

	return false;
}
Пример #28
0
Floor* Map::addFloor(World* world, const Vector& position, const Vector& tiles, 
  const Vector& tileSize, iTexture* tex) {
    Floor* floor = nullptr;
    if (!tex) tex = CreateTexture(L"metalbare.jpg");
    Reflectivity white(Colour(1, 1, 1));
    iGraphic* box = CreateBox(0, 0, 0, tileSize.x, tileSize.y, tileSize.z);
    iObject* floorModel = CreateObject(box, &white);
    floorModel->attach(tex);
    floor = new Floor(world, floorModel, position, tiles);
    world->floors.push_back(floor);
    return floor;
}
Пример #29
0
//----------------------------------------------------------------------------
void RoughPlaneSolidBox::CreateScene ()
{
    mScene = new0 Node();
    mWireState = new0 WireState();
    mRenderer->SetOverrideWireState(mWireState);

    mScene->AttachChild(CreateGround());
    mScene->AttachChild(CreateRamp());
    mScene->AttachChild(CreateBox());

    mScene->LocalTransform.SetRotate(HMatrix(AVector::UNIT_Z, 0.661917f));
}
Пример #30
0
void CreateDrainActors()
{
	// Create the drains in the scene
	box			= CreateBox(NxVec3(5,0,0), NxVec3(1.5,1.5,1.5), 1);
	box->getShapes()[0]->setFlag(NX_SF_FLUID_DRAIN,true);
	sphere		= CreateSphere(NxVec3(0,0.0,0), 1.5, 1);
	sphere->getShapes()[0]->setFlag(NX_SF_FLUID_DRAIN,true);
	capsule		= CreateCapsule(NxVec3(-5,0,0), 1, 1, 1);
	capsule->getShapes()[0]->setFlag(NX_SF_FLUID_DRAIN,true);

	gSelectedActor = sphere;
}