1 package com.insanityengine.ghia.apps;
2
3 import java.applet.*;
4
5 import java.awt.*;
6 import java.awt.image.*;
7 import java.awt.event.*;
8
9 import javax.swing.*;
10 import javax.swing.event.*;
11
12 import java.util.*;
13
14 import com.insanityengine.ghia.m3.*;
15 import com.insanityengine.ghia.model.*;
16 import com.insanityengine.ghia.pixels.*;
17 import com.insanityengine.ghia.pixelops.*;
18 import com.insanityengine.ghia.libograf.*;
19
20 /***
21 *
22 * <P>
23 * This is used primarily for looking foxy and benchmarking
24 * </P>
25 *
26 * <table border="1">
27 * <topic>945*5 = 4725 triangles</topic>
28 * <TH>RendererName</TH>
29 * <TH>KiloTrianglesPerSecond</TH>
30 * <TH>SnapShot</TH>
31 * <TR valign="top">
32 * <TD>Memagery</TD>
33 * <TD>51 fps</TD>
34 * <TD><img src="http://ghia.sourceforge.net/images/old_snaps/Memagery_Light.gif"/></TD>
35 * </TR>
36 * <TR valign="top">
37 * <TD>WireFuRenderer</TD>
38 * <TD>1593 fps</TD>
39 * <TD><img src="http://ghia.sourceforge.net/images/old_snaps/WireFuRender_Light.gif"/></TD>
40 * </TR>
41 * <TR valign="top">
42 * <TD>ZortPolyRenderer</TD>
43 * <TD>1646 fps</TD>
44 * <TD><img src="http://ghia.sourceforge.net/images/old_snaps/ZortPolyRenderer_Light.gif"/></TD>
45 * </TR>
46 * </table>
47 *
48 * @author BrianHammond
49 *
50 */
51
52 public class Light extends AppletBase {
53
54
55
56 public final static void main( String argv[] ) {
57 Light lite = new Light();
58 lite.frame();
59 }
60
61
62
63 public Light() {
64 }
65
66
67
68 public void initImpl( int w, int h ) {
69 if ( gl.getRenderer() instanceof PixelBufferReadInterface ) {
70 skin = new ImageSkin(
71 ( PixelBufferReadInterface ) gl.getRenderer()
72 );
73 }
74
75 fx = new BufferFx( gl.getRenderer() );
76 gl.getRenderer().setShadingMethod( M3_Constants.DEPTH_SHADE );
77 gl.getRenderer().setShadingMethod( M3_Constants.NONE_SHADE );
78 gl.getRenderer().setShadingMethod( M3_Constants.NORM_SHADE );
79 }
80
81 public final void drawImpl() {
82 float f;
83
84 gl.getRenderer().clearDepthBuffer();
85 gl.getRenderer().setSkin( skin );
86
87 if ( false && BufferFx.objectSupportsFx( gl.getRenderer() ) ) {
88 fx.or( 0x00D05030 );
89 fx.smoothoDoomo();
90 fx.and( 0xFFEE9977 );
91 } else {
92 gl.getRenderer().setClearColor( 0x0000FF00 );
93 gl.getRenderer().clearColorBuffer();
94 }
95
96 gl.identity();
97 gl.rotate( rotation );
98
99 Cube.cube( gl );
100
101 f = 0.2f;
102 gl.identity();
103 gl.rotate( rotation );
104 gl.scale( scale.set( f ) );
105
106 f = 14;
107 Cube.cubeAt( gl, +f, 0, 0 );
108 Cube.cubeAt( gl, 0, +f, 0 );
109 Cube.cubeAt( gl, 0, 0, +f );
110
111 Cube.cubeAt( gl, -f, 0, 0 );
112 Cube.cubeAt( gl, 0, -f, 0 );
113 Cube.cubeAt( gl, 0, 0, -f );
114 }
115
116
117
118 private Pt3 scale = new Pt3();
119 };
120
121 /***
122 *
123 * $Log: Light.java,v $
124 * Revision 1.23 2005/03/26 23:42:41 brian
125 * fix links
126 *
127 * Revision 1.22 2005/03/19 17:50:02 brian
128 * repackaging
129 *
130 * Revision 1.21 2005/03/11 23:35:31 brian
131 * major refactoring to add in com.insanityengine.ghia.libograf.State bitz
132 *
133 * Revision 1.20 2005/02/17 03:31:13 brian
134 * good stuff???
135 *
136 * Revision 1.19 2004/09/13 03:06:41 brian
137 * fix up Frustrum.toScreen, still working on JoglRenderer's texture support... sigh...
138 *
139 * Revision 1.18 2004/09/11 14:37:21 brian
140 * added RendererConsumer and stuff
141 *
142 * Revision 1.17 2004/09/08 02:26:40 brian
143 * set normal shading as the default
144 *
145 * Revision 1.16 2004/09/02 23:32:26 brian
146 * dont make the RendererInterface extend PixelBufferInterface
147 *
148 * Revision 1.15 2004/09/02 15:43:46 brian
149 * redefine PixelBufferReadInterface so BufferFx can use it as an interface rather than the RenderInterface
150 *
151 * Revision 1.14 2004/09/02 13:17:16 brian
152 * the big reorg
153 *
154 * Revision 1.13 2004/09/01 01:52:47 brian
155 * added test results (ok, and images) to javadoc
156 *
157 * Revision 1.12 2004/09/01 01:10:42 brian
158 * fix class level javadoc placement
159 *
160 * Revision 1.11 2004/09/01 00:11:06 brian
161 * author, log and header stuff
162 *
163 *
164 */