3D raycasting

Страница 6/16
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11

By NYYRIKKI

Enlighted (5541)

Аватар пользователя NYYRIKKI

01-05-2011, 05:50


@NYYRIKKI

I was studing your code to adapt it to RLE sequences
What is this section for?
Why do you set R#17 = 172 ?

	LD A,#AC
	LD (#99),A
	LD A,#91
	OUT (#99),A

It means that all the following bytes (#80=Auto increment off) written to I/O #9B will be redirected to VDP register #2C (#80+#2C=#AC) that is used as data input for HMMC

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

01-05-2011, 09:47

ok thanks

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

01-05-2011, 10:24

hit9918,NYYRIKKI
I'm testing your code, I'm going to relase a pure asm test package (maze3d needs HiTech C v7.8)
BTW I'm facing the problem of clipping, when the colum size if larger than the height of the port view
More soon

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

01-05-2011, 12:49

look for zoom.rar
https://sites.google.com/site/devmsx/rle-textures

It implements only NYYRIKKI's code
But it does not work yet...
wip

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

02-05-2011, 01:19

New zoom.rar at https://sites.google.com/site/devmsx/rle-textures
now has a fixed version of NYYRIKKI's code
It works but columsx get duplicated...
Any hint ?

After that I'll move to RLE data

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

02-05-2011, 22:48

I've fixed NYYRIKKI's code, now works perfectly! Thanks very much!!
Try NYYRIKKI.rar from https://sites.google.com/site/devmsx/rle-textures
It will be the reference for RLE. This is the fixed version


	align 256
	
MulTab:	

	;DB 0, low (16384),low (16384/2),low (16384/3) ... ,low (16384/254), ,low (16384/255)

	DB 0,64,32,106,16,216,180,45, 8,35,108,214,90,240,150,72, 4,198,145,97,54,15,234,202,172,145,120
	DB 96,75,54,36,18, 2,241,226,213,200,187,176,165,154,144,135,126,117,109,101,93,86,79,72,66,60
	DB 54,48,42,37,32,27,22,18,13, 9, 5, 1,252,248,244,240,237,234,230,227,224,221,218,215,212,210
	DB 207,204,202,199,197,195,192,190,188,186,184,182,180,178,176,174,172,170,168,167,165,163,162,160,159,157
	DB 156,154,153,151,150,148,147,146,144,143,142,141,140,138,137,136,135,134,133,132,131,130,129,128,127,126
	DB 125,124,123,122,121,120,119,118,117,117,116,115,114,113,112,112,111,110,109,109,108,107,107,106,105,105
	DB 104,103,103,102,101,101,100,99,99,98,98,97,96,96,95,95,94,94,93,93,92,92,91,91,90,90
	DB 89,89,88,88,87,87,86,86,85,85,84,84,84,83,83,82,82,81,81,81,80,80,79,79,79,78
	DB 78,78,77,77,76,76,76,75,75,75,74,74,74,73,73,73,72,72,72,71,71,71,70,70,70,70
	DB 69,69,69,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,64,64,64
	
	;DB 0, high(16384),high(16384/2),high(16384/3) ... ,high(16384/254), ,high(16384/255)

   DB  0, 64, 32, 21, 16, 12, 10,  9,  8,  7,  6,  5,  5,  4,  4,  4,  4,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2
   DB  2,  2,  2,  2,  2,  2,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1
   DB  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
   DB  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0

	
	
; input HL -> texture colum: 64 bytes 
; input A = final size in [1...255]
; input DE = (X,Y) coords for the starting point where to plot the scaled colum 

scaler: 

	LD IXL,A
	LD B,A
	LD C,#9B
	
	LD A,#24
	out (#99),A
	LD A,#91
	OUT (#99),A		; set R#17=36

	xor	a
	OUT (C),D
	OUT (0x9B),a
	OUT (C),E		; set DX,DY
	OUT (0x9B),a
	
	ld	a,2
	OUT (0x9B),a
	xor	a
	OUT (0x9B),a
	OUT (C),B
	OUT (0x9B),a	; set NX,NY
	
	LD A,(HL)
	OUT (#9B),A		; set C

	xor	a
	OUT (0x9B),a
	LD A,#F0
	OUT (#9B),A		; set HMMC

	LD A,#AC
	out (#99),A
	LD A,#91
	OUT (#99),A		; set R#17=44 with no autoincrement

	LD	A,L
	LD 	L,B

	LD 	B,H 			; (Texture starts also from 256 byte boundary)
	
	LD 	H,MulTab/256
	LD 	E,(HL)
	INC H
	LD 	D,(HL)		; DE = C*0x4000/255
	
	LD 	L,0			
	LD	H,A
	
CORE:
	ADD HL,DE
	LD C,H
	LD A,(BC)
	OUT (#9B),A

	DEC IXL
	JP NZ,CORE

	ret

Going to explore hit9918's solution

BTW the clipping stais an unsolved problem ...

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

03-05-2011, 08:55

Hummm....
I missed a INC A, without the code sends twice the same first byte

LD A,#AC
	out (#99),A
	LD A,#91
	OUT (#99),A		; set R#17=44 with no autoincrement

	LD	A,L
	INC  A                       ; <---- NEEDED
	LD 	L,B

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

03-05-2011, 10:19

@hit9918
I was integrating your snippet to compare it with teh plain cpu scroll and start to develop the HMMV version.
What I find critical is the part where you access to the multable.
Assuming a max run lenght of 64 the table results of 16K!

The first solution I can think at is to use a multiplication routine (slow) or R800 (fast)
The other idea is to reduce the max run lenght, say, to 8 textels, resulting in a table of 2048 bytes
This would reduce the efficency of the VDP work, but, in any case, it is probably better than resorting to use a multiplication routine
Any suggestion?

By hit9918

Prophet (2891)

Аватар пользователя hit9918

05-05-2011, 00:11

@ARTRAG: how about splitting the mul into two pieces:

table[length / 8] * 8 + table[length & (8 - 1)]

8 * 256 entries, 8 * 256 * 2 bytes as the mul result needs to be 16bit fixpoint. table size would be 4k. This can take a max number of (8*8) - 1 = 63 as max runlength.

Max runlength should maybe not be snipped too much, else overheads kick in too much.

By ARTRAG

Enlighted (6367)

Аватар пользователя ARTRAG

01-11-2011, 09:58

WIP
https://sites.google.com/site/testmsx/msx2-doom/mz3d_dos_2011_11_01c.rar?attredirects=0&d=1

Press CTRL to see the buggy wip on textures
The RLE scaler is buggy, not optimized, and the whole screen (including floor and ceiling are plotted at each frame

Страница 6/16
1 | 2 | 3 | 4 | 5 | | 7 | 8 | 9 | 10 | 11