Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendepth.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.1 00004 * 00005 * Copyright (C) 1999-2007 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 #include "glheader.h" 00027 #include "imports.h" 00028 #include "context.h" 00029 #include "depth.h" 00030 #include "enums.h" 00031 #include "macros.h" 00032 #include "mtypes.h" 00033 00034 00035 /**********************************************************************/ 00036 /***** API Functions *****/ 00037 /**********************************************************************/ 00038 00039 00040 00041 void GLAPIENTRY 00042 _mesa_ClearDepth( GLclampd depth ) 00043 { 00044 GET_CURRENT_CONTEXT(ctx); 00045 ASSERT_OUTSIDE_BEGIN_END(ctx); 00046 00047 depth = CLAMP( depth, 0.0, 1.0 ); 00048 00049 if (ctx->Depth.Clear == depth) 00050 return; 00051 00052 FLUSH_VERTICES(ctx, _NEW_DEPTH); 00053 ctx->Depth.Clear = depth; 00054 if (ctx->Driver.ClearDepth) 00055 (*ctx->Driver.ClearDepth)( ctx, ctx->Depth.Clear ); 00056 } 00057 00058 00059 00060 void GLAPIENTRY 00061 _mesa_DepthFunc( GLenum func ) 00062 { 00063 GET_CURRENT_CONTEXT(ctx); 00064 ASSERT_OUTSIDE_BEGIN_END(ctx); 00065 00066 if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) 00067 _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); 00068 00069 switch (func) { 00070 case GL_LESS: /* (default) pass if incoming z < stored z */ 00071 case GL_GEQUAL: 00072 case GL_LEQUAL: 00073 case GL_GREATER: 00074 case GL_NOTEQUAL: 00075 case GL_EQUAL: 00076 case GL_ALWAYS: 00077 case GL_NEVER: 00078 break; 00079 default: 00080 _mesa_error( ctx, GL_INVALID_ENUM, "glDepth.Func" ); 00081 return; 00082 } 00083 00084 if (ctx->Depth.Func == func) 00085 return; 00086 00087 FLUSH_VERTICES(ctx, _NEW_DEPTH); 00088 ctx->Depth.Func = func; 00089 00090 if (ctx->Driver.DepthFunc) 00091 ctx->Driver.DepthFunc( ctx, func ); 00092 } 00093 00094 00095 00096 void GLAPIENTRY 00097 _mesa_DepthMask( GLboolean flag ) 00098 { 00099 GET_CURRENT_CONTEXT(ctx); 00100 ASSERT_OUTSIDE_BEGIN_END(ctx); 00101 00102 if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) 00103 _mesa_debug(ctx, "glDepthMask %d\n", flag); 00104 00105 /* 00106 * GL_TRUE indicates depth buffer writing is enabled (default) 00107 * GL_FALSE indicates depth buffer writing is disabled 00108 */ 00109 if (ctx->Depth.Mask == flag) 00110 return; 00111 00112 FLUSH_VERTICES(ctx, _NEW_DEPTH); 00113 ctx->Depth.Mask = flag; 00114 00115 if (ctx->Driver.DepthMask) 00116 ctx->Driver.DepthMask( ctx, flag ); 00117 } 00118 00119 00120 00124 void GLAPIENTRY 00125 _mesa_DepthBoundsEXT( GLclampd zmin, GLclampd zmax ) 00126 { 00127 GET_CURRENT_CONTEXT(ctx); 00128 ASSERT_OUTSIDE_BEGIN_END(ctx); 00129 00130 if (zmin > zmax) { 00131 _mesa_error(ctx, GL_INVALID_VALUE, "glDepthBoundsEXT(zmin > zmax)"); 00132 return; 00133 } 00134 00135 zmin = CLAMP(zmin, 0.0, 1.0); 00136 zmax = CLAMP(zmax, 0.0, 1.0); 00137 00138 if (ctx->Depth.BoundsMin == zmin && ctx->Depth.BoundsMax == zmax) 00139 return; 00140 00141 FLUSH_VERTICES(ctx, _NEW_DEPTH); 00142 ctx->Depth.BoundsMin = (GLfloat) zmin; 00143 ctx->Depth.BoundsMax = (GLfloat) zmax; 00144 } 00145 00146 00147 /**********************************************************************/ 00148 /***** Initialization *****/ 00149 /**********************************************************************/ 00150 00151 00155 void 00156 _mesa_init_depth(GLcontext *ctx) 00157 { 00158 ctx->Depth.Test = GL_FALSE; 00159 ctx->Depth.Clear = 1.0; 00160 ctx->Depth.Func = GL_LESS; 00161 ctx->Depth.Mask = GL_TRUE; 00162 } Generated on Sat May 26 2012 04:19:00 for ReactOS by
1.7.6.1
|