Merge pull request #84 from Vulpovile/NT_x86
Minor optimization in createBody
This commit is contained in:
BIN
Dialogs.aps
BIN
Dialogs.aps
Binary file not shown.
@@ -10,7 +10,7 @@
|
|||||||
#define APP_GENER 0
|
#define APP_GENER 0
|
||||||
#define APP_MAJOR 0
|
#define APP_MAJOR 0
|
||||||
#define APP_MINOR 106
|
#define APP_MINOR 106
|
||||||
#define APP_PATCH 2
|
#define APP_PATCH 3
|
||||||
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
||||||
|
|
||||||
#define VER_PREFIX( N ) v##N
|
#define VER_PREFIX( N ) v##N
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
|||||||
{
|
{
|
||||||
// calculate collisions
|
// calculate collisions
|
||||||
//dSpaceCollide (physSpace,0,&collisionCallback);
|
//dSpaceCollide (physSpace,0,&collisionCallback);
|
||||||
|
|
||||||
|
Vector3 partSize = partInstance->getSize();
|
||||||
|
Vector3 partPosition = partInstance->getPosition();
|
||||||
if(partInstance->physBody == NULL)
|
if(partInstance->physBody == NULL)
|
||||||
{
|
{
|
||||||
// init body
|
// init body
|
||||||
@@ -93,9 +95,9 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
|||||||
if(partInstance->shape == Enum::Shape::Block)
|
if(partInstance->shape == Enum::Shape::Block)
|
||||||
{
|
{
|
||||||
partInstance->physGeom[0] = dCreateBox(physSpace,
|
partInstance->physGeom[0] = dCreateBox(physSpace,
|
||||||
partInstance->getSize()[0],
|
partSize.x,
|
||||||
partInstance->getSize()[1],
|
partSize.y,
|
||||||
partInstance->getSize()[2]
|
partSize.z
|
||||||
);
|
);
|
||||||
|
|
||||||
dVector3 result;
|
dVector3 result;
|
||||||
@@ -108,11 +110,11 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partInstance->physGeom[0] = dCreateSphere(physSpace, partInstance->getSize()[0]/2);
|
partInstance->physGeom[0] = dCreateSphere(physSpace, partSize[0]/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
dMass mass;
|
dMass mass;
|
||||||
mass.setBox(partInstance->getSize().x, partInstance->getSize().y, partInstance->getSize().z, 0.7F);
|
mass.setBox(partSize.x, partSize.y, partSize.z, 0.7F);
|
||||||
dBodySetMass(partInstance->physBody, &mass);
|
dBodySetMass(partInstance->physBody, &mass);
|
||||||
|
|
||||||
// Debug output
|
// Debug output
|
||||||
@@ -121,15 +123,15 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
|||||||
// Create rigid body
|
// Create rigid body
|
||||||
//printf("[XplicitNgine] Created Geom for PartInstance\n");
|
//printf("[XplicitNgine] Created Geom for PartInstance\n");
|
||||||
dBodySetPosition(partInstance->physBody,
|
dBodySetPosition(partInstance->physBody,
|
||||||
partInstance->getPosition()[0],
|
partPosition.x,
|
||||||
partInstance->getPosition()[1],
|
partPosition.y,
|
||||||
partInstance->getPosition()[2]
|
partPosition.z
|
||||||
);
|
);
|
||||||
|
|
||||||
dGeomSetPosition(partInstance->physGeom[0],
|
dGeomSetPosition(partInstance->physGeom[0],
|
||||||
partInstance->getPosition()[0],
|
partPosition.x,
|
||||||
partInstance->getPosition()[1],
|
partPosition.y,
|
||||||
partInstance->getPosition()[2]);
|
partPosition.z);
|
||||||
|
|
||||||
Matrix3 g3dRot = partInstance->getCFrame().rotation;
|
Matrix3 g3dRot = partInstance->getCFrame().rotation;
|
||||||
float rotation [12] = { g3dRot[0][0], g3dRot[0][1], g3dRot[0][2], 0,
|
float rotation [12] = { g3dRot[0][0], g3dRot[0][1], g3dRot[0][2], 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user