.proj13 \ By this point, we have the following: \ \ (QQ PP) = |xPoint| \ (SS RR) = |yPoint| * 2 \ (Q P) = |zPoint| \ \ with (Q P) set to a minimum value of 1 LDY P \ Set (X Y) = (Q P) LDX Q \ = |zPoint| \ \ so we call ScaleUp with a non-zero (X Y), as we know \ (Q P) is at least 1 JSR ScaleUp \ Set (A Y) = (X Y), scaled up until it doesn't fit into \ 16 bits any more, and set WW to the minimum number of \ bits in the original number TAX \ Set (TT S) = the A-th entry from the division table LDA divisionHi,X \ with bits 0 to 2 cleared (as they contain unrelated STA TT \ data) LDA divisionLo,X AND #%11111000 STA S STY K \ Set K = Y, the low byte of the result from ScaleUp LDA WW \ Set UU = WW STA UU LDY PP \ Set (X Y) = (QQ PP) LDX QQ \ = |xPoint| JSR DivideScaled \ Set (Q P) = (X Y) divided by (TT S) \ = |xPoint| / |zPoint| \ \ And set WW to the scale factor of the result LDA Q \ Set (QQ PP) = (Q P) STA QQ LDA P STA PP LDA WW \ Set VV = WW STA VV LDY RR \ Set (X Y) = (SS RR) LDX SS \ = |yPoint| * 2 JSR DivideScaled \ Set (Q P) = (X Y) divided by (TT S) \ = |yPoint| * 2 / |zPoint| \ \ And set WW to the scale factor of the result JSR ScaleDown \ Scale (Q P) and (QQ PP) down by the correct amounts in \ UU, VC and WW to give screen coordinates in (SS QQ) \ and (RR Q)Name: ProjectPoint (Part 2 of 3) [Show more] Type: Subroutine Category: 3D geometry Summary: Calculate the screen coordinates of the projected pointContext: See this subroutine in context in the source code References: No direct references to this subroutine in this source file
[X]
Subroutine DivideScaled (category: Maths)
Divide a 16-bit number by a scaled 16-bit number
[X]
Subroutine ScaleDown (Part 1 of 4) (category: Maths)
Scale down the results of divisions done using the ScaleUp and DivideScaled routines
[X]
Subroutine ScaleUp (category: Maths)
Scale up a 16-bit number until it doesn't fit into 16 bits any more
[X]
Variable divisionHi (category: Maths)
Division lookup table
[X]
Variable divisionLo (category: Maths)
Division lookup table