Var VERTEX = "vertex" ; Var COLOR = "couleur" ; Var NORMAL = "normal" ; Var TEX_COORD = "texCoord" ; Var wallModel = [ [ COLOR , [ 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 ] ] , [ VERTEX , [ [ 5 , 5 , 0 ] , [ - 5 , 5 , 0 ] , [ 5 , - 5 , 0 ] , [ - 5 , - 5 , 0 ] ] ] , [ TEX_COORD , [ 0 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ] , [ NORMAL , $ W. Util . GenDummyArray ( [ 0 , 0 , - 1 ] , 4 ) ] ] ; Var floorModel = [ [ COLOR , [ 1 , 1 , .5 , 1 , 1 , .5 , 1 , 1 , .5 , 1 , 1 , .5 ] ] , [ VERTEX , [ [ 5 , - 5 , 5 ] , [ - 5 , - 5 , 5 ] , [ 5 , - 5 , - 5 ] , [ - 5 , - 5 , - 5 ] ] ] , [ TEX_COORD , [ 0 , 1 , 1 , 1 , 1 , 0 , 0 , 0 ] ] , [ NORMAL , $ W. Util . GenDummyArray ( [ 0 , 1 , 0 ] , 4 ) ] ] ; Var spotlit = new $ W. Matériel ( 'spotlit.json' ) ; Var wall = new $ W. Objet ( $ W. GL . TRIANGLE_STRIP ) ; mur. SetMaterial ( spotlit ) ; mur. VertexCount = 4 ; mur. FillArrays ( wallModel ) ; mur. Ambiance = [ 1 , 0 , 0 ] ; mur. Diffuse = [ 1 , 0 , 0 ] ; Var floor = new $ W. Objet ( $ W. GL . TRIANGLE_STRIP ) ; sol. SetMaterial ( spotlit ) ; sol. VertexCount = 4 ; sol. FillArrays ( floorModel ) ; sol. Diffuse = [ 1 , 1 , .5 ] ; sol. Diffuse = [ 1 , 1 , .5 ] ; Var sphère = new $ W. Objet ( $ W. GL . TRIANGLES ) ; sphère. SetMaterial ( spotlit ) ; sphère. SetPosition ( 0 , 0 , - .02 ) ; sphère. Environnement = [ 0,5 , 0,5 , 0,05 ] ; sphère. Diffuse = [ 0.5 , 0.5 , 0.05 ] ; Var sphereData = $ W. Util . GenSphere ( 30 , 30 ) ; sphère. FillArray ( TEX_COORD , sphereData. TexCoords ) ; sphère. FillArray ( VERTEX , sphereData. sommets ) ; sphère. FillArray ( COLOR , $ W. util . genDummyArray ( [ 0 , 1 , 0 ] , sphereData. sommets . longueur ) ) ; sphère. FillArray ( NORMAL , sphereData. normales ) ; sphère. SetElements ( sphereData. Indices ) ; Spotlit. SetUniformAction ( 'global_ambient' , Fonction ( uniforme , objet , matériau ) { $ W. GL . Uniform1f ( uniform. Location , 0.4 ) ; } ) ; Spotlit. SetUniformAction ( 'l0_position' , Fonction ( uniforme , objet , matériau ) { $ W. GL . uniform3fv ( uniforme. emplacement , [ 0 , 10 , - 8 ] ) ; } ) ; Spotlit. SetUniformAction ( 'l0_spot_target' , Fonction ( uniforme , objet , matériau ) { $ W. GL . uniform3fv ( uniforme. emplacement , [ 0 , 0 , 0 ] ) ; } ) ; Spotlit. SetUniformAction ( 'camera_position' , Fonction ( uniforme , objet , matériau ) { $ W. GL . uniform3fv ( . uniforme emplacement , $ W. caméra . Position . éléments ) ; } ) ; Spotlit. SetUniformAction ( 'l0_ambient' , Fonction ( uniforme , objet , matériau ) { $ W. GL . Uniform3fv ( uniform. Location , [ .2 , .2 , .2 ] ) ; } ) ; Spotlit. SetUniformAction ( 'l0_diffuse' , Fonction ( uniforme , objet , matériau ) { $ W. GL . Uniform3fv ( uniform , location , [ 1 , 1 , 1 ] ) ; } ) ; Spotlit. SetUniformAction ( 'mat_ambient' , Fonction ( uniforme , objet , matériau ) { $ W. GL . uniform3fv ( . uniforme emplacement , . objet ambiante ) ; } ) ; Spotlit. SetUniformAction ( 'mat_diffuse' , Fonction ( uniforme , objet , matériau ) { $ W. GL . uniform3fv ( . uniforme emplacement , objet. diffuse ) ; } ) ;