Subversion Repositories Kolibri OS

Rev

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

Rev 1728 Rev 1776
Line 1... Line 1...
1
; application : View3ds ver. 0.053 - tiny .3ds files viewer.
1
; application : View3ds ver. 0.054 - tiny .3ds files viewer.
2
; compiler    : FASM  1.65.13
2
; compiler    : FASM  1.67.11
3
; system      : KolibriOS/MenuetOS
3
; system      : KolibriOS/MenuetOS
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.menuet.xt.pl
6
; web         : www.menuet.xt.pl
7
; Fell free to use this intro in your own distribution of KolibriOS/MenuetOS.
7
; Fell free to use this intro in your own distribution of KolibriOS/MenuetOS.
Line 213... Line 213...
213
;        call     draw_window             ; redraw other labels to navigation buttons
213
;        call     draw_window             ; redraw other labels to navigation buttons
214
     .next_m:
214
     .next_m:
215
	cmp	 ah,18
215
	cmp	 ah,18
216
	jne	 .next_m2
216
	jne	 .next_m2
217
	mov	 bl,[generator_flag]
217
     if USE_LFN
-
 
218
	mov	 [re_alloc_flag],1	 ; reallocate memory
-
 
219
	mov	 [triangles_count_var],1000
-
 
220
	mov	 [points_count_var],1000
-
 
221
	call	 alloc_mem_for_tp
-
 
222
	mov	 [re_alloc_flag],0
-
 
223
     end if
-
 
224
	mov	 bl,[generator_flag]
218
	or	 bl,bl
225
	or	 bl,bl
219
	jz	 .next_m2
226
	jz	 .next_m2
220
	cmp	 bl,1
227
	cmp	 bl,1
221
	jne	 @f
228
	jne	 @f
222
	call	 generate_object
229
	call	 generate_object
Line 243... Line 250...
243
     @@:
250
     @@:
244
	mov	 edi,bumpmap
251
	mov	 edi,bumpmap
245
	call	 calc_bumpmap
252
	call	 calc_bumpmap
246
      .next_m3:
253
     .next_m3:
247
 
254
	cmp	ah,21		 ; re map bumps, texture coordinates
-
 
255
	jne	@f
248
	jmp	noclose
256
	call	calc_bumpmap_coords
-
 
257
      @@:
-
 
258
	jmp	noclose
249
 
259
 
Line 250... Line 260...
250
 
260
 
251
			       ; there are 6 navigation buttons each
261
			       ; there are 6 navigation buttons each
Line 593... Line 603...
593
 
603
 
Line 594... Line 604...
594
;      mov   ebp,esp
604
;      mov   ebp,esp
595
;      sub   esp,4
605
;      sub   esp,4
Line 596... Line 606...
596
 
606
 
597
      fninit			 ; spherical mapping around y axle
607
      fninit
598
      fldpi
608
      fldpi
599
      fadd	st,st
-
 
600
;      fstp      .Pi2
609
      fadd	st,st
601
      mov	esi,[points_ptr]
610
      mov	esi,[points_ptr]
602
      mov	edi,tex_points
611
      mov	edi,tex_points
603
      movzx	ecx,[points_count_var]
612
      movzx	ecx,[points_count_var]
-
 
613
      inc	ecx
-
 
614
;      cmp       [map_tex_flag],1
-
 
615
;      jne       .cylindric
Line 604... Line 616...
604
      inc	ecx
616
      ; spherical mapping around y axle
605
 
617
 
606
   @@:
618
   @@:
607
      fld	dword[esi]     ; x coord
619
      fld	dword[esi]     ; x coord
Line 633... Line 645...
633
      add      esi,12
645
      add      esi,12
634
      add      edi,4
646
      add      edi,4
635
      loop     @b
647
      loop     @b
636
      ffree    st0
648
      ffree    st0
-
 
649
;      jmp      .end_map
-
 
650
;  .cylindric:
-
 
651
;       fld     dword[esi]     ; around y axle
-
 
652
;       fld     dword[esi+8]
-
 
