View3ds 0.068: Editing option - new 'editor' button [by macgub]

git-svn-id: svn://kolibrios.org@6769 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-11-30 10:24:07 +00:00
parent 3d2f646747
commit c83f800bbe
9 changed files with 1060 additions and 530 deletions

View File

@ -28,6 +28,137 @@ make_vector:
ret
end if
reverse_mx_3x3:
; esi - source matrix
; edi - desired reversed matrix
push ebp
mov ebp,esp
sub esp,4
.det equ ebp-4
fninit
fld dword[esi]
fmul dword[esi+16]
fmul dword[esi+32]
fld dword[esi+12]
fmul dword[esi+28]
fmul dword[esi+8]
faddp
fld dword[esi+24]
fmul dword[esi+4]
fmul dword[esi+20]
faddp
fld dword[esi]
fmul dword[esi+28]
fmul dword[esi+20]
fchs
faddp
fld dword[esi+24]
fmul dword[esi+16]
fmul dword[esi+8]
fchs
faddp
fld dword[esi+12]
fmul dword[esi+4]
fmul dword[esi+32]
fchs
faddp
fstp dword[.det]
cmp dword[.det],0
jne @f
int3
@@:
; fld1
; fdiv dword[.det]
; fstp dword[.det]
fld dword[esi+16]
fmul dword[esi+32]
fld dword[esi+20]
fmul dword[esi+28]
fchs
faddp
fdiv dword[.det]
fstp dword[edi]
fld dword[esi+8]
fmul dword[esi+28]
fld dword[esi+4]
fmul dword[esi+32]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+4]
fld dword[esi+4]
fmul dword[esi+20]
fld dword[esi+8]
fmul dword[esi+16]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+8]
fld dword[esi+20]
fmul dword[esi+24]
fld dword[esi+12]
fmul dword[esi+32]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+12]
fld dword[esi]
fmul dword[esi+32]
fld dword[esi+8]
fmul dword[esi+24]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+16]
fld dword[esi+8]
fmul dword[esi+12]
fld dword[esi]
fmul dword[esi+20]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+20]
fld dword[esi+12]
fmul dword[esi+28]
fld dword[esi+16]
fmul dword[esi+24]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+24]
fld dword[esi+4]
fmul dword[esi+24]
fld dword[esi]
fmul dword[esi+28]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+28]
fld dword[esi]
fmul dword[esi+16]
fld dword[esi+4]
fmul dword[esi+12]
fchs
faddp
fdiv dword[.det]
fstp dword[edi+32]
mov esp,ebp
pop ebp
ret
make_vector_r:
fninit
fld dword[edi] ;edi+x3d
@ -211,7 +342,7 @@ make_rotation_matrix:
faddp
fstp dword[edi+24]
fld .siny
fld .cosy
fmul .sinz
fstp dword[edi+4]
@ -377,6 +508,7 @@ ret
translate_points: ; just convert into integer; z coord still needed
fninit
.again:
if 0
fld dword[esi+8]
; fmul [rsscale]
fist word[edi+4]
@ -403,7 +535,19 @@ translate_points: ; just convert into integer; z coord still needed
fiadd [yobs]
fiadd [vect_y]
fistp word[edi+2]
end if
; movups xmm0,[esi]
; cvtps2dq xmm0,xmm0
; packsdw xmm0,xmm0
; movq [edi]
fld dword[esi]
fiadd [vect_x]
fistp word[edi]
fld dword[esi+4]
fiadd [vect_y]
fistp word[edi+2]
fld dword[esi+8]
fistp word[edi+4]
add esi,12
add edi,6
dec ecx

View File

@ -176,9 +176,9 @@ if Ext >= SSE2
punpcklbw xmm3,xmm0
punpcklbw xmm4,xmm0
psubsw xmm1,xmm2
paddw xmm1,[.bias]
paddw xmm1,[emboss_bias]
psubsw xmm3,xmm4
paddw xmm3,[.bias]
paddw xmm3,[emboss_bias]
pmulhw xmm1,xmm3
movaps xmm7,xmm1
movaps xmm6,xmm1
@ -228,9 +228,9 @@ end if
end if
ret
align 16
.bias:
dw 128, 128, 128, 128, 128, 128, 128, 128
;align 16
; emboss_bias:
; dw 128, 128, 128, 128, 128, 128, 128, 128
if 0 ; old emb proc

View File

