/* ===================== RE_AddDynamicLightToScene ===================== */ void RE_AddDynamicLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, int flags, qhandle_t hShader ) { dlight_t *dl; // early out if ( !tr.registered || r_numdlights >= MAX_DLIGHTS || radius <= 0 || intensity <= 0 ) { return; } // RF, allow us to force some dlights under all circumstances if ( !( flags & REF_FORCE_DLIGHT ) ) { if ( r_dynamiclight->integer == 0 ) { return; } } // set up a new dlight dl = &backEndData->dlights[ r_numdlights++ ]; VectorCopy( org, dl->origin ); VectorCopy( org, dl->transformed ); dl->radius = radius; dl->radiusInverseCubed = ( 1.0 / dl->radius ); dl->radiusInverseCubed = dl->radiusInverseCubed * dl->radiusInverseCubed * dl->radiusInverseCubed; dl->intensity = intensity; dl->color[ 0 ] = r; dl->color[ 1 ] = g; dl->color[ 2 ] = b; dl->flags = flags; if ( hShader ) { dl->dlshader = R_GetShaderByHandle( hShader ); } else { dl->dlshader = NULL; } }
/* ============== RE_StretchPicGradient ============== */ void RE_StretchPicGradient( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, const Color::Color& gradientColor, int gradientType ) { stretchPicCommand_t *cmd; cmd = (stretchPicCommand_t*) R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = renderCommand_t::RC_STRETCH_PIC_GRADIENT; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; cmd->gradientColor = gradientColor; cmd->gradientType = gradientType; }
void RE_2DPolyies(polyVert_t *verts, int numverts, qhandle_t hShader) { #if 0 poly2dCommand_t *cmd; if (r_numpolyverts + numverts > max_polyverts) { return; } cmd = R_GetCommandBuffer(sizeof(*cmd)); if (!cmd) { return; } cmd->commandId = RC_2DPOLYS; cmd->verts = &backEndData->polyVerts[r_numpolyverts]; cmd->numverts = numverts; memcpy(cmd->verts, verts, sizeof(polyVert_t) * numverts); cmd->shader = R_GetShaderByHandle(hShader); r_numpolyverts += numverts; #endif }
/* ===================== RE_AddDynamicLightToScene modified dlight system to support seperate radius and intensity ===================== */ void RE_AddDynamicLightToSceneET(const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags) { trRefLight_t *light; if (!tr.registered) { return; } if (r_numLights >= MAX_REF_LIGHTS) { return; } if (intensity <= 0 || radius <= 0) { return; } light = &backEndData[tr.smpFrame]->lights[r_numLights++]; light->l.rlType = RL_OMNI; //light->l.lightfx = 0; VectorCopy(org, light->l.origin); QuatClear(light->l.rotation); VectorClear(light->l.center); // HACK: this will tell the renderer backend to use tr.defaultLightShader #if 0 dl->shader = R_GetShaderByHandle(hShader); if (dl->shader == tr.defaultShader) { dl->shader = NULL; } #endif light->l.attenuationShader = 0; light->l.radius[0] = radius; light->l.radius[1] = radius; light->l.radius[2] = radius; light->l.color[0] = r; light->l.color[1] = g; light->l.color[2] = b; light->l.noShadows = r_dynamicLightCastShadows->integer ? qfalse : qtrue; light->l.inverseShadows = qfalse; light->isStatic = qfalse; light->additive = qtrue; light->l.scale = intensity; #if 0 if (light->l.scale <= r_lightScale->value) { light->l.scale = r_lightScale->value; } #endif }
/* ============= RE_StretchPic ============= */ void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; //void *p0 = __builtin_return_address(0); //printf("RE_StretchPic: %08x\n", p0); if (!tr.registered) { return; } //printf("RE_StretchPic %3.2f %3.2f %3.2f %3.2f\n%1.3f %1.3f %1.3f %1.3f\n",x,y,w,h,s1,t1,s2,t2); cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_STRETCH_PIC; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; }
/* ============= RE_StretchPic ============= */ void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; if (!tr.registered) { return; } if (R_ClipRegion(&x, &y, &w, &h, &s1, &t1, &s2, &t2)) { return; } cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_STRETCH_PIC; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; }
void RE_2DPolyiesIndexed( polyVert_t *verts, int numverts, int *indexes, int numindexes, int trans_x, int trans_y, qhandle_t hShader ) { poly2dIndexedCommand_t *cmd; if ( r_numPolyVerts + numverts > r_maxPolyVerts->integer ) { return; } if ( r_numPolyIndexes + numindexes > r_maxPolyVerts->integer ) { return; } cmd = (poly2dIndexedCommand_t*) R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_2DPOLYSINDEXED; cmd->verts = &backEndData[ tr.smpFrame ]->polyVerts[ r_numPolyVerts ]; cmd->numverts = numverts; memcpy( cmd->verts, verts, sizeof( polyVert_t ) * numverts ); cmd->shader = R_GetShaderByHandle( hShader ); cmd->indexes = &backEndData[ tr.smpFrame ]->polyIndexes[ r_numPolyIndexes ]; memcpy( cmd->indexes, indexes, sizeof( int ) * numindexes ); cmd->numIndexes = numindexes; cmd->translation[ 0 ] = trans_x; cmd->translation[ 1 ] = trans_y; r_numPolyVerts += numverts; r_numPolyIndexes += numindexes; }
/* ============= RE_RotatedPic ============= */ void RE_RotatedPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, float angle ) { stretchPicCommand_t *cmd; cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_ROTATED_PIC; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; // fixup cmd->w /= 2; cmd->h /= 2; cmd->x += cmd->w; cmd->y += cmd->h; cmd->w = sqrt( ( cmd->w * cmd->w ) + ( cmd->h * cmd->h ) ); cmd->h = cmd->w; cmd->angle = angle; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; }
/* ============== RE_StretchPicGradient ============== */ void RE_StretchPicGradient( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader, const float *gradientColor, int gradientType ) { stretchPicCommand_t *cmd; cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_STRETCH_PIC_GRADIENT; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; if ( !gradientColor ) { static float colorWhite[4] = { 1, 1, 1, 1 }; gradientColor = colorWhite; } cmd->gradientColor[0] = gradientColor[0] * 255; cmd->gradientColor[1] = gradientColor[1] * 255; cmd->gradientColor[2] = gradientColor[2] * 255; cmd->gradientColor[3] = gradientColor[3] * 255; cmd->gradientType = gradientType; }
void Q_EXTERNAL_CALL RE_StretchPic( float x, float y, float w, float h, float mat[2][3], float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; if( !tr.registered ) return; cmd = R_GetCommandBuffer( RB_StretchPic, sizeof( *cmd ) ); if( !cmd ) return; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; if( mat ) Com_Memcpy( cmd->mat, mat, sizeof( cmd->mat ) ); else { cmd->mat[0][0] = 1.0F; cmd->mat[0][1] = 0.0F; cmd->mat[0][2] = 0.0F; cmd->mat[1][0] = 0.0F; cmd->mat[1][1] = 1.0F; cmd->mat[1][2] = 0.0F; } }
/* ===================== RE_AddLightToScene ===================== */ void RE_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b, int overdraw ) { dlight_t *dl; if ( !tr.registered ) { return; } if ( r_numdlights >= MAX_DLIGHTS ) { return; } if ( intensity <= 0 ) { return; } // these cards don't have the correct blend mode if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) { return; } // RF, allow us to force some dlights under all circumstances if ( !( overdraw & REF_FORCE_DLIGHT ) ) { if ( r_dynamiclight->integer == 0 ) { return; } if ( r_dynamiclight->integer == 2 && !( backEndData[tr.smpFrame]->dlights[r_numdlights].forced ) ) { return; } } overdraw &= ~REF_FORCE_DLIGHT; overdraw &= ~REF_JUNIOR_DLIGHT; //----(SA) added dl = &backEndData[tr.smpFrame]->dlights[r_numdlights++]; VectorCopy( org, dl->origin ); dl->radius = intensity; dl->color[0] = r; dl->color[1] = g; dl->color[2] = b; dl->dlshader = NULL; dl->overdraw = 0; if ( overdraw == 10 ) { // sorry, hijacking 10 for a quick hack (SA) dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "negdlightshader" ) ); } else if ( overdraw == 11 ) { // 11 is flames dl->dlshader = R_GetShaderByHandle( RE_RegisterShader( "flamedlightshader" ) ); } else { dl->overdraw = overdraw; } }
void G2_TraceModels(CGhoul2Info_v &ghoul2, vec3_t rayStart, vec3_t rayEnd, CCollisionRecord *collRecMap, int entNum, EG2_Collision eG2TraceType, int useLod, float fRadius) { int i, lod; skin_t *skin; shader_t *cust_shader; // walk each possible model for this entity and try tracing against it for (i=0; i<ghoul2.size(); i++) { // don't bother with models that we don't care about. if (!ghoul2[i].mValid) { continue; } assert(G2_MODEL_OK(&ghoul2[i])); // do we really want to collide with this object? if (ghoul2[i].mFlags & GHOUL2_NOCOLLIDE) { continue; } if (ghoul2[i].mCustomShader) { cust_shader = R_GetShaderByHandle(ghoul2[i].mCustomShader ); } else { cust_shader = NULL; } // figure out the custom skin thing if ( ghoul2[i].mSkin > 0 && ghoul2[i].mSkin < tr.numSkins ) { skin = R_GetSkinByHandle( ghoul2[i].mSkin ); } else { skin = NULL; } lod = G2_DecideTraceLod(ghoul2[i],useLod); //reset the quick surface override lookup G2_FindOverrideSurface(-1, ghoul2[i].mSlist); CTraceSurface TS(ghoul2[i].mSurfaceRoot, ghoul2[i].mSlist, ghoul2[i].currentModel, lod, rayStart, rayEnd, collRecMap, entNum, i, skin, cust_shader, ghoul2[i].mTransformedVertsArray, eG2TraceType, fRadius); // start the surface recursion loop G2_TraceSurfaces(TS); // if we've hit one surface on one model, don't bother doing the rest if (TS.hitOne) { break; } } }
void R_AddPolygonSurfaces() { tr.currentEntityNum = ENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; const srfPoly_t* poly = tr.refdef.polys; for (int i = 0; i < tr.refdef.numPolys; ++i, ++poly) { R_AddDrawSurf( (const surfaceType_t*)poly, R_GetShaderByHandle( poly->hShader ), poly->fogIndex ); } }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonSurfaces( void ) { int i; shader_t *sh; srfPoly_t *poly; tr.currentEntityNum = ENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { sh = R_GetShaderByHandle( poly->hShader ); R_AddDrawSurf( reinterpret_cast<surfaceType_t*>(poly), sh, poly->fogIndex, false ); } }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonSurfaces( void ) { int i; shader_t *sh; srfPoly_t *poly; tr.currentEntityNum = REFENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT; for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { sh = R_GetShaderByHandle( poly->hShader ); R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex, qfalse ); } }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonSurfaces( void ) { int i; shader_t *sh; srfPoly_t *poly; tr.currentEntityNum = ENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { sh = R_GetShaderByHandle( poly->hShader ); R_AddDrawSurf( ( surfaceType_t * )poly, sh, poly->fogIndex, qfalse ); // ***GREGS_VC9_PORT_MOD*** -- changed typecast; was void * } }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonBufferSurfaces( void ) { int i; shader_t *sh; srfPolyBuffer_t *polybuffer; tr.currentEntityNum = ENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT; for ( i = 0, polybuffer = tr.refdef.polybuffers; i < tr.refdef.numPolyBuffers ; i++, polybuffer++ ) { sh = R_GetShaderByHandle( polybuffer->pPolyBuffer->shader ); R_AddDrawSurf( ( void * )polybuffer, sh, R_PolyBufferFogNum( polybuffer ), qfalse ); } }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonBufferSurfaces() { int i; shader_t* sh; srfPolyBuffer_t* polybuffer; tr.currentEntity = &tr.worldEntity; for (i = 0, polybuffer = tr.refdef.polybuffers; i < tr.refdef.numPolybuffers; i++, polybuffer++) { sh = R_GetShaderByHandle(polybuffer->pPolyBuffer->shader); R_AddDrawSurf((surfaceType_t*) polybuffer, sh, -1, polybuffer->fogIndex); } }
/* ============= RE_SetColorGrading ============= */ void RE_SetColorGrading( int slot, qhandle_t hShader ) { setColorGradingCommand_t *cmd; shader_t *shader = R_GetShaderByHandle( hShader ); image_t *image; if ( !tr.registered ) { return; } if ( slot < 0 || slot > 3 ) { return; } if ( shader->defaultShader || !shader->stages[ 0 ] ) { return; } image = shader->stages[ 0 ]->bundle[ 0 ].image[ 0 ]; if ( !image ) { return; } if ( image->width != REF_COLORGRADEMAP_SIZE && image->height != REF_COLORGRADEMAP_SIZE ) { return; } if ( image->width * image->height != REF_COLORGRADEMAP_STORE_SIZE ) { return; } cmd = ( setColorGradingCommand_t * ) R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->slot = slot; cmd->image = image; cmd->commandId = RC_SET_COLORGRADING; }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonSurfaces( void ) { int i; shader_t *sh; srfPoly_t *poly; int fogMask; tr.currentEntityNum = REFENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT; fogMask = -((tr.refdef.rdflags & RDF_NOFOG) == 0); for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { sh = R_GetShaderByHandle( poly->hShader ); R_AddDrawSurf( ( void * )poly, sh, poly->fogIndex & fogMask, qfalse, qfalse, 0 /*cubeMap*/ ); } }
/* ============= RE_StretchPic ============= */ void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; float tmp; if (!tr.registered) { return; } cmd = R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } // flip image horizontally if (w < 0) { // flip texture coords tmp = s1; s1 = s2; s2 = tmp; // draw shader left of x w = fabs(w); x -= w; } // flip image vertically if (h < 0) { // flip texture coords tmp = t2; t2 = t1; t1 = tmp; // draw shader above y h = fabs(h); y -= h; } cmd->commandId = RC_STRETCH_PIC; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; }
/* ===================== R_AddPolygonSurfaces Adds all the scene's polys into this view's drawsurf list ===================== */ void R_AddPolygonSurfaces() { int i; shader_t* sh; srfPoly_t* poly; if (!r_drawpolies->integer) { return; } tr.currentEntity = &tr.worldEntity; for (i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys; i++, poly++) { sh = R_GetShaderByHandle(poly->hShader); R_AddDrawSurf((surfaceType_t*) poly, sh, -1, poly->fogIndex); } }
/* ============== R_AddAnimSurfaces ============== */ void R_AddAnimSurfaces( trRefEntity_t *ent ) { md4Header_t *header; md4Surface_t *surface; md4LOD_t *lod; shader_t *shader; int i; header = tr.currentModel->md4; lod = (md4LOD_t *)( (byte *)header + header->ofsLODs ); surface = (md4Surface_t *)( (byte *)lod + lod->ofsSurfaces ); for ( i = 0 ; i < lod->numSurfaces ; i++ ) { shader = R_GetShaderByHandle( surface->shaderIndex ); R_AddDrawSurf( (void *)surface, shader, 0 /*fogNum*/, qfalse ); surface = (md4Surface_t *)( (byte *)surface + surface->ofsEnd ); } }
void Q_EXTERNAL_CALL RE_DrawPolys( const polyVert2D_t *verts, uint numVertsPerPoly, uint numPolys, qhandle_t hShader ) { uint numVerts; drawPolysCmd_t *cmd; numVerts = numPolys * numVertsPerPoly; cmd = (drawPolysCmd_t*)R_GetCommandBuffer( RB_DrawPolys, sizeof( drawPolysCmd_t ) + sizeof( polyVert2D_t ) * (numVerts - 1) ); if( !cmd ) return; cmd->numVertsPerPoly = numVertsPerPoly; cmd->numPolys = numPolys; cmd->shader = R_GetShaderByHandle( hShader ); Com_Memcpy( cmd->verts, verts, sizeof( polyVert2D_t ) * numVerts ); }
void RE_AddLightToScene( const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags ) { dlight_t *dl; // early out if ( !tr.registered || r_numdlights >= MAX_DLIGHTS || radius <= 0 || intensity <= 0 ) { return; } // these cards don't have the correct blend mode if ( glConfig.hardwareType == GLHW_RIVA128 || glConfig.hardwareType == GLHW_PERMEDIA2 ) { return; } // RF, allow us to force some dlights under all circumstances if ( !( flags & REF_FORCE_DLIGHT ) ) { if ( r_dynamiclight->integer == 0 ) { return; } } // set up a new dlight dl = &backEndData[ tr.smpFrame ]->dlights[ r_numdlights++ ]; VectorCopy( org, dl->origin ); VectorCopy( org, dl->transformed ); dl->radius = radius; dl->radiusInverseCubed = ( 1.0 / dl->radius ); dl->radiusInverseCubed = dl->radiusInverseCubed * dl->radiusInverseCubed * dl->radiusInverseCubed; dl->intensity = intensity; dl->color[ 0 ] = r; dl->color[ 1 ] = g; dl->color[ 2 ] = b; dl->shader = R_GetShaderByHandle( hShader ); if ( dl->shader == tr.defaultShader ) { dl->shader = NULL; } dl->flags = flags; }
/* ============= RE_StretchPic ============= */ void RE_StretchPic ( float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader ) { stretchPicCommand_t *cmd; cmd = (stretchPicCommand_t *) R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_STRETCH_PIC; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; }
/* RE_AddLightToScene() modified dlight system to support seperate radius and intensity */ void RE_AddLightToScene(const vec3_t org, float radius, float intensity, float r, float g, float b, qhandle_t hShader, int flags) { dlight_t *dl; // early out if (!tr.registered || radius <= 0 || intensity <= 0) { return; } if (r_numdlights >= MAX_DLIGHTS) { Ren_Print("WARNING RE_AddLightToScene: Dropping dlight, reached MAX_DLIGHTS\n"); return; } // allow us to force some dlights under all circumstances if (!(flags & REF_FORCE_DLIGHT)) { if (r_dynamiclight->integer == 0) { return; } } // set up a new dlight dl = &backEndData->dlights[r_numdlights++]; VectorCopy(org, dl->origin); VectorCopy(org, dl->transformed); dl->radius = radius; dl->radiusInverseCubed = (1.0 / dl->radius); dl->radiusInverseCubed = dl->radiusInverseCubed * dl->radiusInverseCubed * dl->radiusInverseCubed; dl->intensity = intensity; dl->color[0] = r; dl->color[1] = g; dl->color[2] = b; dl->shader = R_GetShaderByHandle(hShader); if (dl->shader == tr.defaultShader) { dl->shader = NULL; } dl->flags = flags; }
/** * @brief GetMDVSurfaceShader * @param[in] ent * @param[in] mdvSurface * @return */ static shader_t *GetMDVSurfaceShader(const trRefEntity_t *ent, mdvSurface_t *mdvSurface) { shader_t *shader = 0; if (ent->e.customShader) { shader = R_GetShaderByHandle(ent->e.customShader); } else if (ent->e.customSkin > 0 && ent->e.customSkin < tr.numSkins) { skin_t *skin; int j; skin = R_GetSkinByHandle(ent->e.customSkin); // match the surface name to something in the skin file shader = tr.defaultShader; for (j = 0; j < skin->numSurfaces; j++) { // the names have both been lowercased if (!strcmp(skin->surfaces[j].name, mdvSurface->name)) { shader = skin->surfaces[j].shader; break; } } if (shader == tr.defaultShader) { Ren_Developer("WARNING: no shader for surface %s in skin %s\n", mdvSurface->name, skin->name); } else if (shader->defaultShader) { Ren_Developer("WARNING: shader %s in skin %s not found\n", shader->name, skin->name); } } else { shader = mdvSurface->shader; } return shader; }
/* ============= RE_RotatePic2 ============= */ void RE_RotatePic2 ( float x, float y, float w, float h, float s1, float t1, float s2, float t2,float a, qhandle_t hShader ) { rotatePicCommand_t *cmd; cmd = (rotatePicCommand_t *) R_GetCommandBuffer( sizeof( *cmd ) ); if ( !cmd ) { return; } cmd->commandId = RC_ROTATE_PIC2; cmd->shader = R_GetShaderByHandle( hShader ); cmd->x = x; cmd->y = y; cmd->w = w; cmd->h = h; cmd->s1 = s1; cmd->t1 = t1; cmd->s2 = s2; cmd->t2 = t2; cmd->a = a; }
void RE_2DPolyies(polyVert_t* verts, int numverts, qhandle_t hShader) { poly2dCommand_t* cmd; if (r_numPolyVerts + numverts > r_maxPolyVerts->integer) { return; } cmd = (poly2dCommand_t*) R_GetCommandBuffer(sizeof(*cmd)); if (!cmd) { return; } cmd->commandId = RC_2DPOLYS; cmd->verts = &backEndData[tr.smpFrame]->polyVerts[r_numPolyVerts]; cmd->numverts = numverts; memcpy(cmd->verts, verts, sizeof(polyVert_t) * numverts); cmd->shader = R_GetShaderByHandle(hShader); r_numPolyVerts += numverts; }