├── 2019-01-18_185333.jpg ├── 2019-01-18_185529.jpg ├── PlaneGame.cbp ├── PlaneGame.depend ├── PlaneGame.layout ├── README.md ├── RGBpixmap.cpp ├── bin └── Debug │ └── PlaneGame.exe ├── main.cpp └── obj └── Debug └── main.o /2019-01-18_185333.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rksazid/PlaneGame-OpenGL-CPP/27b0d8cc6980fc7c9b1e2c2a964179a2ebd5ad0f/2019-01-18_185333.jpg -------------------------------------------------------------------------------- /2019-01-18_185529.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rksazid/PlaneGame-OpenGL-CPP/27b0d8cc6980fc7c9b1e2c2a964179a2ebd5ad0f/2019-01-18_185529.jpg -------------------------------------------------------------------------------- /PlaneGame.cbp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 53 | 54 | -------------------------------------------------------------------------------- /PlaneGame.depend: -------------------------------------------------------------------------------- 1 | # depslib dependency file v1.0 2 | 1544001564 source:d:\4th_year\2nd_semester\cg lab\assignments\planegame\main.cpp 3 | 4 | 5 | 6 | 7 | "RGBpixmap.cpp" 8 | 9 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\windows.h 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winresrc.h 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\winuser.h 48 | 49 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winnt.h 50 | 51 | 52 | 53 | 54 | 55 | 56 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winerror.h 57 | 58 | 1341006776 c:\program files (x86)\codeblocks\mingw\include\string.h 59 | <_mingw.h> 60 | 61 | 62 | 1341006770 c:\program files (x86)\codeblocks\mingw\include\_mingw.h 63 | 64 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\basetsd.h 65 | 66 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\pshpack4.h 67 | 68 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\poppack.h 69 | 70 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\winver.h 71 | 72 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\dde.h 73 | 74 | 1301111150 c:\program files (x86)\codeblocks\mingw\include\dlgs.h 75 | 76 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\commctrl.h 77 | 78 | 79 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\prsht.h 80 | 81 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\windef.h 82 | 83 | 84 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\wincon.h 85 | 86 | 1301111160 c:\program files (x86)\codeblocks\mingw\include\winbase.h 87 | 88 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\wingdi.h 89 | 90 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winnls.h 91 | 92 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winnetwk.h 93 | 94 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winreg.h 95 | 96 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\winsvc.h 97 | 98 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\cderr.h 99 | 100 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\ddeml.h 101 | 102 | 1301111150 c:\program files (x86)\codeblocks\mingw\include\imm.h 103 | 104 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\lzexpand.h 105 | 106 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\mmsystem.h 107 | 108 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\nb30.h 109 | 110 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpc.h 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcdce.h 119 | 120 | 121 | 122 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\basetyps.h 123 | 124 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcdcep.h 125 | 126 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnsi.h 127 | 128 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnterr.h 129 | 130 | 1341006772 c:\program files (x86)\codeblocks\mingw\include\excpt.h 131 | <_mingw.h> 132 | 133 | 134 | 1301111160 c:\program files (x86)\codeblocks\mingw\include\shellapi.h 135 | 136 | 137 | 138 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\pshpack2.h 139 | 140 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winperf.h 141 | 142 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\commdlg.h 143 | 144 | 145 | 146 | 1301111160 c:\program files (x86)\codeblocks\mingw\include\unknwn.h 147 | 148 | 149 | 150 | 151 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\objfwd.h 152 | 153 | 154 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\wtypes.h 155 | 156 | 157 | 158 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcndr.h 159 | 160 | 161 | 162 | 1301111158 c:\program files (x86)\codeblocks\mingw\include\rpcnsip.h 163 | 164 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winspool.h 165 | 166 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winsock2.h 167 | 168 | 169 | 1301111162 c:\program files (x86)\codeblocks\mingw\include\winsock.h 170 | 171 | 172 | 173 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\mswsock.h 174 | 175 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\ole2.h 176 | 177 | 178 | 179 | 180 | 181 | 182 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\objbase.h 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 1341006776 c:\program files (x86)\codeblocks\mingw\include\stdlib.h 193 | <_mingw.h> 194 | 195 | 196 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\objidl.h 197 | 198 | 199 | 1301111148 c:\program files (x86)\codeblocks\mingw\include\cguid.h 200 | 201 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\olectlid.h 202 | 203 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\oleauto.h 204 | 205 | 206 | 1301111154 c:\program files (x86)\codeblocks\mingw\include\oaidl.h 207 | 208 | 209 | 210 | 1301111156 c:\program files (x86)\codeblocks\mingw\include\oleidl.h 211 | 212 | 213 | 976645372 c:\program files (x86)\codeblocks\mingw\include\gl\glut.h 214 | 215 | 216 | 217 | 218 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\gl\gl.h 219 | 220 | 1301111164 c:\program files (x86)\codeblocks\mingw\include\gl\glu.h 221 | 222 | 223 | 224 | 1540285916 d:\4th_year\2nd_semester\cg lab\assignments\planegame\rgbpixmap.cpp 225 | 226 | 227 | 228 | 229 | -------------------------------------------------------------------------------- /PlaneGame.layout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PlaneGame-OpenGL 2 | Window 1 : 3 | ![Screenshot](https://github.com/rksazid/PlaneGame-OpenGL-CPP/blob/master/2019-01-18_185333.jpg) 4 | 5 | Window 2: 6 | ![Screenshot](https://github.com/rksazid/PlaneGame-OpenGL-CPP/blob/master/2019-01-18_185529.jpg) 7 | -------------------------------------------------------------------------------- /RGBpixmap.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | #define checkImageWidth 512 8 | #define checkImageHeight 512 9 | 10 | 11 | 12 | using namespace std; 13 | 14 | typedef unsigned short ushort; 15 | typedef unsigned long ulong; 16 | typedef unsigned char uchar; 17 | 18 | fstream inf; 19 | 20 | static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; 21 | 22 | 23 | class mRGB 24 | { 25 | public: 26 | uchar r,g,b,a; 27 | mRGB(){r = g = b = 0,a=255;} 28 | }; 29 | 30 | class RGBpixmap 31 | { 32 | public: 33 | int nRows,nCols; 34 | mRGB *pixel; 35 | void readBMPFile(char *frame); 36 | void makeCheckerBoard(); 37 | void makeCheckImage(); 38 | void setTexture(GLuint textureName); 39 | }; 40 | 41 | 42 | void RGBpixmap::makeCheckImage() 43 | { 44 | int i, j, c; 45 | for (i = 0; i < checkImageHeight; i++) { 46 | for (j = 0; j < checkImageWidth; j++) { 47 | c = ( ((i&0x8)==0) ^ ((j&0x8)==0) )*255; 48 | checkImage[i][j][0] = (GLubyte) c; 49 | checkImage[i][j][1] = (GLubyte) c; 50 | checkImage[i][j][2] = (GLubyte) c; 51 | checkImage[i][j][3] = (GLubyte) 255; 52 | } 53 | } 54 | } 55 | 56 | void RGBpixmap::makeCheckerBoard() 57 | { 58 | // make checkerboard pattern 59 | nRows=nCols=64; 60 | pixel = new mRGB[3*nRows*nCols]; 61 | if(!pixel) 62 | { 63 | cout<<"Out of memeory!"; 64 | return; 65 | } 66 | long count=0; 67 | for(int i=0;i> dum; 206 | } 207 | } 208 | inf.close(); 209 | return ; 210 | //success 211 | } 212 | -------------------------------------------------------------------------------- /bin/Debug/PlaneGame.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rksazid/PlaneGame-OpenGL-CPP/27b0d8cc6980fc7c9b1e2c2a964179a2ebd5ad0f/bin/Debug/PlaneGame.exe -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #define rad (3.1416/180) 6 | #define EN_SIZE 20 7 | 8 | #include "RGBpixmap.cpp" 9 | 10 | using namespace std; 11 | 12 | RGBpixmap pix[6]; 13 | 14 | float zoom=4; 15 | int tola[5000][5000]; 16 | float tX=0,tY=0,tZ=-8,rX=0,rY=0,rZ=4; 17 | float tZ1=-20,tZ2=-40,tZ3=-60,tZ4=-80,tZ5=-100,tZ6=-120; 18 | float rotX=0,rotY=0,rotZ=0; 19 | float cosX=0,cosY=1,cosZ=0; 20 | float angle=0; 21 | float xEye=0.0f,yEye=5.0f,zEye=30.0f; 22 | float cenX=0,cenY=0,cenZ=0,roll=0; 23 | float radius=0; 24 | float theta=0,slope=0; 25 | float speed = 0.3; 26 | float angleBackFrac = 0.2; 27 | bool saheedMinarVisible = false; 28 | float r[] = {0.1,0.4,0.0,0.9,0.2,0.5,0.0,0.7,0.5,0.0}; 29 | float g[] = {0.2,0.0,0.4,0.5,0.2,0.0,0.3,0.9,0.0,0.2}; 30 | float b[] = {0.4,0.5,0.0,0.7,0.9,0.0,0.1,0.2,0.5,0.0}; 31 | int TIME=0; 32 | bool START = false; 33 | float torusPosX[7] = {1,-2,3,-4,-2,0,2}; 34 | float torusPosY[7] = {2,3,10,6,7,4,1}; 35 | 36 | bool rot = false; 37 | 38 | 39 | static void resize(int width, int height) 40 | { 41 | const float ar = (float) width / (float) height; 42 | 43 | glViewport(0, 0, width, height); 44 | glMatrixMode(GL_PROJECTION); 45 | glLoadIdentity(); 46 | glFrustum(-ar, ar, -1.0, 1.0, 2.0, 1000.0); 47 | 48 | glMatrixMode(GL_MODELVIEW); 49 | glLoadIdentity(); 50 | } 51 | 52 | void drawShohidMinar(){ 53 | 54 | glColor3d(0.4,0.2,0.2); 55 | glPushMatrix(); 56 | glTranslated(0,1.55,0); 57 | glScaled(2,0.05,1.5); 58 | glutSolidCube(1); 59 | glPopMatrix(); 60 | 61 | glColor3d(0.4,0.2,0.2); 62 | glPushMatrix(); 63 | glTranslated(0,1.6,0); 64 | glScaled(1.9,0.05,1.4); 65 | glutSolidCube(1); 66 | glPopMatrix(); 67 | 68 | //glColor3d(0.4,0.2,0.2); 69 | //glColor3d(1,0.8,0.7); 70 | glColor3d(0.4,0.2,0.2); 71 | glPushMatrix(); 72 | glTranslated(0,1.65,0); 73 | glScaled(1.8,0.05,1.3); 74 | glutSolidCube(1); 75 | glPopMatrix(); 76 | 77 | /// pataton 78 | 79 | glColor3d(1,1,1); 80 | glPushMatrix(); 81 | glTranslated(0,1.68,-0.4); 82 | glScaled(0.5,0.02,0.08); 83 | glutSolidCube(1); 84 | glPopMatrix(); 85 | 86 | /// Piller 87 | 88 | glPushMatrix(); 89 | glTranslated(0,1.99,-0.4); 90 | glScaled(0.06,0.7,0.04); 91 | glutSolidCube(1); 92 | glPopMatrix(); 93 | 94 | /// ROD 95 | 96 | glColor3d(0,0,0); 97 | 98 | glPushMatrix(); 99 | glTranslated(0.07,1.99,-0.4); 100 | glScaled(0.003,0.7,0.003); 101 | glutSolidCube(1); 102 | glPopMatrix(); 103 | 104 | glPushMatrix(); 105 | glTranslated(0.11,1.99,-0.4); 106 | glScaled(0.003,0.7,0.003); 107 | glutSolidCube(1); 108 | glPopMatrix(); 109 | 110 | glPushMatrix(); 111 | glTranslated(0.15,1.99,-0.4); 112 | glScaled(0.003,0.7,0.003); 113 | glutSolidCube(1); 114 | glPopMatrix(); 115 | 116 | /// 117 | glPushMatrix(); 118 | glTranslated(-0.22,0,0); 119 | glPushMatrix(); 120 | glTranslated(0.07,1.99,-0.4); 121 | glScaled(0.003,0.7,0.003); 122 | glutSolidCube(1); 123 | glPopMatrix(); 124 | 125 | glPushMatrix(); 126 | glTranslated(0.11,1.99,-0.4); 127 | glScaled(0.003,0.7,0.003); 128 | glutSolidCube(1); 129 | glPopMatrix(); 130 | 131 | glPushMatrix(); 132 | glTranslated(0.15,1.99,-0.4); 133 | glScaled(0.003,0.7,0.003); 134 | glutSolidCube(1); 135 | glPopMatrix(); 136 | glPopMatrix(); 137 | 138 | ///Horizontal rod 139 | glPushMatrix(); 140 | glTranslated(2.2,0,-0.1); 141 | glScaled(4.2,1,1); 142 | glColor3d(0,0,0); 143 | glPushMatrix(); 144 | glTranslated(-0.528,1.85,-0.3); 145 | glScaled(0.1,0.003,0.003); 146 | glutSolidCube(1); 147 | glPopMatrix(); 148 | 149 | glPushMatrix(); 150 | glTranslated(-0.528,2.02,-0.3); 151 | glScaled(0.1,0.003,0.003); 152 | glutSolidCube(1); 153 | glPopMatrix(); 154 | 155 | glPushMatrix(); 156 | glTranslated(-0.528,2.18,-0.3); 157 | glScaled(0.1,0.003,0.003); 158 | glutSolidCube(1); 159 | glPopMatrix(); 160 | glColor3d(1,1,1); 161 | glPopMatrix(); 162 | 163 | /// ROD END 164 | 165 | glColor3d(1,1,1); 166 | glPushMatrix(); 167 | glTranslated(-0.22,1.99,-0.4); 168 | glScaled(0.06,0.7,0.04); 169 | glutSolidCube(1); 170 | glPopMatrix(); 171 | 172 | glPushMatrix(); 173 | glTranslated(0.22,1.99,-0.4); 174 | glScaled(0.06,0.7,0.04); 175 | glutSolidCube(1); 176 | glPopMatrix(); 177 | 178 | /// Uporer piller 179 | 180 | glPushMatrix(); 181 | glTranslated(0,0.743,-1.424); 182 | glRotated(45,1,0,0); 183 | 184 | //glColor3d(1,0,1); 185 | glPushMatrix(); 186 | glTranslated(0,1.99,-0.4); 187 | glScaled(0.06,0.3,0.04); 188 | glutSolidCube(1); 189 | glPopMatrix(); 190 | //glColor3d(1,1,1); 191 | 192 | glPushMatrix(); 193 | glTranslated(-0.22,1.99,-0.4); 194 | glScaled(0.06,0.3,0.04); 195 | glutSolidCube(1); 196 | glPopMatrix(); 197 | 198 | glPushMatrix(); 199 | glTranslated(0.22,1.99,-0.4); 200 | glScaled(0.06,0.3,0.04); 201 | glutSolidCube(1); 202 | glPopMatrix(); 203 | 204 | glPushMatrix(); 205 | glTranslated(0,2.15,-0.4); 206 | glScaled(0.5,0.04,0.04); 207 | glutSolidCube(1); 208 | glPopMatrix(); 209 | 210 | /// ROD 211 | 212 | glColor3d(0,0,0); 213 | 214 | glPushMatrix(); 215 | glTranslated(0.07,1.99,-0.4); 216 | glScaled(0.003,0.277,0.003); 217 | glutSolidCube(1); 218 | glPopMatrix(); 219 | 220 | glPushMatrix(); 221 | glTranslated(0.11,1.99,-0.4); 222 | glScaled(0.003,0.277,0.003); 223 | glutSolidCube(1); 224 | glPopMatrix(); 225 | 226 | glPushMatrix(); 227 | glTranslated(0.15,1.99,-0.4); 228 | glScaled(0.003,0.277,0.003); 229 | glutSolidCube(1); 230 | glPopMatrix(); 231 | 232 | /// 233 | 234 | glColor3d(0,0,0); 235 | glPushMatrix(); 236 | glTranslated(-0.22,0,0); 237 | glPushMatrix(); 238 | glTranslated(0.07,1.99,-0.4); 239 | glScaled(0.003,0.277,0.003); 240 | glutSolidCube(1); 241 | glPopMatrix(); 242 | 243 | glPushMatrix(); 244 | glTranslated(0.11,1.99,-0.4); 245 | glScaled(0.003,0.277,0.003); 246 | glutSolidCube(1); 247 | glPopMatrix(); 248 | 249 | glPushMatrix(); 250 | glTranslated(0.15,1.99,-0.4); 251 | glScaled(0.003,0.277,0.003); 252 | glutSolidCube(1); 253 | glPopMatrix(); 254 | glPopMatrix(); 255 | /// ROD END 256 | 257 | ///Horizontal rod 258 | glPushMatrix(); 259 | glTranslated(2.2,0,-0.1); 260 | glScaled(4.2,1,1); 261 | glColor3d(0,0,0); 262 | glPushMatrix(); 263 | glTranslated(-0.528,1.85,-0.3); 264 | glScaled(0.1,0.003,0.003); 265 | glutSolidCube(1); 266 | glPopMatrix(); 267 | 268 | glPushMatrix(); 269 | glTranslated(-0.528,2,-0.3); 270 | glScaled(0.1,0.003,0.003); 271 | glutSolidCube(1); 272 | glPopMatrix(); 273 | 274 | glPushMatrix(); 275 | glTranslated(-0.528,2.15,-0.3); 276 | glScaled(0.1,0.003,0.003); 277 | glutSolidCube(1); 278 | glPopMatrix(); 279 | glColor3d(1,1,1); 280 | glPopMatrix(); 281 | 282 | glPopMatrix(); 283 | 284 | 285 | /// pasher piller left 1 286 | glColor3d(1,1,1); 287 | glPushMatrix(); 288 | glTranslated(0.1,0,-0.4); 289 | glRotated(45,0,1,0); 290 | 291 | glPushMatrix(); 292 | glTranslated(-0.605,1.94,-0.3); 293 | glScaled(0.045,0.65,0.03); 294 | glutSolidCube(1); 295 | glPopMatrix(); 296 | 297 | glPushMatrix(); 298 | glTranslated(-0.45,1.94,-0.3); 299 | glScaled(0.045,0.65,0.03); 300 | glutSolidCube(1); 301 | glPopMatrix(); 302 | 303 | glPushMatrix(); 304 | glTranslated(-0.528,2.258,-0.3); 305 | glScaled(0.199,0.04,0.03); 306 | glutSolidCube(1); 307 | glPopMatrix(); 308 | 309 | glPushMatrix(); 310 | glTranslated(-0.528,1.68,-0.3); 311 | glScaled(0.199,0.02,0.06); 312 | glutSolidCube(1); 313 | glPopMatrix(); 314 | 315 | /// ROD 316 | glColor3d(0,0,0); 317 | glPushMatrix(); 318 | glTranslated(-0.64,-0.05,0.1); 319 | glScaled(1,1.02,1); 320 | glPushMatrix(); 321 | glTranslated(0.078,1.99,-0.4); 322 | glScaled(0.003,0.56,0.003); 323 | glutSolidCube(1); 324 | glPopMatrix(); 325 | 326 | glPushMatrix(); 327 | glTranslated(0.11,1.99,-0.4); 328 | glScaled(0.003,0.56,0.003); 329 | glutSolidCube(1); 330 | glPopMatrix(); 331 | 332 | glPushMatrix(); 333 | glTranslated(0.145,1.99,-0.4); 334 | glScaled(0.003,0.56,0.003); 335 | glutSolidCube(1); 336 | glPopMatrix(); 337 | glPopMatrix(); 338 | 339 | /// 340 | glColor3d(1,1,1); 341 | 342 | ///Horizontal rod 343 | glColor3d(0,0,0); 344 | glPushMatrix(); 345 | glTranslated(-0.528,1.85,-0.3); 346 | glScaled(0.1,0.003,0.003); 347 | glutSolidCube(1); 348 | glPopMatrix(); 349 | 350 | glPushMatrix(); 351 | glTranslated(-0.528,2,-0.3); 352 | glScaled(0.1,0.003,0.003); 353 | glutSolidCube(1); 354 | glPopMatrix(); 355 | 356 | glPushMatrix(); 357 | glTranslated(-0.528,2.15,-0.3); 358 | glScaled(0.1,0.003,0.003); 359 | glutSolidCube(1); 360 | glPopMatrix(); 361 | glColor3d(1,1,1); 362 | glPopMatrix(); 363 | 364 | /// pasher piller left 2 365 | glPushMatrix(); 366 | glTranslated(0.65,0,0.3); 367 | glRotated(-45,0,1,0); 368 | 369 | glPushMatrix(); 370 | glTranslated(-0.605,1.94,-0.3); 371 | glScaled(0.045,0.65,0.03); 372 | glutSolidCube(1); 373 | glPopMatrix(); 374 | 375 | glPushMatrix(); 376 | glTranslated(-0.45,1.94,-0.3); 377 | glScaled(0.045,0.65,0.03); 378 | glutSolidCube(1); 379 | glPopMatrix(); 380 | 381 | glPushMatrix(); 382 | glTranslated(-0.528,2.258,-0.3); 383 | glScaled(0.199,0.04,0.03); 384 | glutSolidCube(1); 385 | glPopMatrix(); 386 | 387 | glPushMatrix(); 388 | glTranslated(-0.528,1.68,-0.3); 389 | glScaled(0.199,0.02,0.06); 390 | glutSolidCube(1); 391 | glPopMatrix(); 392 | 393 | ///ROD 394 | glColor3d(0,0,0); 395 | glPushMatrix(); 396 | glTranslated(-0.64,-0.05,0.1); 397 | glScaled(1,1.02,1); 398 | glPushMatrix(); 399 | glTranslated(0.078,1.99,-0.4); 400 | glScaled(0.003,0.56,0.003); 401 | glutSolidCube(1); 402 | glPopMatrix(); 403 | 404 | glPushMatrix(); 405 | glTranslated(0.11,1.99,-0.4); 406 | glScaled(0.003,0.56,0.003); 407 | glutSolidCube(1); 408 | glPopMatrix(); 409 | 410 | glPushMatrix(); 411 | glTranslated(0.145,1.99,-0.4); 412 | glScaled(0.003,0.56,0.003); 413 | glutSolidCube(1); 414 | glPopMatrix(); 415 | glPopMatrix(); 416 | glColor3d(1,1,1); 417 | ///ROD 418 | 419 | ///Horizontal rod 420 | glColor3d(0,0,0); 421 | glPushMatrix(); 422 | glTranslated(-0.528,1.85,-0.3); 423 | glScaled(0.1,0.003,0.003); 424 | glutSolidCube(1); 425 | glPopMatrix(); 426 | 427 | glPushMatrix(); 428 | glTranslated(-0.528,2,-0.3); 429 | glScaled(0.1,0.003,0.003); 430 | glutSolidCube(1); 431 | glPopMatrix(); 432 | 433 | glPushMatrix(); 434 | glTranslated(-0.528,2.15,-0.3); 435 | glScaled(0.1,0.003,0.003); 436 | glutSolidCube(1); 437 | glPopMatrix(); 438 | glColor3d(1,1,1); 439 | 440 | glPopMatrix(); 441 | 442 | 443 | ///Choto pillers 444 | 445 | glPushMatrix(); 446 | /// pasher piller left 1 447 | glTranslated(0.06,0,0.14); 448 | glPushMatrix(); 449 | 450 | glTranslated(-0.2,0,-0.31); 451 | glRotated(45,0,1,0); 452 | 453 | glPushMatrix(); 454 | glTranslated(-0.605,1.88,-0.3); 455 | glScaled(0.045,0.4,0.03); 456 | glutSolidCube(1); 457 | glPopMatrix(); 458 | 459 | glPushMatrix(); 460 | glTranslated(-0.45,1.88,-0.3); 461 | glScaled(0.045,0.4,0.03); 462 | glutSolidCube(1); 463 | glPopMatrix(); 464 | 465 | glPushMatrix(); 466 | glTranslated(-0.528,2.08,-0.3); 467 | glScaled(0.2,0.04,0.03); 468 | glutSolidCube(1); 469 | glPopMatrix(); 470 | 471 | glPushMatrix(); 472 | glTranslated(-0.528,1.68,-0.3); 473 | glScaled(0.199,0.02,0.06); 474 | glutSolidCube(1); 475 | glPopMatrix(); 476 | 477 | ///ROD 478 | glColor3d(0,0,0); 479 | glPushMatrix(); 480 | glTranslated(-0.641,0.43,0.1); 481 | glScaled(1,0.73,1); 482 | glPushMatrix(); 483 | glTranslated(0.078,1.99,-0.4); 484 | glScaled(0.003,0.56,0.003); 485 | glutSolidCube(1); 486 | glPopMatrix(); 487 | 488 | glPushMatrix(); 489 | glTranslated(0.11,1.99,-0.4); 490 | glScaled(0.003,0.56,0.003); 491 | glutSolidCube(1); 492 | glPopMatrix(); 493 | 494 | glPushMatrix(); 495 | glTranslated(0.145,1.99,-0.4); 496 | glScaled(0.003,0.56,0.003); 497 | glutSolidCube(1); 498 | glPopMatrix(); 499 | glPopMatrix(); 500 | 501 | ///Horizontal rod 502 | glColor3d(0,0,0); 503 | glPushMatrix(); 504 | glTranslated(-0.528,1.8,-0.3); 505 | glScaled(0.1,0.003,0.003); 506 | glutSolidCube(1); 507 | glPopMatrix(); 508 | 509 | glPushMatrix(); 510 | glTranslated(-0.528,1.96,-0.3); 511 | glScaled(0.1,0.003,0.003); 512 | glutSolidCube(1); 513 | glPopMatrix(); 514 | glColor3d(1,1,1); 515 | ///ROD 516 | 517 | glPopMatrix(); 518 | 519 | /// pasher piller left 2 520 | glPushMatrix(); 521 | glTranslated(0.83,0,0.39); 522 | glRotated(-45,0,1,0); 523 | 524 | glPushMatrix(); 525 | glTranslated(-0.605,1.88,-0.3); 526 | glScaled(0.045,0.4,0.03); 527 | glutSolidCube(1); 528 | glPopMatrix(); 529 | 530 | glPushMatrix(); 531 | glTranslated(-0.45,1.88,-0.3); 532 | glScaled(0.045,0.4,0.03); 533 | glutSolidCube(1); 534 | glPopMatrix(); 535 | 536 | glPushMatrix(); 537 | glTranslated(-0.528,2.1,-0.3); 538 | glScaled(0.199,0.04,0.03); 539 | glutSolidCube(1); 540 | glPopMatrix(); 541 | 542 | glPushMatrix(); 543 | glTranslated(-0.528,1.68,-0.3); 544 | glScaled(0.199,0.02,0.06); 545 | glutSolidCube(1); 546 | glPopMatrix(); 547 | 548 | 549 | ///Horizontal rod 550 | glColor3d(0,0,0); 551 | glPushMatrix(); 552 | glTranslated(-0.528,1.8,-0.3); 553 | glScaled(0.1,0.003,0.003); 554 | glutSolidCube(1); 555 | glPopMatrix(); 556 | 557 | glPushMatrix(); 558 | glTranslated(-0.528,1.96,-0.3); 559 | glScaled(0.1,0.003,0.003); 560 | glutSolidCube(1); 561 | glPopMatrix(); 562 | glColor3d(1,1,1); 563 | 564 | ///ROD 565 | glColor3d(0,0,0); 566 | glPushMatrix(); 567 | glTranslated(-0.641,0.43,0.1); 568 | glScaled(1,0.73,1); 569 | glPushMatrix(); 570 | glTranslated(0.078,1.99,-0.4); 571 | glScaled(0.003,0.56,0.003); 572 | glutSolidCube(1); 573 | glPopMatrix(); 574 | 575 | glPushMatrix(); 576 | glTranslated(0.11,1.99,-0.4); 577 | glScaled(0.003,0.56,0.003); 578 | glutSolidCube(1); 579 | glPopMatrix(); 580 | 581 | glPushMatrix(); 582 | glTranslated(0.145,1.99,-0.4); 583 | glScaled(0.003,0.56,0.003); 584 | glutSolidCube(1); 585 | glPopMatrix(); 586 | glPopMatrix(); 587 | glColor3d(1,1,1); 588 | ///ROD 589 | 590 | glPopMatrix(); 591 | 592 | 593 | glPopMatrix(); 594 | 595 | /// Circle 596 | 597 | glColor3d(1,0,0); 598 | glPushMatrix(); 599 | glTranslated(0,2.1,-0.44); 600 | glScaled(0.35,0.35,0.01); 601 | glutSolidSphere(1,50,50); 602 | glPopMatrix(); 603 | 604 | glColor3d(0,0,0); 605 | glPushMatrix(); 606 | glTranslated(-0.18,1.9,-0.45); 607 | glScaled(0.01,0.5,0.01); 608 | glutSolidCube(1); 609 | glPopMatrix(); 610 | 611 | glColor3d(0,0,0); 612 | glPushMatrix(); 613 | glTranslated(0.18,1.9,-0.45); 614 | glScaled(0.01,0.5,0.01); 615 | glutSolidCube(1); 616 | glPopMatrix(); 617 | 618 | 619 | } 620 | 621 | void fan(){ 622 | glColor3d(0.5,1,0); 623 | glPushMatrix(); 624 | glTranslated(0,0,0); 625 | glScaled(1,1,0.7); 626 | glutSolidSphere(0.8,30,30); 627 | glPopMatrix(); 628 | 629 | glColor3d(0.5,1,0); 630 | glPushMatrix(); 631 | glTranslated(0,0,0); 632 | glRotated(5,0,1,0); 633 | glScaled(0.5,2.5,0.05); 634 | glutSolidSphere(1,30,30); 635 | glPopMatrix(); 636 | 637 | glColor3d(0.5,1,0); 638 | glPushMatrix(); 639 | glTranslated(0,0,0); 640 | glRotated(-5,0,1,0); 641 | glRotated(90,0,0,1); 642 | glScaled(0.5,2.5,0.05); 643 | glutSolidSphere(1,30,30); 644 | glPopMatrix(); 645 | 646 | } 647 | 648 | void plane(){ 649 | const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; 650 | double a = t*90.0; 651 | 652 | /// Main body 653 | glColor3d(0.5,1,0); 654 | glPushMatrix(); 655 | glTranslated(0,0,0); 656 | glScaled(3,0.4,0.5); 657 | glutSolidSphere(1,30,30); 658 | glPopMatrix(); 659 | 660 | glColor3d(0,0,0); 661 | glPushMatrix(); 662 | glTranslated(1.7,0.1,0); 663 | glScaled(1.5,0.7,0.8); 664 | glRotated(40,0,1,0); 665 | glutSolidSphere(0.45,30,30); 666 | glPopMatrix(); 667 | 668 | ///Samner Pakha 669 | 670 | ///Right 671 | glColor3d(0.8,1,0); 672 | glPushMatrix(); 673 | glTranslated(0,0,1.2); 674 | glRotated(-50,0,1,0); 675 | glScaled(0.7,0.1,3); 676 | glRotated(25,0,1,0); 677 | glutSolidCube(1); 678 | glPopMatrix(); 679 | 680 | glColor3d(0.8,1,0); 681 | glPushMatrix(); 682 | glTranslated(-0.3,-0.15,1.5); 683 | glRotated(90,0,1,0); 684 | glScaled(0.1,0.1,0.9); 685 | glutSolidTorus(0.5,0.5,50,50); 686 | glPopMatrix(); 687 | 688 | glColor3d(0.8,1,0); 689 | glPushMatrix(); 690 | glTranslated(0.2,-0.15,0.9); 691 | glRotated(90,0,1,0); 692 | 693 | /// FAN 694 | // glPushMatrix(); 695 | // glTranslated(0,0,0.5); 696 | // glRotated(10*a,0,0,1); 697 | // glScaled(0.1,0.1,0.1); 698 | // fan(); 699 | // glPopMatrix(); 700 | 701 | glScaled(0.1,0.1,0.9); 702 | glutSolidTorus(0.5,0.5,50,50); 703 | glPopMatrix(); 704 | 705 | ///Left 706 | glColor3d(0.8,1,0); 707 | glPushMatrix(); 708 | glTranslated(0,0,-1.2); 709 | glRotated(50,0,1,0); 710 | glScaled(0.7,0.1,3); 711 | glRotated(-25,0,1,0); 712 | glutSolidCube(1); 713 | glPopMatrix(); 714 | 715 | glColor3d(0.8,1,0); 716 | glPushMatrix(); 717 | glTranslated(-0.3,-0.15,-1.5); 718 | glRotated(90,0,1,0); 719 | glScaled(0.1,0.1,0.9); 720 | glutSolidTorus(0.5,0.5,50,50); 721 | glPopMatrix(); 722 | 723 | glColor3d(0.8,1,0); 724 | glPushMatrix(); 725 | glTranslated(0.2,-0.15,-0.9); 726 | glRotated(90,0,1,0); 727 | glScaled(0.1,0.1,0.9); 728 | glutSolidTorus(0.5,0.5,50,50); 729 | glPopMatrix(); 730 | 731 | 732 | ///Pechoner pakha 733 | glPushMatrix(); 734 | glTranslated(-2.8,0,0); 735 | glScaled(0.8,0.5,0.3); 736 | 737 | ///Right 738 | glColor3d(0.8,1,0); 739 | glPushMatrix(); 740 | glTranslated(0.4,0,1.5); 741 | glRotated(-30,0,1,0); 742 | glScaled(0.7,0.1,3); 743 | glRotated(10,0,1,0); 744 | glutSolidCube(1); 745 | glPopMatrix(); 746 | 747 | ///left 748 | glColor3d(0.8,1,0); 749 | glPushMatrix(); 750 | glTranslated(0.4,0,-1.5); 751 | glRotated(30,0,1,0); 752 | glScaled(0.7,0.1,3); 753 | glRotated(-10,0,1,0); 754 | glutSolidCube(1); 755 | glPopMatrix(); 756 | glPopMatrix(); 757 | 758 | /// Pesoner Uporer pakha 759 | glColor3d(0.8,1,0); 760 | glPushMatrix(); 761 | glTranslated(-2.7,0.5,0); 762 | glRotated(45,0,0,1); 763 | glScaled(0.8,2,0.1); 764 | glRotated(-20,0,0,1); 765 | glutSolidCube(0.5); 766 | glPopMatrix(); 767 | 768 | // glColor3d(0.8,1,0); 769 | // glPushMatrix(); 770 | // glTranslated(-2.95,0.85,0); 771 | // glRotated(90,0,1,0); 772 | // glScaled(0.05,0.05,0.6); 773 | // glutSolidTorus(0.5,0.5,50,50); 774 | // glPopMatrix(); 775 | 776 | 777 | ///FANS 778 | 779 | // glPushMatrix(); 780 | // glTranslated(0,0,0); 781 | // glRotated(10*a,0,0,1); 782 | // //glRotated(90,1,0,0); 783 | // fan(); 784 | // glPopMatrix(); 785 | } 786 | 787 | 788 | void singleTolaHouse(int R,int G,int B){ 789 | glColor3d(r[R%11],g[G%11],b[B%11]); 790 | glPushMatrix(); 791 | glTranslated(0,0,0); 792 | glutSolidCube(1); 793 | glPopMatrix(); 794 | 795 | glColor3d(0,0,0); 796 | glPushMatrix(); 797 | glTranslated(0.2,0,0); 798 | glScaled(0.3,0.3,1.001); 799 | glutSolidCube(1); 800 | glPopMatrix(); 801 | 802 | glColor3d(0,0,0); 803 | glPushMatrix(); 804 | glTranslated(-0.2,0,0); 805 | glScaled(0.3,0.3,1.001); 806 | glutSolidCube(1); 807 | glPopMatrix(); 808 | 809 | glColor3d(0,0,0); 810 | glPushMatrix(); 811 | glTranslated(0,0,0.2); 812 | glScaled(1.001,0.3,0.3); 813 | glutSolidCube(1); 814 | glPopMatrix(); 815 | 816 | glColor3d(0,0,0); 817 | glPushMatrix(); 818 | glTranslated(0,0,-0.2); 819 | glScaled(1.001,0.3,0.3); 820 | glutSolidCube(1); 821 | glPopMatrix(); 822 | 823 | } 824 | 825 | void house(int n,int R,int G){ 826 | for(int i=0;i=-5&&i<=5){} 886 | else{ 887 | tola[i+(EN_SIZE/2)+1][j+(EN_SIZE/2)+1]=(rand()%5)+1; 888 | glPushMatrix(); 889 | glTranslated(i,0,j); 890 | house(tola[i+(EN_SIZE/2)+1][j+(EN_SIZE/2)+1],i,j); 891 | glPopMatrix(); 892 | } 893 | } 894 | } 895 | 896 | // glColor3d(0,1,0.7); 897 | 898 | // glPushMatrix(); 899 | // glRotated(angle,0,1,0); 900 | // glPushMatrix(); 901 | // glTranslated(tX,tY,tZ); 902 | // glScaled(1,1,2); 903 | // //glRotated(90,1,0,0); 904 | // glutSolidCube(1); 905 | // glPopMatrix(); 906 | // glPopMatrix(); 907 | } 908 | 909 | void draw(){ 910 | double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; 911 | double a = t*90.0; 912 | 913 | TIME = t; 914 | 915 | ///Plane 916 | if(rotX>11)rotX=11; 917 | if(rotX<-11)rotX=-11; 918 | if(rotZ>10)rotZ=10; 919 | if(rotZ<-15)rotZ=-15; 920 | 921 | glPushMatrix(); 922 | glTranslated(0,1,0); 923 | glRotated(90,0,1,0); 924 | glRotated(5,0,0,1); 925 | glRotated(rotX,1,0,0); 926 | glRotated(rotY,0,1,0); 927 | glRotated(rotZ,0,0,1); 928 | 929 | glScaled(0.4,0.4,0.4); 930 | plane(); 931 | glPopMatrix(); 932 | 933 | ///Environment 934 | if(tX>=4.1)tX=4.1; 935 | if(tX<=-4.1)tX=-4.1; 936 | if(tY>0.1)tY= 0.1; 937 | if(tY<-15)tY= -15; 938 | 939 | glPushMatrix(); 940 | glTranslated(tX,tY,tZ); 941 | environment(2); 942 | glPopMatrix(); 943 | 944 | glPushMatrix(); 945 | glTranslated(tX,tY,tZ1); 946 | soheedMinarEnv(); 947 | glPopMatrix(); 948 | 949 | glPushMatrix(); 950 | glTranslated(tX,tY,tZ2); 951 | environment(3); 952 | glPopMatrix(); 953 | 954 | glPushMatrix(); 955 | glTranslated(tX,tY,tZ3); 956 | environment(1); 957 | glPopMatrix(); 958 | 959 | glPushMatrix(); 960 | glTranslated(tX,tY,tZ4); 961 | environment(5); 962 | glPopMatrix(); 963 | 964 | glPushMatrix(); 965 | glTranslated(tX,tY,tZ5); 966 | environment(4); 967 | glPopMatrix(); 968 | 969 | glPushMatrix(); 970 | glTranslated(tX,tY,tZ6); 971 | environment(2); 972 | glPopMatrix(); 973 | 974 | tZ+=speed; 975 | tZ1+=speed; 976 | tZ2+=speed; 977 | tZ3+=speed; 978 | tZ4+=speed; 979 | tZ5+=speed; 980 | tZ6+=speed; 981 | 982 | if(tZ>=20)tZ=-110; 983 | if(tZ1>=20)tZ1=-110; 984 | if(tZ2>=20)tZ2=-110; 985 | if(tZ3>=20)tZ3=-110; 986 | if(tZ4>=20)tZ4=-110; 987 | if(tZ5>=20)tZ5=-110; 988 | if(tZ6>=20)tZ6=-110; 989 | 990 | if(rotX>0)rotX-=angleBackFrac; 991 | if(rotX<0)rotX+=angleBackFrac; 992 | if(rotY>0)rotY-=angleBackFrac; 993 | if(rotY<0)rotY+=angleBackFrac; 994 | if(rotZ>0)rotZ-=angleBackFrac; 995 | if(rotZ<0)rotZ+=angleBackFrac; 996 | 997 | //cout<=0.7)speed=0.7; 1002 | } 1003 | 1004 | 1005 | void drawBitmapText(char *str,float x,float y,float z) 1006 | { 1007 | char *c; 1008 | glRasterPos3f(x,y+8,z); 1009 | 1010 | for (c=str; *c != '\0'; c++) 1011 | { 1012 | glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_10, *c); 1013 | } 1014 | } 1015 | 1016 | void drawStrokeText(char* str,int x,int y,int z) 1017 | { 1018 | char *c; 1019 | glPushMatrix(); 1020 | glTranslatef(x, y+8,z); 1021 | glScalef(0.002f,0.002f,z); 1022 | 1023 | for (c=str; *c != '\0'; c++) 1024 | { 1025 | glutStrokeCharacter(GLUT_STROKE_ROMAN , *c); 1026 | } 1027 | glPopMatrix(); 1028 | } 1029 | 1030 | void drawStrokeText2(char* str,int x,int y,int z) 1031 | { 1032 | char *c; 1033 | glPushMatrix(); 1034 | glTranslatef(x, y+8,z); 1035 | glScalef(0.005f,0.005f,z); 1036 | 1037 | for (c=str; *c != '\0'; c++) 1038 | { 1039 | glutStrokeCharacter(GLUT_STROKE_ROMAN , *c); 1040 | } 1041 | glPopMatrix(); 1042 | } 1043 | void drawStrokeChar(char c,float x,float y,float z) 1044 | { 1045 | glPushMatrix(); 1046 | glTranslatef(x, y+8,z); 1047 | glScalef(0.002f,0.002f,z); 1048 | glutStrokeCharacter(GLUT_STROKE_ROMAN , c); 1049 | glPopMatrix(); 1050 | } 1051 | 1052 | static void display(void) 1053 | { 1054 | const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0; 1055 | double a = t*90.0; 1056 | double aa=a; 1057 | 1058 | if(!rot){ 1059 | a=0; 1060 | } 1061 | 1062 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1063 | 1064 | glLoadIdentity(); 1065 | 1066 | gluLookAt( 0.0, 4.5, 10.0, 1067 | 0, 4, 0, 1068 | 0, 1.0f, 0.0f); 1069 | 1070 | if(START){ 1071 | 1072 | glPushMatrix(); 1073 | glTranslated(0,0,0); 1074 | glScaled(zoom,zoom,zoom); 1075 | glRotated(a,0,1,0); 1076 | draw(); 1077 | glPopMatrix(); 1078 | 1079 | drawStrokeText("UP: W, DOWN: S, LEFT: A, RIGHT: D, MAIN MENU: M",-8,0.9,0); 1080 | drawStrokeText("TIME : ",3,0,0); 1081 | int mod,number=0; 1082 | while(TIME){ 1083 | mod=TIME%10; 1084 | number=number*10+mod; 1085 | TIME/=10; 1086 | } 1087 | float tmp=0; 1088 | while(number){ 1089 | mod=number%10; 1090 | drawStrokeChar(mod+48,4+tmp,0,0); 1091 | number/=10; 1092 | tmp+=0.2; 1093 | } 1094 | } 1095 | else{ 1096 | 1097 | glPushMatrix(); 1098 | glTranslated(0,3,0); 1099 | glRotated(aa,0,1,0); 1100 | glScaled(1.5,1.5,1.5); 1101 | plane(); 1102 | glPopMatrix(); 1103 | 1104 | drawStrokeText("Press G to Start",-1,-1,0); 1105 | drawStrokeText2("Plane Game",-2,0,0); 1106 | } 1107 | 1108 | //glColor3d(1,1,0); 1109 | //drawStrokeText("Osama Hosam's OpenGL Tutorials",200,200,0); 1110 | 1111 | // glRasterPos2i(100, 120); 1112 | // glColor4f(0.0f, 0.0f, 1.0f, 1.0f); 1113 | // glutBitmapString(GLUT_BITMAP_HELVETICA_18, "text to render"); 1114 | 1115 | //drawBitmapText("Osama Hosam's OpenGL Tutorials",0,0,0); 1116 | 1117 | 1118 | //drawStrokeChar(49,2,0,0); 1119 | 1120 | 1121 | glutSwapBuffers(); 1122 | } 1123 | 1124 | 1125 | static void key(unsigned char key, int x, int y) 1126 | { 1127 | float frac = 0.3; 1128 | float rotFrac = 1; 1129 | switch (key) 1130 | { 1131 | case 27 : 1132 | case 'q': 1133 | exit(0); 1134 | break; 1135 | case 'r': 1136 | rot=true; 1137 | break; 1138 | case 't': 1139 | rot=false; 1140 | break; 1141 | case 'z': 1142 | zoom+=0.05; 1143 | break; 1144 | case 'Z': 1145 | zoom-=0.05; 1146 | case 'w': 1147 | tY-=frac; 1148 | rotZ+=rotFrac; 1149 | break; 1150 | case 's': 1151 | tY+=frac; 1152 | rotZ-=rotFrac; 1153 | break; 1154 | case 'a': 1155 | tX+=frac; 1156 | rotX-=rotFrac*3; 1157 | rotY+=rotFrac/2; 1158 | break; 1159 | case 'd': 1160 | tX-=frac; 1161 | rotX+=rotFrac*3; 1162 | rotY-=rotFrac/2; 1163 | break; 1164 | // case 'y': 1165 | // rotX-=rotFrac; 1166 | // break; 1167 | // case 'h': 1168 | // rotX+=rotFrac; 1169 | // break; 1170 | // case 'g': 1171 | // rotY+=rotFrac; 1172 | // break; 1173 | // case 'j': 1174 | // rotY-=rotFrac; 1175 | // break; 1176 | case 'g': 1177 | START=true; 1178 | break; 1179 | case 'm': 1180 | START=false; 1181 | break; 1182 | // case 'o': 1183 | // cosX-=frac*cos(rotX*rad); 1184 | // cosY+=frac*cos(rotY*rad); 1185 | // cosZ-=frac*cos(rotZ*rad); 1186 | // //cout<<"Front : "<