/******************************************************************************/
#include "stdafx.h"
/******************************************************************************/
Actor ground, ballActor;
Mesh ballMesh;
PhysBody ballphys;
Flt size;
/******************************************************************************/
void InitPre()
{
App.name("Simple Code");
App.flag=APP_MS_EXCLUSIVE;
Paks.add("../data/engine.pak");
D.sync(true);
}
Bool Init()
{
Cam.dist=4;
size = 0.5f;
Physics.create(CSS_NONE,true,"../Installation/PhysX");
ground .create(Box (15,1,15,Vec(0,-5,0)), 0);
ballMesh.parts.New().base.create(Ball(size),VTX_TEX0|VTX_NRM|VTX_TNG);
ballMesh.setMaterial(Materials.ptrRequire("../data/mtrl/brick/0.mtrl")).setRender().setBox();
ballActor .create(Ball(size ,Vec(0.0f, 0, 0)))
.adamping(5 )
.ccd (true);
return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
Bool Update()
{
if(Kb.bp(KB_ESC))return false;
CamHandle(0.1f,10,CAMH_ZOOM|CAMH_ROT);
Physics.startSimulation().stopSimulation();
if(Kb.bp(KB_SPACE))ballActor.addVel(Vec(0,3,0));
return true;
}
void Render()
{
switch(Renderer())
{
case RM_PREPARE:
{
ballMesh. draw(ballActor.matrix(), ballActor.vel(),ballActor.angVel());
LightPoint(20,Vec(0,3,-3)).add();
}break;
}
}
void Draw()
{
Renderer(Render);
ground.draw();
}