Correct way to set up camera buffer using CFirstPersonCamera

Started by
1 comment, last by KoDim97 3 years, 2 months ago

I would like to play with two different implementations of a particle system in my project (ok, actually not mine, but I am working on it).

I copied the particle system successfully, however, faced the camera buffer initialization problem, show this code:

bool ParticleShader::Render(Direct3DManager* direct, ParticleSystem* particlesystem, Camera* camera)
{
bool result;
result = SetShaderParameters(direct->GetDeviceContext(), camera, direct->GetWorldMatrix(), camera->GetViewMatrix(), direct->GetProjectionMatrix(), particlesystem->GetTexture());
if (!result)
 return false;
RenderShader(direct->GetDeviceContext(), particlesystem->GetVertexCount(), particlesystem->GetInstaceCount(), particlesystem->GetIndexCount());
return true;
}

If I just call SetShaderParameters with the same args, there is a bug obviously: particle system scene sticks to the camera (originally, it looks like this).

I checked the params in debug mode and found out that the difference is in the World matrix. The DXUT CFirstPersonCamera is used in my project and it changed the World matrix while moving around the scene whereas in the original particle system project it's constant (identity matrix).

I understand that there is a difference between DXUT camera and the default project camera at the ideological level. Nevertheless, I am a newbie in Graphic it's too difficult to realize how to change the code in a proper way.

Thank you in advance

Advertisement

Hmm.. lt sounds quite silly, however, I hardcode World Matrix as the identity matrix and it looks much better.. I guess the issue may be closed

This topic is closed to new replies.

Advertisement