gameTSCtrl - unnecessary code in ::onRender ?
by JeffH · in Torque 3D Professional · 02/12/2014 (9:44 am) · 9 replies
Torque3D MIT V 3.5
Should the 2 lines dealing with GameConnection be removed or should the true segment be taken out.
void GameTSCtrl::onRender(Point2I offset, const RectI &updateRect) {
// check if should bother with a render
GameConnection * con = GameConnection::getConnectionToServer();
bool skipRender = !con || (con->getWhiteOut() >= 1.f) || (con->getDamageFlash() >= 1.f) || (con->getBlackOut() >= 1.f);
if (!skipRender || true)
Parent::onRender(offset, updateRect);
#ifdef TORQUE_DEMO_WATERMARK
mWatermark.render(getExtent());
#endif
}Should the 2 lines dealing with GameConnection be removed or should the true segment be taken out.
About the author
19 year old who loves programming with Torque3D!
#2
Okay, thanks robert.
02/12/2014 (11:00 am)
I love it when i see if statements that always result in true or false :POkay, thanks robert.
#3
02/12/2014 (1:04 pm)
omg..
#4
02/12/2014 (1:52 pm)
No comment.
#5
02/12/2014 (2:08 pm)
Don't see any issues this end with killing off the ||true so far. Presumably this would be for supporting... what, aiConnections?
#6
Considering that it's always "or true-ing"...
02/12/2014 (2:14 pm)
My main point was just asking if it was even necessary to keep any of that and instead just reduce it to this:void GameTSCtrl::onRender(Point2I offset, const RectI &updateRect) {
Parent::onRender(offset, updateRect);
#ifdef TORQUE_DEMO_WATERMARK
mWatermark.render(getExtent());
#endif
}Considering that it's always "or true-ing"...
#7
Likely take a bit more digging to sort out the blackout/whiteout/damageflash bit for tossing out unnecessary scene rendering based on those parameters.
02/12/2014 (2:29 pm)
Hrm. Stand corrected. Doesn't play nice with the extreme ends of the getWhiteOut(). (At least, not with a black... (background?).) Could see pruning it down to just checking if it's a real, or fake connection as the simplest resolution for keeping some of that filtering functionality in.Likely take a bit more digging to sort out the blackout/whiteout/damageflash bit for tossing out unnecessary scene rendering based on those parameters.
#8
Um. Is there actually benefit to not rendering while the whiteout is happening? It's not like you're saving cycles to do something else with them. And it's not going to make the experience any smoother/faster on the whole.
02/13/2014 (5:10 am)
I was about to say 'oh the compiler will take care of that for you' but no. It can't. Sigh.Um. Is there actually benefit to not rendering while the whiteout is happening? It's not like you're saving cycles to do something else with them. And it's not going to make the experience any smoother/faster on the whole.
#9
Guess the question boils down to: Take a hammer, or a scalpel to it?
02/13/2014 (11:34 am)
Would tend to agree, there. Personally I just pruned it on down to verifying if it was a valid connection or not this end, since there at least, I could see some merit. Guess the question boils down to: Take a hammer, or a scalpel to it?
Torque Owner Robert Fritzen
Phantom Games Development
The:
is complete unnecessary :)