Subversion Repositories Kolibri OS

Rev

Rev 1776 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1245 hidnplayr 1
; DATA AREA  ************************************
2
 
3
	i3		dw	3
4
	i256		dw	256
5
	i255d		dd	255
6
	dot_max 	dd	1.0	 ; dot product max and min
7
	dot_min 	dd	0.0
8
	env_const	dd	1.05
9
	correct_tex	dw	255
10
	tex_x_div2	dw	TEX_X  / 2
11
	tex_y_div2	dw	TEX_Y  / 2
12
	xobs		dw	0 ;SIZE_X / 2 ;200 ;observer  = camera
13
	yobs		dw	0 ;SIZE_Y / 2 ;200 ;coordinates
14
	zobs		dw	-500
15
	size_x		dw	SIZE_X
16
	size_y		dw	SIZE_Y
17
 
1776 yogev_ezra 18
	re_alloc_flag db 0
1245 hidnplayr 19
	angle_counter dw 0
20
	piD180	      dd 0.017453292519943295769236907684886
21
	piD128	      dd 0.024544
22
	const6	      dw 6,6,6,6
23
	x_offset      dw SIZE_X / 2
24
	y_offset      dw SIZE_Y / 2
25
	z_offset      dw 0
26
	rsscale       dd 175.0		 ; next real scale
27
	vect_x	      dw SIZE_X / 2
28
	vect_y	      dw SIZE_Y / 2
29
	vect_z	      dw 0
30
	angle_x       dw 0
31
	angle_y       dw 0
32
	angle_z       dw 0
33
 
34
 
35
	menu:
36
	       db 2		   ; button number  = index
37
	       db 'rotary    '	   ; label
38
	       db 3		   ; max flag  + 1 , if = 255, no flag
39
 r_flag        db 1		   ; flag
40
	       dd axl_f 	   ; offset to flags description
41
 
42
	       db 3
43
	       db 'shd. model'
44
	       db 11
45
 dr_flag       db 0
46
	       dd shd_f
47
 
48
	       db 4
49
	       db 'speed     '
50
	       db 2
51
 speed_flag    db 0
52
	       dd spd_f
53
 
54
	       db 5
55
	       db 'zoom out  '
56
	       db 255
57
	       db ?
58
	       dd ?
59
 
60
	       db 6
61
	       db 'zoom in   '
62
	       db 255
63
	       db ?
64
	       dd ?
65
 
66
	       db 7
67
	       db 'catmull   '
68
	       db 2
69
catmull_flag   db 1
70
	       dd onoff_f
71
 
72
	       db 8
73
	       db 'culling   '
74
	       db 2
75
culling_flag   db 1
76
	       dd onoff_f
77
 
78
	       db 9
79
	       db 'rand.light'
80
	       db 255
81
	       db ?
82
	       dd ?
83
 
84
	       db 10
85
	       db 'blur      '
86
	       db 6
87
blur_flag      db 0
88
	       dd blur_f
89
 
90
	       db 11
91
	       db 'mirror x  '
92
	       db 2
93
mirr_x_flag    db 0
94
	       dd onoff_f
95
 
96
	       db 12
97
	       db 'mirror y  '
98
	       db 2
99
mirr_y_flag    db 0
100
	       dd onoff_f
101
 
102
	       db 13
103
	       db 'mirror z  '
104
	       db 2
105
mirr_z_flag    db 0
106
	       dd onoff_f
107
 
108
	       db 14
109
	       db 'xchg      '
110
	       db 4
111
xchg_flag      db 0
112
	       dd xchg_f
113
 
114
	       db 15
115
	       db 'emboss    '
116
	       db 2
117
emboss_flag    db 0
118
	       dd onoff_f
119
 
120
	       db 16
121
	       db 'fire      '
122
	       db 3
123
fire_flag      db 0
124
	       dd blur_f
125
 
126
	       db 17
127
	       db 'move      '
128
	       db 2
129
move_flag      db 0
130
	       dd move_f
131
 
132
		  db 18
133
		  db 'generate  '
134
		  db 6
135
generator_flag	  db 0
136
		  dd blur_f
137
 
138
		  db 19
139
		  db 'bumps     '
140
		  db 2
141
bumps_flag	  db 0
142
		  dd bumps_f
143
 
144
		  db 20
145
		  db 'bumps deep'
146
		  db 4
147
bumps_deep_flag   db 3
148
		  dd bumps_d_f
149
 
1776 yogev_ezra 150
		  db 21
151
		  db 're-map tex'
152
		  db 255
153
map_tex_flag	  db ? ;1
154
		  dd ?	;bumps_d_f
1245 hidnplayr 155
;                  db 21
156
;                  db 'light No. '
157
;                  db 3
158
;light_no_flag     db 0
159
;                  dd bumps_d_f
160
 
161
;                db 22
162
;                db 'light comp'
163
;                db 3
164
;light_comp_flag db 0
165
;                dd light_component_f
166
 
167
;;                db 23
168
;;                db 'col. comp'
169
;;                db 3
170
;;color_comp_flag db 0
171
;;                dd color_component_f
172
 
