Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also fixed raster, pipeline and texture code in backface culling, enforced some code definition.
- Loading branch information
1 parent
73c01f8
commit cc69cc8
Showing
19 changed files
with
34,191 additions
and
12,533 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
@echo off | ||
color 0F | ||
:Loop | ||
echo ----------------------------------- | ||
echo Building example.ez80... | ||
tools\spasm -L -T -E -A -S -I include/ example.ez80 bin/TEST.8xp | ||
echo ----------------------------------- | ||
echo Building example1.ez80... | ||
tools\spasm -L -T -E -A -S -I include/ example1.ez80 bin/TEST1.8xp | ||
pause | ||
goto Loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
#include "vx3D.inc" | ||
|
||
#define DELTA 4096 | ||
|
||
.org userMem - 2 | ||
.db tExtTok, tAsm84CeCmp | ||
.assume ADL=1 | ||
|
||
; init the virtual 3d library | ||
call vxEngineInit | ||
ret c ; qui if error at init | ||
|
||
ld hl, VertexName | ||
call vxFindFile | ||
ret c | ||
ld (Vertex), hl | ||
|
||
ld hl, TriangleName | ||
call vxFindFile | ||
ret c | ||
ld (Triangle), hl | ||
|
||
|
||
; setup global variable for rendering, euler angle and the translation of WorldMatrix | ||
|
||
ld hl, 0 | ||
ld (EulerAngle), hl | ||
|
||
ld ix, WorldMatrix | ||
lea hl, ix+0 | ||
call vxMatrixLoadIdentity | ||
ld hl, 65536 | ||
ld (ix+15), hl ; Z translation of the matrix | ||
|
||
MainLoop: | ||
|
||
call vxTimerStart | ||
|
||
ld hl, (EulerAngle) | ||
ld iy, Quaternion | ||
ld ix, UnitVector | ||
call vxQuaternionRotationAxis | ||
ld ix, WorldMatrix | ||
call vxQuaternionGetMatrix | ||
lea iy, ix+0 | ||
ld ix, ScaleMatrix | ||
ld hl, WorldMatrix | ||
call vxMatrixMlt | ||
|
||
ld a, VX_GEOMETRY_CI9 | ||
ld ix, WorldMatrix | ||
ld iy, ModelMatrix | ||
ld bc, VX_VERTEX_BUFFER | ||
ld hl, (Vertex) | ||
ld de, (Triangle) | ||
call vxCmdDraw | ||
|
||
ld hl, (vxGeometrySize) | ||
ld (triangle_count), hl | ||
|
||
call vxCmdDepthSort | ||
|
||
ld c, %00000000 | ||
call vxClearBuffer | ||
call vxCmdExecute | ||
|
||
; timer & counter | ||
|
||
ld bc, 320*8-1 | ||
ld de, (vxFramebuffer) | ||
or a, a | ||
sbc hl, hl | ||
add hl, de | ||
inc de | ||
ld (hl), 0 | ||
ldir | ||
|
||
ld hl, 0 | ||
ld (TextXPos_SMC), hl | ||
ld a, 0 | ||
ld (TextYPos_SMC), a | ||
|
||
call vxTimerRead | ||
; do (ade/256)/187 | ||
ld (Temp), de | ||
ld (Temp+3), a | ||
ld de, (Temp+1) | ||
; divide de by 187 | ||
ex de, hl | ||
ld bc, 187 | ||
call __idivs_ASM | ||
ld de, 4 | ||
push de | ||
push hl | ||
call _PrintUInt | ||
pop de | ||
pop hl | ||
|
||
ld hl, (TextXPos_SMC) | ||
ld de, 8 | ||
add hl, de | ||
ld (TextXPos_SMC), hl | ||
|
||
triangle_count=$+1 | ||
ld hl, 0 | ||
ld de, 4 | ||
push de | ||
push hl | ||
call _PrintUInt | ||
pop de | ||
pop hl | ||
|
||
call vxFlushLCD | ||
|
||
KeyboardTest: | ||
ld hl,$F50000 | ||
ld (hl),2 | ||
xor a,a | ||
kwait: | ||
cp a,(hl) | ||
jr nz,kwait | ||
|
||
ld de, 8 | ||
ld a, ($F5001E) | ||
bit 1, a | ||
jr z, _kskip | ||
ld hl, (EulerAngle) | ||
add hl, de | ||
ld (EulerAngle), hl | ||
_kskip: | ||
ld de, -8 | ||
ld a, ($F5001E) | ||
bit 2, a | ||
jr z, _kskip2 | ||
ld hl, (EulerAngle) | ||
add hl, de | ||
ld (EulerAngle), hl | ||
_kskip2: | ||
ld a, ($F5001E) | ||
bit 0, a | ||
jr z, _kskip5 | ||
ld hl, (WorldMatrix+12) | ||
ld de, DELTA | ||
add hl, de | ||
ld (WorldMatrix+12), hl | ||
_kskip5: | ||
|
||
ld a, ($F5001E) | ||
bit 3, a | ||
jr z, _kskip6 | ||
ld hl, (WorldMatrix+12) | ||
ld de, -DELTA | ||
add hl, de | ||
ld (WorldMatrix+12), hl | ||
_kskip6: | ||
|
||
ld hl, (WorldMatrix+15) | ||
|
||
ld a, ($F50012) | ||
bit 0,a | ||
jr z, _kskip3 | ||
ld de, DELTA | ||
add hl, de | ||
_kskip3: | ||
|
||
bit 4,a | ||
jr z, _kskip4 | ||
ld de, -DELTA | ||
add hl, de | ||
_kskip4: | ||
|
||
ld (WorldMatrix+15), hl | ||
|
||
ld a,($F5001C) | ||
bit 6,a | ||
|
||
jp z, MainLoop | ||
ret | ||
|
||
#include "vxMain.ez80" | ||
#include "graphics_lib.asm" | ||
|
||
posX: | ||
.dw 0 | ||
posY: | ||
.dw 0 | ||
posZ: | ||
.dw 0 | ||
Temp: | ||
.dl 0,0 | ||
|
||
VertexName: | ||
.db AppVarObj, "SUZAN0",0 | ||
Vertex: | ||
.dl 0 | ||
TriangleName: | ||
.db AppVarObj, "SUZAN1", 0 | ||
Triangle: | ||
.dl 0 | ||
|
||
ScaleMatrix: | ||
.db 77,0,0 ; 44 | ||
.db 0,102,0 ; 58 | ||
.db 0,0,64 ; 37 | ||
UnitVector: | ||
.dl 0,16384,0 | ||
Quaternion: | ||
.dl 0,0,0,0 | ||
QuatMatrix: | ||
.dl 0,0,0,0,0,0 | ||
WorldMatrix: | ||
.dl 0,0,0,0,0,0 | ||
ModelMatrix: | ||
.db 64,0,0 | ||
.db 0,64,0 | ||
.db 0,0,64 | ||
.dw 0,0,0 | ||
EulerAngle: | ||
.dl 0,0,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Blender MTL File: 'None' | ||
# Material Count: 2 | ||
|
||
newmtl Material.001 | ||
Ns 96.078431 | ||
Ka 1.000000 1.000000 1.000000 | ||
Kd 0.640000 0.000000 0.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.000000 | ||
d 1.000000 | ||
illum 2 | ||
|
||
newmtl Material.002 | ||
Ns 96.078431 | ||
Ka 1.000000 1.000000 1.000000 | ||
Kd 0.006859 0.640000 0.000000 | ||
Ks 0.500000 0.500000 0.500000 | ||
Ke 0.000000 0.000000 0.000000 | ||
Ni 1.000000 | ||
d 1.000000 | ||
illum 2 |
Oops, something went wrong.