// Cloned by Dave on 19 Nov 2022 from World "Port of flying birds " by Discover three.js
// Please leave this clone trail here.
// Port of flying birds from discoverthreejs.com
// "Final code from Ch 1.7 of Discover three.js"
// https://codesandbox.io/s/github/looeee/discoverthree.com-examples/tree/master/1-first-steps/7-load-models?from-embed
const startRadius = 150; // distance from centre we start the camera at
const maxRadius = startRadius * 20; // maximum distance from camera we render things
// can load skybox of other user:
const SKYBOX_ARRAY = [
"/uploads/dg/corona_ft.png",
"/uploads/dg/corona_bk.png",
"/uploads/dg/corona_up.png",
"/uploads/dg/corona_dn.png",
"/uploads/dg/corona_rt.png",
"/uploads/dg/corona_lt.png"
];
const mixers = [];
const clock = new THREE.Clock();
// AB customisations
// Select text and "Code Help" to see what these mean:
ABHandler.MAXCAMERAPOS = maxRadius;
ABWorld.drawCameraControls = false;
AB.drawRunControls = false;
AB.world.newRun = function()
{
// ABWorld.renderer = new THREE.WebGLRenderer ( { antialias: true } );
// custom renderer args - uncomment if need this - otherwise init3d makes the renderer
var color = new THREE.Color (); // renderer color is not used - there is a skybox
ABWorld.init3d ( startRadius, maxRadius, color );
initLights();
loadModels();
// skybox:
ABWorld.scene.background = new THREE.CubeTextureLoader().load ( SKYBOX_ARRAY );
};
AB.world.nextStep = function()
{
const delta = clock.getDelta();
mixers.forEach( ( mixer ) => { mixer.update( delta ); } );
};