const start_r = 100
const max_r = 2000
AB.world.newRun = function()
{
// Code for Three.js initial drawing of objects.
// Should include one of:
// ABWorld.init2d ( arguments );
ABWorld.init3d ( start_r, max_r, 0xff0000);
var light = new THREE.AmbientLight("white", 0.8);
ABWorld.scene.add(light);
loadResources();
};
function loadResources(){
var manager = new THREE.LoadingManager();
var loader = new THREE.OBJLoader( manager );
var mtlLoader = new THREE.MTLLoader();
mtlLoader.load("/uploads/graya27/starwars-tie-fighter.obj", function(materials){
materials.preload();
loader.setMaterials(materials);
loader.load( "/uploads/graya27/starwars-tie-fighter.obj", buildbird );
});
};// asynchronous file loads - call initScene() when all finished
function buildbird(object){
object.scale.multiplyScalar ( 10 ); // make 3d object n times bigger
object.traverse( paintEnemy );
bird1 = object;
bird1.position.x = 0;
bird1.position.y = 0;
bird1.position.z = 0;
ABWorld.scene.add( bird1);
};
function paintEnemy ( child ){
if ( child instanceof THREE.Mesh ){
child.material.map = THREE.TextureLoader( "/uploads/graya27/starwars-tie-fighter.mtl" );
}
}
AB.world.nextStep = function()
{
// Code for Three.js re-drawing of objects.
};
AB.world.endRun = function()
{
};