1
1
/*
2
2
* HexGL
3
3
* @author Thibaut 'BKcore' Despoulain <http://bkcore.com>
4
- * @license This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License.
4
+ * @license This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License.
5
5
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/.
6
6
*/
7
7
@@ -73,9 +73,9 @@ bkcore.hexgl.HexGL = function(opts)
73
73
74
74
this . initRenderer ( ) ;
75
75
76
- function onKeyPress ( event )
76
+ function onKeyPress ( event )
77
77
{
78
- if ( event . keyCode == 27 /*escape*/ )
78
+ if ( event . keyCode == 27 /*escape*/ )
79
79
{
80
80
self . reset ( ) ;
81
81
}
@@ -155,6 +155,7 @@ bkcore.hexgl.HexGL.prototype.initGameplay = function()
155
155
pixelRatio : this . track . pixelRatio ,
156
156
track : this . track ,
157
157
onFinish : function ( ) {
158
+ self . components . shipControls . terminate ( ) ;
158
159
self . displayScore ( this . finishTime , this . lapTimes ) ;
159
160
}
160
161
} ) ;
@@ -173,12 +174,12 @@ bkcore.hexgl.HexGL.prototype.displayScore = function(f, l)
173
174
bkcore . Timer . msToTimeString ( l [ 2 ] )
174
175
] ;
175
176
176
- if ( this . mobile )
177
+ if ( this . gameover !== null )
177
178
{
178
179
this . gameover . style . display = "block" ;
179
- this . gameover . innerHTML = tf . m + "'" + tf . s + "''" + tf . ms ;
180
- this . containers . main . style . display = "none" ;
181
- return ;
180
+ this . gameover . children [ 0 ] . innerHTML = tf . m + "'" + tf . s + "''" + tf . ms ;
181
+ this . containers . main . parentElement . style . display = "none" ;
182
+ return ;
182
183
}
183
184
184
185
var t = this . track ;
@@ -286,7 +287,7 @@ bkcore.hexgl.HexGL.prototype.initRenderer = function()
286
287
renderer . setSize ( this . width , this . height ) ;
287
288
renderer . domElement . style . position = "relative" ;
288
289
289
- this . containers . main . appendChild ( renderer . domElement ) ;
290
+ this . containers . main . appendChild ( renderer . domElement ) ;
290
291
this . canvas = renderer . domElement ;
291
292
this . renderer = renderer ;
292
293
this . manager = new bkcore . threejs . RenderManager ( renderer ) ;
@@ -302,7 +303,7 @@ bkcore.hexgl.HexGL.prototype.initHUD = function()
302
303
bg : this . track . lib . get ( "images" , "hud.bg" ) ,
303
304
speed : this . track . lib . get ( "images" , "hud.speed" ) ,
304
305
shield : this . track . lib . get ( "images" , "hud.shield" )
305
- } ) ;
306
+ } ) ;
306
307
this . containers . overlay . appendChild ( this . hud . canvas ) ;
307
308
}
308
309
@@ -311,16 +312,16 @@ bkcore.hexgl.HexGL.prototype.initGameComposer = function()
311
312
var renderTargetParameters = { minFilter : THREE . LinearFilter , magFilter : THREE . LinearFilter , format : THREE . RGBFormat , stencilBuffer : false } ;
312
313
var renderTarget = new THREE . WebGLRenderTarget ( this . width , this . height , renderTargetParameters ) ;
313
314
314
- // GAME COMPOSER
315
+ // GAME COMPOSER
315
316
var renderSky = new THREE . RenderPass ( this . manager . get ( "sky" ) . scene , this . manager . get ( "sky" ) . camera ) ;
316
317
317
318
var renderModel = new THREE . RenderPass ( this . manager . get ( "game" ) . scene , this . manager . get ( "game" ) . camera ) ;
318
319
renderModel . clear = false ;
319
320
320
321
this . composers . game = new THREE . EffectComposer ( this . renderer , renderTarget ) ;
321
322
322
- var effectScreen = new THREE . ShaderPass ( THREE . ShaderExtras [ "screen" ] ) ;
323
- effectScreen . renderToScreen = true ;
323
+ var effectScreen = new THREE . ShaderPass ( THREE . ShaderExtras [ "screen" ] ) ;
324
+ effectScreen . renderToScreen = true ;
324
325
var effectVignette = new THREE . ShaderPass ( THREE . ShaderExtras [ "vignette" ] ) ;
325
326
326
327
var effectHex = new THREE . ShaderPass ( bkcore . threejs . Shaders [ "hexvignette" ] ) ;
@@ -335,17 +336,17 @@ bkcore.hexgl.HexGL.prototype.initGameComposer = function()
335
336
this . composers . game . addPass ( renderSky ) ;
336
337
this . composers . game . addPass ( renderModel ) ;
337
338
338
- if ( this . quality > 0 && ! this . mobile )
339
- {
340
- var effectFXAA = new THREE . ShaderPass ( THREE . ShaderExtras [ "fxaa" ] ) ;
341
- effectFXAA . uniforms [ 'resolution' ] . value . set ( 1 / this . width , 1 / this . height ) ;
339
+ // if(this.quality > 0 && !this.mobile)
340
+ // {
341
+ // var effectFXAA = new THREE.ShaderPass( THREE.ShaderExtras[ "fxaa" ] );
342
+ // effectFXAA.uniforms[ 'resolution' ].value.set( 1 / this.width, 1 / this.height );
342
343
343
- this . composers . game . addPass ( effectFXAA ) ;
344
-
345
- this . extras . fxaa = effectFXAA ;
346
- }
344
+ // this.composers.game.addPass( effectFXAA );
345
+
346
+ // this.extras.fxaa = effectFXAA;
347
+ // }
347
348
if ( this . quality > 1 && ! this . mobile )
348
- {
349
+ {
349
350
var effectBloom = new THREE . BloomPass ( 0.8 , 25 , 4 , 256 ) ;
350
351
351
352
this . composers . game . addPass ( effectBloom ) ;
@@ -358,10 +359,10 @@ bkcore.hexgl.HexGL.prototype.initGameComposer = function()
358
359
else
359
360
this . composers . game . addPass ( effectScreen ) ;
360
361
361
-
362
+
362
363
}
363
364
364
- bkcore . hexgl . HexGL . prototype . createMesh = function ( parent , geometry , x , y , z , mat )
365
+ bkcore . hexgl . HexGL . prototype . createMesh = function ( parent , geometry , x , y , z , mat )
365
366
{
366
367
geometry . computeTangents ( ) ;
367
368
@@ -422,4 +423,4 @@ bkcore.hexgl.HexGL.prototype.tweakShipControls = function()
422
423
423
424
if ( this . godmode )
424
425
c . shieldDamage = 0.0 ;
425
- }
426
+ }
0 commit comments