… | |
… | |
26 | }; |
26 | }; |
27 | |
27 | |
28 | struct draw_context { |
28 | struct draw_context { |
29 | view &v; |
29 | view &v; |
30 | |
30 | |
31 | gl_matrix projection; |
31 | matrix projection; |
|
|
32 | matrix modelview; |
|
|
33 | |
32 | struct { |
34 | struct { |
33 | plane l, r, t, b, n, f; |
35 | plane l, r, t, b, n, f; |
34 | } frustum; |
36 | } frustum; |
35 | enum { DEPTH, LIGHTED } mode; |
37 | enum { DEPTH, LIGHTED } mode; |
36 | light *l; |
38 | light *l; |
… | |
… | |
45 | |
47 | |
46 | draw_context (view &v); |
48 | draw_context (view &v); |
47 | ~draw_context (); |
49 | ~draw_context (); |
48 | }; |
50 | }; |
49 | |
51 | |
50 | inline void update_matrix (const draw_context &ctx) |
|
|
51 | { |
|
|
52 | gl_matrix m1 = ctx.projection; |
|
|
53 | gl_matrix m2; |
|
|
54 | |
|
|
55 | glGetFloatv (GL_MODELVIEW_MATRIX, (GLfloat *)&m2); |
|
|
56 | |
|
|
57 | m1 = m1 * m2; |
|
|
58 | |
|
|
59 | for (int i = 0; i < 4; i++) |
|
|
60 | for (int j = 0; j < 4 ; j++) |
|
|
61 | mvp[i][j] = m1(i,j); |
|
|
62 | } |
|
|
63 | |
|
|
64 | #endif |
52 | #endif |
65 | |
53 | |