bool liquid_reflection_maps_create_process(int nliq,char *err_str) { int n,txt_idx; char base_path[1024],dir_path[1024], map_name[256],str[256]; // base path file_paths_data_default(&file_path_setup,base_path,"Bitmaps/Textures",NULL,NULL); // create folders if they don't exist sprintf(dir_path,"%s/ReflectionMaps",base_path); os_create_directory(dir_path); light_map_texture_map_folder_name(map_name); sprintf(dir_path,"%s/ReflectionMaps/%s",base_path,map_name); os_create_directory(dir_path); // clear the textures and // start mesh-poly and/or liquid setup progress_next_title("Liquid Reflection Map: Setup"); map_delete_texture(&map,liquid_reflection_texture_start_idx,(liquid_reflection_texture_start_idx+max_liquid_reflection_map_textures)); liquid_reflection_map_setup(); liquid_reflection_map_bitmap_pixel_start(); // create a ray traced light map // for all the polys txt_idx=liquid_reflection_texture_start_idx; for (n=0;n!=map.liquid.nliquid;n++) { sprintf(str,"Liquid Reflection Map: Rendering Liquid %d/%d",(n+1),nliq); progress_next_title(str); if (!liquid_reflection_map_run_for_liquid(txt_idx,n,base_path,map_name,err_str)) { liquid_reflection_map_bitmap_pixel_free(); return(FALSE); } txt_idx++; } // free textures and polys progress_next_title("Liquid Reflection Map: Finishing"); liquid_reflection_map_bitmap_pixel_free(); main_wind_draw(); return(TRUE); }
bool create_course_script(char *file_name) { int sz; char *data,path[1024]; FILE *file; struct stat sb; // read the file file_paths_app(&file_path_setup,path,"Contents/Resources/Defaults","Course","js"); if (stat(path,&sb)!=0) return(FALSE); sz=sb.st_size; file=fopen(path,"r"); if (file==NULL) return(FALSE); data=(char*)malloc(sz); if (data==NULL) { fclose(file); return(FALSE); } fread(data,1,sz,file); fclose(file); // write the file file_paths_data_default(&file_path_setup,path,"Scripts/Courses",file_name,"js"); file=fopen(path,"w"); if (file==NULL) { free(data); return(FALSE); } fwrite(data,1,sz,file); fclose(file); return(TRUE); }
void model_auto_generate_textures(void) { char base_path[1024],dir_path[1024]; os_set_wait_cursor(); // texture directory file_paths_data_default(&file_path_setup,base_path,"Models",NULL,NULL); strcat(base_path,"/"); strcat(base_path,state.model.model_file_name); sprintf(dir_path,"%s/Textures",base_path); // run bitmap generation for model auto_generate_model_create_texture_set(&model,dir_path); os_set_arrow_cursor(); main_wind_draw(); }
void texture_copy(char *path,char *name,char *sub_name) { char *c,dest_name[256],srce_path[1024],dest_path[1024], sub_path[1024]; strcpy(srce_path,path); if (sub_name!=NULL) { c=strrchr(srce_path,'.'); if (c==NULL) return; *c=0x0; strcat(srce_path,sub_name); strcat(srce_path,".png"); } strcpy(dest_name,name); if (sub_name!=NULL) strcat(dest_name,sub_name); sprintf(sub_path,"Models/%s/Textures",model.name); file_paths_data_default(&file_path_setup,dest_path,sub_path,dest_name,"png"); bitmap_copy(srce_path,dest_path); }
bool map_new(map_type *map,char *name) { // info strcpy(map->info.name,name); map->info.title[0]=0x0; map->info.author[0]=0x0; file_paths_data_default(&maputility_settings.file_path_setup,map->info.load_path,"Maps",map->info.name,"xml"); // settings map->settings.gravity=1; map->settings.gravity_max_power=32; map->settings.gravity_max_speed=400; map->settings.resistance=1; map->settings.txt_scale_x=0.04f; map->settings.txt_scale_y=0.04f; map->settings.editor_link_always_start=FALSE; map->settings.network_game_list[0]=0x0; // media map->media.type=mi_none; map->media.name[0]=0x0; map->media.title_sound_name[0]=0x0; // music map->music.fade_msec=0; map->music.name[0]=0x0; // ambients map->ambient.light_color.r=map->ambient.light_color.g=map->ambient.light_color.b=0.0f; map->ambient.sound_name[0]=0x0; map->ambient.sound_pitch=1.0f; // rain map->rain.on=FALSE; map->rain.density=200; map->rain.radius=40000; map->rain.height=15000; map->rain.speed=35; map->rain.line_length=1500; map->rain.line_width=1; map->rain.slant_add=20; map->rain.slant_time_msec=8000; map->rain.slant_change_msec=1000; map->rain.alpha=0.3f; map->rain.start_color.r=map->rain.start_color.g=map->rain.start_color.b=1.0f; map->rain.end_color.r=map->rain.end_color.g=0.2f; map->rain.end_color.b=1.0f; // background map->background.on=FALSE; map->background.fill=-1; map->background.x_scroll_fact=0; map->background.y_scroll_fact=0; // sky map->sky.on=FALSE; map->sky.type=st_cube; map->sky.fill=-1; map->sky.bottom_fill=-1; map->sky.north_fill=-1; map->sky.south_fill=-1; map->sky.east_fill=-1; map->sky.west_fill=-1; map->sky.radius=300*map_enlarge; map->sky.dome_y=0; map->sky.dome_mirror=FALSE; map->sky.txt_fact=1; map->sky.txt_x_shift=0; map->sky.txt_y_shift=0; // fog map->fog.on=FALSE; map->fog.count=30; map->fog.outer_radius=1000*map_enlarge; map->fog.inner_radius=500*map_enlarge; map->fog.high=150*map_enlarge; map->fog.drop=50*map_enlarge; map->fog.texture_idx=0; map->fog.speed=0.001f; map->fog.txt_x_fact=8.0f; map->fog.txt_y_fact=1.0f; map->fog.col.r=0.5; map->fog.col.g=0.5; map->fog.col.b=0.5; map->fog.alpha=0.05f; map->fog.use_solid_color=TRUE; // pieces map->nspot=0; map->nnode=0; map->nscenery=0; map->nmovement=0; map->nlight=0; map->nsound=0; map->nparticle=0; map->ngroup=0; map->narea=0; // meshes and liquids map->mesh.nmesh=0; map->mesh.meshes=NULL; map->liquid.nliquid=0; map->liquid.liquids=NULL; // memory map->textures=(texture_type*)malloc(max_map_texture*sizeof(texture_type)); if (map->textures==NULL) return(FALSE); map->spots=(spot_type*)malloc(max_spot*sizeof(spot_type)); if (map->spots==NULL) return(FALSE); map->nodes=(node_type*)malloc(max_node*sizeof(node_type)); if (map->nodes==NULL) return(FALSE); map->sceneries=(map_scenery_type*)malloc(max_map_scenery*sizeof(map_scenery_type)); if (map->sceneries==NULL) return(FALSE); map->movements=(movement_type*)malloc(max_movement*sizeof(movement_type)); if (map->movements==NULL) return(FALSE); map->lights=(map_light_type*)malloc(max_map_light*sizeof(map_light_type)); if (map->lights==NULL) return(FALSE); map->sounds=(map_sound_type*)malloc(max_map_sound*sizeof(map_sound_type)); if (map->sounds==NULL) return(FALSE); map->particles=(map_particle_type*)malloc(max_map_particle*sizeof(map_particle_type)); if (map->particles==NULL) return(FALSE); map->groups=(group_type*)malloc(max_group*sizeof(group_type)); if (map->groups==NULL) return(FALSE); map->areas=(map_area_type*)malloc(max_area*sizeof(map_area_type)); if (map->areas==NULL) return(FALSE); // zero memory bzero(map->textures,(max_map_texture*sizeof(texture_type))); bzero(map->spots,(max_spot*sizeof(spot_type))); bzero(map->nodes,(max_node*sizeof(node_type))); bzero(map->sceneries,(max_map_scenery*sizeof(map_scenery_type))); bzero(map->movements,(max_movement*sizeof(movement_type))); bzero(map->lights,(max_map_light*sizeof(map_light_type))); bzero(map->sounds,(max_map_sound*sizeof(map_sound_type))); bzero(map->particles,(max_map_particle*sizeof(map_particle_type))); bzero(map->groups,(max_group*sizeof(group_type))); bzero(map->areas,(max_area*sizeof(map_area_type))); // bitmaps map_textures_new(map); return(TRUE); }
bool model_file_new(void) { char file_name[256],err_str[256], base_path[1024],path[1024]; // close model state.model.texture_edit_idx=-1; if (!model_file_close()) return(FALSE); // get name strcpy(file_name,"NewModel"); if (!dialog_new_model_run(file_name)) { model_file_reset_state(); return(FALSE); } // create model os_set_wait_cursor(); model_new(&model,file_name); model.nmesh=1; strcpy(model.meshes[0].name,"Default"); model.view_box.size.x=model.view_box.size.y=model.view_box.size.z=100; os_select_window(); os_set_wait_cursor(); // create new folders file_paths_data_default(&file_path_setup,base_path,"Models",NULL,NULL); strcat(base_path,"/"); strcat(base_path,file_name); os_create_directory(base_path); sprintf(path,"%s/Textures",base_path); os_create_directory(path); // write the XML if (!model_save(&model,err_str)) { os_set_arrow_cursor(); os_dialog_alert("dim3 Animator could not save model.",err_str); model_file_reset_state(); return(FALSE); } os_set_arrow_cursor(); // finish state.model.model_open=TRUE; strcpy(state.model.model_file_name,file_name); model_file_reset_state(); return(TRUE); }