653
;       fpatan
-
 
654
;       fdiv    st0,st1
-
 
655
;       fimul   [tex_x_div2]
-
 
656
;       fiadd   [tex_x_div2]
-
 
657
;       fistp   word[edi]
Line -... Line 658...
-
 
658
 
-
 
659
;       fld     dword[esi+4]
-
 
660
;       fimul   [tex_y_div2]
-
 
661
;       fiadd   [tex_y_div2]
-
 
662
;       fistp   word[edi+2]
-
 
663
 
-
 
664
;       add     esi,12
-
 
665
;       add     edi,4
-
 
666
;       loop    .cylindric
637
 
667
;       ffree    st0
-
 
668
;;      mov      esp,ebp
638
;      mov      esp,ebp
669
;   .end_map:
Line 639... Line 670...
639
ret
670
ret
640
 
671
 
Line 2397... Line 2428...
2397
 
2428
 
Line 2398... Line 2429...
2398
if USE_LFN
2429
if USE_LFN
2399
alloc_mem_for_tp:
2430
alloc_mem_for_tp:
2400
	mov	eax, 68
2431
	mov	eax, 68
-
 
2432
	cmp	[re_alloc_flag],1
-
 
2433
	jz	@f
2401
	mov	ebx, 12
2434
	mov	ebx, 12
-
 
2435
	jmp	.alloc
-
 
2436
    @@:
-
 
2437
	mov	ebx,20
-
 
2438
    .alloc:
2402
	movzx	ecx, [triangles_count_var]
2439
	movzx	ecx, [triangles_count_var]
2403
	inc	ecx
2440
	inc	ecx
2404
	lea	ecx, [ecx*3]
2441
	lea	ecx, [ecx*3]
2405
	add	ecx, ecx
2442
	add	ecx, ecx
-
 
2443
	mov	edx,[triangles_ptr]
2406
	int	0x40		       ;  -> allocate memory to triangles
2444
	int	0x40		       ;  -> allocate memory to triangles
2407
	mov	[triangles_ptr], eax   ;  -> eax = pointer to allocated mem
2445
	mov	[triangles_ptr], eax   ;  -> eax = pointer to allocated mem
Line 2408... Line 2446...
2408
 
2446
 
2409
;        mov     eax, 68
2447
;        mov     eax, 68
Line 2417... Line 2455...
2417
	mov	eax, 68
2455
	mov	eax, 68
2418
	movzx	ecx, [triangles_count_var]
2456
	movzx	ecx, [triangles_count_var]
2419
	lea	ecx, [3+ecx*3]
2457
	lea	ecx, [3+ecx*3]
2420
	shl	ecx, 2
2458
	shl	ecx, 2
-
 
2459
	mov	edx,[triangles_normals_ptr]
2421
	int	0x40			       ;  -> allocate memory for triangles normals
2460
	int	0x40			       ;  -> allocate memory for triangles normals
2422
	mov	[triangles_normals_ptr], eax   ;  -> eax = pointer to allocated mem
2461
	mov	[triangles_normals_ptr], eax   ;  -> eax = pointer to allocated mem
Line 2423... Line 2462...
2423
 
2462
 
2424
	mov	eax, 68
2463
	mov	eax, 68
2425
	movzx	ecx, [points_count_var]
2464
	movzx	ecx, [points_count_var]
2426
	lea	ecx,[3+ecx*3]
2465
	lea	ecx,[3+ecx*3]
-
 
2466
	shl	ecx, 2
2427
	shl	ecx, 2
2467
	mov	edx,[points_normals_ptr]
2428
	int	0x40
2468
	int	0x40
Line 2429... Line 2469...
2429
	mov	[points_normals_ptr], eax
2469
	mov	[points_normals_ptr], eax
2430
 
2470
 
2431
	mov	eax, 68
2471
	mov	eax, 68
2432
	mov	ebx, 12
2472
    ;    mov     ebx, 12
2433
	movzx	ecx, [points_count_var]
2473
	movzx	ecx, [points_count_var]
