@@ -176,7 +176,7 @@ public class ModelRenderer implements GLSurfaceView.Renderer {
176176 private boolean fatalException = false ;
177177
178178 // shadowing
179- private boolean doShadowing = true ;
179+ private boolean doShadowing = false ;
180180 private ShadowsRenderer shadowsRenderer ;
181181 final Object3DData plane2 = Plane2 .build ();
182182 final Object3DData plane3 = Plane2 .build ();
@@ -381,17 +381,15 @@ public void onDrawFrame(GL10 unused) {
381381 return ;
382382 }
383383
384- // FIXME: ground plane
385-
386- if (scene .getObjects ().size () > 0 && !scene .getObjects ().contains (plane2 )) {
384+ // shadows
385+ if (doShadowing && scene .getObjects ().size () > 0 && !scene .getObjects ().contains (plane2 )) {
387386 scene .getLightBulb ().setLocation (new float []{25f , 200f , 0f });
388387 plane2 .setColor (Constants .COLOR_GRAY );
389388 plane2 .setLocation (new float []{0f , -50f , 0f });
390389 plane2 .setPinned (true );
391390 scene .addObject (plane2 );
392391 }
393392
394-
395393 float [] colorMask = BLENDING_MASK_DEFAULT ;
396394 if (scene .isBlendingEnabled ()) {
397395 // Enable blending for combining colors when there is transparency
@@ -456,47 +454,36 @@ public void onDrawFrame(GL10 unused) {
456454 lightPosInWorldSpace [2 ] = tempVector4 [2 ];
457455
458456 // Calculate position of the light in world space to support lighting
459- doShadowing = false ;
460- if (scene .isRotatingLight ()) {
461- doShadowing = true ;
462- } else {
457+ if (!scene .isRotatingLight ()) {
463458 lightPosInWorldSpace [0 ] = cameraPosInWorldSpace [0 ];
464459 lightPosInWorldSpace [1 ] = cameraPosInWorldSpace [1 ];
465460 lightPosInWorldSpace [2 ] = cameraPosInWorldSpace [2 ];
466- doShadowing = true ;
467461 }
468462
469463 // render shadow
470464 if (doShadowing ){
471465 shadowsRenderer .onPrepareFrame (unused , projectionMatrix , viewMatrix , lightPosInWorldSpace , scene );
472466 }
473467
474-
475468 drawSkyBox (viewMatrix , projectionMatrix , cameraPosInWorldSpace , colorMask );
476469
470+
477471 if (scene .isDrawLighting ()) {
478472 if (scene .isRotatingLight ()) {
479473 // Draw a point that represents the light bulb
480474 basicShader .draw (scene .getLightBulb (), projectionMatrix , viewMatrix , -1 , lightPosInWorldSpace , colorMask , cameraPosInWorldSpace , scene .getLightBulb ().getDrawMode (), scene .getLightBulb ().getDrawSize ());
481475 //basicShader.draw(Point.build(lightPosInWorldSpace), projectionMatrix, viewMatrix, -1, lightPosInWorldSpace, colorMask, cameraPosInWorldSpace);
482476 }
483-
484-
485- Object3DData data = Line .build (new float []{lightPosInWorldSpace [0 ],
486- lightPosInWorldSpace [1 ], lightPosInWorldSpace [2 ], 0 , 0 , 0 }).setId ("light_line" );
487- basicShader .draw (data , projectionMatrix ,
488- viewMatrix , -1 ,
489- lightPosInWorldSpace ,
490- colorMask , cameraPosInWorldSpace , data .getDrawMode (), data .getDrawSize ());
491477 }
492478
493- // FIXME: integrate this
479+ // render with shadows
494480 if (doShadowing && scene .getObjects ().size () > 0 ) {
495481 // shadowsRenderer.onPrepareFrame(unused, projectionMatrix, viewMatrix, lightPosInWorldSpace, scene);
496482 shadowsRenderer .onDrawFrame (unused , projectionMatrix , viewMatrix , lightPosInWorldSpace , scene );
497483 return ;
498484 }
499485
486+ // render
500487 if (!scene .isStereoscopic ()) {
501488 this .onDrawFrame (viewMatrix , projectionMatrix , colorMask );
502489 if (camera .hasChanged ()) camera .setChanged (false );
0 commit comments