2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 * -# 4x4 transformation matrices are stored in memory in column major order.
33 * -# Points/vertices are to be thought of as column vectors.
34 * -# Transformation of a point p by a matrix M is: p' = M * p
45 #include "math/m_matrix.h"
49 * Apply a perspective projection matrix.
51 * \param left left clipping plane coordinate.
52 * \param right right clipping plane coordinate.
53 * \param bottom bottom clipping plane coordinate.
54 * \param top top clipping plane coordinate.
55 * \param nearval distance to the near clipping plane.
56 * \param farval distance to the far clipping plane.
60 * Flushes vertices and validates parameters. Calls _math_matrix_frustum() with
61 * the top matrix of the current matrix stack and sets
62 * __struct gl_contextRec::NewState.
65 _mesa_Frustum( GLdouble left
, GLdouble right
,
66 GLdouble bottom
, GLdouble top
,
67 GLdouble nearval
, GLdouble farval
)
69 GET_CURRENT_CONTEXT(ctx
);
70 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
78 _mesa_error( ctx
, GL_INVALID_VALUE
, "glFrustum" );
82 _math_matrix_frustum( ctx
->CurrentStack
->Top
,
83 (GLfloat
) left
, (GLfloat
) right
,
84 (GLfloat
) bottom
, (GLfloat
) top
,
85 (GLfloat
) nearval
, (GLfloat
) farval
);
86 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
91 * Apply an orthographic projection matrix.
93 * \param left left clipping plane coordinate.
94 * \param right right clipping plane coordinate.
95 * \param bottom bottom clipping plane coordinate.
96 * \param top top clipping plane coordinate.
97 * \param nearval distance to the near clipping plane.
98 * \param farval distance to the far clipping plane.
102 * Flushes vertices and validates parameters. Calls _math_matrix_ortho() with
103 * the top matrix of the current matrix stack and sets
104 * __struct gl_contextRec::NewState.
107 _mesa_Ortho( GLdouble left
, GLdouble right
,
108 GLdouble bottom
, GLdouble top
,
109 GLdouble nearval
, GLdouble farval
)
111 GET_CURRENT_CONTEXT(ctx
);
112 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
114 if (MESA_VERBOSE
& VERBOSE_API
)
115 _mesa_debug(ctx
, "glOrtho(%f, %f, %f, %f, %f, %f)\n",
116 left
, right
, bottom
, top
, nearval
, farval
);
122 _mesa_error( ctx
, GL_INVALID_VALUE
, "glOrtho" );
126 _math_matrix_ortho( ctx
->CurrentStack
->Top
,
127 (GLfloat
) left
, (GLfloat
) right
,
128 (GLfloat
) bottom
, (GLfloat
) top
,
129 (GLfloat
) nearval
, (GLfloat
) farval
);
130 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
135 * Set the current matrix stack.
137 * \param mode matrix stack.
139 * \sa glMatrixMode().
141 * Flushes the vertices, validates the parameter and updates
142 * __struct gl_contextRec::CurrentStack and gl_transform_attrib::MatrixMode with the
143 * specified matrix stack.
146 _mesa_MatrixMode( GLenum mode
)
148 GET_CURRENT_CONTEXT(ctx
);
149 ASSERT_OUTSIDE_BEGIN_END(ctx
);
151 if (ctx
->Transform
.MatrixMode
== mode
&& mode
!= GL_TEXTURE
)
153 FLUSH_VERTICES(ctx
, _NEW_TRANSFORM
);
157 ctx
->CurrentStack
= &ctx
->ModelviewMatrixStack
;
160 ctx
->CurrentStack
= &ctx
->ProjectionMatrixStack
;
163 /* This error check is disabled because if we're called from
164 * glPopAttrib() when the active texture unit is >= MaxTextureCoordUnits
165 * we'll generate an unexpected error.
166 * From the GL_ARB_vertex_shader spec it sounds like we should instead
167 * do error checking in other places when we actually try to access
168 * texture matrices beyond MaxTextureCoordUnits.
171 if (ctx
->Texture
.CurrentUnit
>= ctx
->Const
.MaxTextureCoordUnits
) {
172 _mesa_error(ctx
, GL_INVALID_OPERATION
, "glMatrixMode(invalid tex unit %d)",
173 ctx
->Texture
.CurrentUnit
);
177 ASSERT(ctx
->Texture
.CurrentUnit
< Elements(ctx
->TextureMatrixStack
));
178 ctx
->CurrentStack
= &ctx
->TextureMatrixStack
[ctx
->Texture
.CurrentUnit
];
188 if (ctx
->Extensions
.NV_vertex_program
) {
189 ctx
->CurrentStack
= &ctx
->ProgramMatrixStack
[mode
- GL_MATRIX0_NV
];
192 _mesa_error( ctx
, GL_INVALID_ENUM
, "glMatrixMode(mode)" );
204 if (ctx
->Extensions
.ARB_vertex_program
||
205 ctx
->Extensions
.ARB_fragment_program
) {
206 const GLuint m
= mode
- GL_MATRIX0_ARB
;
207 if (m
> ctx
->Const
.MaxProgramMatrices
) {
208 _mesa_error(ctx
, GL_INVALID_ENUM
,
209 "glMatrixMode(GL_MATRIX%d_ARB)", m
);
212 ctx
->CurrentStack
= &ctx
->ProgramMatrixStack
[m
];
215 _mesa_error( ctx
, GL_INVALID_ENUM
, "glMatrixMode(mode)" );
220 _mesa_error( ctx
, GL_INVALID_ENUM
, "glMatrixMode(mode)" );
224 ctx
->Transform
.MatrixMode
= mode
;
229 * Push the current matrix stack.
231 * \sa glPushMatrix().
233 * Verifies the current matrix stack is not full, and duplicates the top-most
234 * matrix in the stack. Marks __struct gl_contextRec::NewState with the stack dirty
238 _mesa_PushMatrix( void )
240 GET_CURRENT_CONTEXT(ctx
);
241 struct gl_matrix_stack
*stack
= ctx
->CurrentStack
;
242 ASSERT_OUTSIDE_BEGIN_END(ctx
);
244 if (MESA_VERBOSE
&VERBOSE_API
)
245 _mesa_debug(ctx
, "glPushMatrix %s\n",
246 _mesa_lookup_enum_by_nr(ctx
->Transform
.MatrixMode
));
248 if (stack
->Depth
+ 1 >= stack
->MaxDepth
) {
249 if (ctx
->Transform
.MatrixMode
== GL_TEXTURE
) {
250 _mesa_error(ctx
, GL_STACK_OVERFLOW
,
251 "glPushMatrix(mode=GL_TEXTURE, unit=%d)",
252 ctx
->Texture
.CurrentUnit
);
255 _mesa_error(ctx
, GL_STACK_OVERFLOW
, "glPushMatrix(mode=%s)",
256 _mesa_lookup_enum_by_nr(ctx
->Transform
.MatrixMode
));
260 _math_matrix_copy( &stack
->Stack
[stack
->Depth
+ 1],
261 &stack
->Stack
[stack
->Depth
] );
263 stack
->Top
= &(stack
->Stack
[stack
->Depth
]);
264 ctx
->NewState
|= stack
->DirtyFlag
;
269 * Pop the current matrix stack.
273 * Flushes the vertices, verifies the current matrix stack is not empty, and
274 * moves the stack head down. Marks __struct gl_contextRec::NewState with the dirty
278 _mesa_PopMatrix( void )
280 GET_CURRENT_CONTEXT(ctx
);
281 struct gl_matrix_stack
*stack
= ctx
->CurrentStack
;
282 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
284 if (MESA_VERBOSE
&VERBOSE_API
)
285 _mesa_debug(ctx
, "glPopMatrix %s\n",
286 _mesa_lookup_enum_by_nr(ctx
->Transform
.MatrixMode
));
288 if (stack
->Depth
== 0) {
289 if (ctx
->Transform
.MatrixMode
== GL_TEXTURE
) {
290 _mesa_error(ctx
, GL_STACK_UNDERFLOW
,
291 "glPopMatrix(mode=GL_TEXTURE, unit=%d)",
292 ctx
->Texture
.CurrentUnit
);
295 _mesa_error(ctx
, GL_STACK_UNDERFLOW
, "glPopMatrix(mode=%s)",
296 _mesa_lookup_enum_by_nr(ctx
->Transform
.MatrixMode
));
301 stack
->Top
= &(stack
->Stack
[stack
->Depth
]);
302 ctx
->NewState
|= stack
->DirtyFlag
;
307 * Replace the current matrix with the identity matrix.
309 * \sa glLoadIdentity().
311 * Flushes the vertices and calls _math_matrix_set_identity() with the top-most
312 * matrix in the current stack. Marks __struct gl_contextRec::NewState with the stack
316 _mesa_LoadIdentity( void )
318 GET_CURRENT_CONTEXT(ctx
);
319 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
321 if (MESA_VERBOSE
& VERBOSE_API
)
322 _mesa_debug(ctx
, "glLoadIdentity()\n");
324 _math_matrix_set_identity( ctx
->CurrentStack
->Top
);
325 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
330 * Replace the current matrix with a given matrix.
334 * \sa glLoadMatrixf().
336 * Flushes the vertices and calls _math_matrix_loadf() with the top-most matrix
337 * in the current stack and the given matrix. Marks __struct gl_contextRec::NewState
338 * with the dirty stack flag.
341 _mesa_LoadMatrixf( const GLfloat
*m
)
343 GET_CURRENT_CONTEXT(ctx
);
345 if (MESA_VERBOSE
& VERBOSE_API
)
347 "glLoadMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
348 m
[0], m
[4], m
[8], m
[12],
349 m
[1], m
[5], m
[9], m
[13],
350 m
[2], m
[6], m
[10], m
[14],
351 m
[3], m
[7], m
[11], m
[15]);
353 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
354 _math_matrix_loadf( ctx
->CurrentStack
->Top
, m
);
355 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
360 * Multiply the current matrix with a given matrix.
364 * \sa glMultMatrixf().
366 * Flushes the vertices and calls _math_matrix_mul_floats() with the top-most
367 * matrix in the current stack and the given matrix. Marks
368 * __struct gl_contextRec::NewState with the dirty stack flag.
371 _mesa_MultMatrixf( const GLfloat
*m
)
373 GET_CURRENT_CONTEXT(ctx
);
375 if (MESA_VERBOSE
& VERBOSE_API
)
377 "glMultMatrix(%f %f %f %f, %f %f %f %f, %f %f %f %f, %f %f %f %f\n",
378 m
[0], m
[4], m
[8], m
[12],
379 m
[1], m
[5], m
[9], m
[13],
380 m
[2], m
[6], m
[10], m
[14],
381 m
[3], m
[7], m
[11], m
[15]);
382 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
383 _math_matrix_mul_floats( ctx
->CurrentStack
->Top
, m
);
384 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
389 * Multiply the current matrix with a rotation matrix.
391 * \param angle angle of rotation, in degrees.
392 * \param x rotation vector x coordinate.
393 * \param y rotation vector y coordinate.
394 * \param z rotation vector z coordinate.
398 * Flushes the vertices and calls _math_matrix_rotate() with the top-most
399 * matrix in the current stack and the given parameters. Marks
400 * __struct gl_contextRec::NewState with the dirty stack flag.
403 _mesa_Rotatef( GLfloat angle
, GLfloat x
, GLfloat y
, GLfloat z
)
405 GET_CURRENT_CONTEXT(ctx
);
406 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
408 _math_matrix_rotate( ctx
->CurrentStack
->Top
, angle
, x
, y
, z
);
409 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
415 * Multiply the current matrix with a general scaling matrix.
417 * \param x x axis scale factor.
418 * \param y y axis scale factor.
419 * \param z z axis scale factor.
423 * Flushes the vertices and calls _math_matrix_scale() with the top-most
424 * matrix in the current stack and the given parameters. Marks
425 * __struct gl_contextRec::NewState with the dirty stack flag.
428 _mesa_Scalef( GLfloat x
, GLfloat y
, GLfloat z
)
430 GET_CURRENT_CONTEXT(ctx
);
431 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
432 _math_matrix_scale( ctx
->CurrentStack
->Top
, x
, y
, z
);
433 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
438 * Multiply the current matrix with a translation matrix.
440 * \param x translation vector x coordinate.
441 * \param y translation vector y coordinate.
442 * \param z translation vector z coordinate.
444 * \sa glTranslatef().
446 * Flushes the vertices and calls _math_matrix_translate() with the top-most
447 * matrix in the current stack and the given parameters. Marks
448 * __struct gl_contextRec::NewState with the dirty stack flag.
451 _mesa_Translatef( GLfloat x
, GLfloat y
, GLfloat z
)
453 GET_CURRENT_CONTEXT(ctx
);
454 ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx
);
455 _math_matrix_translate( ctx
->CurrentStack
->Top
, x
, y
, z
);
456 ctx
->NewState
|= ctx
->CurrentStack
->DirtyFlag
;
462 _mesa_LoadMatrixd( const GLdouble
*m
)
467 for (i
= 0; i
< 16; i
++)
468 f
[i
] = (GLfloat
) m
[i
];
469 _mesa_LoadMatrixf(f
);
473 _mesa_MultMatrixd( const GLdouble
*m
)
478 for (i
= 0; i
< 16; i
++)
479 f
[i
] = (GLfloat
) m
[i
];
480 _mesa_MultMatrixf( f
);
485 _mesa_Rotated( GLdouble angle
, GLdouble x
, GLdouble y
, GLdouble z
)
487 _mesa_Rotatef((GLfloat
) angle
, (GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
492 _mesa_Scaled( GLdouble x
, GLdouble y
, GLdouble z
)
494 _mesa_Scalef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
499 _mesa_Translated( GLdouble x
, GLdouble y
, GLdouble z
)
501 _mesa_Translatef((GLfloat
) x
, (GLfloat
) y
, (GLfloat
) z
);
508 _mesa_LoadTransposeMatrixfARB( const GLfloat
*m
)
512 _math_transposef(tm
, m
);
513 _mesa_LoadMatrixf(tm
);
518 _mesa_LoadTransposeMatrixdARB( const GLdouble
*m
)
522 _math_transposefd(tm
, m
);
523 _mesa_LoadMatrixf(tm
);
528 _mesa_MultTransposeMatrixfARB( const GLfloat
*m
)
532 _math_transposef(tm
, m
);
533 _mesa_MultMatrixf(tm
);
538 _mesa_MultTransposeMatrixdARB( const GLdouble
*m
)
542 _math_transposefd(tm
, m
);
543 _mesa_MultMatrixf(tm
);
549 /**********************************************************************/
550 /** \name State management */
555 * Update the projection matrix stack.
557 * \param ctx GL context.
559 * Calls _math_matrix_analyse() with the top-matrix of the projection matrix
560 * stack, and recomputes user clip positions if necessary.
562 * \note This routine references __struct gl_contextRec::Tranform attribute values to
563 * compute userclip positions in clip space, but is only called on
564 * _NEW_PROJECTION. The _mesa_ClipPlane() function keeps these values up to
565 * date across changes to the __struct gl_contextRec::Transform attributes.
568 update_projection( struct gl_context
*ctx
)
570 _math_matrix_analyse( ctx
->ProjectionMatrixStack
.Top
);
573 /* Recompute clip plane positions in clipspace. This is also done
574 * in _mesa_ClipPlane().
576 if (ctx
->Transform
.ClipPlanesEnabled
) {
578 for (p
= 0; p
< ctx
->Const
.MaxClipPlanes
; p
++) {
579 if (ctx
->Transform
.ClipPlanesEnabled
& (1 << p
)) {
580 _mesa_transform_vector( ctx
->Transform
._ClipUserPlane
[p
],
581 ctx
->Transform
.EyeUserPlane
[p
],
582 ctx
->ProjectionMatrixStack
.Top
->inv
);
591 * Calculate the combined modelview-projection matrix.
593 * \param ctx GL context.
595 * Multiplies the top matrices of the projection and model view stacks into
596 * __struct gl_contextRec::_ModelProjectMatrix via _math_matrix_mul_matrix() and
597 * analyzes the resulting matrix via _math_matrix_analyse().
600 calculate_model_project_matrix( struct gl_context
*ctx
)
602 _math_matrix_mul_matrix( &ctx
->_ModelProjectMatrix
,
603 ctx
->ProjectionMatrixStack
.Top
,
604 ctx
->ModelviewMatrixStack
.Top
);
606 _math_matrix_analyse( &ctx
->_ModelProjectMatrix
);
611 * Updates the combined modelview-projection matrix.
613 * \param ctx GL context.
614 * \param new_state new state bit mask.
616 * If there is a new model view matrix then analyzes it. If there is a new
617 * projection matrix, updates it. Finally calls
618 * calculate_model_project_matrix() to recalculate the modelview-projection
621 void _mesa_update_modelview_project( struct gl_context
*ctx
, GLuint new_state
)
623 if (new_state
& _NEW_MODELVIEW
) {
624 _math_matrix_analyse( ctx
->ModelviewMatrixStack
.Top
);
626 /* Bring cull position uptodate.
628 TRANSFORM_POINT3( ctx
->Transform
.CullObjPos
,
629 ctx
->ModelviewMatrixStack
.Top
->inv
,
630 ctx
->Transform
.CullEyePos
);
634 if (new_state
& _NEW_PROJECTION
)
635 update_projection( ctx
);
637 /* Keep ModelviewProject uptodate always to allow tnl
638 * implementations that go model->clip even when eye is required.
640 calculate_model_project_matrix(ctx
);
646 /**********************************************************************/
647 /** Matrix stack initialization */
652 * Initialize a matrix stack.
654 * \param stack matrix stack.
655 * \param maxDepth maximum stack depth.
656 * \param dirtyFlag dirty flag.
658 * Allocates an array of \p maxDepth elements for the matrix stack and calls
659 * _math_matrix_ctr() and _math_matrix_alloc_inv() for each element to
663 init_matrix_stack( struct gl_matrix_stack
*stack
,
664 GLuint maxDepth
, GLuint dirtyFlag
)
669 stack
->MaxDepth
= maxDepth
;
670 stack
->DirtyFlag
= dirtyFlag
;
672 stack
->Stack
= (GLmatrix
*) CALLOC(maxDepth
* sizeof(GLmatrix
));
673 for (i
= 0; i
< maxDepth
; i
++) {
674 _math_matrix_ctr(&stack
->Stack
[i
]);
675 _math_matrix_alloc_inv(&stack
->Stack
[i
]);
677 stack
->Top
= stack
->Stack
;
683 * \param stack matrix stack.
685 * Calls _math_matrix_dtr() for each element of the matrix stack and
689 free_matrix_stack( struct gl_matrix_stack
*stack
)
692 for (i
= 0; i
< stack
->MaxDepth
; i
++) {
693 _math_matrix_dtr(&stack
->Stack
[i
]);
696 stack
->Stack
= stack
->Top
= NULL
;
702 /**********************************************************************/
703 /** \name Initialization */
708 * Initialize the context matrix data.
710 * \param ctx GL context.
712 * Initializes each of the matrix stacks and the combined modelview-projection
715 void _mesa_init_matrix( struct gl_context
* ctx
)
719 /* Initialize matrix stacks */
720 init_matrix_stack(&ctx
->ModelviewMatrixStack
, MAX_MODELVIEW_STACK_DEPTH
,
722 init_matrix_stack(&ctx
->ProjectionMatrixStack
, MAX_PROJECTION_STACK_DEPTH
,
724 for (i
= 0; i
< Elements(ctx
->TextureMatrixStack
); i
++)
725 init_matrix_stack(&ctx
->TextureMatrixStack
[i
], MAX_TEXTURE_STACK_DEPTH
,
726 _NEW_TEXTURE_MATRIX
);
727 for (i
= 0; i
< Elements(ctx
->ProgramMatrixStack
); i
++)
728 init_matrix_stack(&ctx
->ProgramMatrixStack
[i
],
729 MAX_PROGRAM_MATRIX_STACK_DEPTH
, _NEW_TRACK_MATRIX
);
730 ctx
->CurrentStack
= &ctx
->ModelviewMatrixStack
;
732 /* Init combined Modelview*Projection matrix */
733 _math_matrix_ctr( &ctx
->_ModelProjectMatrix
);
738 * Free the context matrix data.
740 * \param ctx GL context.
742 * Frees each of the matrix stacks and the combined modelview-projection
745 void _mesa_free_matrix_data( struct gl_context
*ctx
)
749 free_matrix_stack(&ctx
->ModelviewMatrixStack
);
750 free_matrix_stack(&ctx
->ProjectionMatrixStack
);
751 for (i
= 0; i
< Elements(ctx
->TextureMatrixStack
); i
++)
752 free_matrix_stack(&ctx
->TextureMatrixStack
[i
]);
753 for (i
= 0; i
< Elements(ctx
->ProgramMatrixStack
); i
++)
754 free_matrix_stack(&ctx
->ProgramMatrixStack
[i
]);
755 /* combined Modelview*Projection matrix */
756 _math_matrix_dtr( &ctx
->_ModelProjectMatrix
);
762 * Initialize the context transform attribute group.
764 * \param ctx GL context.
766 * \todo Move this to a new file with other 'transform' routines.
768 void _mesa_init_transform( struct gl_context
*ctx
)
772 /* Transformation group */
773 ctx
->Transform
.MatrixMode
= GL_MODELVIEW
;
774 ctx
->Transform
.Normalize
= GL_FALSE
;
775 ctx
->Transform
.RescaleNormals
= GL_FALSE
;
776 ctx
->Transform
.RasterPositionUnclipped
= GL_FALSE
;
777 for (i
=0;i
<MAX_CLIP_PLANES
;i
++) {
778 ASSIGN_4V( ctx
->Transform
.EyeUserPlane
[i
], 0.0, 0.0, 0.0, 0.0 );
780 ctx
->Transform
.ClipPlanesEnabled
= 0;
782 ASSIGN_4V( ctx
->Transform
.CullObjPos
, 0.0, 0.0, 1.0, 0.0 );
783 ASSIGN_4V( ctx
->Transform
.CullEyePos
, 0.0, 0.0, 1.0, 0.0 );