Subversion Repositories Kolibri OS

Rev

Rev 1819 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1819 Rev 1931
Line 1... Line 1...
1
; application : View3ds ver. 0.055 - tiny .3ds files viewer.
1
; application : View3ds ver. 0.057 - tiny .3ds files viewer.
2
; compiler    : FASM
2
; compiler    : FASM
3
; system      : KolibriOS
3
; system      : KolibriOS
4
; author      : Macgub aka Maciej Guba
4
; author      : Macgub aka Maciej Guba
5
; email       : macgub3@wp.pl
5
; email       : macgub3@wp.pl
6
; web         : www.macgub.hekko.pl
6
; web         : www.macgub.hekko.pl
Line 79... Line 79...
79
				    ;  to be in <-1.0,1.0>
79
				    ;  to be in <-1.0,1.0>
80
	call   normalize_all_light_vectors
80
	call   normalize_all_light_vectors
81
	call   init_triangles_normals2
81
	call   init_triangles_normals2
82
	call   init_point_normals
82
	call   init_point_normals
83
   ;    call   init_envmap2
83
	call   init_envmap2
84
	call   init_envmap_cub
84
	call   init_envmap_cub
85
	call   generate_texture2
85
	call   generate_texture2
86
	call   init_sincos_tab
86
	call   init_sincos_tab
87
 
87
 
Line 88... Line 88...
88
	call   do_color_buffer	 ; intit color_map
88
	call   do_color_buffer	 ; intit color_map
Line 139... Line 139...
139
	cmp	ah,3		      ; ah = 3 -> shading model
139
	cmp	ah,3		      ; ah = 3 -> shading model
140
	jne	.next_m6
140
	jne	.next_m6
141
	cmp	[dr_flag],2
141
	cmp	[dr_flag],2
142
	jne	@f
142
	jne	@f
143
	call	init_envmap2
143
   ;     call    init_envmap2    ;   <----! this don't works in env mode
144
 ;       call    init_envmap_cub2
144
				 ;          and more than ~18 kb objects
-
 
145
 ;       call    init_envmap_cub2
145
     @@:
146
     @@:
146
	cmp	[dr_flag],4
147
	cmp	[dr_flag],4
147
	jne	@f
148
	jne	@f
148
	call	generate_texture2
149
	call	generate_texture2
149
 
150
 
Line 172... Line 173...
172
	jne	.next_m5				;    'grd '  1
173
	jne	.next_m5				;    'grd '  1
173
	call	make_random_lights			;    'env '  2
174
	call	make_random_lights			;    'env '  2
174
	call	normalize_all_light_vectors		;    'bump'  3
175
	call	normalize_all_light_vectors		;    'bump'  3
175
	call	do_color_buffer   ; intit color_map     ;    'tex '  4
176
	call	do_color_buffer   ; intit color_map     ;    'tex '  4
176
	cmp	[emboss_flag],1 			;    'pos '  5
177
      ;  cmp     [emboss_flag],1                         ;    'pos '  5
177
	je	@f					;    'dots'  6
178
      ;  je      @f                                      ;    'dots'  6
178
	cmp	[dr_flag],8
179
      ;  cmp     [dr_flag],8
179
	jge	@f
180
      ;  jge     @f
180
	cmp	[dr_flag],2				;    'txgr'  7
181
      ;  cmp     [dr_flag],2                             ;    'txgr'  7
181
	jl	.next_m5			    ;    '2tex'  8
182
      ;  jl      .next_m5                            ;    '2tex'  8
182
	cmp	[dr_flag],3				;    'btex'  9
183
      ;  cmp     [dr_flag],3                             ;    'btex'  9
183
	jg	.next_m5
184
      ;  jg      .next_m5
184
     @@:
185
    ; @@:
185
	call	init_envmap2	; update env map if shading model = environment or bump
186
	call	init_envmap2	; update env map if shading model = environment or bump
186
    .next_m5:
187
    .next_m5:
187
	cmp	 ah,11
188
	cmp	 ah,11
188
	je	 @f
189
	je	 @f
189
	cmp	 ah,12
190
	cmp	 ah,12
190
	je	 @f
191
	je	 @f
Line 374... Line 375...
374
 
375
 
Line 375... Line 376...
375
	mov	esi,angle_x
376
	mov	esi,angle_x
376
	mov	edi,matrix
377
	mov	edi,matrix
377
	call	make_rotation_matrix
378
	call	make_rotation_matrix
378
;    RDTSC
379
    RDTSC
379
;    push eax
380
    push eax
380
	mov	esi,[points_normals_ptr]
381
	mov	esi,[points_normals_ptr]
381
	mov	edi,[points_normals_rot_ptr]
382
	mov	edi,[points_normals_rot_ptr]
382
	mov	ebx,matrix
383
	mov	ebx,matrix
383
	movzx	ecx,[points_count_var]
384
	movzx	ecx,[points_count_var]
384
	call	rotary
385
	call	rotary
Line 423... Line 424...
423
	je	.non_f
424
	je	.non_f
424
      @@:
425
      @@:
425
	call	fill_Z_buffer	  ; make background
426
	call	fill_Z_buffer	  ; make background
426
     .non_f:
427
     .non_f:
427
    RDTSC
428
;    RDTSC
428
    push eax
429
;    push eax
429
	cmp	[dr_flag],6
430
	cmp	[dr_flag],6
430
	jne	@f
431
	jne	@f
431
	call	 draw_dots
432
	call	 draw_dots
432
	jmp	 .blurrr
433
	jmp	 .blurrr
433
      @@:
434
      @@:
434
	call	draw_triangles	; draw all triangles from the list
435
	call	draw_triangles	; draw all triangles from the list
Line 797... Line 798...
797
	 mov	 esp,ebp
798
	 mov	 esp,ebp
798
	 pop	 ebp
799
	 pop	 ebp
799
ret
800
ret
Line -... Line 801...
-
 
801
 
-
 
802
 
800
 
803
 
801
do_color_buffer:	 ; do color buffer for Gouraud, flat shading
804
do_color_buffer:	 ; do color buffer for Gouraud, flat shading
802
;env_map 512 x 512 x 3 bytes    ; many lights using
805
;env_map 512 x 512 x 3 bytes    ; many lights using
803
.temp  equ word   [ebp-2]
806
.temp  equ word   [ebp-2]
804
.nz    equ dword  [ebp-6]  ; dword
807
.nz    equ dword  [ebp-6]  ; dword