0
\$\begingroup\$

I would like to play with two different implementation of 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, highlight 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

\$\endgroup\$
0
\$\begingroup\$

Hmm.. lt sounds quite silly, however, I hardcoded World Matrix as the identity matrix and It looks OK

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.