29 #include "../idlib/precompiled.h"
239 for (i = 0 ; i < numDrawSurfs ; i++ ) {
240 drawSurf = drawSurfs[
i];
265 triFunc_( drawSurf );
286 for ( drawSurf = drawSurfs ; drawSurf ; drawSurf = drawSurf->
nextOnLight ) {
310 triFunc_( drawSurf );
327 matrix[0] = shaderRegisters[ texture->
matrix[0][0] ];
328 matrix[4] = shaderRegisters[ texture->
matrix[0][1] ];
330 matrix[12] = shaderRegisters[ texture->
matrix[0][2] ];
334 if ( matrix[12] < -40 || matrix[12] > 40 ) {
335 matrix[12] -= (
int)matrix[12];
338 matrix[1] = shaderRegisters[ texture->
matrix[1][0] ];
339 matrix[5] = shaderRegisters[ texture->
matrix[1][1] ];
341 matrix[13] = shaderRegisters[ texture->
matrix[1][2] ];
342 if ( matrix[13] < -40 || matrix[13] > 40 ) {
343 matrix[13] -= (
int)matrix[13];
399 if (texture->
image) {
462 qglTexGenf( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
463 qglTexGenf( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
464 qglTexGenf( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
525 for ( i = 0 ; i < numStages ; i++ ) {
527 for ( j = 0 ; j < 3 ; j++ ) {
583 qglClear( GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
604 matrix[0][0] = surfaceRegs[surfaceStage->
texture.
matrix[0][0]];
605 matrix[0][1] = surfaceRegs[surfaceStage->
texture.
matrix[0][1]];
607 matrix[0][3] = surfaceRegs[surfaceStage->
texture.
matrix[0][2]];
609 matrix[1][0] = surfaceRegs[surfaceStage->
texture.
matrix[1][0]];
610 matrix[1][1] = surfaceRegs[surfaceStage->
texture.
matrix[1][1]];
612 matrix[1][3] = surfaceRegs[surfaceStage->
texture.
matrix[1][2]];
616 if ( matrix[0][3] < -40 || matrix[0][3] > 40 ) {
617 matrix[0][3] -= (
int)matrix[0][3];
619 if ( matrix[1][3] < -40 || matrix[1][3] > 40 ) {
620 matrix[1][3] -= (
int)matrix[1][3];
635 for (
int i = 0 ;
i < 4 ;
i++ ) {
640 if ( color[
i] < 0 ) {
642 }
else if ( color[
i] > 1.0 ) {
677 DrawInteraction( din );
702 RB_LogComment(
"---------- RB_CreateSingleDrawInteractions %s on %s ----------\n", lightShader->
GetName(), surfaceShader->
GetName() );
740 for (
int i = 0 ;
i < 4 ;
i++ ) {
744 for (
int lightStageNum = 0 ; lightStageNum < lightShader->
GetNumStages() ; lightStageNum++ ) {
777 for (
int surfaceStageNum = 0 ; surfaceStageNum < surfaceShader->
GetNumStages() ; surfaceStageNum++ ) {
791 RB_SubmittInteraction( &inter, DrawInteraction );
803 RB_SubmittInteraction( &inter, DrawInteraction );
820 RB_SubmittInteraction( &inter, DrawInteraction );
835 RB_SubmittInteraction( &inter, DrawInteraction );
#define qglTexCoordPointer
const srfTriangles_t * geo
#define qglEnableClientState
#define qglDisableClientState
void RB_DrawShadowElementsWithCounters(const srfTriangles_t *tri, int numIndexes)
void RB_RenderDrawSurfChainWithFunction(const drawSurf_t *drawSurfs, void(*triFunc_)(const drawSurf_t *))
idCVar r_useIndexBuffers("r_useIndexBuffers","0", CVAR_RENDERER|CVAR_ARCHIVE|CVAR_INTEGER,"use ARB_vertex_buffer_object for indexes", 0, 1, idCmdSystem::ArgCompletion_Integer< 0, 1 >)
stageVertexColor_t vertexColor
float GetFloat(void) const
const int GetNumStages(void) const
idCVar r_skipDynamicTextures("r_skipDynamicTextures","0", CVAR_RENDERER|CVAR_BOOL,"don't dynamically create textures")
void RB_RenderDrawSurfListWithFunction(drawSurf_t **drawSurfs, int numDrawSurfs, void(*triFunc_)(const drawSurf_t *))
idCVar r_singleTriangle("r_singleTriangle","0", CVAR_RENDERER|CVAR_BOOL,"only draw a single triangle per primitive")
const float * ToFloatPtr(void) const
void RB_STD_DrawView(void)
idCVar r_skipSpecular("r_skipSpecular","0", CVAR_RENDERER|CVAR_BOOL|CVAR_CHEAT|CVAR_ARCHIVE,"use black for specular1")
void RB_T_RenderTriangleSurface(const drawSurf_t *surf)
void RB_DrawView(const void *data)
const char * GetName(void) const
GLenum GLsizei GLenum GLenum const GLvoid * image
GLint GLint GLsizei GLsizei GLsizei depth
void RB_CreateSingleDrawInteractions(const drawSurf_t *surf, void(*DrawInteraction)(const drawInteraction_t *))
void RB_BakeTextureMatrixIntoTexgen(idPlane lightProject[3], const float *textureMatrix)
const struct drawSurf_s * globalInteractions
const struct viewEntity_s * space
struct vertCache_s * ambientCache
const idMaterial * material
float projectionMatrix[16]
bool IsAmbientLight() const
const viewEntity_t * currentSpace
const idMaterial * lightShader
struct srfTriangles_s * ambientSurface
void RB_LoadShaderTextureMatrix(const float *shaderRegisters, const textureStage_t *texture)
void RB_DrawElementsWithCounters(const srfTriangles_t *tri)
void GL_Cull(int cullType)
#define GL_REFLECTION_MAP_EXT
struct viewLight_s * next
struct viewLight_s * viewLights
void RB_BeginDrawingView(void)
const shaderStage_t * GetStage(const int index) const
idCVar r_skipBump("r_skipBump","0", CVAR_RENDERER|CVAR_BOOL|CVAR_ARCHIVE,"uses a flat surface instead of the bump map")
idImage * lightFalloffImage
void UploadScratch(const byte *pic, int width, int height)
void RB_BindStageTexture(const float *shaderRegisters, const textureStage_t *texture, const drawSurf_t *surf)
idCVar r_skipRender("r_skipRender","0", CVAR_RENDERER|CVAR_BOOL,"skip 3D rendering, but pass 2D")
void RB_RenderTriangleSurface(const srfTriangles_t *tri)
struct vertCache_s * dynamicTexCoords
GLsizei GLsizei GLenum GLenum const GLvoid * data
void RB_EnterWeaponDepthHack()
idImageManager * globalImages
float lightTextureMatrix[16]
void GLimp_DeactivateContext(void)
idCVar r_skipInteractions("r_skipInteractions","0", CVAR_RENDERER|CVAR_BOOL,"skip all light/surface interaction drawing")
void RB_DrawElementsImmediate(const srfTriangles_t *tri)
float backEndRendererMaxLight
float shaderParms[MAX_GLOBAL_SHADER_PARMS]
const struct drawSurf_s * translucentInteractions
idCVar r_lightScale("r_lightScale","2", CVAR_RENDERER|CVAR_FLOAT,"all light intensities are multiplied by this")
void RB_SetDefaultGLState(void)
const float * ToFloatPtr(void) const
void R_TransposeGLMatrix(const float in[16], float out[16])
void RB_ShowOverdraw(void)
idCVar r_skipRenderContext("r_skipRenderContext","0", CVAR_RENDERER|CVAR_BOOL,"NULL the rendering context during backend 3D rendering")
const float * shaderRegisters
void R_GlobalPointToLocal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
void RB_LogComment(const char *comment,...)
struct viewEntity_s * viewEntitys
void RB_GetShaderTextureMatrix(const float *shaderRegisters, const textureStage_t *texture, float matrix[16])
idVec4 lightProjection[4]
const struct drawSurf_s * localInteractions
const float * ToFloatPtr(void) const
void RB_BindVariableStageImage(const textureStage_t *texture, const float *shaderRegisters)
void * Position(vertCache_t *buffer)
void RB_EnterModelDepthHack(float depth)
const struct drawSurf_s * nextOnLight
float modelViewMatrix[16]
void RB_FinishStageTexture(const textureStage_t *texture, const drawSurf_t *surf)
stageVertexColor_t vertexColor
idVertexCache vertexCache
const idVec3 & ToVec3(void) const
void GL_State(int stateBits)
void RB_DetermineLightScale(void)
idCVar r_useScissor("r_useScissor","1", CVAR_RENDERER|CVAR_BOOL,"scissor clip as portals and lights are processed")
virtual cinData_t ImageForTime(int milliseconds)
struct vertCache_s * indexCache
idCVar r_skipDiffuse("r_skipDiffuse","0", CVAR_RENDERER|CVAR_BOOL,"use black for diffuse")
void GLimp_ActivateContext(void)
idScreenRect currentScissor
void R_SetDrawInteraction(const shaderStage_t *surfaceStage, const float *surfaceRegs, idImage **image, idVec4 matrix[2], float color[4])
void R_GlobalPlaneToLocal(const float modelMatrix[16], const idPlane &in, idPlane &out)
const float * shaderRegisters
bool Equals(const idScreenRect &rect) const
const viewDef_t * viewDef