var world, camera,camera2, gamePaused, jump,boxes,shady,shadowOK; var pause = function () { gamePaused = !gamePaused } window.setup = function () { setGL("agl"); PATH = "/media/Rocky desert/" gamePaused = false var agl = new aexolGL(); world = new Scene(); camera = new Camera(1,1.0,500.0,45.0) shaderdiff3 = basicShader({}) shaderdiff4 = basicShader({useLights:true,useDiffuse:true}) shaderdiff2 = basicShader({useLights:true,useDiffuse:true,useBump:true}) shaderdiff = basicShader({useLights:true,useDiffuse:true,useTiling:true,useBump:true,useShadow:true}) lights = new Light([ { lightPosition: new Vector(3,6,10.0), attenuation: 55.0, intensity: 1.3, shadow:true, color: [1.0,0.9,0.9] }, { intensity: 0.5, lightType:2.0, color: [0.6,0.7,1.0] } ]) boxMesh = Mesh.cube().scale(0.1,0.1,0.1) shady = new Shadow(world,new Vector(3,6,10.0),1.0,500.0) lights.setShadow(shady) matsRocks = new Material({ color:[1.0,1.0,1.0],diffuse:Texture.fromImage(PATH+"rc1.jpg"),bump:Texture.fromImage(PATH+"rc1b.jpg",{wrap:gl.REPEAT }), bumpWeight:0.4,specularWeight:1,shininess:4.0 }) matsTeren = new Material({ color:[1.0,1.0,1.0],diffuse:Texture.fromImage(PATH+"snd1.jpg",{wrap:gl.REPEAT }),bump:Texture.fromImage(PATH+"snd1b.jpg",{wrap:gl.REPEAT }) }) matsPalmLeaf= new Material({ color:[0.3,1.0,0.2] }) matsGrass= new Material({ color:[0.3,1.0,0.2] }) matsPalmRoot= new Material({ color:[0.4,0.2,0.05] }) matsSfera = new Material({ color:[0.9,0.9,1.0] }) sky = new GameObject(world,{ mesh: Mesh.sphere(30).scaleUniform(20.0), shader:shaderdiff3, material:matsSfera }) Mesh.obj(PATH+"rocks.obj", function (e) { gm = new GameObject(world,{ shader:shaderdiff2, material:matsRocks, light:lights, mesh: e }) }) Mesh.obj(PATH+"teren.obj", function (e) { gm = new GameObject(world,{ shader:shaderdiff, material:matsTeren, light:lights, mesh: e }) }) agl.init(); shadowOK = false gl.angle = 66 camera.position = new Vector(-2,6,13); camera.rotation = new Vector(15,21, 0); camera.on(0.1) // camera2.position = new Vector(-3.8,-3.8,-18.0); // camera2.rotation = new Vector(0.0,0.0, 0); // camera2.setScene(world); // camera2.on(0.1) } window.logic = function () { if(!shadowOK){ shady.draw() shadowOK = true } } window.draw = function () { if (!gamePaused) { world.draw(camera) } } glStart(window.setup);
RUN