173
 
174
	       db -1	   ; end mark
175
 
176
 
177
flags:		   ; flags description
178
 shd_f:
179
    db 'flat'
180
    db 'grd '
181
    db 'env '
182
    db 'bump'
183
    db 'tex '
184
    db 'pos '
185
    db 'dots'
186
    db 'txgr'
187
    db '2tex'
188
    db 'btex'
189
    db 'cenv'
190
 spd_f:
191
    db 'idle'
192
    db 'full'
193
 axl_f:
194
    db ' y  '
195
    db 'x+y '
196
    db ' x  '
197
 onoff_f:
198
    db 'off '
199
    db 'on  '
200
; light_component_f:
201
;    db 'norm '                ; diffuse   |
202
;    db 'min'                  ; specular  |  or sth. like this
203
;    db 'max '                 ; emmisive  |
204
 
205
;; color_component_f:
206
;;    db ' r  '
207
;;    db ' g  '
208
;;    db ' b  '
209
 
210
	  blur_f:	       ; blur, fire
211
	    db 'off '
212
bumps_d_f:  db ' 1  '
213
	    db ' 2  '
214
	    db ' 3  '
215
	    db ' 4  '
216
	    db ' 5  '
217
 
218
 xchg_f:
219
    db 'no  '
220
    db 'x<>y'
221
    db 'z<>x'
222
    db 'y<>z'
223
 move_f:
224
    db 'obj '
225
    db 'camr'
226
;    db 'lght'
227
 bumps_f:
228
    db 'rand'
229
    db 'tex '
230
;    db 'cscl'
231
base_vector:
232
    labelvector:
233
	db   'add vector'
234
    labelvectorend:
235
    labelyminus:
236
	db   'y -'
237
    labelyminusend:
238
    labelzplus:
239
	db   'z +'
240
    labelzplusend:
241
    labelxminus:
242
	db   'x -'
243
    labelxminusend:
244
    labelxplus:
245
	db   'x +'
246
    labelxplusend:
247
    labelzminus:
248
	db   'z -'
249
    labelzminusend:
250
    labelyplus:
251
	db   'y +'
252
    labelyplusend:
253
 
254
;navigation_size = $ - labelvector
255
;        db   'set color '
256
;        db   'r -'
257
;        db   'g +'
258
;        db   'b -'
259
;        db   'b +'
260
;        db   'g -'
261
;        db   'r +'
262
 
263
    labelt:
264
	db   'DEUS CARITAS EST'
265
      if Ext=MMX
266
	db   ' (MMX)'
267
      end if
268
      if Ext=SSE
269
	db   ' (SSE)'
270
      end if
1776 yogev_ezra 271
	db   ' 0.054'
1245 hidnplayr 272
    labellen:
273
	STRdata db '-1        '
274
 
275
    all_lights_size dw lightsend-lights
276
 
277
if USE_LFN
278
 
279
	file_info:
280
		dd	0
281
		dd	0
282
		dd	0
283
	 fsize	dd	0 ;180000 ; sizeof(workarea)
284
	 fptr	dd	0 ;workarea
285
	file_name:
1776 yogev_ezra 286
		db	'/rd/1/3d/house.3ds',0
1245 hidnplayr 287
 
288
else
289
 
290
	file_info:
291
		dd 0
292
		dd 0
293
	 fsize	dd 1
294
		dd workarea
295
		dd hash_table
296
	file_name:
1776 yogev_ezra 297
		db   '/rd/1/house.3ds',0
1245 hidnplayr 298
end if
299
 
300
I_END:
301
 
302
      rb 256
303
 
304
;=============================================
305
lights:
306
     .light_vector	  dd	  0.0,0.0,-1.0	 ; x,y,z  Z cooficient of vector must be negative
307
     .orginal_color_r	  db	  1		 ;  +12
308
     .orginal_color_g	  db	  255		   ;
309
     .orginal_color_b	  db	  1		 ;  +14
310
     .min_color_r	  db	  1		 ;
311
     .min_color_g	  db	  1		 ;  +16
312
     .min_color_b	  db	  1		 ;
313
     .max_color_r	  db	  255		 ;
314
     .max_color_g	  db	  255		 ;
315
     .max_color_b	  db	  255		 ;
316
     .shine		  db	  24		 ;  +21
317
 ;    LIGHT_SIZE equ ($-lights)
318
 
319
	dd	-0.5,-0.5,-1.0	 ; x,y,z ;  .light_vector
320
	db	5		 ; .orginal_color_r
321
	db	1		 ; .orginal_color_g
322
	db	135		 ; .orginal_color_b
323
	db	19		 ; .min_color_r
324
	db	19		 ; .min_color_g
325
	db	19		 ; .min_color_b
326
	db	255		 ; .max_color_r
327
	db	255		 ; .max_color_g
328
	db	255		 ; .max_color_b
329
	db	16		 ; .shine
330
 
331
	dd	0.5,0.5,-1.0	; x,y,z ;  .light_vector
332
	db	135		; .orginal_color_r
