コード例 #1
0
/*
** RB_EndSurface
*/
void RB_EndSurface( void ) {
	shaderCommands_t *input;

	input = &tess;

	if (input->numIndexes == 0 || input->numVertexes == 0) {
		return;
	}

	if (input->indexes[SHADER_MAX_INDEXES-1] != 0) {
		ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");
	}	
	if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) {
		ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit");
	}

	if ( tess.shader == tr.shadowShader ) {
		RB_ShadowTessEnd();
		return;
	}

	// for debugging of sort order issues, stop rendering after a given sort value
	if ( r_debugSort->integer && r_debugSort->integer < tess.shader->sort ) {
		return;
	}

	//
	// update performance counters
	//
	backEnd.pc.c_shaders++;
	backEnd.pc.c_vertexes += tess.numVertexes;
	backEnd.pc.c_indexes += tess.numIndexes;
	backEnd.pc.c_totalIndexes += tess.numIndexes * tess.numPasses;

	//
	// call off to shader specific tess end function
	//
	tess.currentStageIteratorFunc();

	//
	// draw debugging stuff
	//
	if ( r_showtris->integer ) {
		DrawTris (input);
	}
	if ( r_shownormals->integer ) {
		DrawNormals (input);
	}
	// clear shader so we can tell we don't have any unclosed surfaces
	tess.numIndexes = 0;
	tess.numVertexes = 0;
	tess.firstIndex = 0;
	tess.multiDrawPrimitives = 0;

	GLimp_LogComment( "----------\n" );
}
コード例 #2
0
ファイル: tr_shade.c プロジェクト: ptitSeb/etlegacy
/*
===================
RB_EndSurface
===================
*/
void RB_EndSurface(void)
{
	shaderCommands_t *input = &tess;

	if (input->numIndexes == 0)
	{
		return;
	}

	if (input->indexes[input->maxShaderIndicies - 1] != 0)
	{
		ri.Error(ERR_DROP, "RB_EndSurface() - input->maxShaderIndicies(%i) hit", input->maxShaderIndicies);
	}
	if (input->xyz[input->maxShaderVerts - 1].v[0] != 0)
	{
		ri.Error(ERR_DROP, "RB_EndSurface() - input->maxShaderVerts(%i) hit", input->maxShaderVerts);
	}

	if (tess.shader == tr.shadowShader)
	{
		RB_ShadowTessEnd();
		return;
	}

	// for debugging of sort order issues, stop rendering after a given sort value
	if (r_debugSort->integer && r_debugSort->integer < tess.shader->sort)
	{
		return;
	}

	// update performance counters
	backEnd.pc.c_shaders++;
	backEnd.pc.c_vertexes     += tess.numVertexes;
	backEnd.pc.c_indexes      += tess.numIndexes;
	backEnd.pc.c_totalIndexes += tess.numIndexes * tess.numPasses;

	// call off to shader specific tess end function
	tess.currentStageIteratorFunc();

	// draw debugging stuff
	if (r_showtris->integer)
	{
		DrawTris(input);
	}
	if (r_shownormals->integer)
	{
		DrawNormals(input);
	}

	// clear shader so we can tell we don't have any unclosed surfaces
	tess.numIndexes = 0;

	GLimp_LogComment("----------\n");
}
コード例 #3
0
ファイル: tr_shade.c プロジェクト: redrumrobot/quakeconstruct
void RB_MaskTessEnd( void ) {
    shaderCommands_t *input;

    input = &tess;

    //qglClear( GL_COLOR_BUFFER_BIT );

    qglColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
    qglDepthMask(GL_FALSE);

    qglEnable(GL_STENCIL_TEST);
    qglClearStencil(0);
    qglClear(GL_STENCIL_BUFFER_BIT);

    qglStencilFunc(GL_ALWAYS,1,1);
    qglStencilOp(GL_KEEP,GL_KEEP,GL_REPLACE);

    tess.currentStageIteratorFunc();

    qglDepthMask(GL_TRUE);
    qglColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
    qglStencilFunc(GL_EQUAL,1,1);
    qglStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
}
コード例 #4
0
ファイル: tr_shade.c プロジェクト: redrumrobot/quakeconstruct
/*
** RB_EndSurface
*/
void RB_EndSurface( qboolean forceDepth ) {
    shaderCommands_t *input;
    GLenum			 prog;
    int				 loc;
    int i,size;
    shaderStage_t	stage;
    image_t			image;
    char			tex[MAX_QPATH];

    input = &tess;

    if ( tess.shader == tr.maskEndShader ) {
        RB_MaskTessFinish();
        return;
    }

    if (input->numIndexes == 0) {
        return;
    }

    if (input->indexes[SHADER_MAX_INDEXES-1] != 0) {
        ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");
    }
    if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) {
        ri.Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit");
    }

    if ( tess.shader == tr.shadowShader ) {
        RB_ShadowTessEnd();
        return;
    }

    if ( tess.shader == tr.maskShader ) {
        RB_MaskTessEnd();
        return;
    }

    // for debugging of sort order issues, stop rendering after a given sort value
    if ( r_debugSort->integer && r_debugSort->integer < tess.shader->sort ) {
        return;
    }

    //
    // update performance counters
    //
    backEnd.pc.c_shaders++;
    backEnd.pc.c_vertexes += tess.numVertexes;
    backEnd.pc.c_indexes += tess.numIndexes;
    backEnd.pc.c_totalIndexes += tess.numIndexes * tess.numPasses;

    if(forceDepth) {
        //Force depth testing if we are rendering via draw.Start3D -Hxrmn
        size = sizeof(tess.xstages) / sizeof(tess.xstages[0]);
        for(i=0; i<size; i++) {
            if(tess.xstages[i] != NULL) {
                if(tess.xstages[i]->stateBits & GLS_DEPTHTEST_DISABLE) {
                    tess.xstages[i]->stateBits &= ~GLS_DEPTHTEST_DISABLE;
                }
            }
        }
    }

    //
    // call off to shader specific tess end function
    //

    if(tess.shader->GLSL) {
        prog = getShaderProgram(tess.shader->GLSLName);
        if(prog != -1) {
            qglUseProgramObjectARB(prog);

            if(qglUniform1fARB) {
                loc = qglGetUniformLocationARB(prog, "cgtime");
                qglUniform1fARB(loc, backEnd.refdef.floatTime);
            }

            if(qglUniform3fvARB) {
                loc = qglGetUniformLocationARB(prog, "viewPos");
                qglUniform3fARB(loc,
                                backEnd.refdef.vieworg[0],
                                backEnd.refdef.vieworg[1],
                                backEnd.refdef.vieworg[2]);
            }

            if(qglUniform3fvARB) {
                loc = qglGetUniformLocationARB(prog, "viewNormal");
                qglUniform3fARB(loc,
                                backEnd.refdef.viewaxis[0][0],
                                backEnd.refdef.viewaxis[0][1],
                                backEnd.refdef.viewaxis[0][2]);
            }

            if(qglUniform2fARB) {
                loc = qglGetUniformLocationARB(prog, "fov");
                qglUniform2fARB(loc,
                                backEnd.refdef.fov_x,
                                backEnd.refdef.fov_y);
            }
            /*
            loc = qglGetUniformLocationARB(prog, "texture_0");
            qglUniform1iARB(loc, 0);

            loc = qglGetUniformLocationARB(prog, "texture_1");
            qglUniform1iARB(loc, 1);*/
        }
    }

    //tess.shader->stages[0]->bundle[0].image

    tess.currentStageIteratorFunc();

    if(tess.shader->GLSL) {
        revertShaderProgram();
        qglDisable(GL_TEXTURE0_ARB);
        qglDisable(GL_TEXTURE1_ARB);
        qglDisable(GL_TEXTURE2_ARB);
        qglDisable(GL_TEXTURE3_ARB);
    }

    //
    // draw debugging stuff
    //
    if ( r_showtris->integer ) {
        DrawTris (input);
    }
    if ( r_shownormals->integer ) {
        DrawNormals (input);
    }
    // clear shader so we can tell we don't have any unclosed surfaces
    tess.numIndexes = 0;

    GLimp_LogComment( "----------\n" );
}
コード例 #5
0
ファイル: tr_shade.cpp プロジェクト: AlexXT/OpenJK
/*
** RB_EndSurface
*/
void RB_EndSurface( void ) {
	shaderCommands_t *input;

	input = &tess;

	if (input->numIndexes == 0) {
		return;
	}

	if (input->indexes[SHADER_MAX_INDEXES-1] != 0) {
		Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_INDEXES hit");
	}
	if (input->xyz[SHADER_MAX_VERTEXES-1][0] != 0) {
		Com_Error (ERR_DROP, "RB_EndSurface() - SHADER_MAX_VERTEXES hit");
	}

	if ( tess.shader == tr.shadowShader ) {
		RB_ShadowTessEnd();
		return;
	}

	// for debugging of sort order issues, stop rendering after a given sort value
	if ( r_debugSort->integer && r_debugSort->integer < tess.shader->sort ) {
		return;
	}

	if ( skyboxportal )
	{
		// world
		if(!(backEnd.refdef.rdflags & RDF_SKYBOXPORTAL))
		{
			if(tess.currentStageIteratorFunc == RB_StageIteratorSky)
			{	// don't process these tris at all
				return;
			}
		}
		// portal sky
		else
		{
			if(!drawskyboxportal)
			{
				if( !(tess.currentStageIteratorFunc == RB_StageIteratorSky))
				{	// /only/ process sky tris
					return;
				}
			}
		}
	}

	//
	// update performance counters
	//
	backEnd.pc.c_shaders++;
	backEnd.pc.c_vertexes += tess.numVertexes;
	backEnd.pc.c_indexes += tess.numIndexes;
	backEnd.pc.c_totalIndexes += tess.numIndexes * tess.numPasses;
	if (tess.fogNum && tess.shader->fogPass && r_drawfog->value == 1)
	{
		backEnd.pc.c_totalIndexes += tess.numIndexes;
	}

	//
	// call off to shader specific tess end function
	//
	tess.currentStageIteratorFunc();

	//
	// draw debugging stuff
	//
	if ( r_showtris->integer ) {
		DrawTris (input);
	}
	if ( r_shownormals->integer ) {
		DrawNormals (input);
	}
	// clear shader so we can tell we don't have any unclosed surfaces
	tess.numIndexes = 0;

	GLimp_LogComment( "----------\n" );
}