mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 19:51:33 +00:00
Fix sky over Yavin Swamp
The only significant part of this change is the removal of r_fastsky check, since Yavin Swamp doesn't have a skybox.
This commit is contained in:
parent
52061d9040
commit
0d3d244157
3 changed files with 512 additions and 501 deletions
|
@ -495,7 +495,7 @@ static void RB_BeginDrawingView (void) {
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( r_fastsky->integer && !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && !g_bRenderGlowingObjects )
|
||||
if ( !( backEnd.refdef.rdflags & RDF_NOWORLDMODEL ) && !g_bRenderGlowingObjects )
|
||||
{
|
||||
if (tr.world && tr.world->globalFog != -1)
|
||||
{
|
||||
|
@ -1135,179 +1135,165 @@ const void *RB_StretchPic ( const void *data ) {
|
|||
|
||||
/*
|
||||
=============
|
||||
RB_RotatePic
|
||||
RB_DrawRotatePic
|
||||
=============
|
||||
*/
|
||||
const void *RB_RotatePic ( const void *data )
|
||||
{
|
||||
//LOGI("RB_RotatePic");
|
||||
const rotatePicCommand_t *cmd;
|
||||
image_t *image;
|
||||
jk_shader_t *shader;
|
||||
|
||||
cmd = (const rotatePicCommand_t *)data;
|
||||
|
||||
shader = cmd->shader;
|
||||
image = &shader->stages[0].bundle[0].image[0];
|
||||
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
|
||||
shader = cmd->shader;
|
||||
if ( shader != tess.shader ) {
|
||||
if ( tess.numIndexes ) {
|
||||
RB_EndSurface();
|
||||
if ( image ) {
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
backEnd.currentEntity = &backEnd.entity2D;
|
||||
RB_BeginSurface( shader, 0 );
|
||||
|
||||
qglColor4ubv( backEnd.color2D );
|
||||
qglPushMatrix();
|
||||
|
||||
qglTranslatef(cmd->x+cmd->w,cmd->y,0);
|
||||
qglRotatef(cmd->a, 0.0, 0.0, 1.0);
|
||||
|
||||
GL_Bind( image );
|
||||
#ifdef HAVE_GLES
|
||||
GLfloat tex[] = {
|
||||
cmd->s1, cmd->t1,
|
||||
cmd->s2, cmd->t1,
|
||||
cmd->s2, cmd->t2,
|
||||
cmd->s1, cmd->t2
|
||||
};
|
||||
GLfloat vtx[] = {
|
||||
-cmd->w, 0,
|
||||
0, 0,
|
||||
0, cmd->h,
|
||||
-cmd->w, cmd->h
|
||||
};
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (glcol)
|
||||
qglDisableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
|
||||
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
|
||||
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
||||
if (glcol)
|
||||
qglEnableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#else
|
||||
qglBegin (GL_QUADS);
|
||||
qglTexCoord2f( cmd->s1, cmd->t1);
|
||||
qglVertex2f( -cmd->w, 0 );
|
||||
qglTexCoord2f( cmd->s2, cmd->t1 );
|
||||
qglVertex2f( 0, 0 );
|
||||
qglTexCoord2f( cmd->s2, cmd->t2 );
|
||||
qglVertex2f( 0, cmd->h );
|
||||
qglTexCoord2f( cmd->s1, cmd->t2 );
|
||||
qglVertex2f( -cmd->w, cmd->h );
|
||||
qglEnd();
|
||||
#endif
|
||||
|
||||
qglPopMatrix();
|
||||
}
|
||||
|
||||
RB_CHECKOVERFLOW( 4, 6 );
|
||||
int numVerts = tess.numVertexes;
|
||||
int numIndexes = tess.numIndexes;
|
||||
|
||||
float angle = DEG2RAD( cmd-> a );
|
||||
float s = sinf( angle );
|
||||
float c = cosf( angle );
|
||||
|
||||
matrix3_t m = {
|
||||
{ c, s, 0.0f },
|
||||
{ -s, c, 0.0f },
|
||||
{ cmd->x + cmd->w, cmd->y, 1.0f }
|
||||
};
|
||||
|
||||
tess.numVertexes += 4;
|
||||
tess.numIndexes += 6;
|
||||
|
||||
tess.indexes[ numIndexes ] = numVerts + 3;
|
||||
tess.indexes[ numIndexes + 1 ] = numVerts + 0;
|
||||
tess.indexes[ numIndexes + 2 ] = numVerts + 2;
|
||||
tess.indexes[ numIndexes + 3 ] = numVerts + 2;
|
||||
tess.indexes[ numIndexes + 4 ] = numVerts + 0;
|
||||
tess.indexes[ numIndexes + 5 ] = numVerts + 1;
|
||||
|
||||
byteAlias_t *baDest = NULL, *baSource = (byteAlias_t *)&backEnd.color2D;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 0]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 1]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 2]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 3]; baDest->ui = baSource->ui;
|
||||
|
||||
tess.xyz[ numVerts ][0] = m[0][0] * (-cmd->w) + m[2][0];
|
||||
tess.xyz[ numVerts ][1] = m[0][1] * (-cmd->w) + m[2][1];
|
||||
tess.xyz[ numVerts ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts ][0][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts ][0][1] = cmd->t1;
|
||||
|
||||
tess.xyz[ numVerts + 1 ][0] = m[2][0];
|
||||
tess.xyz[ numVerts + 1 ][1] = m[2][1];
|
||||
tess.xyz[ numVerts + 1 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 1 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1;
|
||||
|
||||
tess.xyz[ numVerts + 2 ][0] = m[1][0] * (cmd->h) + m[2][0];
|
||||
tess.xyz[ numVerts + 2 ][1] = m[1][1] * (cmd->h) + m[2][1];
|
||||
tess.xyz[ numVerts + 2 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 2 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2;
|
||||
|
||||
tess.xyz[ numVerts + 3 ][0] = m[0][0] * (-cmd->w) + m[1][0] * (cmd->h) + m[2][0];
|
||||
tess.xyz[ numVerts + 3 ][1] = m[0][1] * (-cmd->w) + m[1][1] * (cmd->h) + m[2][1];
|
||||
tess.xyz[ numVerts + 3 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 3 ][0][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2;
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_RotatePic2
|
||||
RB_DrawRotatePic2
|
||||
=============
|
||||
*/
|
||||
const void *RB_RotatePic2 ( const void *data )
|
||||
{
|
||||
//LOGI("RB_RotatePic2");
|
||||
const rotatePicCommand_t *cmd;
|
||||
image_t *image;
|
||||
jk_shader_t *shader;
|
||||
|
||||
cmd = (const rotatePicCommand_t *)data;
|
||||
|
||||
shader = cmd->shader;
|
||||
|
||||
// FIXME is this needed
|
||||
if ( shader->numUnfoggedPasses )
|
||||
{
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
image = &shader->stages[0].bundle[0].image[0];
|
||||
|
||||
shader = cmd->shader;
|
||||
if ( shader != tess.shader ) {
|
||||
if ( tess.numIndexes ) {
|
||||
RB_EndSurface();
|
||||
if ( image )
|
||||
{
|
||||
if ( !backEnd.projection2D )
|
||||
{
|
||||
RB_SetGL2D();
|
||||
}
|
||||
backEnd.currentEntity = &backEnd.entity2D;
|
||||
RB_BeginSurface( shader, 0 );
|
||||
|
||||
// Get our current blend mode, etc.
|
||||
GL_State( shader->stages[0].stateBits );
|
||||
|
||||
qglColor4ubv( backEnd.color2D );
|
||||
qglPushMatrix();
|
||||
|
||||
// rotation point is going to be around the center of the passed in coordinates
|
||||
qglTranslatef( cmd->x, cmd->y, 0 );
|
||||
qglRotatef( cmd->a, 0.0, 0.0, 1.0 );
|
||||
|
||||
GL_Bind( image );
|
||||
#ifdef HAVE_GLES
|
||||
GLfloat tex[] = {
|
||||
cmd->s1, cmd->t1,
|
||||
cmd->s2, cmd->t1,
|
||||
cmd->s2, cmd->t2,
|
||||
cmd->s1, cmd->t2
|
||||
};
|
||||
GLfloat vtx[] = {
|
||||
-cmd->w * 0.5f, -cmd->h * 0.5f,
|
||||
cmd->w * 0.5f, -cmd->h * 0.5f,
|
||||
cmd->w * 0.5f, cmd->h * 0.5f,
|
||||
-cmd->w * 0.5f, cmd->h * 0.5f
|
||||
};
|
||||
GLboolean text = qglIsEnabled(GL_TEXTURE_COORD_ARRAY);
|
||||
GLboolean glcol = qglIsEnabled(GL_COLOR_ARRAY);
|
||||
if (glcol)
|
||||
qglDisableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
qglTexCoordPointer( 2, GL_FLOAT, 0, tex );
|
||||
qglVertexPointer ( 2, GL_FLOAT, 0, vtx );
|
||||
qglDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
||||
if (glcol)
|
||||
qglEnableClientState(GL_COLOR_ARRAY);
|
||||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#else
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( cmd->s1, cmd->t1);
|
||||
qglVertex2f( -cmd->w * 0.5f, -cmd->h * 0.5f );
|
||||
|
||||
qglTexCoord2f( cmd->s2, cmd->t1 );
|
||||
qglVertex2f( cmd->w * 0.5f, -cmd->h * 0.5f );
|
||||
|
||||
qglTexCoord2f( cmd->s2, cmd->t2 );
|
||||
qglVertex2f( cmd->w * 0.5f, cmd->h * 0.5f );
|
||||
|
||||
qglTexCoord2f( cmd->s1, cmd->t2 );
|
||||
qglVertex2f( -cmd->w * 0.5f, cmd->h * 0.5f );
|
||||
qglEnd();
|
||||
#endif
|
||||
|
||||
qglPopMatrix();
|
||||
|
||||
// Hmmm, this is not too cool
|
||||
GL_State( GLS_DEPTHTEST_DISABLE |
|
||||
GLS_SRCBLEND_SRC_ALPHA |
|
||||
GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA );
|
||||
}
|
||||
|
||||
RB_CHECKOVERFLOW( 4, 6 );
|
||||
int numVerts = tess.numVertexes;
|
||||
int numIndexes = tess.numIndexes;
|
||||
|
||||
float angle = DEG2RAD( cmd-> a );
|
||||
float s = sinf( angle );
|
||||
float c = cosf( angle );
|
||||
|
||||
matrix3_t m = {
|
||||
{ c, s, 0.0f },
|
||||
{ -s, c, 0.0f },
|
||||
{ cmd->x, cmd->y, 1.0f }
|
||||
};
|
||||
|
||||
tess.numVertexes += 4;
|
||||
tess.numIndexes += 6;
|
||||
|
||||
tess.indexes[ numIndexes ] = numVerts + 3;
|
||||
tess.indexes[ numIndexes + 1 ] = numVerts + 0;
|
||||
tess.indexes[ numIndexes + 2 ] = numVerts + 2;
|
||||
tess.indexes[ numIndexes + 3 ] = numVerts + 2;
|
||||
tess.indexes[ numIndexes + 4 ] = numVerts + 0;
|
||||
tess.indexes[ numIndexes + 5 ] = numVerts + 1;
|
||||
|
||||
byteAlias_t *baDest = NULL, *baSource = (byteAlias_t *)&backEnd.color2D;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 0]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 1]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 2]; baDest->ui = baSource->ui;
|
||||
baDest = (byteAlias_t *)&tess.vertexColors[numVerts + 3]; baDest->ui = baSource->ui;
|
||||
|
||||
tess.xyz[ numVerts ][0] = m[0][0] * (-cmd->w * 0.5f) + m[1][0] * (-cmd->h * 0.5f) + m[2][0];
|
||||
tess.xyz[ numVerts ][1] = m[0][1] * (-cmd->w * 0.5f) + m[1][1] * (-cmd->h * 0.5f) + m[2][1];
|
||||
tess.xyz[ numVerts ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts ][0][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts ][0][1] = cmd->t1;
|
||||
|
||||
tess.xyz[ numVerts + 1 ][0] = m[0][0] * (cmd->w * 0.5f) + m[1][0] * (-cmd->h * 0.5f) + m[2][0];
|
||||
tess.xyz[ numVerts + 1 ][1] = m[0][1] * (cmd->w * 0.5f) + m[1][1] * (-cmd->h * 0.5f) + m[2][1];
|
||||
tess.xyz[ numVerts + 1 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 1 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 1 ][0][1] = cmd->t1;
|
||||
|
||||
tess.xyz[ numVerts + 2 ][0] = m[0][0] * (cmd->w * 0.5f) + m[1][0] * (cmd->h * 0.5f) + m[2][0];
|
||||
tess.xyz[ numVerts + 2 ][1] = m[0][1] * (cmd->w * 0.5f) + m[1][1] * (cmd->h * 0.5f) + m[2][1];
|
||||
tess.xyz[ numVerts + 2 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 2 ][0][0] = cmd->s2;
|
||||
tess.texCoords[ numVerts + 2 ][0][1] = cmd->t2;
|
||||
|
||||
tess.xyz[ numVerts + 3 ][0] = m[0][0] * (-cmd->w * 0.5f) + m[1][0] * (cmd->h * 0.5f) + m[2][0];
|
||||
tess.xyz[ numVerts + 3 ][1] = m[0][1] * (-cmd->w * 0.5f) + m[1][1] * (cmd->h * 0.5f) + m[2][1];
|
||||
tess.xyz[ numVerts + 3 ][2] = 0;
|
||||
|
||||
tess.texCoords[ numVerts + 3 ][0][0] = cmd->s1;
|
||||
tess.texCoords[ numVerts + 3 ][0][1] = cmd->t2;
|
||||
}
|
||||
|
||||
return (const void *)(cmd + 1);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1338,7 +1338,8 @@ model_t *R_AllocModel( void );
|
|||
void R_Init( void );
|
||||
image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmip, qboolean allowTC, int glWrapClampMode );
|
||||
|
||||
image_t *R_CreateImage( const char *name, const byte *pic, int width, int height, GLenum format, qboolean mipmap, qboolean allowPicmip, qboolean allowTC, int wrapClampMode);
|
||||
image_t *R_CreateImage( const char *name, const byte *pic, int width, int height,
|
||||
GLenum format, qboolean mipmap, qboolean allowPicmip, qboolean allowTC, int glWrapClampMode, bool bRectangle = false );
|
||||
|
||||
qboolean R_GetModeInfo( int *width, int *height, int mode );
|
||||
|
||||
|
|
Loading…
Reference in a new issue