Old stuff/old_sites/threejs/11_pingu_2_animations/js/level.js
(Deskargatu)
var Level = function(scene,options)
{
this.scene= scene;
this.game_mesh = new THREE.Object3D();
this.init = function()
{
var width = options.door_size * options.maze_num * 3;
var height = options.door_size * options.maze_num * 3;
var ground = new THREE.PlaneGeometry(width, height);
var tall = options.tall;
var texloader = new THREE.TextureLoader();
var groundTexture=texloader.load("textures/ground.jpg");
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping;
groundTexture.repeat.set( 20, 20 );
var material = new THREE.MeshLambertMaterial({ map: groundTexture} );
var i;
// Set the "game" modelisation object
this.game_mesh.name='game mesh';
// Set and add the ground
this.ground = new THREE.Mesh(ground, material);
this.ground.name='Ground';
this.ground.receiveShadow=true;
this.ground.castShadow=true;
this.game_mesh.receiveShadow=true;
this.game_mesh.castShadow=true;
this.ground.rotation.x = -Math.PI / 2;
this.game_mesh.add(this.ground);
this.scene.add(this.game_mesh);
};
this.load = function(options)
{
this.doors = new Doors(this.game_mesh, options);
return this.doors.load();
};
this.add_doors = function(options)
{
this.doors.build();
};
};