Skip to content

Shade Coefficients  #38

@bryanperris

Description

@bryanperris

From this test: https://github.com/PeterLemon/N64/blob/105fd6cfc3f863f0a128802a20ee1137907ba78e/RDP/16BPP/Triangle/ShadeTriangle320x240/Cycle1ShadeTriangle16BPP320X240.asm

You'll find this line: Shade_Coefficients 256.0,0,0,0, 5.12,5.12,-5.12,0, 256.0<<16,0<<16,0<<16,0<<16, 5.12<<16,5.12<<16,-5.12<<16,0<<16, -5.12,5.12,0,0, 0,0,0,0, -5.12<<16,5.12<<16,0<<16,0<<16, 0<<16,0<<16,0<<16,0<<16 // Generated By N64LeftMajorShadeTriangleCalc.py

N64LeftMajorShadeTriangleCalc.py only generates the Shade_Triangle edge coefficients but not the shade coefficients command that should follow after the triangle command. It would be helpful if the comment showed the triangle inputs used to generate the command asm.

The RDP doc does not describe the fields being fixed point, just 16 bits wide. The bass assembler truncates all decimal values into integers. Also why do the fraction fields need to be shifted to the left by 16 bits? The color fields come in pairs of integer, fraction fields, so it seems none of them need to be fixed point.

I want to assemble the correct values that aren't going to be truncated by the assembler and then disassemble the command back into the equivalent asm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions