Subversion Repositories Kolibri OS

Rev

Rev 8909 | Rev 8925 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8909 Rev 8919
Line 46... Line 46...
46
 
46
 
47
struct ModelList{
47
struct ModelList{
48
	char* name;
48
	char* name;
49
	long int color, t_cr;
49
	long int color, t_cr;
-
 
50
	float x,y,z, r_x,r_y,r_z;
50
	float x,y,z, r_x,r_y,r_z;
51
	unsigned long level;
51
	long int level, id_l;
52
	long int id_l;
Line 52... Line 53...
52
};
53
};
53
 
54
 
Line 71... Line 72...
71
float mat_shininess = 3.0; //Размер блика (обратная пропорция)
72
float mat_shininess = 3.0; //Размер блика (обратная пропорция)
72
float white_light[] = {1.0, 1.0, 1.0, 1.0}; //Цвет и интенсивность освещения, генерируемого источником
73
float white_light[] = {1.0, 1.0, 1.0, 1.0}; //Цвет и интенсивность освещения, генерируемого источником
73
float lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; //Параметры фонового освещения
74
float lmodel_ambient[] = {0.3, 0.3, 0.3, 1.0}; //Параметры фонового освещения
Line 74... Line 75...
74
 
75
 
75
char str1[] = "Show active level";
76
char str1[] = "Show active level";
76
check_box check1 = { {16,280,20,4}, 8, 0xffffff, 0x808080, 0xffffff, str1, ch_flag_middle };
77
check_box check1 = { {16,310,20,4}, 8, 0xffffff, 0x808080, 0xffffff, str1, ch_flag_middle };
Line 77... Line 78...
77
scrollbar sb_tcr = { 200,70,19,4, 16, 1, 20,1,0, 0x808080, 0xffffff, 0x0};
78
scrollbar sb_tcr = { 200,100,19,4, 16, 1, 20,1,0, 0x808080, 0xffffff, 0x0};
78
 
79
 
79
void SetLight()
80
void SetLight()
80
{
81
{
Line 193... Line 194...
193
 
194
 
194
bool init_block(){
195
bool init_block(){
195
	FileInfoBlock* file;
196
	FileInfoBlock* file;
Line -... Line 197...
-
 
197
	unsigned long int k;
-
 
198
 
-
 
199
	k = strlen(CurrentDirectoryPath);
-
 
200
	while(CurrentDirectoryPath[k] != '\\' && CurrentDirectoryPath[k] != '/' && k) {k--;};
-
 
201
	memcpy(library_path,CurrentDirectoryPath,k);
196
	unsigned long int k;
202
	strcpy(library_path+k,"block.bin");
197
 
203
 
198
	file = FileOpen("block.bin");
204
	file = FileOpen(library_path);
199
	if (!file){
205
	if (!file){
200
		//SetWindowCaption("Error open file 'block.bin'");
206
		MessageBox("Error open file 'block.bin', file not found");
201
		return false;
207
		return false;
202
	}
208
	}
203
	k = FileGetLength(file);
209
	k = FileGetLength(file);
Line 216... Line 222...
216
				delete b_data;
222
				delete b_data;
217
				b_data = f_data;
223
				b_data = f_data;
218
				f_data = 0;
224
				f_data = 0;
219
			}
225
			}
220
		}
226
		}
-
 
227
		FileClose(file);
-
 
228
	} 
-
 
229
	else {
-
 
230
		MessageBox("Error open file 'block.bin', file length == 0");
-
 
231
		FileClose(file);
-
 
232
		return false;
221
	}
233
	}
222
	FileClose(file);
-
 
223
	
234
 
224
	if (b_data){
235
	if (b_data){
225
		unsigned long i=0, n=0;
236
		unsigned long i=0, n=0;
226
		b_count=0;
237
		b_count=0;
227
		while((long&)b_data[i] && i
238
		while((long&)b_data[i] && i
228
			while(b_data[i]){ i++; };
239
			while(b_data[i]){ i++; };
Line 243... Line 254...
243
			b_list[n].norm_d = (float*)(b_data+i);
254
			b_list[n].norm_d = (float*)(b_data+i);
244
			i += b_list[n].p_cou*12;
255
			i += b_list[n].p_cou*12;
245
			compile_list(&b_list[n]);
256
			compile_list(&b_list[n]);
246
			n++;
257
			n++;
247
		};
258
		};
248
	}	
259
	}
-
 
260
	else {
-
 
261
		MessageBox("Error open file 'block.bin', can't unpack file");
-
 
262
	}
249
	return (bool)b_data;
263
	return (bool)b_data;
250
}
264
}
Line 251... Line 265...
251
 
265
 
252
bool init_model()
266
bool init_model()
Line 468... Line 482...
468
	kosglSwapBuffers();
482
	kosglSwapBuffers();
Line 469... Line 483...
469
 
483
 
470
	// If button have ID 1, this is close button
484
	// If button have ID 1, this is close button
471
	DrawButton(2,0xf0f0f0, 10,4,50,19);
485
	DrawButton(2,0xf0f0f0, 10,4,50,19);
-
 
486
	DrawText(20,10,0,"Open");
472
	DrawText(20,10,0,"Open");
487
	DrawRect(70,7, 24,18, 0x333333);
473
	DrawText(10,TOOLBAR_H+3,(1<<24)|0xffffff,DoubleToStr(sb_tcr.position,0,true));
488
	DrawText(70,7,(1<<24)|0xffffff,DoubleToStr(sb_tcr.position,0,true));
474
	sb_tcr.all_redraw=1;
489
	sb_tcr.all_redraw=1;
475
	scrollbar_h_draw(&sb_tcr);
490
	scrollbar_h_draw(&sb_tcr);
476
	check_box_draw(&check1);
491
	check_box_draw(&check1);
Line 565... Line 580...
565
		draw_3d();
580
		draw_3d();
566
		kosglSwapBuffers();
581
		kosglSwapBuffers();
567
	}
582
	}
568
}
583
}
Line 569... Line 584...
569
 
584
 
570
void KolibriOnSize(int window_rect[], TThreadData /*th*/)
585
void KolibriOnSize(int [], TThreadData /*th*/)
571
{
586
{
572
	unsigned short int width, height;
587
	unsigned short int width, height;
573
	GetClientSize(width, height);
588
	GetClientSize(width, height);
574
	if(!width || !height) return;
589
	if(!width || !height) return;