const SKYCOLOUR = 0xe34d42;
const gridsize = 200;
const squaresize = 100;
const MAXPOS = gridsize * squaresize;
const startRadiusConst = MAXPOS * 0.7;
const maxRadiusConst = MAXPOS * 100;
const skyboxConst = MAXPOS * 3;
const skyboxTexture = ["uploads/dannydevito/red.png", "uploads/dannydevito/blue.png", "uploads/dannydevito/green.png", "uploads/dannydevito/yellow.png", "uploads/dannydevito/purple.png", "uploads/dannydevito/pink.png"]
function World()
{
var fileArray = [];
var textureArray = [];
// Code for Three.js initial drawing of objects.
// Should include one of:
// ABWorld.init2d ( arguments );
function initTextures()
{
for (let i = 0; i < 6; i++)
{
fileArray.push(skyboxTexture[i]);
}
// fileArray.push(skyboxTexture[0]);
// fileArray.push(skyboxTexture[1]);
// fileArray.push(skyboxTexture[2]);
// fileArray.push(skyboxTexture[3]);
// fileArray.push(skyboxTexture[4]);
// fileArray.push(skyboxTexture[5]);
textureArray = [fileArray.length];
for (let i = 0; i < fileArray.length; i++)
{
textureArray[i] = new THREE.ImageUtils.loadTexture(fileArray[i]);
}
for ( let i = 0; i < textureArray.length; i++ )
{
textureArray[i].minFilter = THREE.LinearFilter;
}
}
function initSkybox()
{
var materialArray = [
(new THREE.MeshBasicMaterial ( {map: textureArray[0], side: THREE.BackSide})),
(new THREE.MeshBasicMaterial ( {map: textureArray[1], side: THREE.BackSide})),
(new THREE.MeshBasicMaterial ( {map: textureArray[2], side: THREE.BackSide})),
(new THREE.MeshBasicMaterial ( {map: textureArray[3], side: THREE.BackSide})),
(new THREE.MeshBasicMaterial ( {map: textureArray[4], side: THREE.BackSide})),
(new THREE.MeshBasicMaterial ( {map: textureArray[5], side: THREE.BackSide})),
];
var skyGeometry = new THREE.CubeGeometry(skyboxConst, skyboxConst, skyboxConst);
var skyMaterial = new THREE.MeshFaceMaterial(materialArray);
var theskybox = new THREE.Mesh(skyGeometry, skyMaterial);
threeworld.scene.add(theskybox);
}
this.newRun = function()
{
threeworld.init3d(startRadiusConst, maxRadiusConst, SKYCOLOUR);
initTextures();
initSkybox();
};
}