Esempio n. 1
0
int main(int argc,char** argv)
{
	raytracePicture = new RenderTexture(screenWidth,screenHeight);

	myBox.SetMargin(0.02f);
	myCone.SetMargin(0.2f);

	simplex.SetSimplexSolver(&simplexSolver);
	simplex.AddVertex(SimdPoint3(-1,0,-1));
	simplex.AddVertex(SimdPoint3(1,0,-1));
	simplex.AddVertex(SimdPoint3(0,0,1));
	simplex.AddVertex(SimdPoint3(0,1,0));
	
	
	/// convex hull of 5 spheres
#define NUM_SPHERES 5
	SimdVector3 inertiaHalfExtents(10.f,10.f,10.f);
	SimdVector3 positions[NUM_SPHERES] = {
		SimdVector3(-1.2f,	-0.3f,	0.f),
		SimdVector3(0.8f,	-0.3f,	0.f),
		SimdVector3(0.5f,	0.6f,	0.f),
		SimdVector3(-0.5f,	0.6f,	0.f),
		SimdVector3(0.f,	0.f,	0.f)
	};
	SimdScalar radi[NUM_SPHERES] = { 0.35f,0.35f,0.45f,0.40f,0.40f };

	MultiSphereShape multiSphereShape(inertiaHalfExtents,positions,radi,NUM_SPHERES);

	ConvexHullShape convexHullShape(positions,3);


	//choose shape
	shapePtr[0] = &myCone;
	shapePtr[1] =&simplex;
	shapePtr[2] =&convexHullShape;
	shapePtr[3] =&myMink;//myBox;

	simplex.SetMargin(0.3f);

	setCameraDistance(6.f);

	return glutmain(argc, argv,screenWidth,screenHeight,"Minkowski-Sum Raytracer Demo");
}
Esempio n. 2
0
void	Raytracer::initPhysics()
{
	raytracePicture = new RenderTexture(screenWidth,screenHeight);

	myBox.SetMargin(0.02f);
	myCone.SetMargin(0.2f);

	simplex.SetSimplexSolver(&simplexSolver);
	simplex.AddVertex(SimdPoint3(-1,0,-1));
	simplex.AddVertex(SimdPoint3(1,0,-1));
	simplex.AddVertex(SimdPoint3(0,0,1));
	simplex.AddVertex(SimdPoint3(0,1,0));
	
	
	/// convex hull of 5 spheres
#define NUM_SPHERES 5
	SimdVector3 inertiaHalfExtents(10.f,10.f,10.f);
	SimdVector3 positions[NUM_SPHERES] = {
		SimdVector3(-1.2f,	-0.3f,	0.f),
		SimdVector3(0.8f,	-0.3f,	0.f),
		SimdVector3(0.5f,	0.6f,	0.f),
		SimdVector3(-0.5f,	0.6f,	0.f),
		SimdVector3(0.f,	0.f,	0.f)
	};

	// MultiSphereShape* multiSphereShape = new MultiSphereShape(inertiaHalfExtents,positions,radi,NUM_SPHERES);
	ConvexHullShape* convexHullShape = new ConvexHullShape(positions,3);


	//choose shape
	shapePtr[0] = &myCone;
	shapePtr[1] =&simplex;
	shapePtr[2] =convexHullShape;
	shapePtr[3] =&myMink;//myBox;//multiSphereShape

	simplex.SetMargin(0.3f);


}