This repository has been archived by the owner on Jan 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glxwindow.c
88 lines (83 loc) · 2.15 KB
/
glxwindow.c
1
2
3
4
5
6
7
8
9
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//you arrived here from main.c
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glx.h>
#include "glxwindow.h"
#include "models/shapeloop.h"
void
glx__SetCamera()
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective((CAMERA->coord.fov + 5) / MWASPECT,MWASPECT,0.1,FARAWAY);
gluLookAt(1,0,0,0,0,0,0,0,1);
glScalef(1,-1,-1);
glMatrixMode(GL_MODELVIEW);
//glTranslatef(-(PLAYER->pos.x),-(PLAYER->pos.y),-(PLAYER->pos.z));
//mainhTranslatef(EYECOORD((*PLAYER)));
glTranslatef(0.0,0.0,-(PLAYER->dembones->off.y));
//glRotatef(CAMERA->coord.az,0.0,0.0,1.0);
//glRotatef(CAMERA->coord.alt,0.0,1.0,0.0);
mainhMultMatrixf(matgen_master_deg(0,CAMERA->coord.alt,CAMERA->coord.az,1,1,1));
glTranslatef(0.0,0.0,CAMERA->coord.z);
glFinish();
}
void
glx__DrawLoop()
{
glMatrixMode(GL_MODELVIEW);
struct entity *nextent = PLAYER;
struct bone *nextbone = PLAYER->dembones->root;
glPushMatrix();
FOREVER
{
FOREVER
{
if (nextbone->up == NULL)
{
if (nextent->stat.horiz)
{
glTranslatef(-(nextent->pos.x),-(nextent->pos.y),-(nextent->pos.z));
mainhMultMatrixf(matgen_y_deg(90,1));
mainhMultMatrixf(matgen_zeuler_deg(nextent->rot.z,nextent->rot.y,nextent->rot.x,1,1,1));
}
else
{
glTranslatef(-(nextent->pos.x),-(nextent->pos.y),-(nextent->pos.z + nextent->dembones->off.x));
mainhMultMatrixf(matgen_master_deg(nextent->rot.z,nextent->rot.y,nextent->rot.x,1,1,1));
}
}
else
{
mainhLoadMatrixf(nextbone->up->curr);
glTranslatef(nextbone->up->len.x * frfl(nextbone->off.x),nextbone->up->len.y * frfl(nextbone->off.y),nextbone->up->len.z * frfl(nextbone->off.z));
}
raw_mainhMultMatrixf(nextbone->base);
glGetFloatv(GL_MODELVIEW_MATRIX,(float *)(nextbone->curr));
boneloop(nextbone);
if (nextbone->next != NULL)
{
nextbone = nextbone->next;
}
else
{
break;
}
}
if (nextent->next != NULL)
{
nextent = nextent->next;
}
else
{
glPopMatrix();
return;
}
}
}