orthographic camera

This topic contains 2 replies, has 2 voices, and was last updated by  ahmedsaleh 3 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #264

    ahmedsaleh
    Participant

    Hi,

    What are the changes needed to setup an orthographic camera ?
    I know I have to use XMMatrixOrthographicLH
    but what about update view matrix and update function ? what should be changed?
    Do you have any references for implementing it ? Because its not referenced in your book.

    #266

    Paul Varcholik
    Keymaster

    Hi Ahmed,

    There’s nothing special you need to worry about with respect to the view matrix. If you were writing an orthographic camera component, you might split a class hierarchy into Camera, PerspectiveCamera, and OrthographicCamera — where the Camera class becomes an abstract base class with a pure virtual UpdateProjectionMatrix method. The base Camera class would then contain properties for position, direction, up, right, view matrix, projection matrix, near/far planes, but would move Perspective/Orthographic-specific fields to their associated derived classes. For example, the PerspectiveCamera class would contain field of view and aspect ratio members; and an OrthgraphicCamera class would contain view width and view height fields. These derived classes would then implement the UpdateProjectionMatrix method with the XMMatrixPerspectiveFovRH or XMMatrixOrthographicRH methods, respectively.

    Here’s an implementation of that hierarchy.

    Paul

    #268

    ahmedsaleh
    Participant

    Thanks so much!.
    Can’t wait for your 2nd book that explains more advanced topics like scene management,..etc

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.