Optimizations and Physics Improvements

This commit is contained in:
Vulpovile
2022-10-05 20:35:59 -07:00
parent f587d1d6db
commit 530bcf2a74
3 changed files with 22 additions and 10 deletions

View File

@@ -49,12 +49,16 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="&quot;.\src\include&quot;" AdditionalIncludeDirectories="&quot;.\src\include&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
FloatingPointModel="0"
PrecompiledHeaderFile=".\Release/Blocks3D.pch" PrecompiledHeaderFile=".\Release/Blocks3D.pch"
AssemblerListingLocation=".\Release/" AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/" ObjectFile=".\Release/"
@@ -82,6 +86,11 @@
ProgramDatabaseFile=".\Release/Blocks3D.pdb" ProgramDatabaseFile=".\Release/Blocks3D.pdb"
SubSystem="2" SubSystem="2"
StackReserveSize="16777216" StackReserveSize="16777216"
Driver="0"
OptimizeReferences="2"
EnableCOMDATFolding="2"
OptimizeForWindows98="2"
LinkTimeCodeGeneration="1"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool

View File

@@ -342,7 +342,8 @@ void Application::onSimulation(RealTime rdt, SimTime sdt, SimTime idt) {
{ {
PartInstance * p = toDelete.back(); PartInstance * p = toDelete.back();
toDelete.pop_back(); toDelete.pop_back();
g_dataModel->getSelectionService()->removeSelected(p); if(g_dataModel->getSelectionService()->isSelected(p))
g_dataModel->getSelectionService()->removeSelected(p);
p->setParent(NULL); p->setParent(NULL);
delete p; delete p;
} }
@@ -568,12 +569,12 @@ void Application::onGraphics(RenderDevice* rd) {
renderDevice->setShininess(70); //renderDevice->setShininess(70);
renderDevice->setSpecularCoefficient(Color3(0.1F, 0.1F, 0.1F)); //renderDevice->setSpecularCoefficient(Color3(0.1F, 0.1F, 0.1F));
//float lightAmbient[] = { 0.5F, 0.6F, 0.9F, 1.0F }; //float lightAmbient[] = { 0.5F, 0.5F, 0.5F, 1.0F };
//float lightDiffuse[] = { 0.6F, 0.4F, 0.9F, 1.0F }; //float lightDiffuse[] = { 0.6F, 0.6F, 0.6F, 1.0F };
//float lightSpecular[] = { 0.8F, 0.6F, 1.0F, 1.0F }; //float lightSpecular[] = { 0.8F, 0.8F, 0.8F, 1.0F };
//glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightAmbient); //glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightAmbient);
//glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, lightDiffuse); //glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, lightDiffuse);

View File

@@ -15,11 +15,11 @@ XplicitNgine::XplicitNgine()
physSpace = dHashSpaceCreate(0); physSpace = dHashSpaceCreate(0);
contactgroup = dJointGroupCreate(0); contactgroup = dJointGroupCreate(0);
dWorldSetGravity(physWorld, 0, -9.8, 0); dWorldSetGravity(physWorld, 0, -9.8F, 0);
dWorldSetAutoDisableFlag(physWorld, 1); dWorldSetAutoDisableFlag(physWorld, 1);
dWorldSetAutoDisableLinearThreshold(physWorld, 0.05F); dWorldSetAutoDisableLinearThreshold(physWorld, 0.05F);
dWorldSetAutoDisableAngularThreshold(physWorld, 0.05F); dWorldSetAutoDisableAngularThreshold(physWorld, 0.05F);
dWorldSetAutoDisableSteps(physWorld, 400); dWorldSetAutoDisableSteps(physWorld, 40);
this->name = "PhysicsService"; this->name = "PhysicsService";
//dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0); //dGeomID ground_geom = dCreatePlane(physSpace, 0, 1, 0, 0);
@@ -52,7 +52,7 @@ void collisionCallback(void *data, dGeomID o1, dGeomID o2)
// Define contact surface properties // Define contact surface properties
contact[i].surface.bounce = 0.5; //Elasticity contact[i].surface.bounce = 0.5; //Elasticity
contact[i].surface.mu = 0.3F; //Friction contact[i].surface.mu = 0.4F; //Friction
contact[i].surface.slip1 = 0.0; contact[i].surface.slip1 = 0.0;
contact[i].surface.slip2 = 0.0; contact[i].surface.slip2 = 0.0;
contact[i].surface.soft_erp = 0.8F; contact[i].surface.soft_erp = 0.8F;
@@ -75,6 +75,8 @@ void XplicitNgine::deleteBody(PartInstance* partInstance)
if(partInstance->physBody != NULL) if(partInstance->physBody != NULL)
{ {
dBodyEnable(partInstance->physBody); dBodyEnable(partInstance->physBody);
if(partInstance->isAnchored())
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
dGeomEnable(partInstance->physGeom[0]); dGeomEnable(partInstance->physGeom[0]);
//createBody(partInstance); //createBody(partInstance);
//step(0.5F); //step(0.5F);