// original is here // www.airtightinteractive.com/demos/cubes_three/ @Override public void start( final WebGLRenderer renderer, final int width, final int height, FocusPanel panel) { super.start(renderer, width, height, panel); renderer.setClearColor(0xcccccc, 1); final Camera camera = THREE.PerspectiveCamera(35, (double) width / height, .1, 10000); camera.getPosition().set(0, 0, 0); final Scene scene = THREE.Scene(); final Light light = THREE.SpotLight(0xffffff); light.setPosition(1000, 2000, 1500); // light.setPosition(5,5, 5); scene.add(light); final Mesh root = THREE.Mesh( THREE.PlaneBufferGeometry(50, 50), THREE.MeshLambertMaterial(MeshLambertMaterialParameter.create().color(0x00ee88))); scene.add(root); mesh = root; Object3D group = THREE.Object3D(); mesh.add(group); final EmitterSystem emitterSystem = new EmitterSystem(); emitterSystem.setParent(group); emitterSystem.setVelocity(THREE.Vector3(0, 200.0 / 120, 0)); emitterSystem.setVelocityRange(THREE.Vector3(100.0 / 120, 0, 100.0 / 120)); root.getRotation().set(Math.toDegrees(45), Math.toDegrees(45), Math.toDegrees(-45)); // Particle particle=THREE.Particle(THREE.MeshLambertMaterial().color(0x00ee88).build()); // particle.getScale().set(100, 100, 100); // scene.add(particle); cameraControle.setRotationX(0); cameraControle.setRotationZ(0); cameraControle.setPositionZ(1000); // MainWidget.cameraRotation.setX(-90); Timer timer = new Timer() { public void run() { MainWidget.stats.begin(); try { emitterSystem.update(); camera.setPosition( cameraControle.getPositionX(), cameraControle.getPositionY(), cameraControle.getPositionZ()); mesh.getRotation() .set( cameraControle.getRadiantRotationX(), cameraControle.getRadiantRotationY(), cameraControle.getRadiantRotationZ()); // camera.setPosition(MainWidget.cameraMove.getX(), // MainWidget.cameraMove.getY(),MainWidget.cameraMove.getZ()); // mesh.setRotation(Math.toRadians(MainWidget.cameraRotation.getX()), // Math.toRadians(MainWidget.cameraRotation.getY()), // Math.toRadians(MainWidget.cameraRotation.getZ())); renderer.render(scene, camera); } catch (Exception e) { GWT.log(e.getMessage()); LogUtils.log(e.getMessage()); } MainWidget.stats.end(); } }; startTimer(timer); }
public void browseSourceCode() { if (_pane.getTabCount() == 1) { _pane.addTab("Source", AbstractDemo.createSourceCodePanel(_demo.getDemoSource())); } _pane.setSelectedIndex(1); }