mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
fixed the view weapon motion vectors
This commit is contained in:
parent
75466f3be0
commit
9712ffb17d
2 changed files with 24 additions and 2 deletions
|
@ -69,6 +69,14 @@ struct MotionBlurModes
|
||||||
CameraBit = 1 << 0,
|
CameraBit = 1 << 0,
|
||||||
ObjectBit = 1 << 1
|
ObjectBit = 1 << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Id
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
CameraOnly = CameraBit,
|
||||||
|
ObjectOnly = ObjectBit,
|
||||||
|
Full = CameraOnly + ObjectOnly
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tessellator
|
struct Tessellator
|
||||||
|
|
|
@ -422,6 +422,20 @@ void Prepass::EndBatch()
|
||||||
R_InvMatrix(backEnd.modelMatrix, tempMatrix);
|
R_InvMatrix(backEnd.modelMatrix, tempMatrix);
|
||||||
R_TransposeMatrix(tempMatrix, normalMatrix);
|
R_TransposeMatrix(tempMatrix, normalMatrix);
|
||||||
|
|
||||||
|
// select the right motion vector code path in the shader for view weapons
|
||||||
|
// we should identify view weapons directly instead of using the depth hack flag
|
||||||
|
int mblurMode = crp_mblur->integer;
|
||||||
|
float mblurScale = batchMotionScale;
|
||||||
|
if(batchDepthHack && mblurMode == MotionBlurModes::CameraOnly)
|
||||||
|
{
|
||||||
|
mblurScale = 0.0f;
|
||||||
|
mblurMode = 0; // doesn't really matter but shows intent in the root constants
|
||||||
|
}
|
||||||
|
else if(batchDepthHack && mblurMode == MotionBlurModes::ObjectOnly)
|
||||||
|
{
|
||||||
|
mblurMode = MotionBlurModes::Full;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(rc.modelViewMatrix, backEnd.orient.modelMatrix, sizeof(rc.modelViewMatrix));
|
memcpy(rc.modelViewMatrix, backEnd.orient.modelMatrix, sizeof(rc.modelViewMatrix));
|
||||||
memcpy(rc.modelMatrix, backEnd.modelMatrix, sizeof(rc.modelMatrix));
|
memcpy(rc.modelMatrix, backEnd.modelMatrix, sizeof(rc.modelMatrix));
|
||||||
et.CompareEntity(rc.prevModelMatrix, batchEntityId, backEnd.modelMatrix);
|
et.CompareEntity(rc.prevModelMatrix, batchEntityId, backEnd.modelMatrix);
|
||||||
|
@ -434,11 +448,11 @@ void Prepass::EndBatch()
|
||||||
rc.normalMatrix[6] = normalMatrix[ 8];
|
rc.normalMatrix[6] = normalMatrix[ 8];
|
||||||
rc.normalMatrix[7] = normalMatrix[ 9];
|
rc.normalMatrix[7] = normalMatrix[ 9];
|
||||||
rc.normalMatrix[8] = normalMatrix[10];
|
rc.normalMatrix[8] = normalMatrix[10];
|
||||||
rc.motionBlurScale = batchMotionScale;
|
rc.motionBlurScale = mblurScale;
|
||||||
rc.textureIndex = texIdx;
|
rc.textureIndex = texIdx;
|
||||||
rc.samplerIndex = sampIdx;
|
rc.samplerIndex = sampIdx;
|
||||||
rc.alphaTest = alphaTest;
|
rc.alphaTest = alphaTest;
|
||||||
rc.motionBlurMode = crp_mblur->integer;
|
rc.motionBlurMode = (uint32_t)mblurMode;
|
||||||
CmdSetGraphicsRootConstants(0, sizeof(rc), &rc);
|
CmdSetGraphicsRootConstants(0, sizeof(rc), &rc);
|
||||||
|
|
||||||
db.DrawStage(vertexCount, indexCount);
|
db.DrawStage(vertexCount, indexCount);
|
||||||
|
|
Loading…
Reference in a new issue