Skip to content

Commit

Permalink
Remove or hide under macro unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Jan 27, 2024
1 parent d506b3b commit f2a28de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 101 deletions.
2 changes: 2 additions & 0 deletions src/wes_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ wes_transpose4(GLfloat *in, GLfloat *out)
out[12] = in[3]; out[13] = in[7]; out[14] = in[11]; out[15] = in[15];
}

#ifdef WES_ENABLE_GLU
static GLvoid
normalize3(GLfloat *v)
{
Expand All @@ -127,6 +128,7 @@ cross3(GLfloat *v1, GLfloat *v2, GLfloat *result)
result[1] = v1[2] * v2[0] - v1[0] * v2[2];
result[2] = v1[0] * v2[1] - v1[1] * v2[0];
}
#endif // WES_ENABLE_GLU

static GLvoid
wes_mul4_general(GLfloat *in0, GLfloat *in1, GLfloat *out)
Expand Down
49 changes: 0 additions & 49 deletions src/wes_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,55 +384,6 @@ GLvoid wes_state_init( void )
memcpy(&wrapglState, &wrapglInitState, sizeof(wrapState));
}

static const char*
wes_name_envsrc(GLint param)
{
switch(param)
{
case GL_PREVIOUS: return "WES_SRC_PREVIOUS";
case GL_CONSTANT: return "WES_SRC_CONSTANT";
case GL_PRIMARY_COLOR: return "WES_SRC_PRIMARY_COLOR";
case GL_TEXTURE: return "WES_SRC_TEXTURE";

/* Crossbar Extensions */
case GL_TEXTURE0: return "WES_SRC_TEXTURE0";
case GL_TEXTURE1: return "WES_SRC_TEXTURE1";
case GL_TEXTURE2: return "WES_SRC_TEXTURE2";
case GL_TEXTURE3: return "WES_SRC_TEXTURE3";

/* ATI Extensions */
case GL_ONE: return "WES_SRC_ONE";
case GL_ZERO: return "WES_SRC_ZERO";
}
return "ERROR";
}

static const char*
wes_name_envfunc(GLint param)
{
switch(param)
{
case GL_REPLACE: return "WES_FUNC_REPLACE";
case GL_MODULATE: return "WES_FUNC_MODULATE";
case GL_ADD: return "WES_FUNC_ADD";
case GL_DECAL: return "WES_FUNC_DECAL";
case GL_BLEND: return "WES_FUNC_BLEND";
case GL_COMBINE: return "WES_FUNC_COMBINE";
case GL_ADD_SIGNED: return "WES_FUNC_ADD_SIGNED";
case GL_INTERPOLATE: return "WES_FUNC_INTERPOLATE";
case GL_SUBTRACT: return "WES_FUNC_SUBTRACT";
case GL_DOT3_RGB: return "WES_FUNC_DOT3_RGB";
case GL_DOT3_RGBA: return "WES_FUNC_DOT3_RGBA";
#if 0
/* ATI Extensions */
case GL_MODULATE_ADD_ATI: return "WES_FUNC_MODULATE_ADD";
case GL_MODULATE_SIGNED_ADD_ATI: return "WES_FUNC_MODULATE_SIGNED_ADD";
case GL_MODULATE_SUBTRACT_ATI: return "WES_FUNC_MODULATE_SUBTRACT";
#endif
}
return "ERROR";
}

static GLint
wes_index_envfunc(GLint param)
{
Expand Down
54 changes: 2 additions & 52 deletions src/wes_texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,6 @@ wes_clear_alpha(const GLubyte* inb, GLubyte* outb, GLint size)
}
}

static GLvoid
wes_convert_RGBA2RGB(const GLubyte* inb, GLubyte* outb, GLint insize, GLint outsize)
{
int i, j;
for(i = 0, j = 0; i < insize && j < outsize; i += 4, j += 3){
outb[j] = inb[i];
outb[j + 1] = inb[i + 1];
outb[j + 2] = inb[i + 2];
}
}

static GLvoid
wes_convert_I2LA(const GLubyte* inb, GLubyte* outb, GLint size)
{
Expand All @@ -140,42 +129,6 @@ wes_convert_I2LA(const GLubyte* inb, GLubyte* outb, GLint size)
outb[i*2 + 1] = outb[i*2] = inb[i];
}
}
#if 0

void wes_addtextureformat(GLenum internalformat)
{
textureformat_t *node;
for( node = textureformatlist; node; node = node->next )
if( node->texture == wrapglState2.boundtexture ) break;
if( !node )
{
node = malloc( sizeof(textureformat_t));
node->next = textureformatlist;
textureformatlist = node;
node->texture = wrapglState2.boundtexture;
}
node->internalformat = internalformat;
}

GLenum wes_gettextureformat()
{
textureformat_t *node;

for( node = textureformatlist; node; node = node->next )
if( node->texture == wrapglState2.boundtexture )
return node->internalformat;
return 0;
}

void wes_deletetextureformat()
{
textureformat_t *node;

for( node = textureformatlist; node && node->texture != wrapglState2.boundtexture; node = node->next );
if( node )
node->internalformat = 0;
}
#endif

GLvoid
GL_MANGLE(glTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height,
Expand All @@ -199,6 +152,7 @@ GL_MANGLE(glTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLsiz
wes_convert_I2LA((GLubyte*) pixels, (GLubyte*) data, width * height * 2);
format = GL_LUMINANCE_ALPHA;
}

if( pixels && format == GL_RGBA && (
internalFormat == GL_RGB ||
internalFormat == GL_RGB8 ||
Expand All @@ -208,16 +162,12 @@ GL_MANGLE(glTexImage2D)(GLenum target, GLint level, GLenum internalFormat, GLsiz
internalFormat == GL_LUMINANCE4 )) // strip alpha from texture
{
GLvoid *data2 = malloc(width * height * 4);
//wes_addtextureformat(internalFormat);
//wes_convert_RGBA2RGB((GLubyte*) data, (GLubyte*) data2, width * height * 4, width * height * 3);

wes_clear_alpha((GLubyte*) pixels, (GLubyte*) data2, width * height * 4);
if( data != pixels )
free(data);
data = data2;
//format = GL_RGBA;
}
//else wes_deletetextureformat();

wes_gl->glTexImage2D(target, level, format, width, height, 0, format, type, data);

Expand Down Expand Up @@ -276,6 +226,7 @@ GLvoid GL_MANGLE(glTexSubImage3D)( GLenum target, GLint level,
}


#ifdef WES_ENABLE_GLU
static GLvoid
wes_halveimage(GLint nw, GLint nh, GLint byteperpixel, char* data, char* newdata)
{
Expand All @@ -287,7 +238,6 @@ wes_halveimage(GLint nw, GLint nh, GLint byteperpixel, char* data, char* newdata
}
}

#ifdef WES_ENABLE_GLU
GLvoid
gluBuild2DMipmaps(GLenum target, GLint components, GLsizei width, GLsizei height,
GLenum format, GLenum type, const GLvoid *pixels )
Expand Down

0 comments on commit f2a28de

Please sign in to comment.