Ejemplo n.º 1
0
void OBBColliderExt::initQuery(Prunable** objectsBase, ReportPrunablesCallback callback, void* userData, const Gu::Box& box)
{
	VolumeCollider::InitQuery();

	// Compute obb in world space
	mBoxExtents = box.extents;

	Cm::Matrix34 WorldB;
	WorldB.base0 = box.rot.column0;
	WorldB.base1 = box.rot.column1;
	WorldB.base2 = box.rot.column2;
	WorldB.base3 = box.center;

	// Setup matrices
	const Cm::Matrix34 ModelToBox	= WorldB.getInverseRT();

	mRModelToBox.column0	= ModelToBox.base0;
	mRModelToBox.column1	= ModelToBox.base1;
	mRModelToBox.column2	= ModelToBox.base2;
	mTModelToBox			= ModelToBox.base3;

	mRBoxToModel.column0	= WorldB.base0;
	mRBoxToModel.column1	= WorldB.base1;
	mRBoxToModel.column2	= WorldB.base2;
	mTBoxToModel			= WorldB.base3;

	// Setup destination pointer
	mObjectsBase	= objectsBase;
	mCallback		= callback;
	mUserData		= userData;
	PX_ASSERT(callback);
}
OBBTriangleTest::OBBTriangleTest(const Gu::Box& box)
{
	mBoxExtents				= box.extents;

	Cm::Matrix34 WorldB;
	WorldB.base0 = box.rot.column0;
	WorldB.base1 = box.rot.column1;
	WorldB.base2 = box.rot.column2;
	WorldB.base3 = box.center;

	Cm::Matrix34 ModelToBox	= WorldB.getInverseRT();

	mRModelToBox.column0	= ModelToBox.base0;
	mRModelToBox.column1	= ModelToBox.base1;
	mRModelToBox.column2	= ModelToBox.base2;
	mTModelToBox			= ModelToBox.base3;

	mRBoxToModel.column0	= WorldB.base0;
	mRBoxToModel.column1	= WorldB.base1;
	mRBoxToModel.column2	= WorldB.base2;
	mTBoxToModel			= WorldB.base3;
}