#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
Go to the source code of this file.
Functions | |
void | setDiffuseMaterialColor (const float *mc) |
void | drawBody () |
void | drawPropellerBlade () |
void | drawPropeller () |
void | drawWing () |
void | drawTailRudderFrame () |
void | drawTailRudder () |
void | drawAirplane () |
Variables | |
float | g_fPropellerAngle = 0.0f |
float | g_nPropellerRPS = 0 |
float | g_fRudderAngle = 0.0f |
float | g_fPlaneAngle = 0.0f |
bool | g_bRotateLeft = false |
bool | g_bRotateRight = false |
const float | colorWhite [4] = { 1.0, 1.0, 1.0, 1.0 } |
const float | colorBlue [4] = { 0.0, 0.2, 1.0, 1.0 } |
const float | colorGreen [4] = { 0.0, 1, 0.0, 1.0 } |
const float | colorDarkGreen [4] = { 0.0, 0.5, 0.0, 1.0 } |
const float | colorNone [4] = { 0.0, 0.0, 0.0, 0.0 } |
const float | colorDarkGrey [4] = { 0.2, 0.2, 0.2, 0.0 } |
const float | colorDarkYellow [4] = { 0.8, 0.8, 0.0, 0.0 } |
const float | colorDarkRed [4] = { 0.5, 0.0, 0.0, 0.0 } |
const float | colorDarkBrown [4] = { 0.5, 0.3, 0.0, 0.0 } |
const float | colorSky [4] = { 0.4, 0.6, 1.0, 0.0 } |
|
Definition at line 211 of file airplane.cpp. References drawBody(), drawPropeller(), drawTailRudder(), and drawWing().
00212 { 00213 // Draw body of the plane 00214 drawBody(); 00215 00216 // Draw wings of the plane 00217 glPushMatrix(); 00218 glTranslatef( 0,-0.15,0 ); 00219 drawWing(); 00220 glPopMatrix(); 00221 00222 // Draw wing on the other side 00223 glPushMatrix(); 00224 glTranslatef( 0,-0.15,0 ); 00225 glRotatef( 180,1,0,0 ); 00226 drawWing(); 00227 glPopMatrix(); 00228 00229 // Draw propeller and tail rudder 00230 drawPropeller(); 00231 drawTailRudder(); 00232 } |
|
Definition at line 49 of file airplane.cpp. References colorBlue, and setDiffuseMaterialColor(). Referenced by drawAirplane().
00050 { 00051 glPushMatrix(); 00052 00053 // Setup material 00054 setDiffuseMaterialColor( colorBlue ); 00055 00056 // glTranslatef( -2.5,0,0 ); 00057 // glRotatef( 90, 0,1,0 ); 00058 //glutSolidCone( 0.5,6, 10,10 ); 00059 00060 glTranslatef( -0.7,0,0 ); 00061 glScalef( 3,0.5,0.5 ); 00062 glutSolidSphere( 1,20,20 ); 00063 00064 glPopMatrix(); 00065 } |
|
Definition at line 81 of file airplane.cpp. References colorDarkGreen, drawPropellerBlade(), g_fPropellerAngle, and setDiffuseMaterialColor(). Referenced by drawAirplane().
00082 { 00083 // Setup material 00084 setDiffuseMaterialColor(colorDarkGreen); 00085 00086 glPushMatrix(); 00087 glTranslatef( 2.1, 0,0 ); 00088 glRotatef( g_fPropellerAngle, 1,0,0 ); 00089 00090 // A sphere with three rectangular blades 00091 glPushMatrix(); 00092 glScalef( 0.2, 0.2, 0.2 ); 00093 glutSolidSphere( 1,15,15 ); 00094 glPopMatrix(); 00095 00096 drawPropellerBlade(); 00097 glRotatef( 120, 1,0,0 ); 00098 drawPropellerBlade(); 00099 glRotatef( 120, 1,0,0 ); 00100 drawPropellerBlade(); 00101 00102 glPopMatrix(); 00103 } |
|
Definition at line 68 of file airplane.cpp. References colorDarkGreen, and setDiffuseMaterialColor(). Referenced by drawPropeller().
00069 { 00070 // Setup material 00071 setDiffuseMaterialColor(colorDarkGreen); 00072 00073 glPushMatrix(); 00074 glTranslatef( 0,0.5,0 ); 00075 glScalef( 0.05, 1,0.15 ); 00076 glRotatef( -15, 0,1,0 ); 00077 glutSolidCube(1); 00078 glPopMatrix(); 00079 } |
|
Definition at line 190 of file airplane.cpp. References colorDarkRed, drawTailRudderFrame(), g_fRudderAngle, and setDiffuseMaterialColor(). Referenced by drawAirplane().
00191 { 00192 glPushMatrix(); 00193 glTranslatef( -1.5, 0.3, 0 ); 00194 glScalef( 1.5,1.5,1 ); 00195 00196 // Draw yellow tail unit which holds the rudder 00197 drawTailRudderFrame(); 00198 00199 // Draw rudder itself 00200 setDiffuseMaterialColor( colorDarkRed ); 00201 glTranslatef( -0.7,0.5,0 ); 00202 glRotatef( g_fRudderAngle, 0,1,0 ); 00203 glScalef( 0.3,0.6,0.1 ); 00204 glTranslatef( -0.5,0,0 ); 00205 glutSolidCube(1); 00206 00207 glPopMatrix(); 00208 } |
|
Definition at line 119 of file airplane.cpp. References colorDarkYellow, and setDiffuseMaterialColor(). Referenced by drawTailRudder().
00120 { 00121 setDiffuseMaterialColor(colorDarkYellow); 00122 00123 // The only more difficult object requires some predefined points 00124 const float z = 0.1; 00125 00126 const float p0[3] = {0,0,-z}; 00127 const float p1[3] = {-0.5,1,-z}; 00128 const float p2[3] = { -0.7, 1, -z }; 00129 const float p3[3] = { -0.7, 0, -z }; 00130 00131 const float p0z[3] = { 0, 0, z }; 00132 const float p1z[3] = {-0.5, 1, z }; 00133 const float p2z[3] = { -0.7, 1, z }; 00134 const float p3z[3] = { -0.7, 0, z }; 00135 00136 glBegin( GL_QUADS ); 00137 00138 // Side of tail unit at -z 00139 glNormal3f( 0,0,-1 ); 00140 glVertex3fv( p3 ); 00141 glVertex3fv( p2 ); 00142 glVertex3fv( p1 ); 00143 glVertex3fv( p0 ); 00144 00145 // Side of tail unit at +z 00146 glNormal3f( 0,0,1 ); 00147 glVertex3fv( p0z ); 00148 glVertex3fv( p1z ); 00149 glVertex3fv( p2z ); 00150 glVertex3fv( p3z ); 00151 glEnd(); 00152 00153 // Two rectangular objects which 'hold' the rudder in place 00154 glPushMatrix(); 00155 glTranslatef( -0.85,0.9,0 ); 00156 glScalef( 0.3,0.2,2*z ); 00157 glutSolidCube(1); 00158 glPopMatrix(); 00159 glPushMatrix(); 00160 glTranslatef( -0.85,0.1,0 ); 00161 glScalef( 0.3,0.2,2*z ); 00162 glutSolidCube(1); 00163 glPopMatrix(); 00164 00165 // Finally, the rectangles connecting the two sides 00166 glBegin( GL_QUADS ); 00167 00168 glNormal3f( 0,1,0 ); 00169 glVertex3fv( p1 ); 00170 glVertex3fv( p1z ); 00171 glVertex3fv( p0z ); 00172 glVertex3fv( p0 ); 00173 00174 glNormal3f( 0,1,0 ); 00175 glVertex3fv( p1z); 00176 glVertex3fv( p1 ); 00177 glVertex3fv( p2 ); 00178 glVertex3fv( p2z ); 00179 00180 glNormal3f( 1,0,0 ); 00181 glVertex3fv( p2z ); 00182 glVertex3fv( p2 ); 00183 glVertex3fv( p3 ); 00184 glVertex3fv( p3z ); 00185 00186 glEnd(); 00187 } |
|
Definition at line 106 of file airplane.cpp. References colorDarkYellow, and setDiffuseMaterialColor(). Referenced by drawAirplane().
00107 { 00108 setDiffuseMaterialColor(colorDarkYellow); 00109 00110 glPushMatrix(); 00111 glTranslatef( -0.5, 0, 1.75 ); 00112 glRotatef( -10, 0,1,0 ); 00113 glScalef( 2,0.15, 3 ); 00114 glutSolidCube(1); 00115 glPopMatrix(); 00116 } |
|
Definition at line 39 of file airplane.cpp.
00040 { 00041 glMaterialfv(GL_FRONT, GL_DIFFUSE, mc ); 00042 glMaterialfv(GL_FRONT, GL_AMBIENT, mc ); 00043 glMaterialfv(GL_FRONT, GL_SPECULAR, colorNone ); 00044 glColor4fv(mc); 00045 } |
|
Definition at line 21 of file airplane.cpp. Referenced by drawBody(). |
|
Definition at line 28 of file airplane.cpp. Referenced by renderScene(). |
|
Definition at line 23 of file airplane.cpp. Referenced by __draw_fog(), display(), drawPropeller(), and drawPropellerBlade(). |
|
Definition at line 25 of file airplane.cpp. Referenced by diffuseLighting(), and display(). |
|
Definition at line 27 of file airplane.cpp. Referenced by drawTailRudder(). |
|
Definition at line 26 of file airplane.cpp. Referenced by drawTailRudderFrame(), and drawWing(). |
|
Definition at line 22 of file airplane.cpp. |
|
Definition at line 24 of file airplane.cpp. Referenced by setDiffuseMaterialColor(). |
|
Definition at line 29 of file airplane.cpp. Referenced by streamVertex(). |
|
Definition at line 20 of file airplane.cpp. Referenced by diffuseLighting(), and display(). |
|
Definition at line 14 of file airplane.cpp. |
|
Definition at line 15 of file airplane.cpp. |
|
Definition at line 13 of file airplane.cpp. |
|
Definition at line 8 of file airplane.cpp. Referenced by drawPropeller(). |
|
Definition at line 12 of file airplane.cpp. Referenced by drawTailRudder(). |
|
Definition at line 9 of file airplane.cpp. |