Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenm_xform.h
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.3 00004 * 00005 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 */ 00024 00025 00026 #ifndef _M_XFORM_H 00027 #define _M_XFORM_H 00028 00029 00030 #include "main/glheader.h" 00031 #include "main/config.h" 00032 #include "math/m_vector.h" 00033 #include "math/m_matrix.h" 00034 00035 #ifdef USE_X86_ASM 00036 #define _XFORMAPI _ASMAPI 00037 #define _XFORMAPIP _ASMAPIP 00038 #else 00039 #define _XFORMAPI 00040 #define _XFORMAPIP * 00041 #endif 00042 00043 00044 extern void 00045 _mesa_transform_vector(GLfloat u[4], CONST GLfloat v[4], CONST GLfloat m[16]); 00046 00047 00048 extern void 00049 _math_init_transformation(void); 00050 00051 00052 /* KW: Clip functions now do projective divide as well. The projected 00053 * coordinates are very useful to us because they let us cull 00054 * backfaces and eliminate vertices from lighting, fogging, etc 00055 * calculations. Despite the fact that this divide could be done one 00056 * day in hardware, we would still have a reason to want to do it here 00057 * as long as those other calculations remain in software. 00058 * 00059 * Clipping is a convenient place to do the divide on x86 as it should be 00060 * possible to overlap with integer outcode calculations. 00061 * 00062 * There are two cases where we wouldn't want to do the divide in cliptest: 00063 * - When we aren't clipping. We still might want to cull backfaces 00064 * so the divide should be done elsewhere. This currently never 00065 * happens. 00066 * 00067 * - When culling isn't likely to help us, such as when the GL culling 00068 * is disabled and we not lighting or are only lighting 00069 * one-sided. In this situation, backface determination provides 00070 * us with no useful information. A tricky case to detect is when 00071 * all input data is already culled, although hopefully the 00072 * application wouldn't turn on culling in such cases. 00073 * 00074 * We supply a buffer to hold the [x/w,y/w,z/w,1/w] values which 00075 * are the result of the projection. This is only used in the 00076 * 4-vector case - in other cases, we just use the clip coordinates 00077 * as the projected coordinates - they are identical. 00078 * 00079 * This is doubly convenient because it means the Win[] array is now 00080 * of the same stride as all the others, so I can now turn map_vertices 00081 * into a straight-forward matrix transformation, with asm acceleration 00082 * automatically available. 00083 */ 00084 00085 /* Vertex buffer clipping flags 00086 */ 00087 #define CLIP_RIGHT_SHIFT 0 00088 #define CLIP_LEFT_SHIFT 1 00089 #define CLIP_TOP_SHIFT 2 00090 #define CLIP_BOTTOM_SHIFT 3 00091 #define CLIP_NEAR_SHIFT 4 00092 #define CLIP_FAR_SHIFT 5 00093 00094 #define CLIP_RIGHT_BIT 0x01 00095 #define CLIP_LEFT_BIT 0x02 00096 #define CLIP_TOP_BIT 0x04 00097 #define CLIP_BOTTOM_BIT 0x08 00098 #define CLIP_NEAR_BIT 0x10 00099 #define CLIP_FAR_BIT 0x20 00100 #define CLIP_USER_BIT 0x40 00101 #define CLIP_CULL_BIT 0x80 00102 #define CLIP_FRUSTUM_BITS 0x3f 00103 00104 00105 typedef GLvector4f * (_XFORMAPIP clip_func)( GLvector4f *vClip, 00106 GLvector4f *vProj, 00107 GLubyte clipMask[], 00108 GLubyte *orMask, 00109 GLubyte *andMask ); 00110 00111 typedef void (*dotprod_func)( GLfloat *out, 00112 GLuint out_stride, 00113 CONST GLvector4f *coord_vec, 00114 CONST GLfloat plane[4] ); 00115 00116 typedef void (*vec_copy_func)( GLvector4f *to, 00117 CONST GLvector4f *from ); 00118 00119 00120 00121 /* 00122 * Functions for transformation of normals in the VB. 00123 */ 00124 typedef void (_NORMAPIP normal_func)( CONST GLmatrix *mat, 00125 GLfloat scale, 00126 CONST GLvector4f *in, 00127 CONST GLfloat lengths[], 00128 GLvector4f *dest ); 00129 00130 00131 /* Flags for selecting a normal transformation function. 00132 */ 00133 #define NORM_RESCALE 0x1 /* apply the scale factor */ 00134 #define NORM_NORMALIZE 0x2 /* normalize */ 00135 #define NORM_TRANSFORM 0x4 /* apply the transformation matrix */ 00136 #define NORM_TRANSFORM_NO_ROT 0x8 /* apply the transformation matrix */ 00137 00138 00139 00140 00141 /* KW: New versions of the transform function allow a mask array 00142 * specifying that individual vector transform should be skipped 00143 * when the mask byte is zero. This is always present as a 00144 * parameter, to allow a unified interface. 00145 */ 00146 typedef void (_XFORMAPIP transform_func)( GLvector4f *to_vec, 00147 CONST GLfloat m[16], 00148 CONST GLvector4f *from_vec ); 00149 00150 00151 extern GLvector4f *_mesa_project_points( GLvector4f *to, 00152 CONST GLvector4f *from ); 00153 00154 extern void _mesa_transform_bounds3( GLubyte *orMask, GLubyte *andMask, 00155 CONST GLfloat m[16], 00156 CONST GLfloat src[][3] ); 00157 00158 extern void _mesa_transform_bounds2( GLubyte *orMask, GLubyte *andMask, 00159 CONST GLfloat m[16], 00160 CONST GLfloat src[][3] ); 00161 00162 00163 extern dotprod_func _mesa_dotprod_tab[5]; 00164 extern vec_copy_func _mesa_copy_tab[0x10]; 00165 extern vec_copy_func _mesa_copy_clean_tab[5]; 00166 extern clip_func _mesa_clip_tab[5]; 00167 extern clip_func _mesa_clip_np_tab[5]; 00168 extern normal_func _mesa_normal_tab[0xf]; 00169 00170 /* Use of 2 layers of linked 1-dimensional arrays to reduce 00171 * cost of lookup. 00172 */ 00173 extern transform_func *_mesa_transform_tab[5]; 00174 00175 00176 extern void _mesa_transform_point_sz( GLfloat Q[4], CONST GLfloat M[16], 00177 CONST GLfloat P[4], GLuint sz ); 00178 00179 00180 #define TransformRaw( to, mat, from ) \ 00181 ( _mesa_transform_tab[(from)->size][(mat)->type]( to, (mat)->m, from ), \ 00182 (to) ) 00183 00184 00185 #endif Generated on Sat May 26 2012 04:19:18 for ReactOS by
1.7.6.1
|