kopia lustrzana https://github.com/jameshball/osci-render
rodzic
ae7c974ec0
commit
ca7551acd3
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>sh.ball</groupId>
|
||||
<artifactId>osci-render</artifactId>
|
||||
<version>1.19.1</version>
|
||||
<version>1.19.2</version>
|
||||
|
||||
<name>osci-render</name>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public abstract class PhaseEffect implements Effect {
|
|||
this.speed = speed;
|
||||
}
|
||||
|
||||
protected void resetTheta() {
|
||||
public void resetTheta() {
|
||||
phase = -LARGE_VAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,6 @@ public class RotateEffect extends PhaseEffect {
|
|||
|
||||
@Override
|
||||
public Vector2 apply(int count, Vector2 vector) {
|
||||
if (speed != 0) {
|
||||
return vector.rotate(nextTheta());
|
||||
}
|
||||
|
||||
resetTheta();
|
||||
|
||||
return vector;
|
||||
return vector.rotate(nextTheta());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,11 +65,12 @@ public class Gui extends Application {
|
|||
|
||||
scene.addEventFilter(MouseEvent.MOUSE_MOVED, event -> {
|
||||
if (controller.mouseRotate()) {
|
||||
controller.setObjRotate(new Vector3(
|
||||
Vector3 rotate = new Vector3(
|
||||
3 * Math.PI * (event.getSceneY() / scene.getHeight()),
|
||||
3 * Math.PI * (event.getSceneX() / scene.getWidth()),
|
||||
0
|
||||
));
|
||||
);
|
||||
controller.setObjRotate(rotate, rotate);
|
||||
}
|
||||
if (controller.mouseTranslate()) {
|
||||
controller.setTranslation(new Vector2(
|
||||
|
|
|
@ -4,6 +4,7 @@ import javafx.beans.property.DoubleProperty;
|
|||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.control.TextField;
|
||||
|
@ -84,6 +85,8 @@ public class ImageController implements Initializable, SubController {
|
|||
private SVGPath visibilityMidi;
|
||||
@FXML
|
||||
private CheckBox visibilityMic;
|
||||
@FXML
|
||||
private Button resetRotationButton;
|
||||
|
||||
public ImageController() {
|
||||
this.frequency = new SimpleDoubleProperty(0);
|
||||
|
@ -140,6 +143,8 @@ public class ImageController implements Initializable, SubController {
|
|||
)
|
||||
);
|
||||
|
||||
resetRotationButton.setOnAction(e -> rotateEffect.resetTheta());
|
||||
|
||||
translationXTextField.textProperty().addListener(e -> updateTranslation());
|
||||
translationXTextField.setOnScroll((e) -> changeTranslation(e.getDeltaY() > 0, translationXTextField));
|
||||
translationYTextField.textProperty().addListener(e -> updateTranslation());
|
||||
|
|
|
@ -461,13 +461,8 @@ public class MainController implements Initializable, FrequencyListener, MidiLis
|
|||
imageController.disableMouseTranslate();
|
||||
}
|
||||
|
||||
// updates the 3D object base rotation angle
|
||||
public void setObjRotate(Vector3 vector) {
|
||||
objController.setObjRotate(vector);
|
||||
}
|
||||
|
||||
// updates the 3D object base and current rotation angle
|
||||
protected void setObjRotate(Vector3 baseRotation, Vector3 currentRotation) {
|
||||
public void setObjRotate(Vector3 baseRotation, Vector3 currentRotation) {
|
||||
objController.setObjRotate(baseRotation, currentRotation);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package sh.ball.gui.controller;
|
|||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.shape.SVGPath;
|
||||
|
@ -32,6 +33,8 @@ public class ObjController implements Initializable, SubController {
|
|||
private CheckBox objectRotateSpeedMic;
|
||||
@FXML
|
||||
private CheckBox rotateCheckBox;
|
||||
@FXML
|
||||
private Button resetObjectRotationButton;
|
||||
|
||||
@Override
|
||||
public Map<SVGPath, Slider> getMidiButtonMap() {
|
||||
|
@ -96,6 +99,7 @@ public class ObjController implements Initializable, SubController {
|
|||
objectRotateSpeedSlider.valueProperty().addListener((source, oldValue, newValue) ->
|
||||
setObjectRotateSpeed(newValue.doubleValue())
|
||||
);
|
||||
resetObjectRotationButton.setOnAction(e -> setObjRotate(new Vector3(2 * Math.PI, 2 * Math.PI, 0), new Vector3()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,11 +26,7 @@ public class ObjFrameSource implements FrameSource<List<Shape>> {
|
|||
@Override
|
||||
public List<Shape> next() {
|
||||
currentRotation = currentRotation.add(baseRotation.scale(rotateSpeed));
|
||||
if (rotateSpeed == 0) {
|
||||
object.setRotation(baseRotation);
|
||||
} else {
|
||||
object.setRotation(currentRotation);
|
||||
}
|
||||
object.setRotation(currentRotation);
|
||||
return camera.draw(object);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Slider?>
|
||||
|
@ -12,7 +13,7 @@
|
|||
<children>
|
||||
<CheckBox fx:id="translateEllipseCheckBox" layoutX="324.0" layoutY="19.0" mnemonicParsing="false" text="Ellipse" />
|
||||
<Slider fx:id="rotateSpeedSlider" blockIncrement="0.05" layoutX="116.0" layoutY="159.0" majorTickUnit="1.0" max="10.0" prefHeight="42.0" prefWidth="254.0" showTickLabels="true" showTickMarks="true" />
|
||||
<Label layoutX="13.0" layoutY="158.0" text="2D Rotate speed">
|
||||
<Label layoutX="12.0" layoutY="158.0" text="2D Rotate speed">
|
||||
<font>
|
||||
<Font size="13.0" />
|
||||
</font>
|
||||
|
@ -65,7 +66,7 @@
|
|||
</Label>
|
||||
<Slider fx:id="visibilitySlider" blockIncrement="0.005" layoutX="116.0" layoutY="276.0" majorTickUnit="0.1" max="1.0" prefHeight="42.0" prefWidth="253.0" showTickLabels="true" showTickMarks="true" value="0.5" />
|
||||
<SVGPath fx:id="visibilityMidi" content="M20.15 8.26H22V15.74H20.15M13 8.26H18.43C19 8.26 19.3 8.74 19.3 9.3V14.81C19.3 15.5 19 15.74 18.38 15.74H13V11H14.87V13.91H17.5V9.95H13M10.32 8.26H12.14V15.74H10.32M2 8.26H8.55C9.1 8.26 9.41 8.74 9.41 9.3V15.74H7.59V10.15H6.5V15.74H4.87V10.15H3.83V15.74H2Z" fill="WHITE" layoutX="371.0" layoutY="273.0" pickOnBounds="true" />
|
||||
<CheckBox fx:id="translateCheckBox" layoutX="104.0" layoutY="53.0" mnemonicParsing="false" text="Translate with Mouse (Esc to disable)" />
|
||||
<CheckBox fx:id="translateCheckBox" layoutX="137.0" layoutY="53.0" mnemonicParsing="false" text="Translate with Mouse (Esc to disable)" />
|
||||
<Slider fx:id="translationScaleSlider" blockIncrement="0.05" layoutX="115.0" layoutY="83.0" majorTickUnit="1.0" max="10.0" prefHeight="42.0" prefWidth="254.0" showTickLabels="true" showTickMarks="true" value="1.0" />
|
||||
<Label layoutX="12.0" layoutY="82.0" text="Translation Scale">
|
||||
<font>
|
||||
|
@ -79,5 +80,6 @@
|
|||
<CheckBox fx:id="translationSpeedMic" layoutX="408.0" layoutY="197.0" mnemonicParsing="false" text="Mic" />
|
||||
<CheckBox fx:id="volumeMic" layoutX="408.0" layoutY="236.0" mnemonicParsing="false" text="Mic" />
|
||||
<CheckBox fx:id="visibilityMic" layoutX="408.0" layoutY="276.0" mnemonicParsing="false" text="Mic" />
|
||||
<Button fx:id="resetRotationButton" layoutX="13.0" layoutY="49.0" mnemonicParsing="false" text="Reset Rotation" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Slider?>
|
||||
|
@ -11,8 +12,9 @@
|
|||
<Label layoutX="32.0" layoutY="21.0" text="Focal length" />
|
||||
<Slider fx:id="objectRotateSpeedSlider" blockIncrement="0.005" layoutX="106.0" layoutY="81.0" majorTickUnit="0.1" max="1.0" prefHeight="42.0" prefWidth="205.0" showTickLabels="true" showTickMarks="true" />
|
||||
<Label layoutX="7.0" layoutY="80.0" text="3D Rotate speed" />
|
||||
<CheckBox fx:id="rotateCheckBox" layoutX="90.0" layoutY="143.0" mnemonicParsing="false" text="Rotate with Mouse (Esc to disable)" />
|
||||
<CheckBox fx:id="rotateCheckBox" layoutX="133.0" layoutY="143.0" mnemonicParsing="false" text="Rotate with Mouse (Esc to disable)" />
|
||||
<SVGPath fx:id="focalLengthMidi" content="M20.15 8.26H22V15.74H20.15M13 8.26H18.43C19 8.26 19.3 8.74 19.3 9.3V14.81C19.3 15.5 19 15.74 18.38 15.74H13V11H14.87V13.91H17.5V9.95H13M10.32 8.26H12.14V15.74H10.32M2 8.26H8.55C9.1 8.26 9.41 8.74 9.41 9.3V15.74H7.59V10.15H6.5V15.74H4.87V10.15H3.83V15.74H2Z" fill="WHITE" layoutX="316.0" layoutY="19.0" pickOnBounds="true" />
|
||||
<SVGPath fx:id="objectRotateSpeedMidi" content="M20.15 8.26H22V15.74H20.15M13 8.26H18.43C19 8.26 19.3 8.74 19.3 9.3V14.81C19.3 15.5 19 15.74 18.38 15.74H13V11H14.87V13.91H17.5V9.95H13M10.32 8.26H12.14V15.74H10.32M2 8.26H8.55C9.1 8.26 9.41 8.74 9.41 9.3V15.74H7.59V10.15H6.5V15.74H4.87V10.15H3.83V15.74H2Z" fill="WHITE" layoutX="316.0" layoutY="78.0" pickOnBounds="true" />
|
||||
<CheckBox fx:id="objectRotateSpeedMic" layoutX="353.0" layoutY="81.0" mnemonicParsing="false" text="Mic" />
|
||||
<Button fx:id="resetObjectRotationButton" layoutX="16.0" layoutY="139.0" mnemonicParsing="false" text="Reset Rotation" />
|
||||
</AnchorPane>
|
||||
|
|
Ładowanie…
Reference in New Issue