View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package nl.tudelft.goal.ut2004.visualizer.timeline.map;
7   
8   import java.util.List;
9   import javax.media.opengl.GL;
10  
11  import nl.tudelft.goal.ut2004.visualizer.map.BlendTriangle;
12  
13  
14  
15  /**
16   * This is a subrenderer, it's job is to render some stuff.
17   * Basically I had few {@link GLEventListener}s and there were troubles
18   * with using them directly (order of rendering), so I have now only these
19   * subrenderes that are part of {@link GLRendererCollection}.
20   *
21   * @param <T> Class of object this renderer draws.
22   * @author Honza
23   */
24  public interface ISubGLRenderer<T> {
25      /**
26       * Here should be done preparation for rendering (e.g. generation of display
27       * lists from massive data)
28       * @param gl
29       */
30      public void prepare(GL gl);
31  
32      /**
33       * Display stuff you want to. Assume that settings have already been set in
34       * {@link GLRendererCollection}
35       * @param gl
36       */
37      public void render(GL gl);
38  
39      /**
40       * Return object this renderer draws.
41       *
42       * Because objects we want to draw can change rapidly, we have to remove and
43       * add subrenderers based on passed objects (renderer R draws object A, now
44       * we don't want to draw A anymore, we have to go through subrenderers to find
45       * which ones draws it).
46       * @return Object this renderer draws.
47       */
48      public T getObject();
49  
50      /**
51       * Because blending phase of rendering can be done only after all opaque
52       * objects has been drawn and because polys has to be back-to-front ordered
53       * every renderer will return list of its blended triangles so final
54       * renderer can sort all blended triangles from all blended renderers and
55       * do it correctly.
56       * @return List of blended triangles this renderer wants to render. Empty collection
57       *         if no such exists.
58       */
59      public List<BlendTriangle> getBlendedTris();
60  }