Do not use kart position if there is no kart
This commit is contained in:
parent
866cd2b979
commit
0d982e55f0
@ -464,16 +464,21 @@ void PostProcessing::renderMotionBlur(unsigned cam, FrameBuffer &in_fbo, FrameBu
|
|||||||
|
|
||||||
scene::ICameraSceneNode * const camnode =
|
scene::ICameraSceneNode * const camnode =
|
||||||
Camera::getCamera(cam)->getCameraSceneNode();
|
Camera::getCamera(cam)->getCameraSceneNode();
|
||||||
// Calculate the kart's Y position on screen
|
|
||||||
const core::vector3df pos =
|
|
||||||
Camera::getCamera(cam)->getKart()->getNode()->getPosition();
|
|
||||||
float ndc[4];
|
|
||||||
core::matrix4 trans = camnode->getProjectionMatrix();
|
|
||||||
trans *= camnode->getViewMatrix();
|
|
||||||
|
|
||||||
trans.transformVect(ndc, pos);
|
// Calculate the kart's Y position on screen
|
||||||
const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f;
|
if (Camera::getCamera(cam)->getKart())
|
||||||
setMotionBlurCenterY(cam, karty);
|
{
|
||||||
|
const core::vector3df pos = Camera::getCamera(cam)->getKart()->getNode()->getPosition();
|
||||||
|
float ndc[4];
|
||||||
|
core::matrix4 trans = camnode->getProjectionMatrix();
|
||||||
|
trans *= camnode->getViewMatrix();
|
||||||
|
|
||||||
|
trans.transformVect(ndc, pos);
|
||||||
|
const float karty = (ndc[1] / ndc[3]) * 0.5f + 0.5f;
|
||||||
|
setMotionBlurCenterY(cam, karty);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
setMotionBlurCenterY(cam, 0.5f);
|
||||||
|
|
||||||
out_fbo.Bind();
|
out_fbo.Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
Loading…
Reference in New Issue
Block a user