mirror of
https://github.com/fadden/6502bench.git
synced 2024-09-11 20:54:37 +00:00
There's no "standard" coordinate system, so the choice is arbitrary. However, an examination of the Transporter mesh in Elite revealed that the mesh was designed for a left-handed coordinate system. We can compensate for that trivially in the Elite visualizer, but we might as well match what they're doing. (The only change required in the code is a couple of sign changes on the Z coordinate, and an update to the rotation matrix.) This also downsizes Matrix44 to Matrix33, exposes the rotation mode enum, and adds a left-handed ZYX rotation mode. This does mean that meshes that put the front at +Z will show their backsides initially, since we're now oriented as if we're flying the ships rather than facing them. I considered adding a 180-degree Y rotation (with a tweak to the rotation matrix handedness to correct the first rotation axis) to have them facing by default, but figured that might be confusing since +Z is supposed to be away. Anybody who really wants it to be the other way can trivially flip the coordinates in their visualizer (negate xc/zc). The Z coordinates in the visualization test project were flipped so that the design is still facing the viewer at rotation (0,0,0).
62 lines
1.7 KiB
ArmAsm
62 lines
1.7 KiB
ArmAsm
; Copyright 2020 faddenSoft. All Rights Reserved.
|
|
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
|
;
|
|
; Assembler: Merlin 32
|
|
|
|
; Cube with a decoration on the front (should look like a "7").
|
|
; Defined in a left-handed coordinate system (+Z away from viewer).
|
|
|
|
org $1000
|
|
|
|
lda vertices
|
|
lda edges
|
|
lda faces
|
|
rts
|
|
|
|
; List of vertices (X,Y,Z).
|
|
vertices
|
|
dfb -32,32,-32 ;0
|
|
dfb -32,-32,-32 ;1
|
|
dfb 32,-32,-32 ;2
|
|
dfb 32,32,-32 ;3
|
|
dfb -32,32,32 ;4
|
|
dfb -32,-32,32 ;5
|
|
dfb 32,-32,32 ;6
|
|
dfb 32,32,32 ;7
|
|
|
|
; Put a decoration on the front face.
|
|
dfb -20,-20,-32 ;8
|
|
dfb 20,20,-32 ;9
|
|
dfb 10,20,-32 ;10
|
|
dfb $80
|
|
|
|
; List of edges (vertex0, vertex1, face0, face1).
|
|
edges
|
|
dfb 0,1, 0,5 ;0
|
|
dfb 1,2, 0,3 ;1
|
|
dfb 2,3, 0,4 ;2
|
|
dfb 3,0, 0,2 ;3
|
|
dfb 4,5, 1,5 ;4
|
|
dfb 5,6, 1,3 ;5
|
|
dfb 6,7, 1,4 ;6
|
|
dfb 7,4, 1,2 ;7
|
|
dfb 0,4, 2,5 ;8
|
|
dfb 1,5, 3,5 ;9
|
|
dfb 2,6, 3,4 ;10
|
|
dfb 3,7, 2,4 ;11
|
|
|
|
dfb 8,9, 0,0 ;12
|
|
dfb 9,10, 0,0 ;13
|
|
dfb $80
|
|
|
|
; List of faces (surface normal X,Y,Z).
|
|
faces
|
|
dfb 0,0,-1 ;0 front
|
|
dfb 0,0,1 ;1 back
|
|
dfb 0,1,0 ;2 top
|
|
dfb 0,-1,0 ;3 bottom
|
|
dfb 1,0,0 ;4 right
|
|
dfb -1,0,0 ;5 left
|
|
dfb $80
|
|
|