本文整理汇总了C++中VectorSet4函数的典型用法代码示例。如果您正苦于以下问题:C++ VectorSet4函数的具体用法?C++ VectorSet4怎么用?C++ VectorSet4使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VectorSet4函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CG_GetTeamColor
void CG_GetTeamColor(vector4 *color) {
if (cg.snap->ps.persistent[PERS_TEAM] == TEAM_RED)
VectorSet4( color, 1.0f, 0.0f, 0.0f, 0.25f );
else if (cg.snap->ps.persistent[PERS_TEAM] == TEAM_BLUE)
VectorSet4( color, 0.0f, 0.0f, 1.0f, 0.25f );
else
VectorSet4( color, 0.0f, 0.17f, 0.0f, 0.25f );
}
示例2: RB_ToneMap
void RB_ToneMap(FBO_t *hdrFbo, int autoExposure)
{
vec4i_t srcBox, dstBox;
vec4_t color;
static int lastFrameCount = 0;
if (autoExposure)
{
if (lastFrameCount == 0 || tr.frameCount < lastFrameCount || tr.frameCount - lastFrameCount > 5)
{
// determine average log luminance
FBO_t *srcFbo, *dstFbo, *tmp;
int size = 256;
lastFrameCount = tr.frameCount;
VectorSet4(dstBox, 0, 0, size, size);
srcFbo = hdrFbo;
dstFbo = tr.textureScratchFbo[0];
FBO_Blit(srcFbo, NULL, NULL, dstFbo, dstBox, &tr.calclevels4xShader[0], NULL, 0);
srcFbo = tr.textureScratchFbo[0];
dstFbo = tr.textureScratchFbo[1];
// downscale to 1x1 texture
while (size > 1)
{
VectorSet4(srcBox, 0, 0, size, size);
//size >>= 2;
size >>= 1;
VectorSet4(dstBox, 0, 0, size, size);
if (size == 1)
dstFbo = tr.targetLevelsFbo;
//FBO_Blit(targetFbo, srcBox, NULL, tr.textureScratchFbo[nextScratch], dstBox, &tr.calclevels4xShader[1], NULL, 0);
FBO_FastBlit(srcFbo, srcBox, dstFbo, dstBox, GL_COLOR_BUFFER_BIT, GL_LINEAR);
tmp = srcFbo;
srcFbo = dstFbo;
dstFbo = tmp;
}
}
// blend with old log luminance for gradual change
VectorSet4(srcBox, 0, 0, 0, 0);
color[0] =
color[1] =
color[2] = 1.0f;
if (glRefConfig.textureFloat)
color[3] = 0.03f;
else
color[3] = 0.1f;
FBO_Blit(tr.targetLevelsFbo, srcBox, NULL, tr.calcLevelsFbo, NULL, NULL, color, GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
}
示例3: RB_ShowImages
/*
===============
RB_ShowImages
Draw all the images to the screen, on top of whatever
was there. This is used to test for texture thrashing.
Also called by RE_EndRegistration
===============
*/
void RB_ShowImages( void ) {
int i;
image_t *image;
float x, y, w, h;
int start, end;
RB_SetGL2D();
qglClear( GL_COLOR_BUFFER_BIT );
qglFinish();
start = ri.Milliseconds();
for ( i=0 ; i<tr.numImages ; i++ ) {
image = tr.images[i];
w = glConfig.vidWidth / 20;
h = glConfig.vidHeight / 15;
x = i % 20 * w;
y = i / 20 * h;
// show in proportional size in mode 2
if ( r_showImages->integer == 2 ) {
w *= image->uploadWidth / 512.0f;
h *= image->uploadHeight / 512.0f;
}
{
vec4_t quadVerts[4];
GL_Bind(image);
VectorSet4(quadVerts[0], x, y, 0, 1);
VectorSet4(quadVerts[1], x + w, y, 0, 1);
VectorSet4(quadVerts[2], x + w, y + h, 0, 1);
VectorSet4(quadVerts[3], x, y + h, 0, 1);
RB_InstantQuad(quadVerts);
}
}
qglFinish();
end = ri.Milliseconds();
ri.Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
}
示例4: VectorSet4
/*
================
CG_FadeColor
================
*/
vector4 *CG_FadeColor( int startMsec, int totalMsec ) {
static vector4 color;
int t;
int fadeTime = 500;//FADE_TIME;
if ( startMsec == 0 ) {
return NULL;
}
t = cg.time - startMsec;
if ( t >= totalMsec ) {
return NULL;
}
//Raz: This colour shouldn't be visible yet
if ( t < 0 )
return NULL;
// fade out
VectorSet4( &color, 1.0f, 1.0f, 1.0f, 1.0f );
if ( totalMsec - t < fadeTime )
color.a = (totalMsec - t) * 1.0f / fadeTime;
return &color;
}
示例5: FBO_Blit
void FBO_Blit(FBO_t *src, ivec4_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, ivec4_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend)
{
ivec4_t srcBox;
if (!src)
{
ri.Printf(PRINT_WARNING, "Tried to blit from a NULL FBO!\n");
return;
}
// framebuffers are 0 bottom, Y up.
if (inSrcBox)
{
srcBox[0] = inSrcBox[0];
srcBox[1] = src->height - inSrcBox[1] - inSrcBox[3];
srcBox[2] = inSrcBox[2];
srcBox[3] = inSrcBox[3];
}
else
{
VectorSet4(srcBox, 0, src->height, src->width, -src->height);
}
FBO_BlitFromTexture(src->colorImage[0], srcBox, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
}
示例6: DrawTris
/*
================
DrawTris
Draws triangle outlines for debugging
================
*/
static void DrawTris (shaderCommands_t *input) {
GL_Bind( tr.whiteImage );
GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
qglDepthRange( 0, 0 );
{
shaderProgram_t *sp = &tr.textureColorShader;
vec4_t color;
GLSL_VertexAttribsState(ATTR_POSITION);
GLSL_BindProgram(sp);
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELVIEWPROJECTIONMATRIX, glState.modelviewProjection);
VectorSet4(color, 1, 1, 1, 1);
GLSL_SetUniformVec4(sp, UNIFORM_COLOR, color);
if (input->multiDrawPrimitives)
{
R_DrawMultiElementsVBO(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
}
else
{
R_DrawElementsVBO(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
}
}
qglDepthRange( 0, 1 );
}
示例7: FBO_FastBlit
void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter)
{
ivec4_t srcBoxFinal, dstBoxFinal;
GLuint srcFb, dstFb;
if (!glRefConfig.framebufferBlit)
{
FBO_Blit(src, srcBox, NULL, dst, dstBox, NULL, NULL, 0);
return;
}
srcFb = src ? src->frameBuffer : 0;
dstFb = dst ? dst->frameBuffer : 0;
if (!srcBox)
{
int width = src ? src->width : glConfig.vidWidth;
int height = src ? src->height : glConfig.vidHeight;
VectorSet4(srcBoxFinal, 0, 0, width, height);
}
else
{
VectorSet4(srcBoxFinal, srcBox[0], srcBox[1], srcBox[0] + srcBox[2], srcBox[1] + srcBox[3]);
}
if (!dstBox)
{
int width = dst ? dst->width : glConfig.vidWidth;
int height = dst ? dst->height : glConfig.vidHeight;
VectorSet4(dstBoxFinal, 0, 0, width, height);
}
else
{
VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]);
}
GL_BindFramebuffer(GL_READ_FRAMEBUFFER, srcFb);
GL_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFb);
qglBlitFramebuffer(srcBoxFinal[0], srcBoxFinal[1], srcBoxFinal[2], srcBoxFinal[3],
dstBoxFinal[0], dstBoxFinal[1], dstBoxFinal[2], dstBoxFinal[3],
buffers, filter);
GL_BindFramebuffer(GL_FRAMEBUFFER, 0);
glState.currentFBO = NULL;
}
示例8: FBO_FastBlit
void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter)
{
ivec4_t srcBoxFinal, dstBoxFinal;
GLuint srcFb, dstFb;
if (!glRefConfig.framebufferBlit)
{
FBO_Blit(src, srcBox, NULL, dst, dstBox, NULL, NULL, 0);
return;
}
// get to a neutral state first
//FBO_Bind(NULL);
srcFb = src ? src->frameBuffer : 0;
dstFb = dst ? dst->frameBuffer : 0;
if (!srcBox)
{
if (src)
{
VectorSet4(srcBoxFinal, 0, 0, src->width, src->height);
}
else
{
VectorSet4(srcBoxFinal, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
}
}
else
{
VectorSet4(srcBoxFinal, srcBox[0], srcBox[1], srcBox[0] + srcBox[2], srcBox[1] + srcBox[3]);
}
if (!dstBox)
{
if (dst)
{
VectorSet4(dstBoxFinal, 0, 0, dst->width, dst->height);
}
else
{
VectorSet4(dstBoxFinal, 0, 0, glConfig.vidWidth, glConfig.vidHeight);
}
}
else
{
VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]);
}
qglBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, srcFb);
qglBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, dstFb);
qglBlitFramebufferEXT(srcBoxFinal[0], srcBoxFinal[1], srcBoxFinal[2], srcBoxFinal[3],
dstBoxFinal[0], dstBoxFinal[1], dstBoxFinal[2], dstBoxFinal[3],
buffers, filter);
qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glState.currentFBO = NULL;
}
示例9: SCR_DrawStringExt
// Draws a multi-colored string with a drop shadow, optionally forcing to a fixed color.
// Coordinates are 640x480 virtual values
void SCR_DrawStringExt( int x, int y, float size, const char *string, const vector4 *setColor, qboolean forceColor, qboolean noColorEscape ) {
vector4 color;
const char *s;
int xx;
// draw the drop shadow
VectorSet4( &color, 0.0f, 0.0f, 0.0f, setColor->a );
re->SetColor( &color );
s = string;
xx = x;
while ( *s ) {
if ( !noColorEscape && Q_IsColorString( s ) ) {
s += 2;
continue;
}
SCR_DrawChar( xx+2, y+2, size, *s );
xx += (int)size;
s++;
}
// draw the colored text
s = string;
xx = x;
re->SetColor( setColor );
while ( *s ) {
if ( Q_IsColorString( s ) ) {
if ( !forceColor ) {
memcpy( &color, &g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
color.a = setColor->a;
re->SetColor( &color );
}
if ( !noColorEscape ) {
s += 2;
continue;
}
}
SCR_DrawChar( xx, y, size, *s );
xx += (int)size;
s++;
}
re->SetColor( NULL );
}
示例10: FBO_Blit
void FBO_Blit(FBO_t *src, vec4i_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, vec4i_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend)
{
vec4i_t srcBox;
if (!src)
return;
// framebuffers are 0 bottom, Y up.
if (inSrcBox)
{
srcBox[0] = inSrcBox[0];
srcBox[1] = src->height - inSrcBox[1] - inSrcBox[3];
srcBox[2] = inSrcBox[2];
srcBox[3] = inSrcBox[3];
}
else
{
VectorSet4(srcBox, 0, src->height, src->width, -src->height);
}
FBO_BlitFromTexture(src->colorImage[0], srcBox, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
}
示例11: FBO_Blit
void FBO_Blit(FBO_t *src, ivec4_t inSrcBox, vec2_t srcTexScale, FBO_t *dst, ivec4_t dstBox, struct shaderProgram_s *shaderProgram, vec4_t color, int blend)
{
vec4_t srcTexCorners;
if (!src)
{
ri.Printf(PRINT_WARNING, "Tried to blit from a NULL FBO!\n");
return;
}
if (inSrcBox)
{
srcTexCorners[0] = inSrcBox[0] / (float)src->width;
srcTexCorners[1] = (inSrcBox[1] + inSrcBox[3]) / (float)src->height;
srcTexCorners[2] = (inSrcBox[0] + inSrcBox[2]) / (float)src->width;
srcTexCorners[3] = inSrcBox[1] / (float)src->height;
}
else
{
VectorSet4(srcTexCorners, 0.0f, 0.0f, 1.0f, 1.0f);
}
FBO_BlitFromTexture(src->colorImage[0], srcTexCorners, srcTexScale, dst, dstBox, shaderProgram, color, blend | GLS_DEPTHTEST_DISABLE);
}
示例12: RB_IterateStagesGeneric
//.........这里部分代码省略.........
GLSL_SetUniformVec3(sp, UNIFORM_AMBIENTLIGHT, vec);
VectorScale(backEnd.currentEntity->directedLight, 1.0f / 255.0f, vec);
GLSL_SetUniformVec3(sp, UNIFORM_DIRECTEDLIGHT, vec);
VectorCopy(backEnd.currentEntity->lightDir, vec);
vec[3] = 0.0f;
GLSL_SetUniformVec4(sp, UNIFORM_LIGHTORIGIN, vec);
GLSL_SetUniformFloat(sp, UNIFORM_LIGHTRADIUS, 999999.0f);
}
if (pStage->alphaGen == AGEN_PORTAL)
{
GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
}
GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen);
if ( input->fogNum )
{
vec4_t fogColorMask;
ComputeFogColorMask(pStage, fogColorMask);
GLSL_SetUniformVec4(sp, UNIFORM_FOGCOLORMASK, fogColorMask);
}
ComputeTexMatrix( pStage, TB_DIFFUSEMAP, matrix );
{
vec4_t vector;
VectorSet4(vector, matrix[0], matrix[1], matrix[4], matrix[5]);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, vector);
VectorSet4(vector, matrix[8], matrix[9], matrix[12], matrix[13]);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, vector);
}
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
if (pStage->bundle[0].tcGen == TCGEN_VECTOR)
{
vec3_t vec;
VectorCopy(pStage->bundle[0].tcGenVectors[0], vec);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR0, vec);
VectorCopy(pStage->bundle[0].tcGenVectors[1], vec);
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
}
GLSL_SetUniformMatrix16(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
GLSL_SetUniformVec2(sp, UNIFORM_MATERIALINFO, pStage->materialInfo);
//GLSL_SetUniformFloat(sp, UNIFORM_MAPLIGHTSCALE, backEnd.refdef.mapLightScale);
//
// do multitexture
//
if ( backEnd.depthFill )
{
if (!(pStage->stateBits & GLS_ATEST_BITS))
GL_BindToTMU( tr.whiteImage, 0 );
else if ( pStage->bundle[TB_COLORMAP].image[0] != 0 )
R_BindAnimatedImageToTMU( &pStage->bundle[TB_COLORMAP], TB_COLORMAP );
示例13: getClientFrame
void UIFakkLabel::Draw( void )
{
if( m_stat == -1 && m_itemindex == -1 && m_inventoryrendermodelindex == -1 )
{
if( m_stat_configstring != -1 )
{
m_font->setColor( m_foreground_color );
m_font->PrintJustified( getClientFrame(),
m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString( va( "%s", CL_ConfigString( cl.snap.ps.stats[ m_stat_configstring ] ) ) ),
m_bVirtual ? m_vVirtualScale : NULL );
return;
}
if( !m_rendermodel && m_statbar_or == L_STATBAR_NONE && !m_sDrawModelName.length() )
{
UILabel::Draw();
return;
}
}
if( m_stat_configstring != -1 )
{
m_font->setColor( m_foreground_color );
m_font->PrintJustified( getClientFrame(),
m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString( va( "%s", CL_ConfigString( cl.snap.ps.stats[ m_stat_configstring ] ) ) ),
m_bVirtual ? m_vVirtualScale : NULL );
return;
}
if( m_stat != -1 )
{
float scale;
qhandle_t handle;
vec3_t origin;
vec3_t mins;
vec3_t maxs;
vec3_t angles;
vec3_t offset;
vec3_t rotateoffset;
vec3_t color;
str sAnimName;
float height;
if( m_itemindex != -1 )
{
if( m_itemindex < 0 )
return;
m_font->setColor( m_foreground_color );
m_font->PrintJustified( getClientFrame(),
m_iFontAlignmentHorizontal,
m_iFontAlignmentVertical,
Sys_LV_CL_ConvertString( va( "%s", CL_ConfigString( CS_WEAPONS + cl.snap.ps.activeItems[ m_itemindex ] ) ) ),
m_bVirtual ? m_vVirtualScale : NULL );
return;
}
if( m_inventoryrendermodelindex == -1 && !m_sDrawModelName.length() || !m_rendermodel )
{
float frac = 0.0;
if( m_statbar_or == L_STATBAR_NONE )
return;
if( m_cvarname.length() )
{
frac = Cvar_VariableValue( m_cvarname ) / ( m_statbar_max - m_statbar_min );
}
if( frac > 1.0 )
frac = 1.0;
if( frac < 0.0 )
frac = 0.0;
DrawStatbar( frac );
return;
}
VectorSet4( color, 255, 255, 255, 255 );
if( m_rendermodel )
{
if( !m_cvarname.length() )
return;
handle = re.RegisterModel( Cvar_VariableString( m_cvarname ) );
if( !handle )
return;
VectorCopy( m_angles, angles );
VectorCopy( m_rotateoffset, rotateoffset );
VectorCopy( m_offset, offset );
scale = m_scale;
//.........这里部分代码省略.........
示例14: ForwardDlight
//.........这里部分代码省略.........
ComputeShaderColors(pStage, baseColor, vertColor, GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE);
GLSL_SetUniformVec4(sp, UNIFORM_BASECOLOR, baseColor);
GLSL_SetUniformVec4(sp, UNIFORM_VERTCOLOR, vertColor);
}
if (pStage->alphaGen == AGEN_PORTAL)
{
GLSL_SetUniformFloat(sp, UNIFORM_PORTALRANGE, tess.shader->portalRange);
}
GLSL_SetUniformInt(sp, UNIFORM_COLORGEN, pStage->rgbGen);
GLSL_SetUniformInt(sp, UNIFORM_ALPHAGEN, pStage->alphaGen);
GLSL_SetUniformVec3(sp, UNIFORM_DIRECTEDLIGHT, dl->color);
VectorSet(vector, 0, 0, 0);
GLSL_SetUniformVec3(sp, UNIFORM_AMBIENTLIGHT, vector);
VectorCopy(dl->origin, vector);
vector[3] = 1.0f;
GLSL_SetUniformVec4(sp, UNIFORM_LIGHTORIGIN, vector);
GLSL_SetUniformFloat(sp, UNIFORM_LIGHTRADIUS, radius);
GLSL_SetUniformVec4(sp, UNIFORM_NORMALSCALE, pStage->normalScale);
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, pStage->specularScale);
// include GLS_DEPTHFUNC_EQUAL so alpha tested surfaces don't add light
// where they aren't rendered
GL_State( GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE | GLS_DEPTHFUNC_EQUAL );
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
if (pStage->bundle[TB_DIFFUSEMAP].image[0])
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP);
// bind textures that are sampled and used in the glsl shader, and
// bind whiteImage to textures that are sampled but zeroed in the glsl shader
//
// alternatives:
// - use the last bound texture
// -> costs more to sample a higher res texture then throw out the result
// - disable texture sampling in glsl shader with #ifdefs, as before
// -> increases the number of shaders that must be compiled
//
if (pStage->bundle[TB_NORMALMAP].image[0])
{
R_BindAnimatedImageToTMU( &pStage->bundle[TB_NORMALMAP], TB_NORMALMAP);
}
else if (r_normalMapping->integer)
GL_BindToTMU( tr.whiteImage, TB_NORMALMAP );
if (pStage->bundle[TB_SPECULARMAP].image[0])
{
R_BindAnimatedImageToTMU( &pStage->bundle[TB_SPECULARMAP], TB_SPECULARMAP);
}
else if (r_specularMapping->integer)
GL_BindToTMU( tr.whiteImage, TB_SPECULARMAP );
{
vec4_t enableTextures;
VectorSet4(enableTextures, 0.0f, 0.0f, 0.0f, 0.0f);
GLSL_SetUniformVec4(sp, UNIFORM_ENABLETEXTURES, enableTextures);
}
if (r_dlightMode->integer >= 2)
{
GL_SelectTexture(TB_SHADOWMAP);
GL_Bind(tr.shadowCubemaps[l]);
GL_SelectTexture(0);
}
ComputeTexMods( pStage, TB_DIFFUSEMAP, texMatrix, texOffTurb );
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXMATRIX, texMatrix);
GLSL_SetUniformVec4(sp, UNIFORM_DIFFUSETEXOFFTURB, texOffTurb);
GLSL_SetUniformInt(sp, UNIFORM_TCGEN0, pStage->bundle[0].tcGen);
//
// draw
//
if (input->multiDrawPrimitives)
{
R_DrawMultiElementsVao(input->multiDrawPrimitives, input->multiDrawMinIndex, input->multiDrawMaxIndex, input->multiDrawNumIndexes, input->multiDrawFirstIndex);
}
else
{
R_DrawElementsVao(input->numIndexes, input->firstIndex, input->minIndex, input->maxIndex);
}
backEnd.pc.c_totalIndexes += tess.numIndexes;
backEnd.pc.c_dlightIndexes += tess.numIndexes;
backEnd.pc.c_dlightVertexes += tess.numVertexes;
}
}
示例15: RB_IterateStagesGeneric
//.........这里部分代码省略.........
GLSL_SetUniformVec3(sp, UNIFORM_TCGEN0VECTOR1, vec);
}
GLSL_SetUniformMat4(sp, UNIFORM_MODELMATRIX, backEnd.or.transformMatrix);
GLSL_SetUniformVec4(sp, UNIFORM_NORMALSCALE, pStage->normalScale);
GLSL_SetUniformVec4(sp, UNIFORM_SPECULARSCALE, pStage->specularScale);
//GLSL_SetUniformFloat(sp, UNIFORM_MAPLIGHTSCALE, backEnd.refdef.mapLightScale);
//
// do multitexture
//
if ( backEnd.depthFill )
{
if (!(pStage->stateBits & GLS_ATEST_BITS))
GL_BindToTMU( tr.whiteImage, 0 );
else if ( pStage->bundle[TB_COLORMAP].image[0] != 0 )
R_BindAnimatedImageToTMU( &pStage->bundle[TB_COLORMAP], TB_COLORMAP );
}
else if ( pStage->glslShaderGroup == tr.lightallShader )
{
int i;
vec4_t enableTextures;
if (r_sunlightMode->integer && (backEnd.viewParms.flags & VPF_USESUNLIGHT) && (pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK))
{
GL_BindToTMU(tr.screenShadowImage, TB_SHADOWMAP);
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTAMBIENT, backEnd.refdef.sunAmbCol);
GLSL_SetUniformVec3(sp, UNIFORM_PRIMARYLIGHTCOLOR, backEnd.refdef.sunCol);
GLSL_SetUniformVec4(sp, UNIFORM_PRIMARYLIGHTORIGIN, backEnd.refdef.sunDir);
}
VectorSet4(enableTextures, 0, 0, 0, 0);
if ((r_lightmap->integer == 1 || r_lightmap->integer == 2) && pStage->bundle[TB_LIGHTMAP].image[0])
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
if (i == TB_LIGHTMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], i);
else
GL_BindToTMU( tr.whiteImage, i );
}
}
else if (r_lightmap->integer == 3 && pStage->bundle[TB_DELUXEMAP].image[0])
{
for (i = 0; i < NUM_TEXTURE_BUNDLES; i++)
{
if (i == TB_LIGHTMAP)
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DELUXEMAP], i);
else
GL_BindToTMU( tr.whiteImage, i );
}
}
else
{
qboolean light = (pStage->glslShaderIndex & LIGHTDEF_LIGHTTYPE_MASK) != 0;
qboolean fastLight = !(r_normalMapping->integer || r_specularMapping->integer);
if (pStage->bundle[TB_DIFFUSEMAP].image[0])
R_BindAnimatedImageToTMU( &pStage->bundle[TB_DIFFUSEMAP], TB_DIFFUSEMAP);
if (pStage->bundle[TB_LIGHTMAP].image[0])
R_BindAnimatedImageToTMU( &pStage->bundle[TB_LIGHTMAP], TB_LIGHTMAP);
// bind textures that are sampled and used in the glsl shader, and