Ignore:
Timestamp:
May 23, 2000, 10:41:28 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/rastpos.c

    r2962 r3598  
    1 /* $Id: rastpos.c,v 1.2 2000-03-01 18:49:35 jeroen Exp $ */
     1/* $Id: rastpos.c,v 1.3 2000-05-23 20:40:52 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3232#include "all.h"
    3333#else
    34 #ifndef XFree86Server
    35 #include <assert.h>
    36 #include <math.h>
    37 #else
    38 #include "GL/xf86glx.h"
    39 #endif
     34#include "glheader.h"
    4035#include "clip.h"
    4136#include "types.h"
     
    4944#include "shade.h"
    5045#include "xform.h"
     46#include "state.h"
    5147#endif
    5248
     
    5551 * Caller:  context->API.RasterPos4f
    5652 */
    57 void gl_RasterPos4f( GLcontext *ctx,
    58                      GLfloat x, GLfloat y, GLfloat z, GLfloat w )
     53static void raster_pos4f( GLcontext *ctx,
     54                          GLfloat x, GLfloat y, GLfloat z, GLfloat w )
    5955{
    6056   GLfloat v[4], eye[4], clip[4], ndc[3], d;
     
    7975      GLfloat *objnorm = ctx->Current.Normal;
    8076
    81           /* Not needed???
     77          /* Not needed???
    8278      vert = (ctx->NeedEyeCoords ? eye : v);
    83           */
     79          */
    8480
    8581      if (ctx->NeedEyeNormals) {
    86         GLfloat *inv = ctx->ModelView.inv;
    87         TRANSFORM_NORMAL( eyenorm, objnorm, inv );
    88         norm = eyenorm;
     82        GLfloat *inv = ctx->ModelView.inv;
     83        TRANSFORM_NORMAL( eyenorm, objnorm, inv );
     84        norm = eyenorm;
    8985      } else {
    90         norm = objnorm;
     86        norm = objnorm;
    9187      }
    9288
    9389      gl_shade_rastpos( ctx, v, norm,
    94                         ctx->Current.RasterColor,
    95                         &ctx->Current.RasterIndex );
     90                        ctx->Current.RasterColor,
     91                        &ctx->Current.RasterIndex );
    9692
    9793   }
     
    9995      /* use current color or index */
    10096      if (ctx->Visual->RGBAflag) {
    101         UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
    102                                   ctx->Current.ByteColor);
     97        UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
     98                                  ctx->Current.ByteColor);
    10399      }
    104100      else {
    105         ctx->Current.RasterIndex = ctx->Current.Index;
     101        ctx->Current.RasterIndex = ctx->Current.Index;
    106102      }
    107103   }
     
    122118   /* clip to user clipping planes */
    123119   if ( ctx->Transform.AnyClip &&
    124         gl_userclip_point(ctx, clip) == 0)
     120        gl_userclip_point(ctx, clip) == 0)
    125121   {
    126122      ctx->Current.RasterPosValid = GL_FALSE;
     
    136132
    137133   ctx->Current.RasterPos[0] = (ndc[0] * ctx->Viewport.WindowMap.m[MAT_SX] +
    138                                 ctx->Viewport.WindowMap.m[MAT_TX]);
     134                                ctx->Viewport.WindowMap.m[MAT_TX]);
    139135   ctx->Current.RasterPos[1] = (ndc[1] * ctx->Viewport.WindowMap.m[MAT_SY] +
    140                                 ctx->Viewport.WindowMap.m[MAT_TY]);
     136                                ctx->Viewport.WindowMap.m[MAT_TY]);
    141137   ctx->Current.RasterPos[2] = (ndc[2] * ctx->Viewport.WindowMap.m[MAT_SZ] +
    142                                 ctx->Viewport.WindowMap.m[MAT_TZ]) / DEPTH_SCALE;
     138                                ctx->Viewport.WindowMap.m[MAT_TZ]) / ctx->Visual->DepthMaxF;
    143139   ctx->Current.RasterPos[3] = clip[3];
    144140   ctx->Current.RasterPosValid = GL_TRUE;
     
    162158
    163159
    164 /*
    165  * This is a MESA extension function.  Pretty much just like glRasterPos
    166  * except we don't apply the modelview or projection matrices; specify a
    167  * window coordinate directly.
    168  * Caller:  context->API.WindowPos4fMESA pointer.
    169  */
    170 void gl_windowpos( GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
    171 {
    172    /* KW: Assume that like rasterpos, this must be outside begin/end.
    173     */
    174    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "glWindowPosMESA" );
    175 
    176    /* set raster position */
    177    ctx->Current.RasterPos[0] = x;
    178    ctx->Current.RasterPos[1] = y;
    179    ctx->Current.RasterPos[2] = CLAMP( z, 0.0F, 1.0F );
    180    ctx->Current.RasterPos[3] = w;
    181 
    182    ctx->Current.RasterPosValid = GL_TRUE;
    183 
    184    /* raster color */
    185    if (0 && ctx->Light.Enabled) {
    186 
    187       /* KW: I don't see how this can work - would have to take the
    188        *     inverse of the projection matrix or the combined
    189        *     modelProjection matrix, transform point and normal, and
    190        *     do the lighting.  Those inverses are not used for
    191        *     anything else.  This is not an object-space lighting
    192        *     issue - what this is trying to do is something like
    193        *     clip-space or window-space lighting...
    194        *
    195        *     Anyway, since the implementation was never correct, I'm
    196        *     not fixing it now - just use the unlit color.
    197        */
    198 
    199       /* KW:  As a reprise, we now *do* keep the inverse of the projection
    200        *      matrix, so it is not infeasible to try to swim up stream
    201        *      in this manner.  I still don't want to implement it,
    202        *      however.
    203        */
    204    }
    205    else {
    206       /* use current color or index */
    207       if (ctx->Visual->RGBAflag) {
    208          UBYTE_RGBA_TO_FLOAT_RGBA(ctx->Current.RasterColor,
    209                                   ctx->Current.ByteColor);
    210       }
    211       else {
    212          ctx->Current.RasterIndex = ctx->Current.Index;
    213       }
    214    }
    215 
    216    ctx->Current.RasterDistance = 0.0;
    217 
    218    {
    219       GLuint texSet;
    220       for (texSet=0; texSet<MAX_TEXTURE_UNITS; texSet++) {
    221          COPY_4FV( ctx->Current.RasterMultiTexCoord[texSet],
    222                   ctx->Current.Texcoord[texSet] );
    223       }
    224    }
    225 
    226    if (ctx->RenderMode==GL_SELECT) {
    227       gl_update_hitflag( ctx, ctx->Current.RasterPos[2] );
    228    }
    229 }
     160void
     161_mesa_RasterPos2d(GLdouble x, GLdouble y)
     162{
     163   _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
     164}
     165
     166void
     167_mesa_RasterPos2f(GLfloat x, GLfloat y)
     168{
     169   _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
     170}
     171
     172void
     173_mesa_RasterPos2i(GLint x, GLint y)
     174{
     175   _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
     176}
     177
     178void
     179_mesa_RasterPos2s(GLshort x, GLshort y)
     180{
     181   _mesa_RasterPos4f(x, y, 0.0F, 1.0F);
     182}
     183
     184void
     185_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
     186{
     187   _mesa_RasterPos4f(x, y, z, 1.0F);
     188}
     189
     190void
     191_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
     192{
     193   _mesa_RasterPos4f(x, y, z, 1.0F);
     194}
     195
     196void
     197_mesa_RasterPos3i(GLint x, GLint y, GLint z)
     198{
     199   _mesa_RasterPos4f(x, y, z, 1.0F);
     200}
     201
     202void
     203_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z)
     204{
     205   _mesa_RasterPos4f(x, y, z, 1.0F);
     206}
     207
     208void
     209_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
     210{
     211   _mesa_RasterPos4f(x, y, z, w);
     212}
     213
     214void
     215_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
     216{
     217   GET_CURRENT_CONTEXT(ctx);
     218   raster_pos4f(ctx, x, y, z, w);
     219}
     220
     221void
     222_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
     223{
     224   _mesa_RasterPos4f(x, y, z, w);
     225}
     226
     227void
     228_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
     229{
     230   _mesa_RasterPos4f(x, y, z, w);
     231}
     232
     233void
     234_mesa_RasterPos2dv(const GLdouble *v)
     235{
     236   _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
     237}
     238
     239void
     240_mesa_RasterPos2fv(const GLfloat *v)
     241{
     242   _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
     243}
     244
     245void
     246_mesa_RasterPos2iv(const GLint *v)
     247{
     248   _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
     249}
     250
     251void
     252_mesa_RasterPos2sv(const GLshort *v)
     253{
     254   _mesa_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
     255}
     256
     257void
     258_mesa_RasterPos3dv(const GLdouble *v)
     259{
     260   _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
     261}
     262
     263void
     264_mesa_RasterPos3fv(const GLfloat *v)
     265{
     266   _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
     267}
     268
     269void
     270_mesa_RasterPos3iv(const GLint *v)
     271{
     272   _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
     273}
     274
     275void
     276_mesa_RasterPos3sv(const GLshort *v)
     277{
     278   _mesa_RasterPos4f(v[0], v[1], v[2], 1.0F);
     279}
     280
     281void
     282_mesa_RasterPos4dv(const GLdouble *v)
     283{
     284   _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
     285}
     286
     287void
     288_mesa_RasterPos4fv(const GLfloat *v)
     289{
     290   _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
     291}
     292
     293void
     294_mesa_RasterPos4iv(const GLint *v)
     295{
     296   _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
     297}
     298
     299void
     300_mesa_RasterPos4sv(const GLshort *v)
     301{
     302   _mesa_RasterPos4f(v[0], v[1], v[2], v[3]);
     303}
Note: See TracChangeset for help on using the changeset viewer.