Skip to content

Add basic render-core integration

This change integrates render-core into 4D orbit viewer.

At this time, render-core handles creating the threejs scene, renderer, controls, and cameras. See changes in the constructor.

Since you're using your own extended OrbitControls class, I allowed the library to take a function which gets called when the controls need to be recreated, and I pass a function which creates your orbit controls instance (this is line 100).

render-core handles window-resize events, so the resize event listener is removed, and both update_camera_view and switch_camera are implemented in render-core, so I removed this code.

The main animation loop is also done in render-core, so _frame_id is removed. the animate function is passed to render-core, and the library will call it each frame with the delta time as a parameter.

the getters on lines 196-198 makes the change simpler, all your code touching the scene, camera, and controls stays the same, but still uses the fields exposed by the library.

I had to change the ORTHO_CAM constant since in the library my enum values are switched, 0 is perspective and 1 is orthographic.

Merge request reports