Open madhephaestus opened 1 year ago
I just added support for animations to the GPU-renderer. It does not seem to work as expected in the CPU-renderer, though.
The Scene class contains an addSceneObserver(SceneObserver) method. The SceneObserver interface now contains an onUpdate(Scene, float) method that can be implemented. You could use the AbstractSceneObserver class and only override that method, instead of implementing them all.
I'm not sure if this could be used by you, or you need something else?
An example scene, called Animation.java, has been added as well.
Thats so awesome!
An observer on the Transforms would be the easiest interface. That said i guess i can look into a stateful update. I will look closely at Animation.java when im back at work tomorrow morning.
The Transform class already has methods to add TransformObservers to it. But they are only called by the Transform class, when it is updated by its methods. You perhaps need some adapter class that delegates changes from the JavaFX Transform to something equivalent in its associated Dayflower Transform? Or even in both directions; from JavaFX to Dayflower and from Dayflower to JavaFX.
In what use case would Dayflower modify a Transform itself? I think one directional binding is sufficient. If your transform implemented
cube.localToSceneTransformProperty().addListener((value, oldValue, newValue) -> {
System.out.println("Transformation has changed");
});
and applied that in a way that the renderer is aware, then a User can write code to attach the Dayflower transfomr to the JavaFX transform (where animations are targeted by other software to be rendered)
It would be desirable to bind JavaFX Transform objects to specific Dayflower Transform objects. The purpose would be to animate objects in the scene and render again.
This feature would be useful for animation software to animate and render without having to make a new scene for each frame.
This would also be VERY useful for Robotics applications. Using the virtual range finder code a robot simulation could provide virtual sensor data as fast as a real sensor. This would let roboticsts test control code in virtual environments. (I would LOVE to include this feature in BowlerStudio https://commonwealthrobotics.com/ )