initial check in
This commit is contained in:
parent
6bd1f34a62
commit
0da089d56a
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -0,0 +1,61 @@
|
|||
P1
|
||||
64 64
|
||||
1111111111111111100000000000000000000000000000001111111111111111111111
|
||||
1111111111100000000000000000000000000000001111111111111111111111111111
|
||||
1111100000000000000000000000000000001111111111111111111111111111111110
|
||||
0000000000000000000000000000001111111111111111111111111111111111111000
|
||||
0000000000000000000011111111111111111111111111111111111111111100000000
|
||||
0000000000000111111111111111111111111111111111111111111110000000000000
|
||||
0000001111111111111111111111111111111111111111111111000000000000000001
|
||||
1111111111111111111111111111111111111111111111100000000000000011111111
|
||||
1111111111111111111111111111111111111111100000000000000011111111111111
|
||||
1111111111111111111111111111111111100000000000000011111111111111111111
|
||||
1111111111111111111111111111100000000000000011111111111111111111111111
|
||||
1111111111111111111111100000000000000011111111111111111111111111111111
|
||||
1111111111111111100000000000000011111111111111111111111111111111111111
|
||||
1111111111100000000000000011111111111111111111111111111111111111111111
|
||||
1111100000000000000011111111111111111111111111111111111111111111111110
|
||||
0000000000000011111111111111111111111100001111111111111111111110000000
|
||||
0000000011111111111111111111100000001111111111111111111110000000000000
|
||||
0011111111111111111111100000001111111111111111111110000000000000001111
|
||||
1111111111111111100000001111111111111111111110000000000000001111111111
|
||||
1111111111100000000111111111111111111110000000000000001111111111111111
|
||||
1111000000000011111111111111111110000000000000001111111111111111111000
|
||||
0000000001111111111111111111000000000000011111111111111111110000000000
|
||||
0000111111111111111111100000000000111111111111111111100000000000000000
|
||||
0000000000000111100000000000111100000000000000000000000000000000000000
|
||||
0000000011100000000000111000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000001110000000000011100000000000000000000000000000000000000000000001
|
||||
1110000000000011110000000000000000000000000000001111111111111111111000
|
||||
0000000011111111111111111110000000000000011111111111111111110000000000
|
||||
0001111111111111111111000000000000111111111111111111100000000000000011
|
||||
1111111111111111100000000001111111111111111111100000000000000011111111
|
||||
1111111111110000000011111111111111111111100000000000000011111111111111
|
||||
1111111000000011111111111111111111100000000000000011111111111111111111
|
||||
1000000011111111111111111111100000000000000011111111111111111111100000
|
||||
0011111111111111111111100000000000000011111111111111111111100011111111
|
||||
1111111111111111100000000000000011111111111111111111111111111111111111
|
||||
1111111111100000000000000011111111111111111111111111111111111111111111
|
||||
1111100000000000000011111111111111111111111111111111111111111111111110
|
||||
0000000000000011111111111111111111111111111111111111111111111110000000
|
||||
0000000011111111111111111111111111111111111111111111111110000000000000
|
||||
0011111111111111111111111111111111111111111111111110000000000000001111
|
||||
1111111111111111111111111111111111111111111110000000000000001111111111
|
||||
1111111111111111111111111111111111111110000000000000001111111111111111
|
||||
1111111111111111111111111111111100000000000000000111111111111111111111
|
||||
1111111111111111111111111000000000000000000011111111111111111111111111
|
||||
1111111111111111110000000000000000000001111111111111111111111111111111
|
||||
1111111111100000000000000000000000111111111111111111111111111111111111
|
||||
0000000000000000000000000000000011111111111111111111111111111111000000
|
||||
0000000000000000000000000011111111111111111111111111111111000000000000
|
||||
000000000000000000001111111111111111
|
|
@ -0,0 +1,61 @@
|
|||
P1
|
||||
64 64
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000011111111111111111111111111111111111111111111100000
|
||||
0000000000000011111111111111111111111111111111111111111111100000000000
|
||||
0000000011111111111111111111111111111111111111111111100000000000000000
|
||||
0011111111111111111111111111111111111111111111100000000000000000001111
|
||||
1111111111111111111111111111111111111111100000000000000000001111111111
|
||||
1111111111111111111111111111111111100000000000000000001111111111111111
|
||||
1111111111111111111111111111100000000000000000001111111111111111111111
|
||||
1111111111111111111111100000000000000000001111111111111111111111111111
|
||||
1111111111111111100000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000001000111110001111100011111000111110001111100011111111
|
||||
1111111111110000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000111111
|
||||
1111111111111111111111111111111111111110000000000000000000111111111111
|
||||
1111111111111111111111111111111110000000000000000000111111111111111111
|
||||
1111111111111111111111111110000000000000000000111111111111111111111111
|
||||
1111111111111111111110000000000000000000111111111111111111111111111111
|
||||
1111111111111110000000000000000000111111111111111111111111111111111111
|
||||
1111111110000000000000000000111111111111111111111111111111111111111111
|
||||
1110000000000000000000111111111111111111111111111111111111111111111000
|
||||
0000000000000000111111111111111111111111111111111111111111111000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000
|
|
@ -0,0 +1,61 @@
|
|||
P1
|
||||
64 64
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000111111101000000000000000000000000000000000000000000000000000111111
|
||||
1111111111000000000000000000000000000000000000000000000111111111111111
|
||||
1111111000000000000000000000000000000000000000011111111111111111111111
|
||||
1110000000000000000000000000000000000001111111111111111111111111111110
|
||||
0000000000000000000000000000000011111111111111111111111111111111000000
|
||||
0000000000000000000000001111111111111111111111111111111111110000000000
|
||||
0000000000000000011111111111111111111111111111111111111000000000000000
|
||||
0000000000111111111111111111111111111111111111111100000000000000000000
|
||||
0001111111111111111111111111111111111111111110000000000000000000001111
|
||||
1111111111111111111111111111111111111111000000000000000000001111111111
|
||||
1111111111111111111111111111111111000000000000000000011111111111111111
|
||||
1111111111111111111111111111100000000000000000111111111111111111111111
|
||||
1111111111111111111111110000000000000000111111111111111111111111111111
|
||||
1111111111111111110000000000000001111111111111111111111111111111111111
|
||||
1111111111111000000000000001111111111111111111111111111111111111111111
|
||||
1111111000000000000011111111111111111111111111111111111111111111111111
|
||||
1100000000000011111111111111111111111111111111111111111111111111110000
|
||||
0000000011111111111111111111111111111111111111111111111111110000000000
|
||||
0111111111111111111111111111111111111111111111111111111000000000011111
|
||||
1111111111111111111111111111111111111111111111111000000000011111111111
|
||||
1111111111111111111111111111111111111111111000000000011111111111111111
|
||||
1111111111111111111111111111111111111000000000111111111111111111111111
|
||||
1111111111111111111111111111111100000000111111111111111111111111111111
|
||||
1111111111111111111111111100000000111111111111111111111111111111111111
|
||||
1111111111111111111100000000111111111111111111111111111111111111111111
|
||||
1111111111111100000000111111111111111111111111111111111111111111111111
|
||||
1111111100000000111111111111111111111111111111111111111111111111111111
|
||||
1100000000111111111111111111111111111111111111111111111111111111110000
|
||||
0000111111111111111111111111111111111111111111111111111111110000000001
|
||||
1111111111111111111111111111111111111111111111111111100000000001111111
|
||||
1111111111111111111111111111111111111111111111100000000001111111111111
|
||||
1111111111111111111111111111111111111111100000000001111111111111111111
|
||||
1111111111111111111111111111111111100000000000111111111111111111111111
|
||||
1111111111111111111111111111000000000000111111111111111111111111111111
|
||||
1111111111111111111111000000000000111111111111111111111111111111111111
|
||||
1111111111111111000000000000011111111111111111111111111111111111111111
|
||||
1111111110000000000000011111111111111111111111111111111111111111111111
|
||||
1110000000000000001111111111111111111111111111111111111111111111110000
|
||||
0000000000001111111111111111111111111111111111111111111111110000000000
|
||||
0000000111111111111111111111111111111111111111111111100000000000000000
|
||||
0011111111111111111111111111111111111111111111000000000000000000001111
|
||||
1111111111111111111111111111111111111111000000000000000000000111111111
|
||||
1111111111111111111111111111111110000000000000000000000011111111111111
|
||||
1111111111111111111111111100000000000000000000000001111111111111111111
|
||||
1111111111111111111000000000000000000000000000111111111111111111111111
|
||||
1111111111110000000000000000000000000000001111111111111111111111111111
|
||||
1111000000000000000000000000000000000111111111111111111111111111111000
|
||||
0000000000000000000000000000000001111111111111111111111111100000000000
|
||||
0000000000000000000000000000011111111111111111111110000000000000000000
|
||||
0000000000000000000000000011111111111111110000000000000000000000000000
|
||||
0000000000000000000000001111111010000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000000000000000000000000000000000
|
|
@ -0,0 +1,61 @@
|
|||
P1
|
||||
64 64
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0000000000000000000000000000000000000000000000000011111111111111111111
|
||||
1111111111111111111111111111111111111000000010000000000000000000100000
|
||||
0000000000000000001000100000001000000010000000000000000000100000000000
|
||||
0000000000001000100000001000000010000000000000000000100000000000000000
|
||||
0000001000100000001000000010001111111111111000100011111111111110001111
|
||||
1000100010001000000010001000000000000000100000000000000000001000100010
|
||||
0010001000000010001000000000000000100000000000000000001000100010001000
|
||||
1000000010001000000000000000100000000000000000001000100010001000100000
|
||||
0010001000111111111000100011111111100010001000100010001000100000001000
|
||||
1000000000000000100000000000100010001000100000001000100000001000100000
|
||||
0000000000100000000000100010001000100000001000100000001000100000000000
|
||||
0000100000000000100010001000100000001000100000001000111111111111100010
|
||||
0011111111100010001000111111111000100000001000000000000000100010000000
|
||||
0000000000000000000010000000100000001000000000000000100010000000000000
|
||||
0000000000000010000000100000001000000000000000100010000000000000000000
|
||||
0000000010000000100000001111111111111000100011111111111110001000111110
|
||||
0010001111100000000000000000000000100000000000000000001000000000000000
|
||||
1000000000000000000000000000100000000000000000001000000000000000100000
|
||||
0000000000000000000000100000000000000000001000000000000000100000000000
|
||||
1111111111111000111111111111111110001000111111111000100010000000100000
|
||||
0000000000000000000000000000001000000000001000100010000000100000000000
|
||||
0000000000000000000000001000000000001000100010000000100000000000000000
|
||||
0000000000000000001000000000001000100010000000100011111111111111111111
|
||||
1111111111111000111110001000100010000000000000000000000000000000000000
|
||||
0000001000000010001000000000000000000000000000000000000000000000000000
|
||||
1000000010001000000000000000000000000000000000000000000000000000100000
|
||||
0010001000000000000000111111111111100011111111111111111000111111111000
|
||||
1000111110000000000000000000000010000000100000000000100000001000100010
|
||||
0000000000000000000000000010000000100000000000100000001000100010000000
|
||||
0000000000000000000010000000100000000000100000001000100010000000111111
|
||||
1100001111100010001000111111111000100000001000100010001000000010000000
|
||||
0000000010001000000000001000000000000000000010001000000010000000000000
|
||||
0010001000000000001000000000000000000010001000000010000000000000001000
|
||||
1000000000001000000000000000000010001000000010001111111111111000100011
|
||||
1110001000111110001000111110001000000010000000000000001000100000001000
|
||||
1000000010001000000000001000000010000000000000001000100000001000100000
|
||||
0010001000000000001000000010000000000000001000100000001000100000001000
|
||||
1000000000001000000010001000111110001000111111111000100010001000100011
|
||||
1111111000000010001000000010001000000000000000100010000000100000000000
|
||||
1000000010001000000010001000000000000000100010000000100000000000100000
|
||||
0010001000000010001000000000000000100010000000100000000000100000001000
|
||||
1111111111111111100010001111100011111000100010001000100000001000100000
|
||||
0000000000000010000000000000000000100010001000100000001000100000000000
|
||||
0000000010000000000000000000100010001000100000001000100000000000000000
|
||||
0010000000000000000000100010001000100000001000100011111111100010001000
|
||||
1111100011111000100010001111100000000000000000000000000010001000000010
|
||||
0010000000100010000000000000000000000000000000000010001000000010001000
|
||||
0000100010000000000000000000000000000000000010001000000010001000000010
|
||||
0010000000000011111111111111111111100010001000100010001000100010001111
|
||||
1111100000000000100000001000000010000000100000000000100010000000000010
|
||||
0000000000100000001000000010000000100000000000100010000000000010000000
|
||||
0000100000001000000010000000100000000000100010000000000010000000100010
|
||||
0010001000100010001000111111111111100011111111100010000000100000001000
|
||||
0000100010001000000000000000000000000000100000000000100000001000000010
|
||||
0010001000000000000000000000000000100000000000100000001000000010001000
|
||||
100000000000000000000000000010000000
|
|
@ -0,0 +1,61 @@
|
|||
P1
|
||||
64 64
|
||||
1111111111111111111111111000000000000001111111111111111111111111111111
|
||||
1111111111111111000000000000000000001111111111111111111111111111111111
|
||||
1111111000000000000000000000000001111111111111111111111111111111111110
|
||||
0000000000000000000000000000011111111111111111111111111111111000000000
|
||||
0000000000000000000000000111111111111111111111111111110000000000000000
|
||||
0000000000000000000011111111111111111111111111000000000000000000000000
|
||||
0000000000000000111111111111111111111110000000000000000000000000000000
|
||||
0000000000011111111111111111111100000000000000000011000010000000000000
|
||||
0000001111111111111111111000000000000000111111000011111100000000000000
|
||||
0111111111111111110000000000000011111111000011111111000000000000001111
|
||||
1111111111100000000000001111111111000011111111110000000000000111111111
|
||||
1111000000000000111111111111000011111111111100000000000011111111111100
|
||||
0000000001111111111111000011111111111110000000000011111111111000000000
|
||||
0011111111111111000011111111111111000000000001111111110000000000011111
|
||||
1111111111000011111111111111100000000000111111110000000000111111111111
|
||||
1110000001111111111111110000000000111111100000000001111111111111000000
|
||||
0000001111111111111000000000011111100000000011111111111100000000000000
|
||||
0011111111111100000000011111000000000011111111110000000000000000000011
|
||||
1111111100000000001111000000000111111111100000000000000000000001111111
|
||||
1110000000001111000000000111111111000000000000000000000000111111111000
|
||||
0000001110000000001111111110000000000000000000000000011111111100000000
|
||||
0110000000001111111110000000000000000000000000011111111100000000011000
|
||||
0000011111111100000000000011110000000000001111111110000000010000000001
|
||||
1111111100000000001111111100000000001111111110000000000000000001111111
|
||||
1000000000111111111111000000000111111110000000000000000001111111100000
|
||||
0000111111111111000000000111111110000000000000000011111111100000000111
|
||||
1111111111100000000111111111000000000000000011111111000000000111111111
|
||||
1111100000000011111111000000000000000011111111000000001111111111111111
|
||||
0000000011111111000000000000000011111111000000001111111111111111000000
|
||||
0011111111000000000000000011111111000000001111111111111111000000001111
|
||||
1111000000000000000011111111000000001111111111111111000000001111111100
|
||||
0000000000000011111111000000000111111111111110000000001111111100000000
|
||||
0000000011111111100000000111111111111110000000011111111100000000000000
|
||||
0001111111100000000011111111111100000000011111111000000000000000000111
|
||||
1111100000000011111111111100000000011111111000000000000000000111111111
|
||||
0000000000111111110000000000111111111000000001100000000111111111000000
|
||||
0000001111000000000000111111111000000001100000000011111111100000000000
|
||||
0000000000000001111111110000000001100000000011111111100000000000000000
|
||||
0000000001111111110000000001110000000001111111110000000000000000000000
|
||||
0011111111100000000011110000000001111111111000000000000000000000011111
|
||||
1111100000000011110000000000111111111100000000000000000000111111111100
|
||||
0000000011111000000000111111111111000000000000000011111111111100000000
|
||||
0111111000000000011111111111110000000000001111111111111000000000011111
|
||||
1100000000001111111111111110000001111111111111110000000000111111110000
|
||||
0000000111111111111111000011111111111111100000000000111111111000000000
|
||||
0011111111111111000011111111111111000000000001111111111100000000000111
|
||||
1111111111000011111111111110000000000011111111111100000000000011111111
|
||||
1111000011111111111100000000000011111111111110000000000000111111111100
|
||||
0011111111110000000000000111111111111111000000000000001111111100001111
|
||||
1111000000000000001111111111111111100000000000000011111100001111110000
|
||||
0000000000011111111111111111110000000000000000010100001100000000000000
|
||||
0000111111111111111111111000000000000000000000000000000000000000000111
|
||||
1111111111111111111100000000000000000000000000000000000000001111111111
|
||||
1111111111111111000000000000000000000000000000000000111111111111111111
|
||||
1111111111100000000000000000000000000000000001111111111111111111111111
|
||||
1111111000000000000000000000000000000111111111111111111111111111111111
|
||||
1110000000000000000000000000011111111111111111111111111111111111111111
|
||||
0000000000000000000011111111111111111111111111111111111111111111111100
|
||||
000000000001111111111111111111111111
|
|
@ -0,0 +1,110 @@
|
|||
import pygame, math, sys
|
||||
from pygame.locals import *
|
||||
|
||||
DEG_PER_CIRCLE = 128
|
||||
DEG_TO_RAD = math.pi*2/DEG_PER_CIRCLE
|
||||
FOV = DEG_PER_CIRCLE/3 # FOV in degrees
|
||||
PROJDIST = 0.5 #1.5 # Distance to projection plane
|
||||
PROJHEIGHT = 2.0 # Height of projection screen
|
||||
PROJBOT = 1.5 # Bottom of projection screen
|
||||
PROJTOP = PROJBOT+PROJHEIGHT # Top of projection screen
|
||||
EYEHEIGHT = PROJBOT+PROJHEIGHT/2 # Eye height
|
||||
HORIZON = 16#200
|
||||
|
||||
tex1 = [[(0,0,0),(255,0,0)],[(0,255,0),(0,0,255)]]
|
||||
s = [[0 for x in xrange(DEG_PER_CIRCLE)] for y in xrange(255)]
|
||||
t = [[0 for x in xrange(DEG_PER_CIRCLE)] for y in xrange(255)]
|
||||
ds = [[0 for x in xrange(DEG_PER_CIRCLE)] for y in xrange(255)]
|
||||
dt = [[0 for x in xrange(DEG_PER_CIRCLE)] for y in xrange(255)]
|
||||
|
||||
def setup(width, height):
|
||||
global HORIZON
|
||||
global s, t, ds, dt
|
||||
|
||||
print 'ST_TBL ; S, T, DS, DT angle+scanline table'
|
||||
pixfov = math.tan(FOV/2*DEG_TO_RAD) / width/2
|
||||
for angle in xrange(DEG_PER_CIRCLE):
|
||||
viewv = math.sin(angle*DEG_TO_RAD)
|
||||
viewu = math.cos(angle*DEG_TO_RAD)
|
||||
scanv = viewu # sin((dirview+90)*DEG_TO_RAD)
|
||||
scanu = -viewv # cos((dirview+90)*DEG_TO_RAD)
|
||||
for scanline in xrange(0, height):
|
||||
if scanline >= HORIZON:
|
||||
break
|
||||
scanheight = scanline * PROJHEIGHT / height + PROJBOT
|
||||
if scanheight >= EYEHEIGHT:
|
||||
break
|
||||
scandist = EYEHEIGHT * PROJDIST / (EYEHEIGHT - scanheight)
|
||||
if scandist > PROJDIST and scandist < 256:
|
||||
s[scanline][angle] = viewu * scandist
|
||||
t[scanline][angle] = viewv * scandist
|
||||
dp = pixfov * scandist
|
||||
ds[scanline][angle] = scanu * dp
|
||||
dt[scanline][angle] = scanv * dp
|
||||
fxs = int(math.floor(s[scanline][angle]*1024+0.5))
|
||||
fxt = int(math.floor(t[scanline][angle]*1024+0.5))
|
||||
fxds = int(math.floor(ds[scanline][angle]*65536+0.5))
|
||||
fxdt = int(math.floor(dt[scanline][angle]*65536+0.5))
|
||||
# fxs = int(s[scanline][angle]*1024+0.5) # 6.10 fixpt
|
||||
# fxt = int(t[scanline][angle]*1024+0.5) # 6.10 fixpt
|
||||
# fxds = int(ds[scanline][angle]*65536+0.5) # 0.16 fixpt
|
||||
# fxdt = int(dt[scanline][angle]*65536+0.5) # 0.16 fixpt
|
||||
if fxs < 0:
|
||||
fxs += 65536
|
||||
if fxt < 0:
|
||||
fxt += 65536
|
||||
if fxds < 0:
|
||||
fxds += 65536
|
||||
if fxdt < 0:
|
||||
fxdt += 65536
|
||||
print '\t!WORD\t$%04X, $%04X, $%04X, $%04X\t;scan %d angle %d' % (fxs, fxt, fxds, fxdt, scanline, angle)
|
||||
if scanline > HORIZON:
|
||||
HORIZON = scanline
|
||||
|
||||
def texel(s, t):
|
||||
return tex1[int(math.floor(s))&1][int(math.floor(t))&1]
|
||||
|
||||
def draw(pixbuf, width, height, frame):
|
||||
xview = 0
|
||||
yview = 0
|
||||
dirview = frame%DEG_PER_CIRCLE
|
||||
for scanline in xrange(HORIZON):
|
||||
_s = xview + s[scanline][dirview]
|
||||
_t = yview + t[scanline][dirview]
|
||||
#
|
||||
# Draw right half of scanline
|
||||
#
|
||||
_ds = ds[scanline][dirview]
|
||||
_dt = dt[scanline][dirview]
|
||||
scans = _s + _ds / 2
|
||||
scant = _t + _dt / 2
|
||||
for x in xrange(width/2, width):
|
||||
pixbuf[x][(height-1)-scanline] = texel(scans, scant)
|
||||
scans += _ds
|
||||
scant += _dt
|
||||
#
|
||||
# Draw left half of scanline
|
||||
#
|
||||
scans = _s - _ds / 2
|
||||
scant = _t - _dt / 2
|
||||
for x in xrange(width/2-1, -1, -1):
|
||||
pixbuf[x][(height-1)-scanline] = texel(scans, scant)
|
||||
scans -= _ds
|
||||
scant -= _dt
|
||||
|
||||
WIDTH = 30#320
|
||||
HEIGHT = 40#200
|
||||
pygame.init()
|
||||
surface = pygame.display.set_mode((WIDTH,HEIGHT))
|
||||
surfpix = pygame.PixelArray(surface)
|
||||
frame = 0
|
||||
setup(WIDTH, HEIGHT)
|
||||
while True:
|
||||
draw(surfpix, WIDTH, HEIGHT, frame)
|
||||
pygame.display.update()
|
||||
frame += 1
|
||||
for event in pygame.event.get():
|
||||
if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int scancmp(unsigned char bytes1[], unsigned char bytes2[], int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
if (bytes1[i] != bytes2[i])
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char type[4];
|
||||
int width, height, bytecount, bitcount, bit, prevbit, repeat, rle, linelen, prevlen;
|
||||
unsigned char scanline[256], prevline[256];
|
||||
|
||||
scanf("%s\n%d %d\n", type, &width, &height);
|
||||
fprintf(stderr, "%s -> %d, %d\n", type, width, height);
|
||||
prevlen = 0;
|
||||
repeat = 1;
|
||||
while (height--)
|
||||
{
|
||||
linelen = 0;
|
||||
rle = 0;
|
||||
prevbit = 0;
|
||||
for (bitcount = 0; bitcount < width; bitcount++)
|
||||
{
|
||||
while ((bit = getchar()) != '0' && bit != '1')
|
||||
if (bit == EOF)
|
||||
break;
|
||||
if (bit == prevbit)
|
||||
{
|
||||
rle++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rle)
|
||||
scanline[linelen++] = (prevbit == '0' ? 128 : 0) + rle;
|
||||
prevbit = bit;
|
||||
rle = 1;
|
||||
}
|
||||
}
|
||||
if (rle)
|
||||
scanline[linelen++] = (prevbit == '0' ? 128 : 0) + rle;
|
||||
if (linelen == prevlen && scancmp(scanline, prevline, linelen) == 0)
|
||||
repeat++;
|
||||
else
|
||||
{
|
||||
if (prevlen)
|
||||
{
|
||||
printf("\t!BYTE\t0,%d\t; Scanline repeat count\n", repeat);
|
||||
printf("\t!BYTE\t");
|
||||
for (bytecount = 0; bytecount < prevlen-1; bytecount++)
|
||||
printf("%s%d,", prevline[bytecount] & 0x80 ? "128+" : "", prevline[bytecount] & 0x7F);
|
||||
printf("%s%d\n", prevline[prevlen-1] & 0x80 ? "128+" : "", prevline[prevlen-1] & 0x7F);
|
||||
}
|
||||
for (bytecount = 0; bytecount < linelen; bytecount++)
|
||||
prevline[bytecount] = scanline[bytecount];
|
||||
prevlen = linelen;
|
||||
repeat = 1;
|
||||
}
|
||||
}
|
||||
if (linelen)
|
||||
{
|
||||
printf("\t!BYTE\t0,%d\t; Scanline repeat count\n", repeat);
|
||||
printf("\t!BYTE\t");
|
||||
for (bytecount = 0; bytecount < linelen-1; bytecount++)
|
||||
printf("%s%d,", scanline[bytecount] & 0x80 ? "128+" : "", scanline[bytecount] & 0x7F);
|
||||
printf("%s%d\n", scanline[linelen-1] & 0x80 ? "128+" : "", scanline[linelen-1] & 0x7F);
|
||||
}
|
||||
printf("\t!BYTE 0,0\t; End of compressed map\n");
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import math, sys
|
||||
|
||||
DEG_PER_CIRCLE = 128
|
||||
DEG_TO_RAD = math.pi*2/DEG_PER_CIRCLE
|
||||
|
||||
print 'SIN_TBL'
|
||||
for angle in xrange(DEG_PER_CIRCLE+DEG_PER_CIRCLE/4):
|
||||
if angle == DEG_PER_CIRCLE/4:
|
||||
print 'COS_TBL'
|
||||
sincos = math.sin(angle*DEG_TO_RAD)
|
||||
fxs = int(math.floor(sincos*127.0))
|
||||
if fxs < 0:
|
||||
fxs += 256
|
||||
print '\t!BYTE\t$%03X\t; angle %d' % (fxs, angle)
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
import math, sys
|
||||
|
||||
DEG_PER_CIRCLE = 128
|
||||
DEG_TO_RAD = math.pi*2/DEG_PER_CIRCLE
|
||||
|
||||
print 'TAN_TBL'
|
||||
for angle in xrange(DEG_PER_CIRCLE/4):
|
||||
tan = math.tan(angle*DEG_TO_RAD)
|
||||
fxt = int(math.floor(tan*256.0+0.5))
|
||||
print '\t!WORD\t$%04X\t; angle %d' % (fxt, angle)
|
||||
|
Loading…
Reference in New Issue