Code viewer for World: Universe_Loopinn

// Cloned by Akshat Sen on 16 Sep 2025 from World "One Cube World (Three.js)" by Starter user 
// Please leave this clone trail here.

const skycolor          = 'black';           
const boxcolor          = 'Yellowgreen';
const lathecolor        ='Snow';
const stem              ='brown';
 const objectsize = 300;
 const startRadius   = 10000;                 // distance from centre we start the camera at

 const maxRadius     = startRadius*10;     // maximum distance from camera we render things 





// the object is a cube (each dimension equal): 
  
var shape       = new THREE.TorusGeometry( 10*objectsize, 3*objectsize, 16, 100);
var material    = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
var theobject   = new THREE.Mesh ( shape, material );


const texturefile  = '/uploads/senakshat/universe.jpg';
var   loader       = new THREE.TextureLoader();
 
 loader.load ( texturefile, function ( thetexture ) 
 // this defines a function to be called whenever the file is loaded 
    {			 
        thetexture.minFilter  = THREE.LinearFilter;
        theobject.material    = new THREE.MeshBasicMaterial ( { map: thetexture } );
    }); 
// var shape2      = new THREE.OctahedronGeometry(3, 100);
// var material2    = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
// var thobject2 =new THREE.Mesh(shape2);
// theobject2.position.z=100;

AB.world.newRun = function() 
{
    // start a 3D scene: 
    
    ABWorld.init3d ( startRadius, maxRadius, skycolor ); 
   
    // add the object to the scene:
   
    ABWorld.scene.add(theobject);
    
};
var speed=0.1*Math.PI;
AB.world.nextStep = function()
{
    
    if (speed>=180){
        speed=speed/1.01;
    }
    else{
        speed=speed*1.05;
    }
    theobject.rotation.set(180, 0, speed)  ; 
    console.debug(theobject);
   
    // theobject.position.y = Math.PI * AB.randomIntAtoB ( -1, 1 );
    theobject.position.z = Math.PI * AB.randomIntAtoB ( -10, 1 );
    
};