annscan.py bodiless mode fix

8 views
Skip to first unread message

brilanon

unread,
Mar 13, 2011, 5:35:52 PM3/13/11
to flamoots group
You can get like 10x the FPS from annscan if you omit bodies. The scan
energy isn't economized so the food and drugs will disappear anyway
though the particles spawned associated with scans are slightly
drugged. Anyway, try this, ok

In annscan/src/scenes/worldb.cpp, function checkScans() change

if (somefood < 0) { // bad
port
// cout<<"spawn"<<endl;
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.02f, 0, 0
} else if (somefood < 1500) { //
timeout
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.04f, 0.11
} else if (somefood < 2500) { //
closed
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.1f, 0.2f,
} else if (somefood >= 2500) { //
open
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
1.0f, 0.9f,
}

To:

if (!*bodiless) {
if (somefood < 0) { // bad
port
// cout<<"spawn"<<endl;
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.02f, 0, 0
} else if (somefood < 1500) { //
timeout
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.04f, 0.11
} else if (somefood < 2500) { //
closed
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
0.1f, 0.2f,
} else if (somefood >= 2500) { //
open
btDefaultMotionState*
myMotionState = (
newParticles(myMotionState,
1.0f, 0.9f,
} }

Just an if at the top and a brace at the bottom. 2nd, newScan() needs
a condition to check for bodiless around the call to newParticles(),
changing

btDefaultMotionState* myMotionState =
(btDefaultMotionState*)cRitters[i]->body.mouths[0]->body-
>getMotionState();
//btVector3 np = myMotionState-
>m_graphicsWorldTrans.getOrigin();
// newParticles(myMotionState, ((float)cRitters[i]->ip[0]/
255.0f), ((float)cRitters[i]->ip[1]/255.0f), ((float)cRitters[i]-
>ip[2]/255.0f), ((float)cRitters[i]->ip[3]/512.0f), randgen-
>Instance()->get(6,particledensity*6), -4000, 16000, 60,
1600,101,0,randgen->Instance()->get(0,4),randgen->Instance()->get(0,
(float)*pill_maxtrip/100.0f));
newParticles(myMotionState, 0.001f, 0.001f,
((float)cRitters[i]->ip[2]/581.0f), ((float)cRitters[i]->ip[3]/
512.0f), randgen->Instance()->get(4,particledensity*4), -4000, 16000,
60, 1600,101,0,randgen->Instance()->get(0,4),randgen->Instance()-
>get(0,(float)*pill_maxtrip/100.0f));

To:

if (!*bodiless) {
btDefaultMotionState* myMotionState =
(btDefaultMotionState*)cRitters[i]->body.mouths[0]->body-
>getMotionState();
//btVector3 np = myMotionState-
>m_graphicsWorldTrans.getOrigin();
// newParticles(myMotionState, ((float)cRitters[i]->ip[0]/
255.0f), ((float)cRitters[i]->ip[1]/255.0f), ((float)cRitters[i]-
>ip[2]/255.0f), ((float)cRitters[i]->ip[3]/512.0f), randgen-
>Instance()->get(6,particledensity*6), -4000, 16000, 60,
1600,101,0,randgen->Instance()->get(0,4),randgen->Instance()->get(0,
(float)*pill_maxtrip/100.0f));
newParticles(myMotionState, 0.001f, 0.001f,
((float)cRitters[i]->ip[2]/581.0f), ((float)cRitters[i]->ip[3]/
512.0f), randgen->Instance()->get(4,particledensity*4), -4000, 16000,
60, 1600,101,0,randgen->Instance()->get(0,4),randgen->Instance()-
>get(0,(float)*pill_maxtrip/100.0f)); }

Sorry about that. Again it's just a condition at the top and an ending
brace... newParticles() should also be modified to return if bodiless
is on, although it shouldn't happen, just in case

void WorldB::newParticles(btDefaultMotionState* myMotionState, float
r, float g, float b, float a, unsigned int num, signed int minheight,
signed int maxheight, unsigned int maxs
// return;

Becomes:

void WorldB::newParticles(btDefaultMotionState* myMotionState, float
r, float g, float b, float a, unsigned int num, signed int minheight,
signed int maxheight, unsigned int maxs
if (*bodiless) { return; }
// return;

That's just if you want 1000 fps at annscan. Otherwise ignore this
entirely. Don't hit camera controls they still crash it. I'd just
update the code in my Files section but uploading was disabled by
Google in January because of the superiority of Google Sites. Good
luck, flamoot.
Reply all
Reply to author
Forward
0 new messages