333
	db	1		; .orginal_color_g
334
	db	1		; .orginal_color_b
335
	db	19		; .min_color_r
336
	db	19		; .min_color_g
337
	db	19		; .min_color_b
338
	db	255		; .max_color_r
339
	db	255		; .max_color_g
340
	db	20		; .max_color_b
341
	db	16		; .shine
342
;        ALL_LIGHTS_SIZE equ ($ - lights)
343
;#all_lights_size dw ($ - lights) ;ALL_LIGHTS_SIZE
344
;===============================================
345
 
346
lightsend:
347
 
348
if USE_LFN = 0
349
hash_table rb 4096
350
SourceFile:
351
workarea   rb 180000
352
else
353
SourceFile:
354
workarea   rb 180
355
end if
356
EndFile   dd ?
357
align 8
358
	sinbeta dd	?;+32
359
	cosbeta dd	?
360
 
361
	xsub	dw	?
362
	zsub	dw	?;+40
363
	ysub	dw	?
364
 
365
	xx1	dw	?
366
	yy1	dw	?
367
	zz1	dw	?;+48    xx1 + 4
368
	xx2	dw	?
369
	yy2	dw	?
370
	zz2	dw	?      ; xx1 + 10
371
	xx3	dw	?;+56
372
	yy3	dw	?
373
	zz3	dw	?      ; xx1 + 16
374
	scale	dd	?		  ; help scale variable
375
   ;==
376
	triangles_count_var	dw ?
377
	points_count_var	dw ?
378
	triangles_ptr		dd ?
379
	triangles_w_z_ptr	dd ?
380
	triangles_normals_ptr	dd ?
381
	points_normals_ptr	dd ?
382
	points_normals_rot_ptr	dd ?
383
	points_ptr		dd ?
384
	points_rotated_ptr	dd ?
385
	points_translated_ptr	dd ?
386
	screen_ptr		dd ?
387
	Zbuffer_ptr		dd ?
388
 
389
   ;===
390
 
391
	point_index1	    dw ?   ;-\
392
	point_index2	    dw ?   ;  }  don't change order
393
	point_index3	    dw ?   ;-/
394
	temp_col	    dw ?
395
	high		    dd ?
396
	rand_seed	    dw ?
397
align 8
398
	buffer	dq	?
1777 yogev_ezra 399
	err_	dd	?
1245 hidnplayr 400
	drr	dd	?
401
	xx	dd	?
402
	yy	dd	?
403
	xst	dd	?
404
	yst	dd	?
405
;        screen_ptr      dd     ?
406
;        Zbuffer_ptr     dd     ?
407
 
408
	matrix	rb 36
409
	cos_tab rd 360
410
	sin_tab rd 360
411
 
412
align 16
413
 
414
if USE_LFN = 0
415
     points:
416
	rw (EndFile-SourceFile)/12*3
417
	points_count = ($-points)/6
418
     triangles:
419
	rw  (EndFile-SourceFile)/12*3
420
	triangles_count = ($-triangles)/6
421
align 16
422
	real_points rd points_count*3 + 1
423
align 16
424
	rotated_points_r rd points_count*3 + 1
425
align 16
426
	points_rotated rw points_count*3 + 2 ;means translated
427
align 16
428
	triangles_normals rb triangles_count * 12 ;
429
align 16
430
	point_normals rb points_count * 12  ;one 3dvector - triple float dword x,y,z
431
align 16
432
	point_normals_rotated rb points_count * 12
433
align 16
434
	triangles_normals_rotated rb triangles_count * 12
435
 
436
else
437
    points_count = 180000/6*3
438
    triangles_count = 180000 / 6  ;($-triangles)/6
439
end if
440
align 16
441
	label trizdd dword
442
	label trizdq qword
443
	triangles_with_z rw triangles_count*4 + 2 ; triangles triple dw + z position
444
align 16
445
	vectors rb 24
446
;align 16
447
;        points_color rb 6*points_count    ; each color as word
448
;        sorted_triangles rw triangles_count*3 + 2
449
align 16
450
	bumpmap 	rb	TEXTURE_SIZE + 1
451
align 16
452
	bumpmap2	rb	TEXTURE_SIZE + 1
453
align 16
454
	envmap		rb	(TEXTURE_SIZE +1) * 3
455
align 16
456
	envmap_cub	rb	TEX_X * 3
457
align 16
458
	texmap		rb	(TEXTURE_SIZE +1) * 3
459
align 16
460
	color_map	rb	(TEXTURE_SIZE +1) * 3
461
align 16
462
	tex_points	rb	points_count * 4  ; bump_map  and texture coords
463
				; each point word x, word y
464
align 16
465
  ;      SourceFile:             ; source file temporally in screen area
466
  ;      workarea        dd      ?
467
 
468
    ;    screen          rb      SIZE_X * SIZE_Y * 3   ; screen buffer
469
;align 16
470
     ;   Z_buffer        rb      SIZE_X * SIZE_Y * 4
471
	I_Param 	rb	256
472
	memStack	rb	4000 ;memory area for stack
473
align  16
474
screen: