Changeset 2931 in orxonox.OLD for orxonox/trunk/importer
- Timestamp:
- Nov 20, 2004, 1:33:51 PM (20 years ago)
- Location:
- orxonox/trunk/importer
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/importer/Makefile.am
r2776 r2931 8 8 importer_SOURCES=framework.cc windowHandler.cc object.cc array.cc material.cc 9 9 10 noinst_HEADERS= windowHandler.h object.h array.h material.h10 noinst_HEADERS=framework.h windowHandler.h object.h array.h material.h 11 11 12 12 -
orxonox/trunk/importer/Makefile.in
r2776 r2931 152 152 AM_LDFLAGS = "-L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib -lXt -lX11" $(MWINDOWS) 153 153 importer_SOURCES = framework.cc windowHandler.cc object.cc array.cc material.cc 154 noinst_HEADERS = windowHandler.h object.h array.h material.h154 noinst_HEADERS = framework.h windowHandler.h object.h array.h material.h 155 155 all: all-am 156 156 -
orxonox/trunk/importer/framework.cc
r2863 r2931 1 #include "windowHandler.h" // Include the Whandler Basecode 2 #include "object.h" 1 #include "framework.h" 3 2 4 3 int verbose = 1; 5 WindowHandler wHandler; // Create an instance of the whandler basecode class6 Object* obj;7 float rotator = 0.0;8 GLfloat whiteLight[] = {1.0, 1.0, 0.0,1.0};9 4 10 5 void DrawGLScene() 11 6 { 12 rotator +=.001;7 rotatorP += rotatorV; 13 8 14 9 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); … … 18 13 glLoadIdentity(); 19 14 gluPerspective(45.0f,500/375,0.1f,100.0f); 20 gluLookAt (5*sin(rotator),7.5,5*cos(rotator), 0,0,0, 0,1,0); 21 whiteLight[1] = .5+.5*sin(rotator*10); 22 whiteLight[2] = .5+.5*sin(rotator*10); 15 gluLookAt (5*sin(rotatorP),7.5,5*cos(rotatorP), 0,0,0, 0,1,0); 23 16 24 GLfloat lightPosition[] = {10.0*sin(rotator*10), 10, 19.0, 0.0};25 glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);26 27 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight);28 17 obj->draw(); 29 18 … … 53 42 obj = new Object(); 54 43 44 glEnable(GL_LIGHTING); 45 glEnable(GL_DEPTH_TEST); 46 47 GLfloat whiteLight[] = {1.0, 1.0, 1.0,1.0}; 48 GLfloat light0Position[] = {10.0, 10.0, 10.0, 0.0}; 49 GLfloat light1Position[] = {-10.0, -7.0, -6.0, 0.0}; 55 50 GLfloat lmodelAmbient[] = {.1, .1, .1, 1.0}; 51 52 glEnable(GL_LIGHT0); 53 glLightfv(GL_LIGHT0, GL_POSITION, light0Position); 56 54 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteLight); 57 55 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteLight); 58 glEnable(GL_LIGHTING); 59 glEnable(GL_LIGHT0); 60 glEnable(GL_DEPTH_TEST); 61 56 57 glEnable(GL_LIGHT1); 58 glLightfv(GL_LIGHT1, GL_POSITION, light1Position); 59 glLightfv(GL_LIGHT1, GL_DIFFUSE, whiteLight); 60 glLightfv(GL_LIGHT1, GL_SPECULAR, whiteLight); 61 62 rotatorP = .0; 63 rotatorV = .0; 62 64 // Build the font from a TGA image font.tga in the data directory 63 65 // Hide the mouse cursor 64 SDL_ShowCursor(0);66 SDL_ShowCursor(2); 65 67 66 68 // This is the main loop for the entire program and it will run until done==TRUE … … 73 75 while ( SDL_PollEvent(&event) ) { 74 76 switch (event.type) { 77 case SDL_MOUSEMOTION: 78 if (verbose >=3) 79 printf("Mouse motion about %d,%d Pixels to (%d,%d).\n", 80 event.motion.xrel, event.motion.yrel, 81 event.motion.x, event.motion.y); 82 break; 83 case SDL_MOUSEBUTTONDOWN: 84 printf("MouseButton %d pressed at (%d,%d).\n", 85 event.button.button, event.button.x, event.button.y); 86 rotatorV = ( 250-event.button.x) / 500.0 /100; 87 88 break; 89 case SDL_MOUSEBUTTONUP: 90 printf("MouseButton %d released at (%d,%d).\n", 91 event.button.button, event.button.x, event.button.y); 92 93 94 break; 95 75 96 // If a quit event was recieved 76 97 case SDL_QUIT: -
orxonox/trunk/importer/object.cc
r2863 r2931 295 295 } 296 296 objFileName = fileName; 297 char Buffer[ 500];297 char Buffer[10000]; 298 298 while(!OBJ_FILE->eof()) 299 299 { 300 OBJ_FILE->getline(Buffer, 500);300 OBJ_FILE->getline(Buffer, 10000); 301 301 if (verbose >=4) 302 302 printf ("Read input line: %s\n",Buffer); -
orxonox/trunk/importer/windowHandler.cc
r2759 r2931 3 3 #include "windowHandler.h" 4 4 #include <stdio.h> 5 void WindowHandler::ReSizeGLScene(GLsizei width, GLsizei height) 5 void WindowHandler::ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window 6 6 { 7 if (height==0) 7 if (height==0) // Prevent A Divide By Zero By 8 8 { 9 height=1; 9 height=1;// Making Height Equal One 10 10 } 11 11 12 glViewport(0,0,width,height); 12 glViewport(0,0,width,height); // Reset The Current Viewport 13 13 14 15 glMatrixMode(GL_PROJECTION); 14 15 glMatrixMode(GL_PROJECTION); // Select The Projection Matrix 16 16 glLoadIdentity(); 17 17 … … 21 21 gluLookAt (0,0,15, 0,0,0, 0,1,0); 22 22 23 glMatrixMode(GL_MODELVIEW); 24 glLoadIdentity(); 23 glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix 24 glLoadIdentity(); // Reset The Modelview Matrix 25 25 26 26 } … … 29 29 int WindowHandler::InitGL(GLvoid) // All Setup For OpenGL Goes Here 30 30 { 31 glEnable(GL_TEXTURE_2D); 32 glShadeModel(GL_SMOOTH); 33 glClearColor(0.00f, 0.00f, 0.00f, 0.0f); 34 glClearDepth(1.0f); 35 glEnable(GL_DEPTH_TEST); 36 glDepthFunc(GL_LEQUAL); 37 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); 31 glEnable(GL_TEXTURE_2D); // Enable Texture Mapping 32 glShadeModel(GL_SMOOTH); // Enable Smooth Shading 33 glClearColor(0.00f, 0.00f, 0.00f, 0.0f); // Black Background 34 glClearDepth(1.0f); // Depth Buffer Setup 35 glEnable(GL_DEPTH_TEST); // Enables Depth Testing 36 glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do 37 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations 38 38 39 39 return TRUE; … … 41 41 42 42 43 GLvoid WindowHandler::KillGLWindow(GLvoid) 43 GLvoid WindowHandler::KillGLWindow(GLvoid) // Properly Kill The Window 44 44 { 45 45 SDL_Quit(); … … 68 68 SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &size); 69 69 70 ReSizeGLScene(width, height); 70 ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen 71 71 72 if (!InitGL()) 72 if (!InitGL()) // Initialize Our Newly Created GL Window 73 73 { 74 KillGLWindow();// Reset The Display75 return FALSE; // Return FALSE74 KillGLWindow(); // Reset The Display 75 return FALSE; 76 76 } 77 77 78 return TRUE; // Success78 return TRUE; 79 79 } 80 80 -
orxonox/trunk/importer/windowHandler.h
r2804 r2931 14 14 #include <math.h> 15 15 16 #ifdef __WIN32__ 17 #include <windows.h> 18 #endif /* __WIN32__ */ 16 19 17 20 #define TRUE 1
Note: See TracChangeset
for help on using the changeset viewer.