@ -11,7 +11,7 @@
tex_y_div2 dw TEX_Y / 2
xobs dw 0 ;SIZE_X / 2 ;200 ;observer = camera
yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates
zobs dw -500
zobs dw -1000
; size_x dw SIZE_X
; size_y dw SIZE_Y
@ -38,8 +38,32 @@
XYZpartices:
db 'X','Y','Z'
i10 dw 10
draw_win_at_first db 1
offset_y:
i25 dw 25 ; screen buff offset
offset_x:
i5 dw 5
triangles_ptr dd 0
triangles_w_z_ptr dd 0
triangles_normals_ptr dd 0
points_normals_ptr dd 0
points_normals_rot_ptr dd 0
points_ptr dd 0
points_rotated_ptr dd 0
points_translated_ptr dd 0
screen_ptr dd 0
Zbuffer_ptr dd 0
vertices_index_ptr dd 0
; draw_win_at_first db 1
vertex_edit_no dw 0
edit_start_x:
dw 0
edit_start_y dw 0
edit_end_x:
dw 0
edit_end_y dw 0
mouse_state dd 0
menu:
db 2 ; button number = index
db 'rotary ' ; label
@ -179,6 +203,12 @@ dec_bright_flag db 0 ;1
sinus_flag db 0
dd onoff_f
db 25
db 'editor '
db 2
edit_flag db 0
dd onoff_f
; db 24
; db 'max '
; db 2
@ -314,7 +344,7 @@ base_vector:
if Ext=SSE2
db ' (SSE2)'
end if
db ' 0.067',0
db ' 0.068',0
labellen:
STRdata db '-1 '
@ -343,7 +373,7 @@ else
db '/rd/1/teapot.3ds',0
end if
I_END:
;I_END:
rb 256
@ -390,7 +420,11 @@ lights:
;===============================================
lightsend:
align 16
emboss_bias:
dw 128, 128, 128, 128, 128, 128, 128, 128
I_END:
if USE_LFN = 0
hash_table rb 4096
SourceFile:
@ -425,16 +459,20 @@ align 8
;==
triangles_count_var dw ?
points_count_var dw ?
triangles_ptr dd ?
triangles_w_z_ptr dd ?
triangles_normals_ptr dd ?
points_normals_ptr dd ?
points_normals_rot_ptr dd ?
points_ptr dd ?
points_rotated_ptr dd ?
points_translated_ptr dd ?
screen_ptr dd ?
Zbuffer_ptr dd ?
; triangles_ptr dd ?
; triangles_w_z_ptr dd ?
; triangles_normals_ptr dd ?
; points_normals_ptr dd ?
; points_normals_rot_ptr dd ?
; points_ptr dd ?
; points_rotated_ptr dd ?
; points_translated_ptr dd ?
; screen_ptr dd ?
; Zbuffer_ptr dd ?
; vertices_index_ptr dd ?
; edit_start_x:
dw ? ; don't change order
; edit_start_y dw ?
; edges_ptr dd ?
size_y_var:
dw ?
@ -535,4 +573,4 @@ end if
I_Param rb 256
memStack rb 4000 ;memory area for stack
align 16
screen:
screen:

View File

