Only calculate instancemap from active components

One thing to mention is I had a choice of either adding a special case for the rocket itself, or change the result of isStageActive for stage -1 to be true instead of false as previously.  I couldn't see a place where the previous version mattered, so I changed it.
This commit is contained in:
JoePfeiffer 2020-09-09 17:17:10 -06:00
parent 206ba58a7e
commit 20ab8ef8b1

View File

@ -204,7 +204,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
*/
public boolean isStageActive(int stageNumber) {
if( -1 == stageNumber ) {
return false;
return true;
}
return stages.get(stageNumber).active;
@ -294,10 +294,12 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
}
private InstanceMap getContextListAt(final RocketComponent component, final InstanceMap results, final Transformation parentTransform ){
final boolean active = this.isComponentActive(component);
if (!active)
return results;
final int instanceCount = component.getInstanceCount();
final Coordinate[] allOffsets = component.getInstanceOffsets();
final double[] allAngles = component.getInstanceAngles();
final boolean active = this.isComponentActive(component);
final Transformation compLocTransform = Transformation.getTranslationTransform( component.getPosition() );
final Transformation componentTransform = parentTransform.applyTransformation(compLocTransform);