Skip to content

Questions regarding Mtx_Translate() #55

@BallM4788

Description

@BallM4788

Please be patient with me as I am extremely new to graphics libraries and the math involved in 3D rendering, and frankly have very little idea of what I'm talking about in general.

Background: ScummVM uses a modified version of TinyGL (a stripped-down version of OpenGL) to run several 3D games such as Grim Fandango and Myst 3: Exile on lower-end systems (including the 3DS), provided their ScummVM engine has alternate, TinyGL-specific graphics code. The problem is that attempting to run said 3D games crashes the system. Interestingly, the one 3D game that will run on the 3DS (Westwood's Blade Runner), does not use OpenGL nor TinyGL.

Anyway, there was speculation that the issue might be solved by having the 3DS hardware take over some functions. Since the 3DS backend for ScummVM already uses citro3d for screen rendering, I thought it might be worthwhile to try and write a version of ScummVM's TinyGL implementation that utilizes citro3d. Needless to say, due to tinyGL being column-major and citro3d being row-major, I've been in a slog from the beginning.

What I think I know: Correct me if I'm wrong on any of this. To my understanding, converting between column-major and row-major layout simply requires transposing the matrix (and in citro3d's case, additionally flipping the matrix horizontally to account for PICA200's WZYX ordering). This seemed to work out fine for matrix rotation, as doing this then performing a left-handed MTX_Rotate() produced the same values as TinyGL's glopRotate() (with value positions changed appropriately).

In TinyGL, the translation matrix in its Matrix4::translate() looks like this:

Therefore, I expected that citro3d's translation matrix would be situated like this (but flipped horizontally, of course):

However, according to citro3d's code, a left-sided MTX_Translate() changes every cell's value EXCEPT those in the bottom-row. Additionally, right-handed Mtx_Translate() uses a translation matrix that is a horizontal mirror of TinyGL's translation matrix, changing only the W cells.

Questions:

  1. Is this intentional?
  2. If so, am I not understanding something correctly?
  3. If not, how can I work around this?
  4. Am I going about this all wrong?
  5. Is there anything you think I should know before I continue on this magical journey of mathematics, personal growth, and generally banging my head against a wall?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions