[#1980] Render booster markers even if no children
This commit is contained in:
parent
738905d6d8
commit
3d02766d41
@ -67,6 +67,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
private Map<Integer, Boolean> preloadStageActiveness = null;
|
private Map<Integer, Boolean> preloadStageActiveness = null;
|
||||||
final private Collection<MotorConfiguration> activeMotors = new ConcurrentLinkedQueue<MotorConfiguration>();
|
final private Collection<MotorConfiguration> activeMotors = new ConcurrentLinkedQueue<MotorConfiguration>();
|
||||||
final private InstanceMap activeInstances = new InstanceMap();
|
final private InstanceMap activeInstances = new InstanceMap();
|
||||||
|
final private InstanceMap extraRenderInstances = new InstanceMap(); // Extra instances to be rendered, besides the active instances
|
||||||
|
|
||||||
private int boundsModID = -1;
|
private int boundsModID = -1;
|
||||||
private BoundingBox cachedBoundsAerodynamic = new BoundingBox(); // Bounding box of all aerodynamic components
|
private BoundingBox cachedBoundsAerodynamic = new BoundingBox(); // Bounding box of all aerodynamic components
|
||||||
@ -288,7 +289,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
AxialStage stage = rocket.getStage(stageNumber);
|
AxialStage stage = rocket.getStage(stageNumber);
|
||||||
return stage != null && stage.getChildCount() > 0 &&
|
return stage != null && stage.getChildCount() > 0 && // Stages with no children are marked as inactive
|
||||||
stages.get(stageNumber) != null && stages.get(stageNumber).active;
|
stages.get(stageNumber) != null && stages.get(stageNumber).active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,6 +400,15 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
return activeInstances;
|
return activeInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the InstanceMap of instances that need to be rendered, but are not present in {@link #getActiveInstances()}.
|
||||||
|
* This is the case for example for a booster that has no children. It is marked as an inactive stage, but it still needs to be rendered.
|
||||||
|
* @return the InstanceMap of instances that need to be rendered, but are not present in {@link #getActiveInstances()}.
|
||||||
|
*/
|
||||||
|
public InstanceMap getExtraRenderInstances() {
|
||||||
|
return extraRenderInstances;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generates a read-only, instance-aware collection of the components for this rocket & configuration
|
* Generates a read-only, instance-aware collection of the components for this rocket & configuration
|
||||||
*
|
*
|
||||||
@ -406,7 +416,8 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
*/
|
*/
|
||||||
private void updateActiveInstances() {
|
private void updateActiveInstances() {
|
||||||
activeInstances.clear();
|
activeInstances.clear();
|
||||||
getActiveContextListAt( this.rocket, activeInstances, Transformation.IDENTITY);
|
extraRenderInstances.clear();
|
||||||
|
getActiveContextListAt(this.rocket, activeInstances, Transformation.IDENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private InstanceMap getActiveContextListAt(final RocketComponent component, final InstanceMap results, final Transformation parentTransform ){
|
private InstanceMap getActiveContextListAt(final RocketComponent component, final InstanceMap results, final Transformation parentTransform ){
|
||||||
@ -428,6 +439,10 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
|||||||
// constructs entry in-place if this component is active
|
// constructs entry in-place if this component is active
|
||||||
if (this.isComponentActive(component)) {
|
if (this.isComponentActive(component)) {
|
||||||
results.emplace(component, currentInstanceNumber, currentTransform);
|
results.emplace(component, currentInstanceNumber, currentTransform);
|
||||||
|
} else if (component instanceof ParallelStage && stages.get(component.getStageNumber()).active) {
|
||||||
|
// Boosters with no children are marked as inactive, but still need to be rendered.
|
||||||
|
// See GitHub issue #1980 for more information.
|
||||||
|
extraRenderInstances.emplace(component, currentInstanceNumber, currentTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(RocketComponent child : component.getChildren()) {
|
for(RocketComponent child : component.getChildren()) {
|
||||||
|
@ -384,7 +384,12 @@ public class RocketFigure extends AbstractScaleFigure {
|
|||||||
// allShapes is an output buffer -- it stores all the generated shapes
|
// allShapes is an output buffer -- it stores all the generated shapes
|
||||||
allShapes.clear();
|
allShapes.clear();
|
||||||
|
|
||||||
for (Entry<RocketComponent, ArrayList<InstanceContext>> entry : config.getActiveInstances().entrySet()) {
|
addShapesFromInstanceEntries(allShapes, config.getActiveInstances().entrySet());
|
||||||
|
addShapesFromInstanceEntries(allShapes, config.getExtraRenderInstances().entrySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addShapesFromInstanceEntries(PriorityQueue<RocketComponentShape> allShapes, Set<Entry<RocketComponent, ArrayList<InstanceContext>>> entries) {
|
||||||
|
for (Entry<RocketComponent, ArrayList<InstanceContext>> entry : entries) {
|
||||||
final RocketComponent comp = entry.getKey();
|
final RocketComponent comp = entry.getKey();
|
||||||
|
|
||||||
// Only draw pod sets and boosters when they are selected
|
// Only draw pod sets and boosters when they are selected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user