@ -77,7 +77,7 @@ end if
macro .draw_pixel
{
mov [esi],ebx ; actualize Z buffer
if Ext=SSE2
if Ext>=SSE2
movaps xmm7,xmm1 ;[.cb] ;;xmm1
shufps xmm7,xmm7,00111001b
psrld xmm7,ROUND
@ -136,8 +136,10 @@ end if
jne .end_line
movzx edx,word [size_x_var]
mov [.xres],edx
dec edx
movzx ecx,word [size_y_var]
mov [.yres],ecx
dec ecx
cmp word[.x1],dx ;SIZE_X
jg .end_line
cmp word[.x2],dx ;SIZE_X
@ -209,7 +211,7 @@ end if
call .calc_delta
movzx eax,word [size_x_var] ;SIZE_X
mov eax,[.xres] ;SIZE_X
movsx ebx,word[.y1]
mul ebx
add esi,eax
@ -275,7 +277,7 @@ end if
call .calc_delta
movzx eax,word[size_x_var] ;SIZE_X
mov eax,[.xres] ;SIZE_X
movsx ebx,word[.y1]
mul ebx
add esi,eax

View File

@ -1,5 +1,8 @@
View3ds 0.067 - XI 2016
1. Sizable app window.
-----------------------------------------------------------------------------------
View 3ds 0,066 - X 2016
View3ds 0,066 - X 2016
1. App window size according to current screen resolution.
2. New emboss procedure.
-----------------------------------------------------------------------------------

View File

@ -1,26 +1,26 @@
View3ds 0.067 - tiny viewer to .3ds and .asc files with several graphics
View3ds 0.068 - tiny viewer to .3ds and .asc files with several graphics
effects implementation.
What's new?
1. Sizable app window.
1. Editing option - new 'editor' button.
2. For now I disable perspective correction, to make implemtation of editing option easier.
Buttons description:
1. rotary: choosing rotary axle: x, y, x+y.
2. shd. model: choosing shading model: flat, grd (smooth), env (spherical
environment mapping, bump (bump mapping), tex (texture mapping),
pos (position shading depend), dots (app draws only points - nodes of object),
txgrd (texture mapping + smooth shading), 2tex (texture mapping + spherical
environment mapping), bmap (bump + texture mapping), cenv (cubic environment
mapping), grdl (Gouraud lines - edges only).
3. speed: idle, full.
1. rotary: choosing rotary axle: x, y, x+y.
2. shd. model: choosing shading model: flat, grd (smooth), env (spherical
environment mapping, bump (bump mapping), tex (texture mapping),
pos (position shading depend), dots (app draws only points - nodes of object),
txgrd (texture mapping + smooth shading), 2tex (texture mapping + spherical
environment mapping), bmap (bump + texture mapping), cenv (cubic environment
mapping), grdl (Gouraud lines - edges only).
3. speed: idle, full.
4,5. zoom in, out: no comment.
6. catmull: on -> use z buffer ( z coordinate interpolation), off -> depth sorting, painters
alghoritm).Txgrd, 2tex and bumptex models only with catmull = on.
7. culling: backface culling on/ off.
8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination).
9. Blur: blur N times; N=0,1,2,3,4,5
6. catmull: on -> use z buffer ( z coordinate interpolation), off -> depth sorting, painters
alghoritm).Txgrd, 2tex and bumptex models only with catmull = on.
7. culling: backface culling on/ off.
8. rand. light: Randomize 3 unlinear lights( so called Phong's illumination).
9. Blur: blur N times; N=0,1,2,3,4,5
10.11,12,13. loseless operations (rotary 90, 180 degrees).
12. emboss: Do emboss effect( flat bumps ), use 'bumps deep' button to do edges more deep.
13. fire: do motion blur ( looks like fire ).
@ -34,5 +34,9 @@ Buttons description:
19. bright + -> increase picture brightness.
20. bright - -> decrease picture brightness.
21. wav effect -> do effect based sine function.
22. editor -> setting editing option. If is "on" then red bars are draw according to each vertex, Pressing
and moving left mouse button (cursor must be on handler)- change vertex position. If left mouse button
is released apply current position. You may also decrease whole handlers count by enable culling (using
appropriate button) - some back handlers become hidden.
Maciej Guba XI 2016

View File

@ -788,7 +788,9 @@ two_tex_line_z:
mov ecx,.y
or ecx,ecx
jl .bl_end
cmp cx,word[size_y_var] ;SIZE_Y
mov dx,word[size_y_var]
dec dx
cmp cx,dx ;word[size_y_var] ;SIZE_Y
jge .bl_end
cmp eax,ebx
@ -827,6 +829,7 @@ end if
push eax ebx ;store x1, x2
mov ebx,.x1
movzx edx,word[size_x_var]
dec edx
cmp ebx,edx
; cmp bx,word[size_x_var] ;SIZE_X
jg .bl_end
@ -836,7 +839,7 @@ end if
mov ebx,.x2
sub ebx,.x1
if Ext>=SSE
if Ext >= SSE
sub esp,16
cvtsi2ss xmm3,ebx ;rcps

File diff suppressed because it is too large Load Diff

View File

@ -337,12 +337,9 @@ proc get_font_size, color:dword ; x86 calling convention uses eax ecx edx
ret
endp
CODE_END: ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;
; ---------------------------------------------------------------------------- ;
;---------------------------------------------------------------------
;--- „€<E2809E><E282AC><20><>Žƒ<C5BD>€ŒŒ ----------------------------------------------
;---------------------------------------------------------------------
proc_info rd 1024
DATA_END: ; ¬¥âª  ª®­æ  ¤ ­­ëå ¯à®£à ¬¬ë; ---------------------------------------------------------------------------- ;