ref_soft: Simple triapi and studio rendering (flat fill only)
This commit is contained in:
parent
9ba39f65b3
commit
870ae030ca
6 changed files with 3834 additions and 37 deletions
24
r_context.c
24
r_context.c
|
@ -407,20 +407,6 @@ void R_ClearAllDecals()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float R_StudioEstimateFrame(cl_entity_t *e, mstudioseqdesc_t *pseqdesc)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_StudioLerpMovement(cl_entity_t *e, double time, vec3_t origin, vec3_t angles)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CL_InitStudioAPI()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_InitSkyClouds(mip_t *mt, texture_t *tx, qboolean custom_palette)
|
void R_InitSkyClouds(mip_t *mt, texture_t *tx, qboolean custom_palette)
|
||||||
{
|
{
|
||||||
|
@ -437,11 +423,6 @@ void Mod_LoadMapSprite(model_t *mod, const void *buffer, size_t size, qboolean *
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mod_StudioLoadTextures(model_t *mod, void *data)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CL_DrawParticles(double frametime, particle_t *cl_active_particles, float partsize)
|
void CL_DrawParticles(double frametime, particle_t *cl_active_particles, float partsize)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -512,11 +493,6 @@ void CL_DrawParticlesExternal(const ref_viewpass_t *rvp, qboolean trans_pass, fl
|
||||||
// no renderapi support
|
// no renderapi support
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mstudiotex_s *R_StudioGetTexture(cl_entity_t *e)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GL_BuildLightmaps()
|
void GL_BuildLightmaps()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
14
r_local.h
14
r_local.h
|
@ -84,7 +84,7 @@ extern byte *r_temppool;
|
||||||
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == gEngfuncs.GetPlayerIndex() && e->player )
|
#define RP_LOCALCLIENT( e ) ((e) != NULL && (e)->index == gEngfuncs.GetPlayerIndex() && e->player )
|
||||||
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
#define RP_NORMALPASS() ( FBitSet( RI.params, RP_NONVIEWERREF ) == 0 )
|
||||||
|
|
||||||
#define CL_IsViewEntityLocalPlayer() ( gEngfuncs.GetViewEntIndex() == gEngfuncs.GetPlayerIndex() )
|
#define CL_IsViewEntityLocalPlayer() ( ENGINE_GET_PARM( PARM_VIEWENT_INDEX ) == ENGINE_GET_PARM( PARM_PLAYER_INDEX ) )
|
||||||
|
|
||||||
#define CULL_VISIBLE 0 // not culled
|
#define CULL_VISIBLE 0 // not culled
|
||||||
#define CULL_BACKSIDE 1 // backside of transparent wall
|
#define CULL_BACKSIDE 1 // backside of transparent wall
|
||||||
|
@ -547,7 +547,7 @@ void R_SpriteInit( void );
|
||||||
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags );
|
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags );
|
||||||
mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw );
|
mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw );
|
||||||
void R_DrawSpriteModel( cl_entity_t *e );
|
void R_DrawSpriteModel( cl_entity_t *e );
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
// gl_studio.c
|
// gl_studio.c
|
||||||
//
|
//
|
||||||
|
@ -567,7 +567,7 @@ void R_StudioResetPlayerModels( void );
|
||||||
void CL_InitStudioAPI( void );
|
void CL_InitStudioAPI( void );
|
||||||
void Mod_StudioLoadTextures( model_t *mod, void *data );
|
void Mod_StudioLoadTextures( model_t *mod, void *data );
|
||||||
void Mod_StudioUnloadTextures( void *data );
|
void Mod_StudioUnloadTextures( void *data );
|
||||||
|
#if 0
|
||||||
//
|
//
|
||||||
// gl_alias.c
|
// gl_alias.c
|
||||||
//
|
//
|
||||||
|
@ -682,7 +682,7 @@ void TriFog( float flFogColor[3], float flStart, float flEnd, int bOn );
|
||||||
void TriGetMatrix( const int pname, float *matrix );
|
void TriGetMatrix( const int pname, float *matrix );
|
||||||
void TriFogParams( float flDensity, int iFogSkybox );
|
void TriFogParams( float flDensity, int iFogSkybox );
|
||||||
void TriCullFace( TRICULLSTYLE mode );
|
void TriCullFace( TRICULLSTYLE mode );
|
||||||
|
void TriBrightness( float brightness );
|
||||||
|
|
||||||
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
#define ENGINE_GET_PARM_ (*gEngfuncs.EngineGetParm)
|
||||||
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( (parm), 0 )
|
#define ENGINE_GET_PARM( parm ) ENGINE_GET_PARM_( (parm), 0 )
|
||||||
|
@ -694,6 +694,12 @@ extern cvar_t *r_drawentities;
|
||||||
extern cvar_t *vid_brightness;
|
extern cvar_t *vid_brightness;
|
||||||
extern cvar_t *vid_gamma;
|
extern cvar_t *vid_gamma;
|
||||||
extern cvar_t *r_norefresh;
|
extern cvar_t *r_norefresh;
|
||||||
|
extern cvar_t *r_dynamic;
|
||||||
|
extern cvar_t *r_lightmap;
|
||||||
|
|
||||||
|
// todo: gl_cull.c
|
||||||
|
#define R_CullModel(...) 0
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
//
|
//
|
||||||
// renderer cvars
|
// renderer cvars
|
||||||
|
|
27
r_main.c
27
r_main.c
|
@ -91,6 +91,8 @@ cvar_t *r_dspeeds;
|
||||||
cvar_t *r_fullbright;
|
cvar_t *r_fullbright;
|
||||||
cvar_t *r_lerpmodels;
|
cvar_t *r_lerpmodels;
|
||||||
cvar_t *r_novis;
|
cvar_t *r_novis;
|
||||||
|
cvar_t *r_lightmap;
|
||||||
|
cvar_t *r_dynamic;
|
||||||
|
|
||||||
cvar_t *r_speeds;
|
cvar_t *r_speeds;
|
||||||
cvar_t *r_lightlevel; //FIXME HACK
|
cvar_t *r_lightlevel; //FIXME HACK
|
||||||
|
@ -207,7 +209,7 @@ static int R_RankForRenderMode( int rendermode )
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_GetEntityRenderMode
|
R_GetEntityRenderMode
|
||||||
|
@ -227,7 +229,7 @@ int R_GetEntityRenderMode( cl_entity_t *ent )
|
||||||
RI.currententity = ent;
|
RI.currententity = ent;
|
||||||
return ent->curstate.rendermode;
|
return ent->curstate.rendermode;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void R_AllowFog( qboolean allowed )
|
void R_AllowFog( qboolean allowed )
|
||||||
{
|
{
|
||||||
|
@ -1002,15 +1004,23 @@ R_DrawEntitiesOnList
|
||||||
void R_DrawEntitiesOnList( void )
|
void R_DrawEntitiesOnList( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
extern int d_aflatcolor;
|
||||||
|
d_aflatcolor = 0;
|
||||||
tr.blend = 1.0f;
|
tr.blend = 1.0f;
|
||||||
// GL_CheckForErrors();
|
// GL_CheckForErrors();
|
||||||
|
// HACK: setup world transform
|
||||||
|
void R_AliasSetUpTransform (void);
|
||||||
|
RI.currententity = gEngfuncs.GetEntityByIndex(0);
|
||||||
|
R_AliasSetUpTransform();
|
||||||
|
extern void (*d_pdrawspans)(void *);
|
||||||
|
extern void R_PolysetFillSpans8 ( void * );
|
||||||
|
d_pdrawspans = R_PolysetFillSpans8;
|
||||||
// first draw solid entities
|
// first draw solid entities
|
||||||
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ )
|
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ )
|
||||||
{
|
{
|
||||||
RI.currententity = tr.draw_list->solid_entities[i];
|
RI.currententity = tr.draw_list->solid_entities[i];
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
d_aflatcolor += 500;
|
||||||
|
|
||||||
Assert( RI.currententity != NULL );
|
Assert( RI.currententity != NULL );
|
||||||
Assert( RI.currentmodel != NULL );
|
Assert( RI.currentmodel != NULL );
|
||||||
|
@ -1025,7 +1035,7 @@ void R_DrawEntitiesOnList( void )
|
||||||
break;
|
break;
|
||||||
case mod_studio:
|
case mod_studio:
|
||||||
//R_DrawStudioModel( RI.currententity );
|
//R_DrawStudioModel( RI.currententity );
|
||||||
{finalvert_t fv[3];
|
/*{finalvert_t fv[3];
|
||||||
void R_AliasSetUpTransform (void);
|
void R_AliasSetUpTransform (void);
|
||||||
extern void (*d_pdrawspans)(void *);
|
extern void (*d_pdrawspans)(void *);
|
||||||
extern void R_PolysetFillSpans8 ( void * );
|
extern void R_PolysetFillSpans8 ( void * );
|
||||||
|
@ -1036,7 +1046,8 @@ void R_DrawEntitiesOnList( void )
|
||||||
R_SetupFinalVert( &fv[1], -10, 10, 10, 0, 0, 0);
|
R_SetupFinalVert( &fv[1], -10, 10, 10, 0, 0, 0);
|
||||||
R_SetupFinalVert( &fv[2], 10, 10, -10, 0, 0, 0);
|
R_SetupFinalVert( &fv[2], 10, 10, -10, 0, 0, 0);
|
||||||
R_RenderTriangle( &fv );
|
R_RenderTriangle( &fv );
|
||||||
}
|
}*/
|
||||||
|
R_DrawStudioModel( RI.currententity );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1868,6 +1879,9 @@ qboolean R_Init()
|
||||||
r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
|
r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
|
||||||
sw_mipcap = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
|
sw_mipcap = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
|
||||||
|
|
||||||
|
r_dynamic = gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
|
||||||
|
r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
|
||||||
|
|
||||||
// sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0);
|
// sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0);
|
||||||
// sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE );
|
// sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE );
|
||||||
sw_clearcolor = gEngfuncs.Cvar_Get ("sw_clearcolor", "2", 0, "screen clear color");
|
sw_clearcolor = gEngfuncs.Cvar_Get ("sw_clearcolor", "2", 0, "screen clear color");
|
||||||
|
@ -1915,6 +1929,7 @@ qboolean R_Init()
|
||||||
view_clipplanes[1].rightedge = true;
|
view_clipplanes[1].rightedge = true;
|
||||||
view_clipplanes[1].leftedge = view_clipplanes[2].leftedge =view_clipplanes[3].leftedge = false;
|
view_clipplanes[1].leftedge = view_clipplanes[2].leftedge =view_clipplanes[3].leftedge = false;
|
||||||
view_clipplanes[0].rightedge = view_clipplanes[2].rightedge = view_clipplanes[3].rightedge = false;
|
view_clipplanes[0].rightedge = view_clipplanes[2].rightedge = view_clipplanes[3].rightedge = false;
|
||||||
|
R_StudioInit();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1149,7 +1149,7 @@ void R_PolysetFillSpans8 (spanpackage_t *pspanpackage)
|
||||||
int lcount;
|
int lcount;
|
||||||
// FIXME: do z buffering
|
// FIXME: do z buffering
|
||||||
|
|
||||||
color = d_aflatcolor+= 100;
|
color = d_aflatcolor++ * 10;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
3761
r_studio.c
Normal file
3761
r_studio.c
Normal file
File diff suppressed because it is too large
Load diff
43
r_triapi.c
43
r_triapi.c
|
@ -23,6 +23,10 @@ static struct
|
||||||
vec4_t triRGBA;
|
vec4_t triRGBA;
|
||||||
} ds;
|
} ds;
|
||||||
|
|
||||||
|
finalvert_t triv[3];
|
||||||
|
int vertcount;
|
||||||
|
int mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================
|
===============================================================
|
||||||
|
|
||||||
|
@ -76,7 +80,7 @@ TriBegin
|
||||||
begin triangle sequence
|
begin triangle sequence
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void TriBegin( int mode )
|
void TriBegin( int mode1 )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
switch( mode )
|
switch( mode )
|
||||||
|
@ -110,6 +114,8 @@ void TriBegin( int mode )
|
||||||
|
|
||||||
pglBegin( mode );
|
pglBegin( mode );
|
||||||
#endif
|
#endif
|
||||||
|
mode = mode1;
|
||||||
|
vertcount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -121,6 +127,8 @@ draw triangle sequence
|
||||||
*/
|
*/
|
||||||
void TriEnd( void )
|
void TriEnd( void )
|
||||||
{
|
{
|
||||||
|
//if( vertcount == 3 )
|
||||||
|
R_RenderTriangle( triv );
|
||||||
//pglEnd( );
|
//pglEnd( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +220,7 @@ TriVertex3fv
|
||||||
void TriVertex3fv( const float *v )
|
void TriVertex3fv( const float *v )
|
||||||
{
|
{
|
||||||
//pglVertex3fv( v );
|
//pglVertex3fv( v );
|
||||||
|
TriVertex3f( v[0], v[1], v[2] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -222,7 +231,37 @@ TriVertex3f
|
||||||
*/
|
*/
|
||||||
void TriVertex3f( float x, float y, float z )
|
void TriVertex3f( float x, float y, float z )
|
||||||
{
|
{
|
||||||
//pglVertex3f( x, y, z );
|
if( mode == TRI_TRIANGLE_FAN )
|
||||||
|
{
|
||||||
|
R_SetupFinalVert( &triv[vertcount], x, y, z, 0,0,0);
|
||||||
|
vertcount++;
|
||||||
|
if( vertcount >= 3 )
|
||||||
|
{
|
||||||
|
R_RenderTriangle( triv );
|
||||||
|
triv[1] = triv[2];
|
||||||
|
vertcount = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( mode == TRI_TRIANGLE_STRIP )
|
||||||
|
{
|
||||||
|
R_SetupFinalVert( &triv[vertcount], x, y, z, 0,0,0);
|
||||||
|
vertcount++;
|
||||||
|
if( vertcount == 3 )
|
||||||
|
{
|
||||||
|
R_RenderTriangle( triv );
|
||||||
|
finalvert_t fv = triv[0];
|
||||||
|
|
||||||
|
triv[0] = triv[2];
|
||||||
|
triv[2] = fv;
|
||||||
|
R_RenderTriangle( triv );
|
||||||
|
fv = triv[0];
|
||||||
|
triv[0] = triv[2];
|
||||||
|
triv[2] = fv;
|
||||||
|
triv[0] = triv[1];
|
||||||
|
triv[1] = triv[2];
|
||||||
|
vertcount = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue