46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
#include <GL/gl.h>
|
|
#include <math.h>
|
|
#include <zoom/render.h>
|
|
#include <zoom/player.h>
|
|
#include <zoom/level.h>
|
|
#include <neofx/math.h>
|
|
|
|
extern PLAYER player;
|
|
extern LEVEL level;
|
|
extern GLuint sphere;
|
|
|
|
void Render() {
|
|
GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 };
|
|
GLfloat light_emission[] = {1.0, 1.0, 1.0, 1.0};
|
|
GLfloat std_emission[] = {0.0, 0.0, 0.0, 1.0};
|
|
MATRIX rotate = {
|
|
player.rotycos, 0.0, -player.rotysin, 0.0,
|
|
0.0, 1.0, 0.0, 0.0,
|
|
player.rotysin, 0.0, player.rotycos, 0.0,
|
|
0.0, 0.0, 0.0, 1.0
|
|
};
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
glLoadIdentity();
|
|
|
|
glRotatef(player.rotx, 1.0, 0.0, 0.0);
|
|
glMultMatrixf(rotate.f);
|
|
|
|
|
|
glTranslatef(-player.pos.x, -player.pos.y, -player.pos.z);
|
|
|
|
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
|
glPushMatrix();
|
|
glDisable(GL_TEXTURE_2D);
|
|
glMaterialfv(GL_FRONT, GL_EMISSION, light_emission);
|
|
glTranslatef(light_position[0], light_position[1], light_position[2]);
|
|
glScalef(0.1, 0.1, 0.1);
|
|
glCallList(sphere);
|
|
glMaterialfv(GL_FRONT, GL_EMISSION, std_emission);
|
|
glEnable(GL_TEXTURE_2D);
|
|
glPopMatrix();
|
|
|
|
DrawRoom(&level, player.room);
|
|
|
|
glFlush();
|
|
}
|