Changed FetchTexel() function pointer arguments.
Implemented glGetTexImage(format=GL_COLOR_INDEX). Changed _mesa_unpack_depth_span() args. Minor changes/clean-ups in mtypes.h. Histogram counter component sizes were wrong.
This commit is contained in:
@@ -825,11 +825,10 @@ static GLboolean fxIsTexSupported(GLenum target, GLint internalFormat,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_intensity8(GLcontext *ctx,
|
fetch_intensity8(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLubyte *texel;
|
const GLubyte *texel;
|
||||||
|
|
||||||
@@ -845,11 +844,10 @@ fetch_intensity8(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_luminance8(GLcontext *ctx,
|
fetch_luminance8(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLubyte *texel;
|
const GLubyte *texel;
|
||||||
|
|
||||||
@@ -865,11 +863,10 @@ fetch_luminance8(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_alpha8(GLcontext *ctx,
|
fetch_alpha8(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLubyte *texel;
|
const GLubyte *texel;
|
||||||
|
|
||||||
@@ -887,21 +884,18 @@ fetch_alpha8(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_index8(GLcontext *ctx,
|
fetch_index8(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
/* XXX todo */
|
/* XXX todo */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_luminance8_alpha8(GLcontext *ctx,
|
fetch_luminance8_alpha8(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLubyte *texel;
|
const GLubyte *texel;
|
||||||
|
|
||||||
@@ -917,11 +911,10 @@ fetch_luminance8_alpha8(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_r5g6b5(GLcontext *ctx,
|
fetch_r5g6b5(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLushort *texel;
|
const GLushort *texel;
|
||||||
|
|
||||||
@@ -937,11 +930,10 @@ fetch_r5g6b5(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_r4g4b4a4(GLcontext *ctx,
|
fetch_r4g4b4a4(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLushort *texel;
|
const GLushort *texel;
|
||||||
|
|
||||||
@@ -957,11 +949,10 @@ fetch_r4g4b4a4(GLcontext *ctx,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fetch_r5g5b5a1(GLcontext *ctx,
|
fetch_r5g5b5a1(const struct gl_texture_image *texImage,
|
||||||
const struct gl_texture_object *texObj,
|
GLint i, GLint j, GLint k, GLvoid *texelOut)
|
||||||
const struct gl_texture_image *texImage,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
|
GLchan *rgba = (GLchan *) texelOut;
|
||||||
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
const tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
|
||||||
const GLushort *texel;
|
const GLushort *texel;
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: context.c,v 1.120 2001/02/06 21:42:48 brianp Exp $ */
|
/* $Id: context.c,v 1.121 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -916,11 +916,11 @@ init_attrib_groups( GLcontext *ctx )
|
|||||||
ctx->Histogram.Width = 0;
|
ctx->Histogram.Width = 0;
|
||||||
ctx->Histogram.Format = GL_RGBA;
|
ctx->Histogram.Format = GL_RGBA;
|
||||||
ctx->Histogram.Sink = GL_FALSE;
|
ctx->Histogram.Sink = GL_FALSE;
|
||||||
ctx->Histogram.RedSize = 0xffffffff;
|
ctx->Histogram.RedSize = 0;
|
||||||
ctx->Histogram.GreenSize = 0xffffffff;
|
ctx->Histogram.GreenSize = 0;
|
||||||
ctx->Histogram.BlueSize = 0xffffffff;
|
ctx->Histogram.BlueSize = 0;
|
||||||
ctx->Histogram.AlphaSize = 0xffffffff;
|
ctx->Histogram.AlphaSize = 0;
|
||||||
ctx->Histogram.LuminanceSize = 0xffffffff;
|
ctx->Histogram.LuminanceSize = 0;
|
||||||
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
|
for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) {
|
||||||
ctx->Histogram.Count[i][0] = 0;
|
ctx->Histogram.Count[i][0] = 0;
|
||||||
ctx->Histogram.Count[i][1] = 0;
|
ctx->Histogram.Count[i][1] = 0;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: extensions.c,v 1.46 2001/02/17 00:15:39 brianp Exp $ */
|
/* $Id: extensions.c,v 1.47 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -104,6 +104,7 @@ static struct {
|
|||||||
{ ON, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
|
{ ON, "GL_SGIS_pixel_texture", F(SGIS_pixel_texture) },
|
||||||
{ ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
|
{ ON, "GL_SGIS_texture_edge_clamp", F(SGIS_texture_edge_clamp) },
|
||||||
{ OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) },
|
{ OFF, "GL_SGIX_depth_texture", F(SGIX_depth_texture) },
|
||||||
|
{ OFF, "GL_SGIX_shadow", F(SGIX_shadow) },
|
||||||
{ ON, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
|
{ ON, "GL_SGIX_pixel_texture", F(SGIX_pixel_texture) },
|
||||||
{ OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) }
|
{ OFF, "GL_3DFX_texture_compression_FXT1", F(_3DFX_texture_compression_FXT1) }
|
||||||
};
|
};
|
||||||
@@ -126,6 +127,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
|
|||||||
gl_extensions_enable(ctx, "GL_NV_blend_square");
|
gl_extensions_enable(ctx, "GL_NV_blend_square");
|
||||||
gl_extensions_enable(ctx, "GL_MESA_sprite_point");
|
gl_extensions_enable(ctx, "GL_MESA_sprite_point");
|
||||||
gl_extensions_enable(ctx, "GL_SGIX_depth_texture");
|
gl_extensions_enable(ctx, "GL_SGIX_depth_texture");
|
||||||
|
/*gl_extensions_enable(ctx, "GL_SGIX_shadow"); not finished */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: histogram.c,v 1.6 2001/01/30 17:46:34 brianp Exp $ */
|
/* $Id: histogram.c,v 1.7 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -944,11 +944,11 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s
|
|||||||
ctx->Histogram.Width = width;
|
ctx->Histogram.Width = width;
|
||||||
ctx->Histogram.Format = internalFormat;
|
ctx->Histogram.Format = internalFormat;
|
||||||
ctx->Histogram.Sink = sink;
|
ctx->Histogram.Sink = sink;
|
||||||
ctx->Histogram.RedSize = 0xffffffff;
|
ctx->Histogram.RedSize = 8 * sizeof(GLuint);
|
||||||
ctx->Histogram.GreenSize = 0xffffffff;
|
ctx->Histogram.GreenSize = 8 * sizeof(GLuint);
|
||||||
ctx->Histogram.BlueSize = 0xffffffff;
|
ctx->Histogram.BlueSize = 8 * sizeof(GLuint);
|
||||||
ctx->Histogram.AlphaSize = 0xffffffff;
|
ctx->Histogram.AlphaSize = 8 * sizeof(GLuint);
|
||||||
ctx->Histogram.LuminanceSize = 0xffffffff;
|
ctx->Histogram.LuminanceSize = 8 * sizeof(GLuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->NewState |= _NEW_PIXEL;
|
ctx->NewState |= _NEW_PIXEL;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: image.c,v 1.55 2001/02/16 23:29:14 brianp Exp $ */
|
/* $Id: image.c,v 1.56 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -3507,22 +3507,17 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
|
||||||
GLenum srcType, const GLvoid *source,
|
GLenum srcType, const GLvoid *source,
|
||||||
const struct gl_pixelstore_attrib *srcPacking,
|
const struct gl_pixelstore_attrib *srcPacking )
|
||||||
GLuint transferOps )
|
|
||||||
{
|
{
|
||||||
GLfloat *depth = MALLOC(n * sizeof(GLfloat));
|
|
||||||
if (!depth)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (srcType) {
|
switch (srcType) {
|
||||||
case GL_BYTE:
|
case GL_BYTE:
|
||||||
{
|
{
|
||||||
GLuint i;
|
GLuint i;
|
||||||
const GLubyte *src = (const GLubyte *) source;
|
const GLubyte *src = (const GLubyte *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = BYTE_TO_FLOAT(src[i]);
|
dest[i] = BYTE_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3531,7 +3526,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
|||||||
GLuint i;
|
GLuint i;
|
||||||
const GLubyte *src = (const GLubyte *) source;
|
const GLubyte *src = (const GLubyte *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = UBYTE_TO_FLOAT(src[i]);
|
dest[i] = UBYTE_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3540,7 +3535,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
|||||||
GLuint i;
|
GLuint i;
|
||||||
const GLshort *src = (const GLshort *) source;
|
const GLshort *src = (const GLshort *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = SHORT_TO_FLOAT(src[i]);
|
dest[i] = SHORT_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3549,7 +3544,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
|||||||
GLuint i;
|
GLuint i;
|
||||||
const GLushort *src = (const GLushort *) source;
|
const GLushort *src = (const GLushort *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = USHORT_TO_FLOAT(src[i]);
|
dest[i] = USHORT_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3558,7 +3553,7 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
|||||||
GLuint i;
|
GLuint i;
|
||||||
const GLint *src = (const GLint *) source;
|
const GLint *src = (const GLint *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = INT_TO_FLOAT(src[i]);
|
dest[i] = INT_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -3567,38 +3562,27 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
|||||||
GLuint i;
|
GLuint i;
|
||||||
const GLuint *src = (const GLuint *) source;
|
const GLuint *src = (const GLuint *) source;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = UINT_TO_FLOAT(src[i]);
|
dest[i] = UINT_TO_FLOAT(src[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GL_FLOAT:
|
case GL_FLOAT:
|
||||||
MEMCPY(depth, source, n * sizeof(GLfloat));
|
MEMCPY(dest, source, n * sizeof(GLfloat));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gl_problem(NULL, "bad type in _mesa_unpack_depth_span()");
|
gl_problem(NULL, "bad type in _mesa_unpack_depth_span()");
|
||||||
FREE(depth);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* apply depth scale and bias */
|
/* apply depth scale and bias and clamp to [0,1] */
|
||||||
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
|
if (ctx->Pixel.DepthScale != 1.0 || ctx->Pixel.DepthBias != 0.0) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
depth[i] = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
|
GLfloat d = dest[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias;
|
||||||
|
dest[i] = CLAMP(d, 0.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clamp depth values to [0,1] and convert from floats to integers */
|
|
||||||
{
|
|
||||||
const GLfloat zs = ctx->DepthMaxF;
|
|
||||||
GLuint i;
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FREE(depth);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: image.h,v 1.15 2001/02/16 23:29:14 brianp Exp $ */
|
/* $Id: image.h,v 1.16 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -151,10 +151,9 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
|
|||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
_mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLfloat *dest,
|
||||||
GLenum srcType, const GLvoid *source,
|
GLenum srcType, const GLvoid *source,
|
||||||
const struct gl_pixelstore_attrib *srcPacking,
|
const struct gl_pixelstore_attrib *srcPacking );
|
||||||
GLuint transferOps );
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
_mesa_pack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: mtypes.h,v 1.19 2001/02/17 00:15:39 brianp Exp $ */
|
/* $Id: mtypes.h,v 1.20 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -132,17 +132,17 @@ typedef struct gl_frame_buffer GLframebuffer;
|
|||||||
|
|
||||||
/* Data structure for color tables */
|
/* Data structure for color tables */
|
||||||
struct gl_color_table {
|
struct gl_color_table {
|
||||||
GLvoid *Table;
|
GLenum Format; /* GL_ALPHA, GL_RGB, GL_RGB, etc */
|
||||||
GLboolean FloatTable; /* entries stored as floats? (or GLchan type) */
|
|
||||||
GLuint Size; /* number of entries (rows) in table */
|
|
||||||
GLenum Format;
|
|
||||||
GLenum IntFormat;
|
GLenum IntFormat;
|
||||||
GLint RedSize;
|
GLuint Size; /* number of entries (rows) in table */
|
||||||
GLint GreenSize;
|
GLvoid *Table; /* either GLfloat * or GLchan * */
|
||||||
GLint BlueSize;
|
GLboolean FloatTable; /* are entries stored as floats? */
|
||||||
GLint AlphaSize;
|
GLubyte RedSize;
|
||||||
GLint LuminanceSize;
|
GLubyte GreenSize;
|
||||||
GLint IntensitySize;
|
GLubyte BlueSize;
|
||||||
|
GLubyte AlphaSize;
|
||||||
|
GLubyte LuminanceSize;
|
||||||
|
GLubyte IntensitySize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -218,8 +218,8 @@ struct gl_light {
|
|||||||
GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */
|
GLfloat _MatAmbient[2][3]; /* material ambient * light ambient */
|
||||||
GLfloat _MatDiffuse[2][3]; /* material diffuse * light diffuse */
|
GLfloat _MatDiffuse[2][3]; /* material diffuse * light diffuse */
|
||||||
GLfloat _MatSpecular[2][3]; /* material spec * light specular */
|
GLfloat _MatSpecular[2][3]; /* material spec * light specular */
|
||||||
GLfloat _dli; /* CI diffuse light intensity */
|
GLfloat _dli; /* CI diffuse light intensity */
|
||||||
GLfloat _sli; /* CI specular light intensity */
|
GLfloat _sli; /* CI specular light intensity */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -446,15 +446,15 @@ struct gl_hint_attrib {
|
|||||||
|
|
||||||
|
|
||||||
struct gl_histogram_attrib {
|
struct gl_histogram_attrib {
|
||||||
GLuint Width;
|
GLuint Width; /* number of table entries */
|
||||||
GLint Format;
|
GLint Format; /* GL_ALPHA, GL_RGB, etc */
|
||||||
GLboolean Sink;
|
GLuint Count[HISTOGRAM_TABLE_SIZE][4]; /* the histogram */
|
||||||
GLuint RedSize;
|
GLboolean Sink; /* terminate image transfer? */
|
||||||
GLuint GreenSize;
|
GLubyte RedSize; /* Bits per counter */
|
||||||
GLuint BlueSize;
|
GLubyte GreenSize;
|
||||||
GLuint AlphaSize;
|
GLubyte BlueSize;
|
||||||
GLuint LuminanceSize;
|
GLubyte AlphaSize;
|
||||||
GLuint Count[HISTOGRAM_TABLE_SIZE][4];
|
GLubyte LuminanceSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -766,11 +766,14 @@ struct gl_stencil_attrib {
|
|||||||
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
|
#define ENABLE_TEXMAT(i) (ENABLE_TEXMAT0 << (i))
|
||||||
|
|
||||||
|
|
||||||
typedef void (*FetchTexelFunc)( GLcontext *ctx,
|
/*
|
||||||
const struct gl_texture_object *texObject,
|
* If teximage is color-index, texelOut returns GLchan[1].
|
||||||
const struct gl_texture_image *texImage,
|
* If teximage is depth, texelOut returns GLfloat[1].
|
||||||
|
* Otherwise, texelOut returns GLchan[4].
|
||||||
|
*/
|
||||||
|
typedef void (*FetchTexelFunc)( const struct gl_texture_image *texImage,
|
||||||
GLint col, GLint row, GLint img,
|
GLint col, GLint row, GLint img,
|
||||||
GLchan texel[] );
|
GLvoid *texelOut );
|
||||||
|
|
||||||
|
|
||||||
/* Texture image record */
|
/* Texture image record */
|
||||||
@@ -817,18 +820,20 @@ struct gl_texture_object {
|
|||||||
_glthread_Mutex Mutex; /* for thread safety */
|
_glthread_Mutex Mutex; /* for thread safety */
|
||||||
GLint RefCount; /* reference count */
|
GLint RefCount; /* reference count */
|
||||||
GLuint Name; /* an unsigned integer */
|
GLuint Name; /* an unsigned integer */
|
||||||
GLuint Dimensions; /* 1 or 2 or 3 */
|
GLuint Dimensions; /* 1 or 2 or 3 or 6 (cube map) */
|
||||||
GLfloat Priority; /* in [0,1] */
|
GLfloat Priority; /* in [0,1] */
|
||||||
GLchan BorderColor[4]; /* as integers */
|
GLchan BorderColor[4];
|
||||||
GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
||||||
GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
||||||
GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
|
||||||
GLenum MinFilter; /* minification filter */
|
GLenum MinFilter; /* minification filter */
|
||||||
GLenum MagFilter; /* magnification filter */
|
GLenum MagFilter; /* magnification filter */
|
||||||
GLfloat MinLod; /* OpenGL 1.2 */
|
GLfloat MinLod; /* min lambda, OpenGL 1.2 */
|
||||||
GLfloat MaxLod; /* OpenGL 1.2 */
|
GLfloat MaxLod; /* max lambda, OpenGL 1.2 */
|
||||||
GLint BaseLevel; /* user-specified, OpenGL 1.2 */
|
GLint BaseLevel; /* min mipmap level, OpenGL 1.2 */
|
||||||
GLint MaxLevel; /* user-specified, OpenGL 1.2 */
|
GLint MaxLevel; /* max mipmap level, OpenGL 1.2 */
|
||||||
|
GLboolean CompareFlag; /* GL_SGIX_shadow */
|
||||||
|
GLenum CompareOperator; /* GL_SGIX_shadow */
|
||||||
GLint _MaxLevel; /* actual max mipmap level (q in the spec) */
|
GLint _MaxLevel; /* actual max mipmap level (q in the spec) */
|
||||||
GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */
|
GLfloat _MaxLambda; /* = _MaxLevel - BaseLevel (q - b in spec) */
|
||||||
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
|
struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
|
||||||
@@ -1224,6 +1229,7 @@ struct gl_extensions {
|
|||||||
GLboolean SGIS_texture_edge_clamp;
|
GLboolean SGIS_texture_edge_clamp;
|
||||||
GLboolean SGIX_depth_texture;
|
GLboolean SGIX_depth_texture;
|
||||||
GLboolean SGIX_pixel_texture;
|
GLboolean SGIX_pixel_texture;
|
||||||
|
GLboolean SGIX_shadow;
|
||||||
GLboolean _3DFX_texture_compression_FXT1;
|
GLboolean _3DFX_texture_compression_FXT1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: teximage.c,v 1.76 2001/02/17 00:15:39 brianp Exp $ */
|
/* $Id: teximage.c,v 1.77 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -1180,7 +1180,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
|||||||
GLint col;
|
GLint col;
|
||||||
GLfloat *dst = tmpImage + row * width * 4;
|
GLfloat *dst = tmpImage + row * width * 4;
|
||||||
for (col = 0; col < width; col++) {
|
for (col = 0; col < width; col++) {
|
||||||
(*texImage->FetchTexel)(ctx, texObj, texImage, col, row, img,
|
(*texImage->FetchTexel)(texImage, col, row, img,
|
||||||
texels[col]);
|
texels[col]);
|
||||||
}
|
}
|
||||||
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst,
|
_mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst,
|
||||||
@@ -1244,28 +1244,19 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
|||||||
GLuint indexRow[MAX_WIDTH];
|
GLuint indexRow[MAX_WIDTH];
|
||||||
GLint col;
|
GLint col;
|
||||||
for (col = 0; col < width; col++) {
|
for (col = 0; col < width; col++) {
|
||||||
GLchan rgba[1];
|
(*texImage->FetchTexel)(texImage, col, row, img,
|
||||||
/* XXX this won't really work yet */
|
(GLvoid *) &indexRow[col]);
|
||||||
/*need (*texImage->FetchRawTexel)() */
|
|
||||||
(*texImage->FetchTexel)(ctx, texObj, texImage,
|
|
||||||
col, row, img, rgba);
|
|
||||||
indexRow[col] = rgba[0];
|
|
||||||
}
|
}
|
||||||
_mesa_pack_index_span(ctx, width, type, dest,
|
_mesa_pack_index_span(ctx, width, type, dest,
|
||||||
indexRow, &ctx->Pack,
|
indexRow, &ctx->Pack,
|
||||||
ctx->_ImageTransferState);
|
ctx->_ImageTransferState);
|
||||||
}
|
}
|
||||||
else if (format == GL_DEPTH_COMPONENT) {
|
else if (format == GL_DEPTH_COMPONENT) {
|
||||||
/* XXX finish this */
|
|
||||||
GLfloat depthRow[MAX_WIDTH];
|
GLfloat depthRow[MAX_WIDTH];
|
||||||
GLint col;
|
GLint col;
|
||||||
for (col = 0; col < width; col++) {
|
for (col = 0; col < width; col++) {
|
||||||
GLchan rgba[1];
|
(*texImage->FetchTexel)(texImage, col, row, img,
|
||||||
/* XXX this won't really work yet */
|
(GLvoid *) &depthRow[col]);
|
||||||
/*need (*texImage->FetchRawTexel)() */
|
|
||||||
(*texImage->FetchTexel)(ctx, texObj, texImage,
|
|
||||||
col, row, img, rgba);
|
|
||||||
depthRow[col] = (GLfloat) rgba[0];
|
|
||||||
}
|
}
|
||||||
_mesa_pack_depth_span(ctx, width, dest, type,
|
_mesa_pack_depth_span(ctx, width, dest, type,
|
||||||
depthRow, &ctx->Pack);
|
depthRow, &ctx->Pack);
|
||||||
@@ -1275,12 +1266,12 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
|
|||||||
GLchan rgba[MAX_WIDTH][4];
|
GLchan rgba[MAX_WIDTH][4];
|
||||||
GLint col;
|
GLint col;
|
||||||
for (col = 0; col < width; col++) {
|
for (col = 0; col < width; col++) {
|
||||||
(*texImage->FetchTexel)(ctx, texObj, texImage,
|
(*texImage->FetchTexel)(texImage, col, row, img,
|
||||||
col, row, img, rgba[col]);
|
(GLvoid *) rgba[col]);
|
||||||
}
|
}
|
||||||
_mesa_pack_rgba_span( ctx, width, (const GLchan (*)[4])rgba,
|
_mesa_pack_rgba_span(ctx, width, (const GLchan (*)[4])rgba,
|
||||||
format, type, dest, &ctx->Pack,
|
format, type, dest, &ctx->Pack,
|
||||||
ctx->_ImageTransferState );
|
ctx->_ImageTransferState);
|
||||||
} /* format */
|
} /* format */
|
||||||
} /* row */
|
} /* row */
|
||||||
} /* img */
|
} /* img */
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: texobj.c,v 1.38 2001/01/29 20:47:39 keithw Exp $ */
|
/* $Id: texobj.c,v 1.39 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -79,6 +79,8 @@ _mesa_alloc_texture_object( struct gl_shared_state *shared,
|
|||||||
obj->MaxLod = 1000.0;
|
obj->MaxLod = 1000.0;
|
||||||
obj->BaseLevel = 0;
|
obj->BaseLevel = 0;
|
||||||
obj->MaxLevel = 1000;
|
obj->MaxLevel = 1000;
|
||||||
|
obj->CompareFlag = GL_FALSE;
|
||||||
|
obj->CompareOperator = GL_TEXTURE_LEQUAL_R_SGIX;
|
||||||
_mesa_init_colortable(&obj->Palette);
|
_mesa_init_colortable(&obj->Palette);
|
||||||
|
|
||||||
/* insert into linked list */
|
/* insert into linked list */
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: texstate.c,v 1.31 2001/02/17 00:15:39 brianp Exp $ */
|
/* $Id: texstate.c,v 1.32 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -770,6 +770,31 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
|||||||
/* (keithh@netcomuk.co.uk) */
|
/* (keithh@netcomuk.co.uk) */
|
||||||
texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
|
texObj->Priority = CLAMP( params[0], 0.0F, 1.0F );
|
||||||
break;
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
texObj->CompareFlag = params[0] ? GL_TRUE : GL_FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
GLenum op = (GLenum) params[0];
|
||||||
|
if (op == GL_TEXTURE_LEQUAL_R_SGIX ||
|
||||||
|
op == GL_TEXTURE_GEQUAL_R_SGIX) {
|
||||||
|
texObj->CompareFlag = (GLenum) op;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(pname)" );
|
gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(pname)" );
|
||||||
return;
|
return;
|
||||||
@@ -1021,6 +1046,24 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
|||||||
case GL_TEXTURE_MAX_LEVEL:
|
case GL_TEXTURE_MAX_LEVEL:
|
||||||
*params = (GLfloat) obj->MaxLevel;
|
*params = (GLfloat) obj->MaxLevel;
|
||||||
break;
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
*params = (GLfloat) obj->CompareFlag;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
*params = (GLfloat) obj->CompareOperator;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameterfv(pname)" );
|
||||||
}
|
}
|
||||||
@@ -1095,6 +1138,24 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
|||||||
case GL_TEXTURE_MAX_LEVEL:
|
case GL_TEXTURE_MAX_LEVEL:
|
||||||
*params = obj->MaxLevel;
|
*params = obj->MaxLevel;
|
||||||
break;
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
*params = (GLint) obj->CompareFlag;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_TEXTURE_COMPARE_OPERATOR_SGIX:
|
||||||
|
if (ctx->Extensions.SGIX_shadow) {
|
||||||
|
*params = (GLint) obj->CompareOperator;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
|
gl_error( ctx, GL_INVALID_ENUM, "glGetTexParameteriv(pname)" );
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: texstore.c,v 1.5 2001/02/17 00:15:39 brianp Exp $ */
|
/* $Id: texstore.c,v 1.6 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "colormac.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "convolve.h"
|
#include "convolve.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
@@ -47,57 +48,6 @@
|
|||||||
#include "texstore.h"
|
#include "texstore.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get texture palette entry.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
palette_sample(GLcontext *ctx,
|
|
||||||
const struct gl_texture_object *tObj,
|
|
||||||
GLint index, GLchan rgba[4] )
|
|
||||||
{
|
|
||||||
const GLchan *palette;
|
|
||||||
GLenum format;
|
|
||||||
|
|
||||||
if (ctx->Texture.SharedPalette) {
|
|
||||||
ASSERT(!ctx->Texture.Palette.FloatTable);
|
|
||||||
palette = (const GLchan *) ctx->Texture.Palette.Table;
|
|
||||||
format = ctx->Texture.Palette.Format;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ASSERT(!tObj->Palette.FloatTable);
|
|
||||||
palette = (const GLchan *) tObj->Palette.Table;
|
|
||||||
format = tObj->Palette.Format;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (format) {
|
|
||||||
case GL_ALPHA:
|
|
||||||
rgba[ACOMP] = palette[index];
|
|
||||||
return;
|
|
||||||
case GL_LUMINANCE:
|
|
||||||
case GL_INTENSITY:
|
|
||||||
rgba[RCOMP] = palette[index];
|
|
||||||
return;
|
|
||||||
case GL_LUMINANCE_ALPHA:
|
|
||||||
rgba[RCOMP] = palette[(index << 1) + 0];
|
|
||||||
rgba[ACOMP] = palette[(index << 1) + 1];
|
|
||||||
return;
|
|
||||||
case GL_RGB:
|
|
||||||
rgba[RCOMP] = palette[index * 3 + 0];
|
|
||||||
rgba[GCOMP] = palette[index * 3 + 1];
|
|
||||||
rgba[BCOMP] = palette[index * 3 + 2];
|
|
||||||
return;
|
|
||||||
case GL_RGBA:
|
|
||||||
rgba[RCOMP] = palette[(index << 2) + 0];
|
|
||||||
rgba[GCOMP] = palette[(index << 2) + 1];
|
|
||||||
rgba[BCOMP] = palette[(index << 2) + 2];
|
|
||||||
rgba[ACOMP] = palette[(index << 2) + 3];
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
gl_problem(NULL, "Bad palette format in palette_sample");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default 1-D texture texel fetch function. This will typically be
|
* Default 1-D texture texel fetch function. This will typically be
|
||||||
@@ -105,61 +55,65 @@ palette_sample(GLcontext *ctx,
|
|||||||
* special ways.
|
* special ways.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_1d_texel(GLcontext *ctx,
|
fetch_1d_texel(const struct gl_texture_image *img,
|
||||||
const struct gl_texture_object *tObj,
|
GLint i, GLint j, GLint k, GLvoid *texel)
|
||||||
const struct gl_texture_image *img,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
const GLchan *data = (GLchan *) img->Data;
|
|
||||||
const GLchan *texel;
|
|
||||||
#ifdef DEBUG
|
|
||||||
GLint width = img->Width;
|
|
||||||
assert(i >= 0);
|
|
||||||
assert(i < width);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (img->Format) {
|
switch (img->Format) {
|
||||||
case GL_COLOR_INDEX:
|
case GL_RGBA:
|
||||||
{
|
{
|
||||||
GLint index = data[i];
|
const GLchan *src = (GLchan *) img->Data + i * 4;
|
||||||
palette_sample(ctx, tObj, index, rgba);
|
GLchan *rgba = (GLchan *) texel;
|
||||||
return;
|
COPY_CHAN4(rgba, src);
|
||||||
}
|
|
||||||
case GL_ALPHA:
|
|
||||||
rgba[ACOMP] = data[i];
|
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE:
|
}
|
||||||
case GL_INTENSITY:
|
case GL_RGB:
|
||||||
rgba[RCOMP] = data[i];
|
{
|
||||||
|
const GLchan *src = (GLchan *) img->Data + i * 3;
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[GCOMP] = src[1];
|
||||||
|
rgba[BCOMP] = src[2];
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE_ALPHA:
|
}
|
||||||
texel = data + i * 2;
|
case GL_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[ACOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data + i;
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[ACOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGB:
|
}
|
||||||
texel = data + i * 3;
|
case GL_LUMINANCE:
|
||||||
rgba[RCOMP] = texel[0];
|
case GL_INTENSITY:
|
||||||
rgba[GCOMP] = texel[1];
|
{
|
||||||
rgba[BCOMP] = texel[2];
|
const GLchan *src = (GLchan *) img->Data + i;
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGBA:
|
}
|
||||||
texel = data + i * 4;
|
case GL_LUMINANCE_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[GCOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data + i * 2;
|
||||||
rgba[BCOMP] = texel[2];
|
GLchan *rgba = (GLchan *) texel;
|
||||||
rgba[ACOMP] = texel[3];
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[ACOMP] = src[1];
|
||||||
return;
|
return;
|
||||||
case GL_DEPTH_COMPONENT:
|
}
|
||||||
{
|
case GL_COLOR_INDEX:
|
||||||
const GLfloat *data = (const GLfloat *) img->Data;
|
{
|
||||||
GLfloat *texel = (GLfloat *) rgba;
|
const GLchan *src = (GLchan *) img->Data + i;
|
||||||
*texel = data[i];
|
GLchan *index = (GLchan *) texel;
|
||||||
return;
|
*index = *src;
|
||||||
}
|
|
||||||
default:
|
|
||||||
gl_problem(NULL, "Bad format in fetch_1d_texel");
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
case GL_DEPTH_COMPONENT:
|
||||||
|
{
|
||||||
|
const GLfloat *src = (GLfloat *) img->Data + i;
|
||||||
|
GLfloat *depth = (GLfloat *) texel;
|
||||||
|
*depth = *src;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
gl_problem(NULL, "Bad format in fetch_1d_texel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,64 +122,65 @@ fetch_1d_texel(GLcontext *ctx,
|
|||||||
* Default 2-D texture texel fetch function.
|
* Default 2-D texture texel fetch function.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_2d_texel(GLcontext *ctx,
|
fetch_2d_texel(const struct gl_texture_image *img,
|
||||||
const struct gl_texture_object *tObj,
|
GLint i, GLint j, GLint k, GLvoid *texel)
|
||||||
const struct gl_texture_image *img,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
const GLint width = img->Width; /* includes border */
|
|
||||||
const GLchan *data = (GLchan *) img->Data;
|
|
||||||
const GLchan *texel;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
const GLint height = img->Height; /* includes border */
|
|
||||||
assert(i >= 0);
|
|
||||||
assert(i < width);
|
|
||||||
assert(j >= 0);
|
|
||||||
assert(j < height);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (img->Format) {
|
switch (img->Format) {
|
||||||
case GL_COLOR_INDEX:
|
case GL_RGBA:
|
||||||
{
|
{
|
||||||
GLint index = data[width *j + i];
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 4;
|
||||||
palette_sample(ctx, tObj, index, rgba );
|
GLchan *rgba = (GLchan *) texel;
|
||||||
return;
|
COPY_CHAN4(rgba, src);
|
||||||
}
|
|
||||||
case GL_ALPHA:
|
|
||||||
rgba[ACOMP] = data[width * j + i];
|
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE:
|
}
|
||||||
case GL_INTENSITY:
|
case GL_RGB:
|
||||||
rgba[RCOMP] = data[ width * j + i];
|
{
|
||||||
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 3;
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[GCOMP] = src[1];
|
||||||
|
rgba[BCOMP] = src[2];
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE_ALPHA:
|
}
|
||||||
texel = data + (width * j + i) * 2;
|
case GL_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[ACOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i);
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[ACOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGB:
|
}
|
||||||
texel = data + (width * j + i) * 3;
|
case GL_LUMINANCE:
|
||||||
rgba[RCOMP] = texel[0];
|
case GL_INTENSITY:
|
||||||
rgba[GCOMP] = texel[1];
|
{
|
||||||
rgba[BCOMP] = texel[2];
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i);
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGBA:
|
}
|
||||||
texel = data + (width * j + i) * 4;
|
case GL_LUMINANCE_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[GCOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i) * 2;
|
||||||
rgba[BCOMP] = texel[2];
|
GLchan *rgba = (GLchan *) texel;
|
||||||
rgba[ACOMP] = texel[3];
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[ACOMP] = src[1];
|
||||||
return;
|
return;
|
||||||
case GL_DEPTH_COMPONENT:
|
}
|
||||||
{
|
case GL_COLOR_INDEX:
|
||||||
const GLfloat *data = (const GLfloat *) img->Data;
|
{
|
||||||
GLfloat *texel = (GLfloat *) rgba;
|
const GLchan *src = (GLchan *) img->Data + (img->Width * j + i);
|
||||||
*texel = data[width * j + i];
|
GLchan *index = (GLchan *) texel;
|
||||||
return;
|
*index = *src;
|
||||||
}
|
return;
|
||||||
default:
|
}
|
||||||
gl_problem(NULL, "Bad format in fetch_2d_texel");
|
case GL_DEPTH_COMPONENT:
|
||||||
|
{
|
||||||
|
const GLfloat *src = (GLfloat *) img->Data + (img->Width * j + i);
|
||||||
|
GLfloat *depth = (GLfloat *) texel;
|
||||||
|
*depth = *src;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
gl_problem(NULL, "Bad format in fetch_2d_texel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,68 +189,75 @@ fetch_2d_texel(GLcontext *ctx,
|
|||||||
* Default 2-D texture texel fetch function.
|
* Default 2-D texture texel fetch function.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_3d_texel(GLcontext *ctx,
|
fetch_3d_texel(const struct gl_texture_image *img,
|
||||||
const struct gl_texture_object *tObj,
|
GLint i, GLint j, GLint k, GLvoid *texel)
|
||||||
const struct gl_texture_image *img,
|
|
||||||
GLint i, GLint j, GLint k, GLchan rgba[4])
|
|
||||||
{
|
{
|
||||||
const GLint width = img->Width; /* includes border */
|
const GLint width = img->Width;
|
||||||
const GLint height = img->Height; /* includes border */
|
const GLint rectArea = width * img->Height;
|
||||||
const GLint rectarea = width * height;
|
|
||||||
const GLchan *data = (GLchan *) img->Data;
|
|
||||||
const GLchan *texel;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
const GLint depth = img->Depth; /* includes border */
|
|
||||||
assert(i >= 0);
|
|
||||||
assert(i < width);
|
|
||||||
assert(j >= 0);
|
|
||||||
assert(j < height);
|
|
||||||
assert(k >= 0);
|
|
||||||
assert(k < depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
switch (img->Format) {
|
switch (img->Format) {
|
||||||
case GL_COLOR_INDEX:
|
case GL_RGBA:
|
||||||
{
|
{
|
||||||
GLint index = data[ rectarea * k + width * j + i ];
|
const GLchan *src = (GLchan *) img->Data
|
||||||
palette_sample(ctx, tObj, index, rgba );
|
+ (rectArea * k + width * j + i) * 4;
|
||||||
return;
|
GLchan *rgba = (GLchan *) texel;
|
||||||
}
|
COPY_CHAN4(rgba, src);
|
||||||
case GL_ALPHA:
|
|
||||||
rgba[ACOMP] = data[ rectarea * k + width * j + i ];
|
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE:
|
}
|
||||||
case GL_INTENSITY:
|
case GL_RGB:
|
||||||
rgba[RCOMP] = data[ rectarea * k + width * j + i ];
|
{
|
||||||
|
const GLchan *src = (GLchan *) img->Data
|
||||||
|
+ (rectArea * k + width * j + i) * 3;
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[GCOMP] = src[1];
|
||||||
|
rgba[BCOMP] = src[2];
|
||||||
return;
|
return;
|
||||||
case GL_LUMINANCE_ALPHA:
|
}
|
||||||
texel = data + ( rectarea * k + width * j + i) * 2;
|
case GL_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[ACOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data
|
||||||
|
+ (rectArea * k + width * j + i);
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[ACOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGB:
|
}
|
||||||
texel = data + (rectarea * k + width * j + i) * 3;
|
case GL_LUMINANCE:
|
||||||
rgba[RCOMP] = texel[0];
|
case GL_INTENSITY:
|
||||||
rgba[GCOMP] = texel[1];
|
{
|
||||||
rgba[BCOMP] = texel[2];
|
const GLchan *src = (GLchan *) img->Data
|
||||||
|
+ (rectArea * k + width * j + i);
|
||||||
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
return;
|
return;
|
||||||
case GL_RGBA:
|
}
|
||||||
texel = data + (rectarea * k + width * j + i) * 4;
|
case GL_LUMINANCE_ALPHA:
|
||||||
rgba[RCOMP] = texel[0];
|
{
|
||||||
rgba[GCOMP] = texel[1];
|
const GLchan *src = (GLchan *) img->Data
|
||||||
rgba[BCOMP] = texel[2];
|
+ (rectArea * k + width * j + i) * 2;
|
||||||
rgba[ACOMP] = texel[3];
|
GLchan *rgba = (GLchan *) texel;
|
||||||
|
rgba[RCOMP] = src[0];
|
||||||
|
rgba[ACOMP] = src[1];
|
||||||
return;
|
return;
|
||||||
case GL_DEPTH_COMPONENT:
|
}
|
||||||
{
|
case GL_COLOR_INDEX:
|
||||||
const GLfloat *data = (const GLfloat *) img->Data;
|
{
|
||||||
GLfloat *texel = (GLfloat *) rgba;
|
const GLchan *src = (GLchan *) img->Data
|
||||||
*texel = data[rectarea * k + width * j + i];
|
+ (rectArea * k + width * j + i);
|
||||||
return;
|
GLchan *index = (GLchan *) texel;
|
||||||
}
|
*index = *src;
|
||||||
default:
|
return;
|
||||||
gl_problem(NULL, "Bad format in fetch_3d_texel");
|
}
|
||||||
|
case GL_DEPTH_COMPONENT:
|
||||||
|
{
|
||||||
|
const GLfloat *src = (GLfloat *) img->Data
|
||||||
|
+ (rectArea * k + width * j + i);
|
||||||
|
GLfloat *depth = (GLfloat *) texel;
|
||||||
|
*depth = *src;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
gl_problem(NULL, "Bad format in fetch_3d_texel");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,7 +602,6 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
|
|||||||
}
|
}
|
||||||
else if (texFormat == GL_DEPTH_COMPONENT) {
|
else if (texFormat == GL_DEPTH_COMPONENT) {
|
||||||
/* Depth texture (shadow maps) */
|
/* Depth texture (shadow maps) */
|
||||||
const GLenum texType = GL_FLOAT;
|
|
||||||
GLint img, row;
|
GLint img, row;
|
||||||
GLfloat *dest = (GLfloat *) texAddr + dstZoffset * dstImageStride
|
GLfloat *dest = (GLfloat *) texAddr + dstZoffset * dstImageStride
|
||||||
+ dstYoffset * dstRowStride
|
+ dstYoffset * dstRowStride
|
||||||
@@ -650,14 +611,8 @@ _mesa_transfer_teximage(GLcontext *ctx, GLuint dimensions,
|
|||||||
for (row = 0; row < srcHeight; row++) {
|
for (row = 0; row < srcHeight; row++) {
|
||||||
const GLvoid *src = _mesa_image_address(srcPacking,
|
const GLvoid *src = _mesa_image_address(srcPacking,
|
||||||
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
|
srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0);
|
||||||
(void) src;
|
_mesa_unpack_depth_span(ctx, srcWidth, destRow,
|
||||||
(void) texType;
|
srcType, src, srcPacking);
|
||||||
/* XXX destRow: GLfloat vs. GLdepth? */
|
|
||||||
/*
|
|
||||||
_mesa_unpack_depth_span(ctx, srcWidth, texType, destRow,
|
|
||||||
srcType, src, srcPacking,
|
|
||||||
ctx->_ImageTransferState);
|
|
||||||
*/
|
|
||||||
destRow += dstRowStride;
|
destRow += dstRowStride;
|
||||||
}
|
}
|
||||||
dest += dstImageStride;
|
dest += dstImageStride;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: s_drawpix.c,v 1.8 2001/01/23 23:39:37 brianp Exp $ */
|
/* $Id: s_drawpix.c,v 1.9 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -653,11 +653,21 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||||||
/* General case */
|
/* General case */
|
||||||
GLint row;
|
GLint row;
|
||||||
for (row = 0; row < height; row++, y++) {
|
for (row = 0; row < height; row++, y++) {
|
||||||
|
GLfloat fspan[MAX_WIDTH];
|
||||||
GLdepth zspan[MAX_WIDTH];
|
GLdepth zspan[MAX_WIDTH];
|
||||||
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
|
const GLvoid *src = _mesa_image_address(&ctx->Unpack,
|
||||||
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0);
|
||||||
_mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src,
|
_mesa_unpack_depth_span( ctx, drawWidth, fspan, type, src,
|
||||||
&ctx->Unpack, ctx->_ImageTransferState );
|
&ctx->Unpack );
|
||||||
|
/* clamp depth values to [0,1] and convert from floats to integers */
|
||||||
|
{
|
||||||
|
const GLfloat zs = ctx->DepthMaxF;
|
||||||
|
GLuint i;
|
||||||
|
for (i = 0; i < drawWidth; i++) {
|
||||||
|
zspan[i] = (GLdepth) (fspan[i] * zs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->Visual.rgbMode) {
|
if (ctx->Visual.rgbMode) {
|
||||||
if (zoom) {
|
if (zoom) {
|
||||||
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
|
gl_write_zoomed_rgba_span(ctx, width, x, y, zspan, 0,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: s_texture.c,v 1.10 2001/02/07 03:55:31 brianp Exp $ */
|
/* $Id: s_texture.c,v 1.11 2001/02/17 18:41:01 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -155,6 +155,58 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get texture palette entry.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
palette_sample(const GLcontext *ctx,
|
||||||
|
const struct gl_texture_object *tObj,
|
||||||
|
GLint index, GLchan rgba[4] )
|
||||||
|
{
|
||||||
|
const GLchan *palette;
|
||||||
|
GLenum format;
|
||||||
|
|
||||||
|
if (ctx->Texture.SharedPalette) {
|
||||||
|
ASSERT(!ctx->Texture.Palette.FloatTable);
|
||||||
|
palette = (const GLchan *) ctx->Texture.Palette.Table;
|
||||||
|
format = ctx->Texture.Palette.Format;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ASSERT(!tObj->Palette.FloatTable);
|
||||||
|
palette = (const GLchan *) tObj->Palette.Table;
|
||||||
|
format = tObj->Palette.Format;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (format) {
|
||||||
|
case GL_ALPHA:
|
||||||
|
rgba[ACOMP] = palette[index];
|
||||||
|
return;
|
||||||
|
case GL_LUMINANCE:
|
||||||
|
case GL_INTENSITY:
|
||||||
|
rgba[RCOMP] = palette[index];
|
||||||
|
return;
|
||||||
|
case GL_LUMINANCE_ALPHA:
|
||||||
|
rgba[RCOMP] = palette[(index << 1) + 0];
|
||||||
|
rgba[ACOMP] = palette[(index << 1) + 1];
|
||||||
|
return;
|
||||||
|
case GL_RGB:
|
||||||
|
rgba[RCOMP] = palette[index * 3 + 0];
|
||||||
|
rgba[GCOMP] = palette[index * 3 + 1];
|
||||||
|
rgba[BCOMP] = palette[index * 3 + 2];
|
||||||
|
return;
|
||||||
|
case GL_RGBA:
|
||||||
|
rgba[RCOMP] = palette[(index << 2) + 0];
|
||||||
|
rgba[GCOMP] = palette[(index << 2) + 1];
|
||||||
|
rgba[BCOMP] = palette[(index << 2) + 2];
|
||||||
|
rgba[ACOMP] = palette[(index << 2) + 3];
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
gl_problem(ctx, "Bad palette format in palette_sample");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/* 1-D Texture Sampling Functions */
|
/* 1-D Texture Sampling Functions */
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
@@ -176,7 +228,10 @@ sample_1d_nearest(GLcontext *ctx,
|
|||||||
/* skip over the border, if any */
|
/* skip over the border, if any */
|
||||||
i += img->Border;
|
i += img->Border;
|
||||||
|
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i, 0, 0, rgba);
|
(*img->FetchTexel)(img, i, 0, 0, (GLvoid *) rgba);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, rgba[0], rgba);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -219,13 +274,19 @@ sample_1d_linear(GLcontext *ctx,
|
|||||||
COPY_CHAN4(t0, tObj->BorderColor);
|
COPY_CHAN4(t0, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, 0, 0, t0);
|
(*img->FetchTexel)(img, i0, 0, 0, (GLvoid *) t0);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t0[0], t0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & I1BIT) {
|
if (useBorderColor & I1BIT) {
|
||||||
COPY_CHAN4(t1, tObj->BorderColor);
|
COPY_CHAN4(t1, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, 0, 0, t1);
|
(*img->FetchTexel)(img, i1, 0, 0, (GLvoid *) t1);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t1[0], t1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgba[0] = (GLchan) ((w0 * t0[0] + w1 * t1[0]) >> WEIGHT_SHIFT);
|
rgba[0] = (GLchan) ((w0 * t0[0] + w1 * t1[0]) >> WEIGHT_SHIFT);
|
||||||
@@ -451,7 +512,10 @@ sample_2d_nearest(GLcontext *ctx,
|
|||||||
i += img->Border;
|
i += img->Border;
|
||||||
j += img->Border;
|
j += img->Border;
|
||||||
|
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i, j, 0, rgba);
|
(*img->FetchTexel)(img, i, j, 0, (GLvoid *) rgba);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, rgba[0], rgba);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -507,25 +571,37 @@ sample_2d_linear(GLcontext *ctx,
|
|||||||
COPY_CHAN4(t00, tObj->BorderColor);
|
COPY_CHAN4(t00, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j0, 0, t00);
|
(*img->FetchTexel)(img, i0, j0, 0, (GLvoid *) t00);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t00[0], t00);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT)) {
|
||||||
COPY_CHAN4(t10, tObj->BorderColor);
|
COPY_CHAN4(t10, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j0, 0, t10);
|
(*img->FetchTexel)(img, i1, j0, 0, (GLvoid *) t10);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t10[0], t10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT)) {
|
||||||
COPY_CHAN4(t01, tObj->BorderColor);
|
COPY_CHAN4(t01, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j1, 0, t01);
|
(*img->FetchTexel)(img, i0, j1, 0, (GLvoid *) t01);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t01[0], t01);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT)) {
|
||||||
COPY_CHAN4(t11, tObj->BorderColor);
|
COPY_CHAN4(t11, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j1, 0, t11);
|
(*img->FetchTexel)(img, i1, j1, 0, (GLvoid *) t11);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t11[0], t11);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgba[0] = (GLchan) ((w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT);
|
rgba[0] = (GLchan) ((w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]) >> WEIGHT_SHIFT);
|
||||||
@@ -852,7 +928,10 @@ sample_3d_nearest(GLcontext *ctx,
|
|||||||
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
|
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapT, t, height, j);
|
||||||
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, r, depth, k);
|
COMPUTE_NEAREST_TEXEL_LOCATION(tObj->WrapR, r, depth, k);
|
||||||
|
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i, j, k, rgba);
|
(*img->FetchTexel)(img, i, j, k, (GLvoid *) rgba);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, rgba[0], rgba);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -918,50 +997,74 @@ sample_3d_linear(GLcontext *ctx,
|
|||||||
COPY_CHAN4(t000, tObj->BorderColor);
|
COPY_CHAN4(t000, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j0, k0, t000);
|
(*img->FetchTexel)(img, i0, j0, k0, (GLvoid *) t000);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t000[0], t000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
|
||||||
COPY_CHAN4(t100, tObj->BorderColor);
|
COPY_CHAN4(t100, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j0, k0, t100);
|
(*img->FetchTexel)(img, i1, j0, k0, (GLvoid *) t100);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t100[0], t100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
|
||||||
COPY_CHAN4(t010, tObj->BorderColor);
|
COPY_CHAN4(t010, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j1, k0, t010);
|
(*img->FetchTexel)(img, i0, j1, k0, (GLvoid *) t010);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t010[0], t010);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
|
||||||
COPY_CHAN4(t110, tObj->BorderColor);
|
COPY_CHAN4(t110, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j1, k0, t110);
|
(*img->FetchTexel)(img, i1, j1, k0, (GLvoid *) t110);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t110[0], t110);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
|
if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
|
||||||
COPY_CHAN4(t001, tObj->BorderColor);
|
COPY_CHAN4(t001, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j0, k1, t001);
|
(*img->FetchTexel)(img, i0, j0, k1, (GLvoid *) t001);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t001[0], t001);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
|
if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
|
||||||
COPY_CHAN4(t101, tObj->BorderColor);
|
COPY_CHAN4(t101, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j0, k1, t101);
|
(*img->FetchTexel)(img, i1, j0, k1, (GLvoid *) t101);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t101[0], t101);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
|
if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
|
||||||
COPY_CHAN4(t011, tObj->BorderColor);
|
COPY_CHAN4(t011, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i0, j1, k1, t011);
|
(*img->FetchTexel)(img, i0, j1, k1, (GLvoid *) t011);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t011[0], t011);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
|
if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
|
||||||
COPY_CHAN4(t111, tObj->BorderColor);
|
COPY_CHAN4(t111, tObj->BorderColor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*img->FetchTexel)(ctx, tObj, img, i1, j1, k1, t111);
|
(*img->FetchTexel)(img, i1, j1, k1, (GLvoid *) t111);
|
||||||
|
if (img->Format == GL_COLOR_INDEX) {
|
||||||
|
palette_sample(ctx, tObj, t111[0], t111);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgba[0] = (GLchan) (
|
rgba[0] = (GLchan) (
|
||||||
|
Reference in New Issue
Block a user