コード例 #1
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_mesh_invert_normals(bool poly_only)
{
	int				n,k,sel_count,type,mesh_idx,poly_idx;
	map_mesh_type	*mesh;
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
			// invert the poly
			
		mesh=&map.mesh.meshes[mesh_idx];
		
		if (poly_only) {
			piece_mesh_poly_invert_normals(&mesh->polys[poly_idx]);
		}
		else {
			for (k=0;k!=mesh->npoly;k++) {
				piece_mesh_poly_invert_normals(&mesh->polys[k]);
			}
		}
	}
	
	main_wind_draw();
}
コード例 #2
0
ファイル: palette_node.c プロジェクト: prophile/dim3
void palette_node_save(void)
{
    int						type,main_idx,poly_idx;
    node_type				*node;

    // get node

    select_get(0,&type,&main_idx,&poly_idx);
    node=&map.nodes[main_idx];

    // set controls

    dialog_get_text(palette_node_wind,kNodeName,0,node->name,name_str_len);
    node->event_id=dialog_get_int(palette_node_wind,kNodeEventID,0);
    node->ang.x=dialog_get_float(palette_node_wind,kNodeAngleX,0);
    node->ang.y=dialog_get_float(palette_node_wind,kNodeAngleY,0);
    node->ang.z=dialog_get_float(palette_node_wind,kNodeAngleZ,0);
    node->follow_camera=dialog_get_boolean(palette_node_wind,kNodeFollowCamera,0);

    // need to reset node combo

    main_wind_tool_fill_node_combo();

    main_wind_draw();
}
コード例 #3
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_move(int move_x,int move_y,int move_z)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	d3pnt			mov_pnt;
	
	map_undo_push();
	
	sel_count=select_count();
	
	mov_pnt.x=move_x;
	mov_pnt.y=move_y;
	mov_pnt.z=move_z;
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type==item_map_mesh) {
			if (!map.mesh.meshes[mesh_idx].flag.lock_move) {
				map_mesh_move(&map,mesh_idx,&mov_pnt);
				view_force_grid(mesh_idx,TRUE);
				view_vbo_mesh_rebuild(mesh_idx);
			}
		}
	}
	
	main_wind_draw();
}
コード例 #4
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_tesselate(bool mesh)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	
	map_undo_push();
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type==item_map_mesh) {
			if (mesh) {
				map_mesh_tesselate(&map,mesh_idx);
			}
			else {
				map_mesh_poly_tesselate(&map,mesh_idx,poly_idx);
			}
			view_vbo_mesh_rebuild(mesh_idx);
		}
	}

	select_clear();
	
	main_wind_draw();
}
コード例 #5
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_select_more(void)
{
	int					n,t,t2,sel_count,type,mesh_idx,poly_idx;
	d3pnt				*pt1,*pt2;
	map_mesh_type		*mesh;
	map_mesh_poly_type	*poly;

		// select more polygons
		
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
	
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
		mesh=&map.mesh.meshes[mesh_idx];
		poly=&mesh->polys[poly_idx];
		
		for (t=0;t!=poly->ptsz;t++) {
			t2=t+1;
			if (t2==poly->ptsz) t2=0;
			
			pt1=&mesh->vertexes[poly->v[t]];
			pt2=&mesh->vertexes[poly->v[t2]];
			
			piece_select_more_check_edge(pt1,pt2);
		}
	}
	
	main_wind_draw();
}
コード例 #6
0
ファイル: map_nodes.c プロジェクト: rzel/dim3
int node_link_is_node_link_selected(void)
{
	int			type,main_idx,sub_idx;
	
	if (select_count()!=1) return(-1);
	
	select_get(0,&type,&main_idx,&sub_idx);
	if (type!=item_map_node) return(-1);
	
	return(main_idx);
}
コード例 #7
0
ファイル: texture_palette.c プロジェクト: prophile/dim3
int texture_palette_get_selected_texture(void)
{
	int				type,main_idx,poly_idx;
	
	if (select_count()!=1) return(-1);
	
	select_get(0,&type,&main_idx,&poly_idx);
	
	if (type==liquid_piece) return(map.liquid.liquids[main_idx].txt_idx);
	if (type==mesh_piece) return(map.mesh.meshes[main_idx].polys[poly_idx].txt_idx);
	
	return(-1);
}
コード例 #8
0
ファイル: palette_polygon.c プロジェクト: prophile/dim3
void palette_polygon_load(void)
{
	int						type,main_idx,poly_idx;
	float					x_txtoff,y_txtoff,x_txtfact,y_txtfact;
	map_mesh_type			*mesh;
	map_mesh_poly_type		*poly;
	map_liquid_type			*liq;
	
		// get polygon
		
	select_get(0,&type,&main_idx,&poly_idx);
	
	if (type==mesh_piece) {
		mesh=&map.mesh.meshes[main_idx];
		poly=&mesh->polys[poly_idx];

		map_mesh_get_poly_uv_as_box(&map,main_idx,poly_idx,&x_txtoff,&y_txtoff,&x_txtfact,&y_txtfact);
		
		dialog_set_float(palette_poly_wind,kMeshPolySettingOffX,0,x_txtoff);
		dialog_set_float(palette_poly_wind,kMeshPolySettingOffY,0,y_txtoff);
		dialog_set_float(palette_poly_wind,kMeshPolySettingSizeX,0,x_txtfact);
		dialog_set_float(palette_poly_wind,kMeshPolySettingSizeY,0,y_txtfact);
		
		dialog_set_float(palette_poly_wind,kMeshPolySettingAlpha,0,poly->alpha);
		dialog_set_float(palette_poly_wind,kMeshPolySettingDark,0,poly->dark_factor);
		dialog_set_float(palette_poly_wind,kMeshPolySettingShiftX,0,poly->x_shift);
		dialog_set_float(palette_poly_wind,kMeshPolySettingShiftY,0,poly->y_shift);
		
		dialog_special_combo_fill_node(palette_poly_wind,kMeshPolySettingCamera,0,poly->camera);
	}
	
		// liquid data
		
	else {
		liq=&map.liquid.liquids[main_idx];
		
		dialog_enable(palette_poly_wind,kMeshPolySettingDark,0,FALSE);
		dialog_enable(palette_poly_wind,kMeshPolySettingCamera,0,FALSE);
		
		dialog_set_float(palette_poly_wind,kMeshPolySettingOffX,0,liq->x_txtoff);
		dialog_set_float(palette_poly_wind,kMeshPolySettingOffY,0,liq->y_txtoff);
		dialog_set_float(palette_poly_wind,kMeshPolySettingSizeX,0,liq->x_txtfact);
		dialog_set_float(palette_poly_wind,kMeshPolySettingSizeY,0,liq->y_txtfact);

		dialog_set_float(palette_poly_wind,kMeshPolySettingAlpha,0,liq->alpha);
		dialog_set_float(palette_poly_wind,kMeshPolySettingShiftX,0,liq->x_shift);
		dialog_set_float(palette_poly_wind,kMeshPolySettingShiftY,0,liq->y_shift);
	}
	
	DrawControls(palette_poly_wind);
}
コード例 #9
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_flip_uvs(bool flip_u,bool flip_v)
{
	int						n,sel_count,
							type,mesh_idx,poly_idx;

	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;

		map_mesh_flip_poly_uv(&map,mesh_idx,poly_idx,flip_u,flip_v);
		view_vbo_mesh_rebuild(mesh_idx);
	}
}
コード例 #10
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_rotate_uvs(void)
{
	int						n,sel_count,
							type,mesh_idx,poly_idx;

	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;

		map_mesh_rotate_poly_uv(&map,mesh_idx,poly_idx,90);
		view_vbo_mesh_rebuild(mesh_idx);
	}
}
コード例 #11
0
ファイル: palette_polygon.c プロジェクト: prophile/dim3
void palette_polygon_save(void)
{
	int						type,main_idx,poly_idx;
	float					x_txtoff,y_txtoff,x_txtfact,y_txtfact;
	map_mesh_poly_type		*poly;
	map_liquid_type			*liq;
	
		// get polygon
		
	select_get(0,&type,&main_idx,&poly_idx);
	
		// save data
		
	if (type==mesh_piece) {
		poly=&map.mesh.meshes[main_idx].polys[poly_idx];

		x_txtoff=dialog_get_float(palette_poly_wind,kMeshPolySettingOffX,0);
		y_txtoff=dialog_get_float(palette_poly_wind,kMeshPolySettingOffY,0);
		x_txtfact=dialog_get_float(palette_poly_wind,kMeshPolySettingSizeX,0);
		y_txtfact=dialog_get_float(palette_poly_wind,kMeshPolySettingSizeY,0);

		if ((x_txtfact>0.0f) && (y_txtfact>0.0f)) map_mesh_set_poly_uv_as_box(&map,main_idx,poly_idx,x_txtoff,y_txtoff,x_txtfact,y_txtfact);

		poly->dark_factor=dialog_get_float(palette_poly_wind,kMeshPolySettingDark,0);
		poly->alpha=dialog_get_float(palette_poly_wind,kMeshPolySettingAlpha,0);
		poly->x_shift=dialog_get_float(palette_poly_wind,kMeshPolySettingShiftX,0);
		poly->y_shift=dialog_get_float(palette_poly_wind,kMeshPolySettingShiftY,0);
		
		dialog_special_combo_get_node(palette_poly_wind,kMeshPolySettingCamera,0,poly->camera,name_str_len);
	}
	
		// liquid data
		
	else {
		liq=&map.liquid.liquids[main_idx];

		liq->x_txtoff=dialog_get_float(palette_poly_wind,kMeshPolySettingOffX,0);
		liq->y_txtoff=dialog_get_float(palette_poly_wind,kMeshPolySettingOffY,0);
		liq->x_txtfact=dialog_get_float(palette_poly_wind,kMeshPolySettingSizeX,0);
		liq->y_txtfact=dialog_get_float(palette_poly_wind,kMeshPolySettingSizeY,0);
		
		liq->alpha=dialog_get_float(palette_poly_wind,kMeshPolySettingAlpha,0);
		liq->x_shift=dialog_get_float(palette_poly_wind,kMeshPolySettingShiftX,0);
		liq->y_shift=dialog_get_float(palette_poly_wind,kMeshPolySettingShiftY,0);
	}
	
	main_wind_draw();
}
コード例 #12
0
ファイル: texture_palette.c プロジェクト: prophile/dim3
void texture_palette_put_selected_texture(int txt_idx)
{
	int					n,k,sel_count,type,main_idx,poly_idx;
	map_mesh_type		*mesh;
	map_mesh_poly_type	*poly;
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
	
		select_get(n,&type,&main_idx,&poly_idx);
		
			// liquids
			
		if (type==liquid_piece) {
			map.liquid.liquids[main_idx].txt_idx=txt_idx;
			continue;
		}
		
			// meshes
			
		if (type!=mesh_piece) continue;
		
		mesh=&map.mesh.meshes[main_idx];
		
			// only set polygon
			
		if (drag_mode==drag_mode_polygon) {
			mesh->polys[poly_idx].txt_idx=txt_idx;
		}
		
			// set all mesh
			
		else {
			
			poly=mesh->polys;
			
			for (k=0;k!=mesh->npoly;k++) {
				poly->txt_idx=txt_idx;
				poly++;
			}
		
		}		
	}
}
コード例 #13
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_mesh_select_all_poly(void)
{
	int				n,k,sel_count,type,mesh_idx,poly_idx;
	map_mesh_type	*mesh;
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
		mesh=&map.mesh.meshes[mesh_idx];
		
		for (k=0;k!=mesh->npoly;k++) {
			if (!select_check(item_map_mesh,mesh_idx,k)) select_add(item_map_mesh,mesh_idx,k);
		}
	}
}
コード例 #14
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_flip(bool flip_x,bool flip_y,bool flip_z)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	
	map_undo_push();
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type==item_map_mesh) {
			map_mesh_flip(&map,mesh_idx,flip_x,flip_y,flip_z);
			view_vbo_mesh_rebuild(mesh_idx);
		}
	}
	
	main_wind_draw();
}
コード例 #15
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_force_grid(void)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	
	map_undo_push();
		
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type==item_map_mesh) {
			view_force_grid(mesh_idx,FALSE);
			view_vbo_mesh_rebuild(mesh_idx);
		}
	}
	
	main_wind_draw();
}
コード例 #16
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_poly_hole(void)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type==item_map_mesh) {
			map_mesh_poly_punch_hole(&map,mesh_idx,poly_idx,NULL,FALSE,normal_mode_in);
			view_vbo_mesh_rebuild(mesh_idx);
		}
	}
	
	select_clear();
	
	main_wind_draw();
}
コード例 #17
0
ファイル: palette_sound.c プロジェクト: prophile/dim3
void palette_sound_save(void)
{
	int						type,main_idx,poly_idx;
	map_sound_type			*sound;
	
		// get sound
		
	select_get(0,&type,&main_idx,&poly_idx);
	sound=&map.sounds[main_idx];
	
		// set controls
	
	dialog_special_combo_get_sound(palette_sound_wind,kSoundName,0,sound->name,name_str_len);
	sound->pitch=dialog_get_float(palette_sound_wind,kSoundPitch,0);
	sound->on=dialog_get_boolean(palette_sound_wind,kSoundOn,0);
	
	main_wind_draw();
}
コード例 #18
0
ファイル: palette_sound.c プロジェクト: prophile/dim3
void palette_sound_load(void)
{
	int						type,main_idx,poly_idx;
	map_sound_type			*sound;
	
		// get sound
		
	select_get(0,&type,&main_idx,&poly_idx);
	sound=&map.sounds[main_idx];
	
		// get controls
		
	dialog_special_combo_fill_sound(palette_sound_wind,kSoundName,0,sound->name);
	dialog_set_float(palette_sound_wind,kSoundPitch,0,sound->pitch);
	dialog_set_boolean(palette_sound_wind,kSoundOn,0,sound->on);
	
	DrawControls(palette_sound_wind);
}
コード例 #19
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_rotate(d3ang *ang)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	d3pnt			center_pnt;
	
	map_undo_push();
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
		map_mesh_calculate_center(&map,mesh_idx,&center_pnt);
		map_mesh_rotate(&map,mesh_idx,&center_pnt,ang);
		view_vbo_mesh_rebuild(mesh_idx);
	}
	
	main_wind_draw();
}
コード例 #20
0
ファイル: map_texture_palette.c プロジェクト: rzel/dim3
int map_texture_palette_get_selected_texture(void)
{
	int					type,main_idx,poly_idx;
	
	if (select_count()!=1) return(-1);
	
	select_get(0,&type,&main_idx,&poly_idx);
	
	if (type==item_map_liquid) {
		if (view_get_uv_layer()==uv_layer_normal) return(map.liquid.liquids[main_idx].txt_idx);
		return(map.liquid.liquids[main_idx].lmap_txt_idx);
	}
	
	if (type==item_map_mesh) {
		if (view_get_uv_layer()==uv_layer_normal) return(map.mesh.meshes[main_idx].polys[poly_idx].txt_idx);
		return(map.mesh.meshes[main_idx].polys[poly_idx].lmap_txt_idx);
	}
	
	return(-1);
}
コード例 #21
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_single_uvs(bool poly_only)
{
	int						n,sel_count,
							type,mesh_idx,poly_idx;

	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
		if (poly_only) {
			map_mesh_poly_single_uv(&map,mesh_idx,poly_idx);
		}
		else {
			map_mesh_single_uv(&map,mesh_idx);
		}
		view_vbo_mesh_rebuild(mesh_idx);
	}
}
コード例 #22
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_mesh_recalc_normals(bool poly_only)
{
	int				n,sel_count,type,mesh_idx,poly_idx;
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
		if (poly_only) {
			map_recalc_normals_mesh_poly(&map,&map.mesh.meshes[mesh_idx],poly_idx,normal_mode_none,FALSE);
		}
		else {
			map_recalc_normals_mesh(&map,&map.mesh.meshes[mesh_idx],normal_mode_none,FALSE);
		}
	}
	
	main_wind_draw();
}
コード例 #23
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_mesh_set_normals_in_out(bool out)
{
	int					n,sel_count,normal_mode,
						type,mesh_idx,poly_idx;
	map_mesh_type		*mesh;

	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		
			// recalc the normals
			
		mesh=&map.mesh.meshes[mesh_idx];

		normal_mode=out?normal_mode_out:normal_mode_in;
		map_recalc_normals_mesh(&map,&map.mesh.meshes[mesh_idx],normal_mode,FALSE);
	}
}
コード例 #24
0
ファイル: palette_node.c プロジェクト: prophile/dim3
void palette_node_load(void)
{
    int						type,main_idx,poly_idx;
    node_type				*node;

    // get node

    select_get(0,&type,&main_idx,&poly_idx);
    node=&map.nodes[main_idx];

    // get controls

    dialog_set_text(palette_node_wind,kNodeName,0,node->name);
    dialog_set_int(palette_node_wind,kNodeEventID,0,node->event_id);
    dialog_set_float(palette_node_wind,kNodeAngleX,0,node->ang.x);
    dialog_set_float(palette_node_wind,kNodeAngleY,0,node->ang.y);
    dialog_set_float(palette_node_wind,kNodeAngleZ,0,node->ang.z);
    dialog_set_boolean(palette_node_wind,kNodeFollowCamera,0,node->follow_camera);

    DrawControls(palette_node_wind);
}
コード例 #25
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_reset_uvs(bool poly_only)
{
	int						n,sel_count,
							type,mesh_idx,poly_idx;

	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&mesh_idx,&poly_idx);
		if (type!=item_map_mesh) continue;
		if (map.mesh.meshes[mesh_idx].flag.lock_uv) continue;
		
		if (poly_only) {
			map_mesh_reset_poly_uv(&map,mesh_idx,poly_idx);
		}
		else {
			map_mesh_reset_uv(&map,mesh_idx);
		}

		view_vbo_mesh_rebuild(mesh_idx);
	}
}
コード例 #26
0
ファイル: map_palette.c プロジェクト: rzel/dim3
void map_palette_fill_level_1(void)
{
	int					sel_type,main_idx,sub_idx;

		// special check for non-selection property lists
	
	switch (state.map.cur_no_sel_piece_type) {

		case item_map_setting:
			map_palette_fill_map();
			return;

		case item_map_camera:
			map_palette_fill_camera();
			return;

		case item_map_light_media:
			map_palette_fill_light_media();
			return;

		case item_map_sky_weather:
			map_palette_fill_sky_weather();
			return;

		case item_map_group:
			map_palette_fill_group(state.map.cur_group_idx);
			return;
	
		case item_map_movement:
			map_palette_fill_movement(state.map.cur_movement_idx);
			return;

		case item_map_cinema:
			map_palette_fill_cinema(state.map.cur_cinema_idx);
			return;
	}

		// check selection

	main_idx=-1;
	
	if (select_count()!=0)  select_get(0,&sel_type,&main_idx,&sub_idx);
	if (main_idx==-1) return;

		// selection properties

	switch (sel_type) {

		case item_map_mesh:
			if (state.map.select_mode!=select_mode_polygon) sub_idx=-1;
			map_palette_fill_mesh(main_idx,sub_idx);
			break;

		case item_map_liquid:
			map_palette_fill_liquid(main_idx);
			break;

		case item_map_spot:
			map_palette_fill_spot(main_idx);
			break;

		case item_map_node:
			map_palette_fill_node(main_idx);
			break;

		case item_map_light:
			map_palette_fill_light(main_idx);
			break;

		case item_map_sound:
			map_palette_fill_sound(main_idx);
			break;

		case item_map_particle:
			map_palette_fill_particle(main_idx);
			break;

		case item_map_scenery:
			map_palette_fill_scenery(main_idx);
			break;

	}
}
コード例 #27
0
ファイル: map_palette.c プロジェクト: rzel/dim3
void map_palette_click_level_1(bool double_click)
{
	int					sel_type,main_idx,sub_idx;
	
		// special check for non-selection property lists
		// and check state changes

	switch (state.map.cur_no_sel_piece_type) {

		case item_map_group:
			map_palette_click_group(double_click);
			return;

		case item_map_movement:
			map_palette_click_movement(double_click);
			return;

		case item_map_cinema:
			map_palette_click_cinema(double_click);
			return;
	}

		// get the selection

	main_idx=-1;
	
	if (select_count()!=0) select_get(0,&sel_type,&main_idx,&sub_idx);

		// no selection, map properties

	if (main_idx==-1) {

		switch (state.map.cur_no_sel_piece_type) {
			
			case item_map_setting:
				map_palette_click_map(double_click);
				break;

			case item_map_camera:
				map_palette_click_camera(double_click);
				break;

			case item_map_light_media:
				map_palette_click_light_media(double_click);
				break;

			case item_map_sky_weather:
				map_palette_click_sky_weather(double_click);
				break;

		}

		return;
	}

		// selection properties

	switch (sel_type) {

		case item_map_mesh:
			if (state.map.select_mode!=select_mode_polygon) sub_idx=-1;
			map_palette_click_mesh(main_idx,sub_idx,double_click);
			break;

		case item_map_liquid:
			map_palette_click_liquid(main_idx,double_click);
			break;

		case item_map_spot:
			map_palette_click_spot(main_idx,double_click);
			break;

		case item_map_node:
			map_palette_click_node(main_idx,double_click);
			break;

		case item_map_light:
			map_palette_click_light(main_idx,double_click);
			break;

		case item_map_sound:
			map_palette_click_sound(main_idx,double_click);
			break;

		case item_map_particle:
			map_palette_click_particle(main_idx,double_click);
			break;

		case item_map_scenery:
			map_palette_click_scenery(main_idx,double_click);
			break;

	}
}
コード例 #28
0
ファイル: walk_view_draw_select.c プロジェクト: prophile/dim3
void walk_view_draw_select(d3pnt *cpt,bool draw_area)
{
	int						n,sel_count,
							type,main_idx,sub_idx;
	unsigned char			draw_mesh_once[max_mesh];
	
	sel_count=select_count();
	if (sel_count==0) return;
	
		// only draw mesh selections once
		// as there could be multiple polygon selections
		// for a single mesh
		
	memset(draw_mesh_once,0x0,max_mesh);
	
		// draw the selection of meshes, liquids,
		// and other pieces, drawing the selected
		// polygons later
		
	for (n=(sel_count-1);n>=0;n--) {
	
		select_get(n,&type,&main_idx,&sub_idx);
		
			// draw selection
			
		switch (type) {
		
			case mesh_piece:
				if (draw_mesh_once[main_idx]==0x0) {
					draw_mesh_once[main_idx]=0x1;
					walk_view_draw_select_mesh(main_idx);
				}
				break;
				
			case liquid_piece:
				walk_view_draw_select_liquid(main_idx);
				break;
				
			case node_piece:
				walk_view_draw_select_sprite(&map.nodes[main_idx].pnt);
				break;
				
			case spot_piece:
				if (!walk_view_model_draw_select(&map.spots[main_idx].pnt,&map.spots[main_idx].ang,map.spots[main_idx].display_model)) {
					walk_view_draw_select_sprite(&map.spots[main_idx].pnt);
				}
				break;
				
			case scenery_piece:
				if (!walk_view_model_draw_select(&map.sceneries[main_idx].pnt,&map.sceneries[main_idx].ang,map.sceneries[main_idx].model_name)) {
					walk_view_draw_select_sprite(&map.sceneries[main_idx].pnt);
				}
				break;
				
			case light_piece:
				walk_view_draw_select_sprite(&map.lights[main_idx].pnt);
				break;
				
			case sound_piece:
				walk_view_draw_select_sprite(&map.sounds[main_idx].pnt);
				break;
				
			case particle_piece:
				walk_view_draw_select_sprite(&map.particles[main_idx].pnt);
				break;
				
			case area_piece:
				if (draw_area) walk_view_draw_select_area(main_idx);
				break;
		}
	}
	
		// draw selected polygons
		// draw afterwards so mesh highlighting doesn't
		// effect selection
		
	if (drag_mode==drag_mode_polygon) {
	
		for (n=(sel_count-1);n>=0;n--) {
		
			select_get(n,&type,&main_idx,&sub_idx);
			if (type!=mesh_piece) continue;
			
			walk_view_draw_select_mesh_poly(main_idx,sub_idx);
		}
		
	}
	
		// finish with selecte mesh vertexes
		
	if (drag_mode==drag_mode_vertex) {

		memset(draw_mesh_once,0x0,max_mesh);
			
		for (n=(sel_count-1);n>=0;n--) {
		
			select_get(n,&type,&main_idx,&sub_idx);
			if (type!=mesh_piece) continue;
			
			if (draw_mesh_once[main_idx]==0x0) {
				draw_mesh_once[main_idx]=0x1;
				walk_view_draw_select_mesh_vertex(main_idx);
			}
		}
	}
}
コード例 #29
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_duplicate(void)
{
	int				n,i,nsel_count,type,main_idx,sub_idx,
					index;
	d3pnt			mpt,mov_pt;

	map_undo_push();
	
		// duplicate selection
		
	select_duplicate_clear();
	
		// get duplicate offset
		
	mov_pt.x=view_get_grid();
	mov_pt.y=0;
	mov_pt.z=view_get_grid();
	
		// duplicate pieces
		
	nsel_count=select_count();
	
	for (n=0;n!=nsel_count;n++) {
		select_get(n,&type,&main_idx,&sub_idx);
		
		switch (type) {
			
			case item_map_mesh:
				if (state.map.select_mode!=select_mode_polygon) {
					if (!map_piece_duplicate_mesh(main_idx,&mov_pt)) return;
				}
				else {
					if (!map_piece_duplicate_mesh_poly(main_idx,sub_idx,&mov_pt)) return;
				}
				break;
			
			case item_map_liquid:
				index=map_liquid_duplicate(&map,main_idx);
				if (index==-1) {
					os_dialog_alert("Can Not Create Liquid","Not enough memory.");
					return;
				}
				
				map_liquid_calculate_center(&map,index,&mpt);
				map_liquid_move(&map,index,&mov_pt);
				
				select_duplicate_add(item_map_liquid,index,-1);
				break;
				
			case item_map_spot:
				if (map.nspot==max_spot) {
					os_dialog_alert("Can Not Create Spot","You've reached the maximum number of spots for a map.");
					return;
				}
				
				map.spots[map.nspot]=map.spots[main_idx];
				map.spots[map.nspot].pnt.x+=mov_pt.x;
				map.spots[map.nspot].pnt.y+=mov_pt.y;
				map.spots[map.nspot].pnt.z+=mov_pt.z;
				select_duplicate_add(item_map_spot,map.nspot,-1);
				map.nspot++;
				break;
				
			case item_map_scenery:
				if (map.nscenery==max_map_scenery) {
					os_dialog_alert("Can Not Create Scenery","You've reached the maximum number of scenery for a map.");
					return;
				}
				
				map.sceneries[map.nscenery]=map.sceneries[main_idx];
				map.sceneries[map.nscenery].pnt.x+=mov_pt.x;
				map.sceneries[map.nscenery].pnt.y+=mov_pt.y;
				map.sceneries[map.nscenery].pnt.z+=mov_pt.z;
				select_duplicate_add(item_map_scenery,map.nscenery,-1);
				map.nscenery++;
				break;
				
			case item_map_node:
				if (map.nnode==max_node) {
					os_dialog_alert("Can Not Create Node","You've reached the maximum number of nodes for a map.");
					return;
				}

				map.nodes[map.nnode]=map.nodes[main_idx];
				map.nodes[map.nnode].pnt.x+=mov_pt.x;
				map.nodes[map.nnode].pnt.y+=mov_pt.y;
				map.nodes[map.nnode].pnt.z+=mov_pt.z;
				for (i=0;i!=max_node_link;i++) {
					map.nodes[map.nnode].link[i]=-1;
				}
				select_duplicate_add(item_map_node,map.nnode,-1);
				map.nnode++;
				break;
				
			case item_map_light:
				if (map.nlight==max_map_light) {
					os_dialog_alert("Can Not Create Light","You've reached the maximum number of lights for a map.");
					return;
				}

				map.lights[map.nlight]=map.lights[main_idx];
				map.lights[map.nlight].pnt.x+=mov_pt.x;
				map.lights[map.nlight].pnt.y+=mov_pt.y;
				map.lights[map.nlight].pnt.z+=mov_pt.z;
				select_duplicate_add(item_map_light,map.nlight,-1);
				map.nlight++;
				break;
				
			case item_map_sound:
				if (map.nsound==max_map_sound) {
					os_dialog_alert("Can Not Create Sound","You've reached the maximum number of sounds for a map.");
					return;
				}

				map.sounds[map.nsound]=map.sounds[main_idx];
				map.sounds[map.nsound].pnt.x+=mov_pt.x;
				map.sounds[map.nsound].pnt.y+=mov_pt.y;
				map.sounds[map.nsound].pnt.z+=mov_pt.z;
				select_duplicate_add(item_map_sound,map.nsound,-1);
				map.nsound++;
				break;
				
			case item_map_particle:
				if (map.nparticle==max_map_particle) {
					os_dialog_alert("Can Not Create Particle","You've reached the maximum number of particles for a map.");
					return;
				}

				map.particles[map.nparticle]=map.particles[main_idx];
				map.particles[map.nparticle].pnt.x+=mov_pt.x;
				map.particles[map.nparticle].pnt.y+=mov_pt.y;
				map.particles[map.nparticle].pnt.z+=mov_pt.z;
				select_duplicate_add(item_map_particle,map.nparticle,-1);
				map.nparticle++;
				break;
				
		}
    }
	
		// switch selections
		
	select_duplicate_copy();
	
	map_palette_reset();
	
	main_wind_draw();
}
コード例 #30
0
ファイル: map_pieces.c プロジェクト: rzel/dim3
void piece_key(char ch)
{
	int					n,sel_count,type,main_idx,sub_idx,mv;
	d3pnt				move_pnt;
	editor_view_type	*view;
	
		// special check for delete key
		
	if ((ch==D3_KEY_BACKSPACE) || (ch==D3_KEY_DELETE)) {
		piece_delete();
		map_palette_reset();
		main_wind_draw();
		main_wind_menu_update();
		return;
	}
	
		// nudge works with grid
	
	mv=view_get_grid();
	if (os_key_shift_down()) mv*=move_key_shift_multiply;
	
		// nudge keys movement

	view=view_get_current_view();
	move_pnt.x=move_pnt.y=move_pnt.z=0;
		
	switch (ch) {
	
		case D3_KEY_LEFT:
			view_mouse_get_scroll_horizontal_axis(view,&move_pnt,-mv);
			break;
			
		case D3_KEY_RIGHT:
			view_mouse_get_scroll_horizontal_axis(view,&move_pnt,+mv);
			break;
			
		case D3_KEY_UP:
			view_mouse_get_scroll_vertical_axis(view,&move_pnt,-mv);
			break;
			
		case D3_KEY_DOWN:
			view_mouse_get_scroll_vertical_axis(view,&move_pnt,mv);
			break;
			
	}
	
	if ((move_pnt.x==0) && (move_pnt.y==0) && (move_pnt.z==0)) return;
	
		// move selection
	
	sel_count=select_count();
	
	for (n=0;n!=sel_count;n++) {
		select_get(n,&type,&main_idx,&sub_idx);

		switch (type) {
		
			case item_map_mesh:
				if (map.mesh.meshes[main_idx].flag.lock_move) break;
				map_mesh_move(&map,main_idx,&move_pnt);
				if ((state.map.auto_texture) && (!map.mesh.meshes[main_idx].flag.lock_uv)) map_mesh_reset_uv(&map,main_idx);
				view_vbo_mesh_rebuild(main_idx);
				break;
				
			case item_map_liquid:
				map_liquid_move(&map,main_idx,&move_pnt);
				if ((state.map.auto_texture) && (!map.liquid.liquids[main_idx].flag.lock_uv)) map_liquid_reset_uv(&map,main_idx);
				break;
				
			case item_map_node:
				map.nodes[main_idx].pnt.x+=move_pnt.x;
				map.nodes[main_idx].pnt.y+=move_pnt.y;
				map.nodes[main_idx].pnt.z+=move_pnt.z;
				break;
				
			case item_map_spot:
				map.spots[main_idx].pnt.x+=move_pnt.x;
				map.spots[main_idx].pnt.y+=move_pnt.y;
				map.spots[main_idx].pnt.z+=move_pnt.z;
				break;
				
			case item_map_scenery:
				map.sceneries[main_idx].pnt.x+=move_pnt.x;
				map.sceneries[main_idx].pnt.y+=move_pnt.y;
				map.sceneries[main_idx].pnt.z+=move_pnt.z;
				break;
				
			case item_map_light:
				map.lights[main_idx].pnt.x+=move_pnt.x;
				map.lights[main_idx].pnt.y+=move_pnt.y;
				map.lights[main_idx].pnt.z+=move_pnt.z;
				break;
				
			case item_map_sound:
				map.sounds[main_idx].pnt.x+=move_pnt.x;
				map.sounds[main_idx].pnt.y+=move_pnt.y;
				map.sounds[main_idx].pnt.z+=move_pnt.z;
				break;
				
			case item_map_particle:
				map.particles[main_idx].pnt.x+=move_pnt.x;
				map.particles[main_idx].pnt.y+=move_pnt.y;
				map.particles[main_idx].pnt.z+=move_pnt.z;
				break;
				
		}
	}
	
	main_wind_draw();
}