fixed bugs in the Photo Renderer

This commit is contained in:
Daniel_M_Williams 2015-12-23 23:17:59 -05:00
parent efd1656fc8
commit 0979cff505
3 changed files with 25 additions and 35 deletions

View File

@ -2034,6 +2034,7 @@ PhotoFrame.fileFilter.png = PNG Image
PhotoFrame.menu.edit.copy = Copy Image
PhotoFrame.menu.edit.copy.desc = Copy image to clipboard
PhotoFrame.menu.edit.settings = Photo Settings
PhotoFrame.menu.edit.unk = Unknown Setting
PhotoFrame.menu.window = Window
PhotoFrame.menu.window.size = Size
PhotoFrame.menu.window.size.portrait = {0} Portrait

View File

@ -206,7 +206,7 @@ public class PhotoFrame extends JFrame {
menu = new JMenu(trans.get("main.menu.edit"));
menu.setMnemonic(KeyEvent.VK_E);
// // Rocket editing
menu.getAccessibleContext().setAccessibleDescription(trans.get("BasicFrame.menu.Rocketedt"));
menu.getAccessibleContext().setAccessibleDescription(trans.get("PhotoFrame.menu.edit.unk"));
menubar.add(menu);
Action action = new AbstractAction(trans.get("PhotoFrame.menu.edit.copy")) {

View File

@ -45,6 +45,7 @@ import net.sf.openrocket.gui.figure3d.TextureCache;
import net.sf.openrocket.gui.figure3d.photo.exhaust.FlameRenderer;
import net.sf.openrocket.gui.main.Splash;
import net.sf.openrocket.motor.Motor;
import net.sf.openrocket.motor.MotorConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfiguration;
import net.sf.openrocket.rocketcomponent.FlightConfigurationId;
import net.sf.openrocket.rocketcomponent.MotorMount;
@ -95,16 +96,6 @@ public class PhotoPanel extends JPanel implements GLEventListener {
rr = new RealisticRenderer(doc);
rr.init(drawable);
doc.getDefaultConfiguration().addChangeListener(
new StateChangeListener() {
@Override
public void stateChanged(EventObject e) {
log.debug("Repainting on config state change");
needUpdate = true;
PhotoPanel.this.repaint();
}
});
doc.addDocumentChangeListener(new DocumentChangeListener() {
@Override
public void documentChanged(DocumentChangeEvent event) {
@ -422,33 +413,31 @@ public class PhotoPanel extends JPanel implements GLEventListener {
final FlightConfigurationId motorID = configuration.getFlightConfigurationID();
final Iterator<RocketComponent> iter = configuration.getActiveComponents().iterator();
final Iterator<MotorConfiguration> iter = configuration.getActiveMotors().iterator();
while( iter.hasNext()){
RocketComponent comp = iter.next();
if( comp instanceof MotorMount){
final MotorMount mount = (MotorMount) comp;
int curStageNumber = comp.getStageNumber();
MotorConfiguration curConfig = iter.next();
final MotorMount mount = curConfig.getMount();
int curStageNumber = ((RocketComponent)mount).getStageNumber();
//If this mount is not in currentStage continue on to the next one.
if( curStageNumber != bottomStageNumber ){
continue;
}
final Motor motor = mount.getMotorInstance(motorID).getMotor();
final double length = motor.getLength();
//If this mount is not in currentStage continue on to the next one.
if( curStageNumber != bottomStageNumber ){
continue;
}
final Motor motor = mount.getMotorInstance(motorID).getMotor();
final double length = motor.getLength();
Coordinate[] position = ((RocketComponent) mount)
.toAbsolute(new Coordinate(((RocketComponent) mount)
.getLength() + mount.getMotorOverhang() - length));
for (int i = 0; i < position.length; i++) {
gl.glPushMatrix();
gl.glTranslated(position[i].x + motor.getLength(),
position[i].y, position[i].z);
FlameRenderer.drawExhaust(gl, p, motor);
gl.glPopMatrix();
}
Coordinate[] position = ((RocketComponent) mount)
.toAbsolute(new Coordinate(((RocketComponent) mount)
.getLength() + mount.getMotorOverhang() - length));
for (int i = 0; i < position.length; i++) {
gl.glPushMatrix();
gl.glTranslated(position[i].x + motor.getLength(),
position[i].y, position[i].z);
FlameRenderer.drawExhaust(gl, p, motor);
gl.glPopMatrix();
}
}