feat: ajout de l'exportation de la fonction "load3ds" dorénavant fonctionnelle Modification des fonctions 3D pour éviter l'ambiguïté entre les variables @nbfaces et @type.
This commit is contained in:
parent
5e55bdcba3
commit
600fe4e7d2
261
lib/3d.asm
261
lib/3d.asm
|
@ -18,7 +18,7 @@ declare draw3d_point
|
||||||
declare draw3d_line
|
declare draw3d_line
|
||||||
declare draw3d_hidden
|
declare draw3d_hidden
|
||||||
declare draw3d_hidden_fill
|
declare draw3d_hidden_fill
|
||||||
;declare load3ds
|
declare load3ds
|
||||||
declare translate
|
declare translate
|
||||||
declare translatex
|
declare translatex
|
||||||
declare translatey
|
declare translatey
|
||||||
|
@ -39,7 +39,7 @@ ende
|
||||||
|
|
||||||
importing
|
importing
|
||||||
use GRAPHIC.LIB,line
|
use GRAPHIC.LIB,line
|
||||||
use GRAPHIC.LIB,polyFill
|
use GRAPHIC.LIB,polyfill
|
||||||
use VIDEO,showpixel
|
use VIDEO,showpixel
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ endp draw3d_point
|
||||||
|
|
||||||
;affiche liste vertex %0
|
;affiche liste vertex %0
|
||||||
PROC draw3d_line FAR
|
PROC draw3d_line FAR
|
||||||
ARG @nbfaces:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
ARG @type:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
||||||
USES ax,bx,cx,dx,si,di
|
USES ax,bx,cx,dx,si,di
|
||||||
mov di,[@faces]
|
mov di,[@faces]
|
||||||
mov si,[@vertex2d]
|
mov si,[@vertex2d]
|
||||||
|
@ -73,7 +73,7 @@ PROC draw3d_line FAR
|
||||||
inc di
|
inc di
|
||||||
inc di
|
inc di
|
||||||
@@draw:
|
@@draw:
|
||||||
mov ax,[@nbfaces]
|
mov ax,[@type]
|
||||||
dec al
|
dec al
|
||||||
mov dx,di
|
mov dx,di
|
||||||
@@drawset:
|
@@drawset:
|
||||||
|
@ -111,7 +111,7 @@ endp draw3d_line
|
||||||
|
|
||||||
;affiche liste vertex %0
|
;affiche liste vertex %0
|
||||||
PROC draw3d_hidden FAR
|
PROC draw3d_hidden FAR
|
||||||
ARG @nbfaces:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
ARG @type:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
||||||
LOCAL @@a1:word,@@a2:word,@@b1:word
|
LOCAL @@a1:word,@@a2:word,@@b1:word
|
||||||
USES ax,bx,cx,dx,si,di
|
USES ax,bx,cx,dx,si,di
|
||||||
mov di,[@faces]
|
mov di,[@faces]
|
||||||
|
@ -162,14 +162,14 @@ PROC draw3d_hidden FAR
|
||||||
sub ecx,eax
|
sub ecx,eax
|
||||||
pop cx
|
pop cx
|
||||||
jge @@nohidden
|
jge @@nohidden
|
||||||
mov ax,[@nbfaces]
|
mov ax,[@type]
|
||||||
shl ax,1
|
shl ax,1
|
||||||
add di,ax
|
add di,ax
|
||||||
dec cx
|
dec cx
|
||||||
jnz @@draw
|
jnz @@draw
|
||||||
jmp @@endof
|
jmp @@endof
|
||||||
@@nohidden:
|
@@nohidden:
|
||||||
mov ax,[@nbfaces]
|
mov ax,[@type]
|
||||||
dec al
|
dec al
|
||||||
mov dx,di
|
mov dx,di
|
||||||
@@drawset:
|
@@drawset:
|
||||||
|
@ -208,7 +208,7 @@ endp draw3d_hidden
|
||||||
|
|
||||||
;creer table pour face caché %0
|
;creer table pour face caché %0
|
||||||
PROC draw3d_hidden_fill FAR
|
PROC draw3d_hidden_fill FAR
|
||||||
ARG @nbfaces:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
ARG @type:word,@faces:word,@vertex3d:word,@vertex2d:word,@camera:word,@color:word
|
||||||
USES eax,bx,ecx,edx,si,di
|
USES eax,bx,ecx,edx,si,di
|
||||||
LOCAL @@a1:word,@@a2:word,@@b1:word
|
LOCAL @@a1:word,@@a2:word,@@b1:word
|
||||||
mov di,[@faces]
|
mov di,[@faces]
|
||||||
|
@ -254,7 +254,7 @@ PROC draw3d_hidden_fill FAR
|
||||||
sub ecx,eax
|
sub ecx,eax
|
||||||
pop cx
|
pop cx
|
||||||
jl @@hidden
|
jl @@hidden
|
||||||
mov ax,[@nbfaces]
|
mov ax,[@type]
|
||||||
mov si,[@vertex3d]
|
mov si,[@vertex3d]
|
||||||
inc si
|
inc si
|
||||||
inc si
|
inc si
|
||||||
|
@ -270,7 +270,7 @@ PROC draw3d_hidden_fill FAR
|
||||||
dec al
|
dec al
|
||||||
jnz @@calcz
|
jnz @@calcz
|
||||||
@@hidden:
|
@@hidden:
|
||||||
mov ax,[@nbfaces]
|
mov ax,[@type]
|
||||||
shl ax,1
|
shl ax,1
|
||||||
add di,ax
|
add di,ax
|
||||||
@@enofvalue:
|
@@enofvalue:
|
||||||
|
@ -281,120 +281,139 @@ endp draw3d_hidden_fill
|
||||||
|
|
||||||
|
|
||||||
;charge un fichier 3ds logé en %0 renvoie error
|
;charge un fichier 3ds logé en %0 renvoie error
|
||||||
|
;sauvegarde en :
|
||||||
|
;- %1 le nom de l'objet
|
||||||
|
;- %2 les vertex 3D de l'objet
|
||||||
|
;- %3 la matrice de transformation de l'objet
|
||||||
|
;- %4 les faces de l'objet
|
||||||
|
;- %5 le type de face de l'objet
|
||||||
;1 non 3ds
|
;1 non 3ds
|
||||||
;2 non 3 et >
|
;2 non 3 et >
|
||||||
;PROC load3ds FAR
|
PROC load3ds FAR
|
||||||
;ARG @pointer:word
|
ARG @seg:word,@add:word,@objectname:word,@vertex:word,@matrix:word,@face:word
|
||||||
;USES eax,bx,cx,si,di
|
USES eax,bx,cx,si,di,ds,es,fs
|
||||||
;
|
push ds
|
||||||
;mov si,[@pointer]
|
pop fs
|
||||||
;cmp [word ptr si],main
|
mov si,[@add]
|
||||||
;jne @@error1
|
mov ds,[@seg]
|
||||||
;cmp [word ptr si+28],3
|
cmp [word ptr si],main
|
||||||
;jb @@error2
|
jne @@error1
|
||||||
;@@reading:
|
cmp [word ptr si+28],3
|
||||||
;mov ax,[si]
|
jb @@error2
|
||||||
;mov bx,[si+2]
|
@@reading:
|
||||||
;cmp ax,main
|
mov ax,[si]
|
||||||
;je @@enter
|
mov bx,[si+2]
|
||||||
;cmp ax,edit
|
cmp ax,main
|
||||||
;je @@enter
|
je @@enter
|
||||||
;cmp ax,mesh
|
cmp ax,edit
|
||||||
;je @@enter
|
je @@enter
|
||||||
;cmp ax,object
|
cmp ax,mesh
|
||||||
;je @@readobject
|
je @@enter
|
||||||
;cmp ax,vertex
|
cmp ax,object
|
||||||
;je @@readvertex
|
je @@readobject
|
||||||
;cmp ax,locale
|
cmp ax,vertex
|
||||||
;je @@readmatrix
|
je @@readvertex
|
||||||
;cmp ax,face
|
cmp ax,locale
|
||||||
;je @@readfaces
|
je @@readmatrix
|
||||||
;@@next:
|
cmp ax,face
|
||||||
;add si,bx
|
je @@readfaces
|
||||||
;jmp @@reading
|
@@next:
|
||||||
;@@enter:
|
add si,bx
|
||||||
;add si,6
|
jmp @@reading
|
||||||
;jmp @@reading
|
@@enter:
|
||||||
;@@readobject:
|
add si,6
|
||||||
;add si,6
|
jmp @@reading
|
||||||
;mov di,si
|
@@readobject:
|
||||||
;mov al,0
|
add si,6
|
||||||
;cld
|
mov di,si
|
||||||
;repne scasb
|
mov al,0
|
||||||
;mov cx,di
|
mov es,[@seg]
|
||||||
;sub cx,si
|
mov cx,12
|
||||||
;mov di,offset objectnamep
|
cld
|
||||||
;rep movsb
|
repne scasb
|
||||||
;jmp @@reading
|
mov cx,di
|
||||||
;@@readvertex:
|
sub cx,si
|
||||||
;add si,6
|
mov di,[@objectname]
|
||||||
;mov ax,[si]
|
push fs
|
||||||
;mov vertexnbp,ax
|
pop es
|
||||||
;inc si
|
cld
|
||||||
;inc si
|
rep movsb
|
||||||
;mov cx,ax
|
jmp @@reading
|
||||||
;shl ax,1
|
@@readvertex:
|
||||||
;add cx,ax
|
add si,6
|
||||||
;mov di,offset vertexp
|
mov ax,[si]
|
||||||
;cld
|
mov di,[@vertex]
|
||||||
;rep movsd
|
mov [fs:di],ax
|
||||||
;jmp @@reading
|
inc si
|
||||||
;@@readmatrix:
|
inc si
|
||||||
;add si,6
|
mov cx,ax
|
||||||
;mov di,offset matrixp
|
shl ax,1
|
||||||
;mov eax,[si]
|
add cx,ax
|
||||||
;mov [(mat di).p1],eax
|
add di,2
|
||||||
;mov eax,[si+4*1]
|
cld
|
||||||
;mov [(mat di).p5],eax
|
push fs
|
||||||
;mov eax,[si+4*2]
|
pop es
|
||||||
;mov [(mat di).p9],eax
|
cld
|
||||||
;mov eax,[si+4*3]
|
rep movsd
|
||||||
;mov [(mat di).p2],eax
|
jmp @@reading
|
||||||
;mov eax,[si+4*4]
|
@@readmatrix:
|
||||||
;mov [(mat di).p6],eax
|
add si,6
|
||||||
;mov eax,[si+4*5]
|
mov di,[@matrix]
|
||||||
;mov [(mat di).p10],eax
|
mov eax,[si]
|
||||||
;mov eax,[si+4*6]
|
mov [fs:(mat di).p1],eax
|
||||||
;mov [(mat di).p3],eax
|
mov eax,[si+4*1]
|
||||||
;mov eax,[si+4*7]
|
mov [fs:(mat di).p5],eax
|
||||||
;mov [(mat di).p7],eax
|
mov eax,[si+4*2]
|
||||||
;mov eax,[si+4*8]
|
mov [fs:(mat di).p9],eax
|
||||||
;mov [(mat di).p11],eax
|
mov eax,[si+4*3]
|
||||||
;mov eax,[si+4*9]
|
mov [fs:(mat di).p2],eax
|
||||||
;mov [(mat di).p4],eax
|
mov eax,[si+4*4]
|
||||||
;mov eax,[si+4*10]
|
mov [fs:(mat di).p6],eax
|
||||||
;mov [(mat di).p8],eax
|
mov eax,[si+4*5]
|
||||||
;mov eax,[si+4*11]
|
mov [fs:(mat di).p10],eax
|
||||||
;mov [(mat di).p12],eax
|
mov eax,[si+4*6]
|
||||||
;mov eax,[cs:un]
|
mov [fs:(mat di).p3],eax
|
||||||
;mov [(mat di).p16],eax
|
mov eax,[si+4*7]
|
||||||
;mov eax,0
|
mov [fs:(mat di).p7],eax
|
||||||
;mov [(mat di).p13],eax
|
mov eax,[si+4*8]
|
||||||
;mov [(mat di).p14],eax
|
mov [fs:(mat di).p11],eax
|
||||||
;mov [(mat di).p15],eax
|
mov eax,[si+4*9]
|
||||||
;add si,12*4
|
mov [fs:(mat di).p4],eax
|
||||||
;jmp @@reading
|
mov eax,[si+4*10]
|
||||||
;@@readfaces:
|
mov [fs:(mat di).p8],eax
|
||||||
;add si,6
|
mov eax,[si+4*11]
|
||||||
;mov ax,[si]
|
mov [fs:(mat di).p12],eax
|
||||||
;mov facenbp,ax
|
mov eax,[cs:un]
|
||||||
;inc si
|
mov [fs:(mat di).p16],eax
|
||||||
;inc si
|
mov eax,0
|
||||||
;mov di,offset facep
|
mov [fs:(mat di).p13],eax
|
||||||
;cld
|
mov [fs:(mat di).p14],eax
|
||||||
;@@readall:
|
mov [fs:(mat di).p15],eax
|
||||||
;mov cx,3
|
add si,12*4
|
||||||
;rep movsw
|
jmp @@reading
|
||||||
;inc si
|
@@readfaces:
|
||||||
;inc si
|
add si,6
|
||||||
;dec ax
|
mov ax,[si]
|
||||||
;jnz @@readall
|
mov di,[@face]
|
||||||
|
mov [fs:di],ax
|
||||||
|
inc si
|
||||||
|
inc si
|
||||||
|
add di,2
|
||||||
|
push fs
|
||||||
|
pop es
|
||||||
|
cld
|
||||||
|
@@readall:
|
||||||
|
mov cx,3
|
||||||
|
rep movsw
|
||||||
|
inc si
|
||||||
|
inc si
|
||||||
|
dec ax
|
||||||
|
jnz @@readall
|
||||||
;;jmp @@reading
|
;;jmp @@reading
|
||||||
;
|
@@error1:
|
||||||
;@@error1:
|
@@error2:
|
||||||
;@@error2:
|
ret
|
||||||
;ret
|
endp load3ds
|
||||||
;endp load3ds
|
|
||||||
|
|
||||||
un dd 1.0
|
un dd 1.0
|
||||||
zero dd 0.0
|
zero dd 0.0
|
||||||
|
|
Loading…
Reference in New Issue