-
 
2474
	lea	ecx,[3+ecx*3]
2434
	lea	ecx,[3+ecx*3]
2475
	shl	ecx, 2
2435
	shl	ecx, 2
2476
	mov	edx,[points_normals_rot_ptr]
Line 2436... Line 2477...
2436
	int	0x40
2477
	int	0x40
-
 
2478
	mov	[points_normals_rot_ptr], eax
2437
	mov	[points_normals_rot_ptr], eax
2479
 
2438
 
2480
	mov	eax, 68
Line 2439... Line 2481...
2439
	mov	eax, 68
2481
	mov	edx,[points_ptr]
-
 
2482
	int	0x40
2440
	int	0x40
2483
	mov	[points_ptr], eax
2441
	mov	[points_ptr], eax
2484
 
Line 2442... Line 2485...
2442
 
2485
	mov	eax, 68
2443
	mov	eax, 68
2486
	mov	edx,[points_rotated_ptr]
2444
	int	0x40
2487
	int	0x40
2445
	mov	[points_rotated_ptr], eax
2488
	mov	[points_rotated_ptr], eax
-
 
2489
 
2446
 
2490
	mov	eax, 68
2447
	mov	eax, 68
2491
	movzx	ecx, [points_count_var]
2448
	movzx	ecx, [points_count_var]
2492
	inc	ecx
2449
	inc	ecx
2493
	shl	ecx, 3
Line 2590... Line 2634...
2590
	mov	bx,[size_x]
2634
	mov	bx,[size_x]
2591
	add	bx,110
2635
	add	bx,110
2592
	mov	cx,[size_y]
2636
	mov	cx,[size_y]
2593
	add	cx,30
2637
	add	cx,30
2594
	mov	edx,0x02000000	; color of work area RRGGBB,8->color gl
2638
	mov	edx,0x14000000	; color of work area RRGGBB,8->color gl
2595
	mov	esi,0x805080d0	; color of grab bar  RRGGBB,8->color gl
2639
	mov	esi,0x805080d0	; color of grab bar  RRGGBB,8->color gl
2596
	mov	edi,0x005080d0	; color of frames    RRGGBB
2640
	mov	edi,0x005080d0	; color of frames    RRGGBB
2597
	int	0x40
2641
	int	0x40
2598
 
2642
 
Line 2599... Line 2643...
2599
	; WINDOW LABEL
2643
	; WINDOW LABEL
Line 2604... Line 2648...
2604
	mov	esi,labellen-labelt	; text length
2648
	mov	esi,labellen-labelt	; text length
2605
	int	0x40
2649
	int	0x40
2606
 
2650
 
Line 2607... Line 2651...
2607
	; CLOSE BUTTON
2651
	; CLOSE BUTTON
2608
	mov	eax,8		; function 8 : define and draw button
2652
;       mov     eax,8           ; function 8 : define and draw button
2609
	movzx	ebx,[size_x]
2653
;       movzx   ebx,[size_x]
2610
	shl	ebx,16
2654
;       shl     ebx,16
2611
	add	ebx, 91 shl 16 + 12
2655
;       add     ebx, 91 shl 16 + 12
2612
;        mov     ebx,(SIZE_X+80+30-19)*65536+12     ; [x start] *65536 + [x size]
2656
;;        mov     ebx,(SIZE_X+80+30-19)*65536+12     ; [x start] *65536 + [x size]
2613
	mov	ecx,5*65536+12	; [y start] *65536 + [y size]
2657
;       mov     ecx,5*65536+12  ; [y start] *65536 + [y size]
2614
	mov	edx,1		; button id
2658
;       mov     edx,1           ; button id
2615
	mov	esi,0x6688dd	; button color RRGGBB
2659
;       mov     esi,0x6688dd    ; button color RRGGBB
2616
	int	0x40
2660
;       int     0x40
Line 2617... Line 2661...
2617
 
2661
 
Line 2618... Line 2662...
2618
	call	buttons 	; more buttons
2662
	call	buttons 	; more buttons