1 package com.insanityengine.ghia.libograf; 2 3 import java.util.Stack; 4 5 import java.awt.*; 6 7 import java.applet.Applet; 8 import java.awt.Component; 9 import java.awt.image.ImageObserver; 10 11 import com.insanityengine.ghia.m3.*; 12 import com.insanityengine.ghia.pixels.*; 13 import com.insanityengine.ghia.renderer.*; 14 15 /*** 16 * 17 * <P> 18 * Very, very, very loosely based on openGL, very loosely! The largest 19 * similarity are the matrix stack a similarity in the polygon handling 20 * </P> 21 * 22 * @author BrianHammond 23 * 24 * $Header: /usr/local/cvsroot/ghia/src/java/com/insanityengine/ghia/libograf/LiboGrafInterface.java,v 1.5 2005/03/19 17:50:02 brian Exp $ 25 * 26 */ 27 28 public interface LiboGrafInterface extends RendererConsumerInterface { 29 30 /*** 31 * Initialize this LiboGraf 32 * 33 * @param width of the display 34 * @param height of the display 35 * @param component to use 36 * 37 */ 38 public void init( int width, int height, java.awt.Component component ); 39 40 /*** 41 * 42 * Rotate the current state 43 * 44 * @param angle 45 * 46 * @return a State 47 * 48 */ 49 public State rotate( Pt3 angle ); 50 51 /*** 52 * 53 * Translate the current state 54 * 55 * @param displacement 56 * 57 * @return a State 58 * 59 */ 60 public State translate( Pt3 displacement ); 61 62 /*** 63 * 64 * Scale the current state 65 * 66 * @param ratio 67 * 68 * @return a State 69 * 70 */ 71 public State scale( Pt3 ratio ); 72 73 /*** 74 * 75 * Load the current state 76 * 77 * @return a State 78 * 79 */ 80 public State identity(); 81 82 /*** 83 * 84 * Push the current state 85 * 86 */ 87 public void push(); 88 89 /*** 90 * 91 * Pop the current state off the stack 92 * 93 * @return a State 94 * 95 */ 96 public State pop(); 97 98 /*** 99 * 100 * Get the current state 101 * 102 * @return the current state 103 * 104 */ 105 public State get(); 106 107 /*** 108 * 109 * Set the current state 110 * 111 * @param state to use 112 * 113 * @return a State 114 * 115 */ 116 public State set( State state ); 117 118 /*** 119 * 120 * Multiply the current state by state 121 * 122 * @param state to multiply 123 * 124 * @return a State 125 * 126 */ 127 public State multiply( State state ); 128 129 /*** 130 * 131 * Use the Imago to skin an image 132 * 133 * @param href to load 134 * 135 * @return an ImageSkin, or null on fail 136 * 137 */ 138 public ImageSkin skinImage( String href ); 139 140 /*** 141 * 142 * Start a new polygon 143 * 144 */ 145 public void startPolygon(); 146 147 /*** 148 * 149 * Set the texture coordinate for the current point 150 * 151 * @param s coordinate in texture space 152 * @param t coordinate in texture space 153 * 154 */ 155 public void textCoord( float s, float t ); 156 157 /*** 158 * 159 * Add a point (to the current polygon) 160 * 161 * @param x coordinate of the point 162 * @param y coordinate of the point 163 * @param z coordinate of the point 164 * 165 */ 166 public void addPoint( float x, float y, float z ); 167 168 /*** 169 * 170 * Add a point (to the current polygon) 171 * 172 * @param point to add 173 * 174 */ 175 public void addPoint( Pt3 point ); 176 177 /*** 178 * 179 * Get the normal of the current polygon 180 * 181 * @return the normal of the current polygon 182 * 183 */ 184 public Pt3 getNormal(); 185 186 /*** 187 * 188 * Finish the current polygon, invokes the drawPolygon method 189 * on the renderer 190 * 191 */ 192 public void stopPolygon(); 193 194 /*** 195 * 196 * Get the maximum number of points a polygon can have 197 * 198 * @return the maximum number of points a polygon can have 199 * 200 */ 201 public int getPolygonPointMax(); 202 203 /*** 204 * 205 * Get the size of the state stack 206 * 207 * @return the size of the state stack 208 * 209 */ 210 public int getStackSize(); 211 212 /*** 213 * 214 * Silly conveinence method to draw a buncha polygons 215 * 216 * @param polygon array of array of Pt3 representing the polygons 217 * 218 */ 219 public void drawPolygons( Pt3 [][] polygon ); 220 221 /*** 222 * 223 * Render the scene 224 * 225 */ 226 public void render(); 227 228 /*** 229 * 230 * Render the scene 231 * 232 * @param graphics to use (if possible) 233 * 234 */ 235 public void render( Graphics graphics ); 236 }; 237 238 /*** 239 * 240 * $Log: LiboGrafInterface.java,v $ 241 * Revision 1.5 2005/03/19 17:50:02 brian 242 * repackaging 243 * 244 * Revision 1.4 2005/03/11 23:35:31 brian 245 * major refactoring to add in com.insanityengine.ghia.libograf.State bitz 246 * 247 * Revision 1.3 2005/03/10 13:31:19 brian 248 * introduce com.insanityengine.ghia/libograf/State to pave the way for quaternions based LiboGrafInterface implementation 249 * 250 * Revision 1.2 2004/09/22 03:03:32 brian 251 * added setMatrix and multiply methods 252 * 253 * Revision 1.1 2004/09/11 19:22:20 brian 254 * open the way for jogl LiboGraf impl 255 * 256 * 257 */