de.jreality.tutorial.scene
Class CameraListenerExample

java.lang.Object
  extended by de.jreality.tutorial.scene.CameraListenerExample

public class CameraListenerExample
extends Object

A simple demo showing how to use a camera listener. It implements a simple level of detail algorithm to display different resolutions of a tessellated icosahedra based on the apparent size of the object. To run: execute the main method, and in the graphics window activate the camera zoom tool via the mouse scroll wheel. The camera listener calculates the expected screen extent of the sphere and chooses a tessellation of the sphere which keeps the size of the triangles roughly constant.

Author:
gunn

Constructor Summary
CameraListenerExample()
           
 
Method Summary
 void doIt()
           
static void main(String[] args)
           
 void update()
          Use the path to the object and to the sphere, plus other information from the Camera, to calculate the net object to NDC (normalized device coordinates) transformation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CameraListenerExample

public CameraListenerExample()
Method Detail

doIt

public void doIt()

update

public void update()
Use the path to the object and to the sphere, plus other information from the Camera, to calculate the net object to NDC (normalized device coordinates) transformation. Use this to estimate how large the object appears. Note: the matrix calculations here could be done somewhat more conveniently using an instance of Graphics3D using the constructor Graphics3D.Graphics3D(Viewer) and setting Graphics3D.setCurrentPath(SceneGraphPath) to spherePath, then this method has only to call Graphics3D.getObjectToNDC(). But it's probably good to see how to do it by hand.


main

public static void main(String[] args)