Re: Doom 3 engine release and game code
Posted: Tue Oct 15, 2013 2:25 pm
Thanks frag
guess ill have to change my nick to stoney now...
guess ill have to change my nick to stoney now...
Tried an older atioglxx.dll? I've heard about this problem regarding Doom3 BFG Edition and even HD Radeons...reckless wrote:Also bought 2x radeon R9 270X and yup doom3 will not run strangely enough prey will
There's never been a video card with mature bug-free drivers at launch. There would be so much delay otherwise that the card would be DoA on release...qbism wrote:Hope your pain doesn't last long, and hopefully you have some pills.
Radeon forever has issues but a new card won't play it??
Code: Select all
void RB_CreateSingleDrawInteractions(const drawSurf_t *surf, void (*DrawInteraction)(const drawInteraction_t *))
{
const idMaterial *surfaceShader = surf->material;
const float *surfaceRegs = surf->shaderRegisters;
const viewLight_t *vLight = backEnd.vLight;
const idMaterial *lightShader = vLight->lightShader;
const float *lightRegs = vLight->shaderRegisters;
drawInteraction_t inter;
if (r_skipInteractions.GetBool() || !surf->geo || !surf->geo->ambientCache)
{
return;
}
// change the matrix and light projection vectors if needed
if (surf->space != backEnd.currentSpace)
{
backEnd.currentSpace = surf->space;
glLoadMatrixf(surf->space->modelViewMatrix);
}
// change the scissor if needed
if (r_useScissor.GetBool() && !backEnd.currentScissor.Equals(surf->scissorRect))
{
backEnd.currentScissor = surf->scissorRect;
glScissor(backEnd.viewDef->viewport.x1 + backEnd.currentScissor.x1,
backEnd.viewDef->viewport.y1 + backEnd.currentScissor.y1,
backEnd.currentScissor.x2 + 1 - backEnd.currentScissor.x1,
backEnd.currentScissor.y2 + 1 - backEnd.currentScissor.y1);
}
// hack depth range if needed
if (surf->space->weaponDepthHack)
{
RB_EnterWeaponDepthHack();
}
if (surf->space->modelDepthHack)
{
RB_EnterModelDepthHack(surf->space->modelDepthHack);
}
inter.surf = surf;
inter.lightFalloffImage = vLight->falloffImage;
R_GlobalPointToLocal(surf->space->modelMatrix, vLight->globalLightOrigin, inter.localLightOrigin.ToVec3());
R_GlobalPointToLocal(surf->space->modelMatrix, backEnd.viewDef->renderView.vieworg, inter.localViewOrigin.ToVec3());
inter.localLightOrigin[3] = 0;
inter.localViewOrigin[3] = 1;
inter.ambientLight = lightShader->IsAmbientLight();
// the base projections may be modified by texture matrix on light stages
idPlane lightProject[4];
for (int i = 0; i < 4; i++)
{
R_GlobalPlaneToLocal(surf->space->modelMatrix, backEnd.vLight->lightProject[i], lightProject[i]);
}
for (int lightStageNum = 0; lightStageNum < lightShader->GetNumStages(); lightStageNum++)
{
const shaderStage_t *lightStage = lightShader->GetStage(lightStageNum);
// ignore stages that fail the condition
if (!lightRegs[lightStage->conditionRegister])
{
continue;
}
inter.lightImage = lightStage->texture.image;
memcpy(inter.lightProjection, lightProject, sizeof(inter.lightProjection));
// now multiply the texgen by the light texture matrix
if (lightStage->texture.hasMatrix)
{
RB_GetShaderTextureMatrix(lightRegs, &lightStage->texture, backEnd.lightTextureMatrix);
RB_BakeTextureMatrixIntoTexgen(reinterpret_cast<class idPlane *>(inter.lightProjection), backEnd.lightTextureMatrix);
}
inter.bumpImage = NULL;
inter.specularImage = NULL;
inter.diffuseImage = NULL;
inter.diffuseColor[0] = inter.diffuseColor[1] = inter.diffuseColor[2] = inter.diffuseColor[3] = 0;
inter.specularColor[0] = inter.specularColor[1] = inter.specularColor[2] = inter.specularColor[3] = 0;
float lightColor[4];
lightColor[0] = backEnd.lightScale * lightRegs[lightStage->color.registers[0]];
lightColor[1] = backEnd.lightScale * lightRegs[lightStage->color.registers[1]];
lightColor[2] = backEnd.lightScale * lightRegs[lightStage->color.registers[2]];
lightColor[3] = lightRegs[lightStage->color.registers[3]];
// go through the individual stages
for (int surfaceStageNum = 0; surfaceStageNum < surfaceShader->GetNumStages(); surfaceStageNum++)
{
const shaderStage_t *surfaceStage = surfaceShader->GetStage(surfaceStageNum);
switch (surfaceStage->lighting)
{
case SL_AMBIENT:
{
// ignore ambient stages while drawing interactions
break;
}
case SL_BUMP:
{
// ignore stage that fails the condition
if (!surfaceRegs[surfaceStage->conditionRegister])
{
// fix for POM initialize the matrix even if no stage.
inter.bumpMatrix[0][0] = 1;
inter.bumpMatrix[0][1] = 0;
inter.bumpMatrix[0][2] = 0;
inter.bumpMatrix[0][3] = 0;
inter.bumpMatrix[1][0] = 0;
inter.bumpMatrix[1][1] = 1;
inter.bumpMatrix[1][2] = 0;
inter.bumpMatrix[1][3] = 0;
break;
}
// draw any previous interaction
RB_SubmitInteraction(&inter, DrawInteraction);
inter.diffuseImage = NULL;
inter.specularImage = NULL;
R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.bumpImage, inter.bumpMatrix, NULL);
break;
}
case SL_DIFFUSE:
{
// ignore stage that fails the condition
if (!surfaceRegs[surfaceStage->conditionRegister])
{
// fix for POM initialize the matrix even if no stage.
inter.diffuseMatrix[0][0] = 1;
inter.diffuseMatrix[0][1] = 0;
inter.diffuseMatrix[0][2] = 0;
inter.diffuseMatrix[0][3] = 0;
inter.diffuseMatrix[1][0] = 0;
inter.diffuseMatrix[1][1] = 1;
inter.diffuseMatrix[1][2] = 0;
inter.diffuseMatrix[1][3] = 0;
break;
}
if (inter.diffuseImage)
{
RB_SubmitInteraction(&inter, DrawInteraction);
}
R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.diffuseImage, inter.diffuseMatrix, inter.diffuseColor.ToFloatPtr());
inter.diffuseColor[0] *= lightColor[0];
inter.diffuseColor[1] *= lightColor[1];
inter.diffuseColor[2] *= lightColor[2];
inter.diffuseColor[3] *= lightColor[3];
inter.vertexColor = surfaceStage->vertexColor;
break;
}
case SL_SPECULAR:
{
// ignore stage that fails the condition
if (!surfaceRegs[surfaceStage->conditionRegister])
{
// fix for POM initialize the matrix even if no stage.
inter.specularMatrix[0][0] = 1;
inter.specularMatrix[0][1] = 0;
inter.specularMatrix[0][2] = 0;
inter.specularMatrix[0][3] = 0;
inter.specularMatrix[1][0] = 0;
inter.specularMatrix[1][1] = 1;
inter.specularMatrix[1][2] = 0;
inter.specularMatrix[1][3] = 0;
break;
}
if (inter.specularImage)
{
RB_SubmitInteraction(&inter, DrawInteraction);
}
R_SetDrawInteraction(surfaceStage, surfaceRegs, &inter.specularImage, inter.specularMatrix, inter.specularColor.ToFloatPtr());
inter.specularColor[0] *= lightColor[0];
inter.specularColor[1] *= lightColor[1];
inter.specularColor[2] *= lightColor[2];
inter.specularColor[3] *= lightColor[3];
inter.vertexColor = surfaceStage->vertexColor;
break;
}
}
}
// draw the final interaction
RB_SubmitInteraction(&inter, DrawInteraction);
}
// unhack depth range if needed
if (surf->space->weaponDepthHack || surf->space->modelDepthHack != 0.0f)
{
RB_LeaveDepthHack();
}
}
Code: Select all
static void RB_SubmitInteraction(drawInteraction_t *din, void (*DrawInteraction)(const drawInteraction_t *))
{
if (!din->bumpImage)
{
// if no bumpmap then we dont have diffuse or specular either.
// initialize the matrices to a default value.
din->diffuseMatrix[0][0] = 1;
din->diffuseMatrix[0][1] = 0;
din->diffuseMatrix[0][2] = 0;
din->diffuseMatrix[0][3] = 0;
din->diffuseMatrix[1][0] = 0;
din->diffuseMatrix[1][1] = 1;
din->diffuseMatrix[1][2] = 0;
din->diffuseMatrix[1][3] = 0;
din->specularMatrix[0][0] = 1;
din->specularMatrix[0][1] = 0;
din->specularMatrix[0][2] = 0;
din->specularMatrix[0][3] = 0;
din->specularMatrix[1][0] = 0;
din->specularMatrix[1][1] = 1;
din->specularMatrix[1][2] = 0;
din->specularMatrix[1][3] = 0;
din->bumpMatrix[0][0] = 1;
din->bumpMatrix[0][1] = 0;
din->bumpMatrix[0][2] = 0;
din->bumpMatrix[0][3] = 0;
din->bumpMatrix[1][0] = 0;
din->bumpMatrix[1][1] = 1;
din->bumpMatrix[1][2] = 0;
din->bumpMatrix[1][3] = 0;
return;
}
if (!din->diffuseImage || r_skipDiffuse.GetBool())
{
din->diffuseMatrix[0][0] = 1;
din->diffuseMatrix[0][1] = 0;
din->diffuseMatrix[0][2] = 0;
din->diffuseMatrix[0][3] = 0;
din->diffuseMatrix[1][0] = 0;
din->diffuseMatrix[1][1] = 1;
din->diffuseMatrix[1][2] = 0;
din->diffuseMatrix[1][3] = 0;
din->diffuseImage = globalImages->blackImage;
}
if (!din->specularImage || r_skipSpecular.GetBool() || din->ambientLight)
{
din->specularMatrix[0][0] = 1;
din->specularMatrix[0][1] = 0;
din->specularMatrix[0][2] = 0;
din->specularMatrix[0][3] = 0;
din->specularMatrix[1][0] = 0;
din->specularMatrix[1][1] = 1;
din->specularMatrix[1][2] = 0;
din->specularMatrix[1][3] = 0;
din->specularImage = globalImages->blackImage;
}
if (!din->bumpImage || r_skipBump.GetBool())
{
din->bumpMatrix[0][0] = 1;
din->bumpMatrix[0][1] = 0;
din->bumpMatrix[0][2] = 0;
din->bumpMatrix[0][3] = 0;
din->bumpMatrix[1][0] = 0;
din->bumpMatrix[1][1] = 1;
din->bumpMatrix[1][2] = 0;
din->bumpMatrix[1][3] = 0;
din->bumpImage = globalImages->flatNormalMap;
}
if (r_lightMap.GetBool())
{
din->diffuseImage = globalImages->whiteImage;
din->specularImage = globalImages->blackImage;
din->bumpImage = globalImages->flatNormalMap;
}
// if we wouldn't draw anything, don't call the Draw function
if (((din->diffuseColor[0] > 0 ||
din->diffuseColor[1] > 0 ||
din->diffuseColor[2] > 0) && din->diffuseImage != globalImages->blackImage) ||
((din->specularColor[0] > 0 ||
din->specularColor[1] > 0 ||
din->specularColor[2] > 0) && din->specularImage != globalImages->blackImage))
{
DrawInteraction(din);
}
}