World Batching

    1. //These are taken from the World sample application
    2. var tree = world.loadModel(hxd.Res.tree);
    3. var rock = world.loadModel(hxd.Res.rock);
    4. //Add 5000 objeects to our scene - randomly choosing between a rock and a tree
    5. for( i in 0...5000 )
    6. world.add( Std.random(2) == 0 ? tree : rock,
    7. 0,
    8. 1.2 + hxd.Math.srand(0.4),
    9. hxd.Math.srand(Math.PI)
    10. );
    11. //Let our world know that we are done batching items so it can perform some optimizations
    12. world.done();
    13. new h3d.scene.DirLight(new h3d.Vector( 0.3, -0.4, -0.9), s3d);
    14. s3d.lightSystem.ambientLight.setColor(0x909090);
    15. //Adjust the camera settings and create a controller so we can observer our scene
    16. s3d.camera.target.set(72, 72, 0);
    17. s3d.camera.pos.set(120, 120, 40);
    18. s3d.camera.zNear = 1;