… | |
… | |
27 | |
27 | |
28 | ctx.generation++; |
28 | ctx.generation++; |
29 | |
29 | |
30 | renormalize (orig, p); |
30 | renormalize (orig, p); |
31 | |
31 | |
|
|
32 | glDisable (GL_ALPHA_TEST); |
|
|
33 | glDisable (GL_BLEND); |
|
|
34 | |
32 | if (ctx.mode == draw_context::DEPTH) |
35 | if (ctx.mode == draw_context::DEPTH) |
33 | { |
36 | { |
34 | glEnable (GL_POLYGON_OFFSET_FILL); |
37 | glEnable (GL_POLYGON_OFFSET_FILL); |
35 | glPolygonOffset (0, 1); |
38 | glPolygonOffset (0, 1); |
36 | glDepthFunc (GL_LESS); |
39 | glDepthFunc (GL_LESS); |
37 | glDisable (GL_LIGHTING); |
40 | glDisable (GL_LIGHTING); |
38 | glColorMask (0, 0, 0, 0); |
41 | glColorMask (0, 0, 0, 0); |
39 | cgGLDisableProfile (CG_PROFILE_ARBVP1); |
42 | //cgGLDisableProfile (CG_PROFILE_ARBVP1); |
40 | cgGLDisableProfile (CG_PROFILE_ARBFP1); |
43 | cgGLDisableProfile (CG_PROFILE_ARBFP1); |
41 | } |
44 | } |
42 | else |
45 | else |
43 | { |
46 | { |
|
|
47 | glEnable (GL_MINMAX); |
44 | glDisable (GL_POLYGON_OFFSET_FILL); |
48 | glDisable (GL_POLYGON_OFFSET_FILL); |
45 | glDrawBuffer (GL_BACK); |
|
|
46 | glDepthFunc (GL_LESS); |
49 | glDepthFunc (GL_LESS); |
47 | glEnable (GL_LIGHTING); |
|
|
48 | glDepthMask (0); |
50 | glDepthMask (0); |
49 | cgGLEnableProfile (CG_PROFILE_ARBVP1); |
51 | cgGLEnableProfile (CG_PROFILE_ARBVP1); |
50 | cgGLEnableProfile (CG_PROFILE_ARBFP1); |
52 | cgGLEnableProfile (CG_PROFILE_ARBFP1); |
51 | } |
53 | } |
52 | |
54 | |
… | |
… | |
67 | vec3 rz = -d; |
69 | vec3 rz = -d; |
68 | vec3 rx = cross (u, rz); |
70 | vec3 rx = cross (u, rz); |
69 | vec3 ry = cross (rz, rx); |
71 | vec3 ry = cross (rz, rx); |
70 | |
72 | |
71 | matrix &m = ctx.projection; |
73 | matrix &m = ctx.projection; |
72 | m(0,0) = rx.x; m(0,1) = rx.y; m(0,2) = rx.z; m(0,3) = -p.x; |
74 | m(0,0) = rx.x; m(0,1) = rx.y; m(0,2) = rx.z; m(0,3) = 0; |
73 | m(1,0) = ry.x; m(1,1) = ry.y; m(1,2) = ry.z; m(1,3) = -p.y; |
75 | m(1,0) = ry.x; m(1,1) = ry.y; m(1,2) = ry.z; m(1,3) = 0; |
74 | m(2,0) = rz.x; m(2,1) = rz.y; m(2,2) = rz.z; m(2,3) = -p.z; |
76 | m(2,0) = rz.x; m(2,1) = rz.y; m(2,2) = rz.z; m(2,3) = 0; |
75 | m(3,0) = 0; m(3,1) = 0; m(3,2) = 0; m(3,3) = 1; |
77 | m(3,0) = 0; m(3,1) = 0; m(3,2) = 0; m(3,3) = 1; |
76 | |
78 | |
77 | glMultMatrixf ((GLfloat *)m.data); |
79 | glMultMatrixf ((GLfloat *)m.data); |
78 | |
80 | |
79 | glGetFloatv (GL_PROJECTION_MATRIX, (GLfloat *)&m); |
81 | glGetFloatv (GL_PROJECTION_MATRIX, (GLfloat *)&m); |
… | |
… | |
85 | ctx.frustum.n = plane ( m(3,0) + m(2,0), m(3,1) + m(2,1), m(3,2) + m(2,2), m(3,3) + m(2,3) ); |
87 | ctx.frustum.n = plane ( m(3,0) + m(2,0), m(3,1) + m(2,1), m(3,2) + m(2,2), m(3,3) + m(2,3) ); |
86 | ctx.frustum.f = plane ( m(3,0) - m(2,0), m(3,1) - m(2,1), m(3,2) - m(2,2), m(3,3) - m(2,3) ); |
88 | ctx.frustum.f = plane ( m(3,0) - m(2,0), m(3,1) - m(2,1), m(3,2) - m(2,2), m(3,3) - m(2,3) ); |
87 | |
89 | |
88 | glMatrixMode (GL_MODELVIEW); |
90 | glMatrixMode (GL_MODELVIEW); |
89 | glLoadIdentity (); |
91 | glLoadIdentity (); |
|
|
92 | glTranslatef (-p.x, -p.y, -p.z); |
90 | |
93 | |
91 | world.draw (ctx); |
94 | world.draw (ctx); |
92 | |
95 | |
93 | ctx.drawn.clear (); |
96 | ctx.drawn.clear (); |
94 | |
97 | |