Esempio n. 1
0
t_node *add_menu_process(void)
{
	t_context *C=ctx_get();
	t_node *menu_main=scene_node_get(C->scene,"block","menu_set");
	t_node *menu=block_make("menu_process","menu");
	t_block *block=menu->data;

	add_brick_switch(C,block,"debug process",&C->event->debug_process);
	add_brick_slider_float(C,block,"limit",&C->engine->global_limit);
	add_brick_slider_float(C,block,"freq",&C->engine->global_freq);
	add_brick_switch(C,block,"limit process",&C->engine->with_global_limit);

	add_brick_submenu(C,menu_main,menu,"process");

	return menu;
}
Esempio n. 2
0
t_node *make_menu_maths(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_logic","menu");
	t_block *block=menu->data;

	add_brick_trigger(C,block,"cos",op_brick_add);
	add_brick_trigger(C,block,"sin",op_brick_add);
	add_brick_trigger(C,block,"x",op_brick_add);
	add_brick_trigger(C,block,"+",op_brick_add);
	add_brick_trigger(C,block,"++",op_brick_add);
	add_brick_trigger(C,block,"neg",op_brick_add);
	add_brick_trigger(C,block,"mod",op_brick_add);

	return menu;
}
Esempio n. 3
0
t_node *make_menu_ops(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_logic","menu");
	t_block *block=menu->data;

	add_brick_trigger(C,block,"get",op_brick_add);
	add_brick_trigger(C,block,"clone",op_brick_add);
	add_brick_trigger(C,block,"pipe",op_brick_add);
	add_brick_trigger(C,block,"for",op_brick_add);
	add_brick_trigger(C,block,"vector",op_brick_add);
	add_brick_trigger(C,block,"bang",op_brick_add);
	add_brick_trigger(C,block,"quit",op_brick_add);

	return menu;
}
Esempio n. 4
0
t_node *make_menu_node_add(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_node_add","menu");
	t_block *block=menu->data;

	add_brick_trigger(C,block,"default",op_add_default);
	add_brick_trigger(C,block,"cube",op_add_cube);
	add_brick_trigger(C,block,"uv cube",op_add_uv_cube);
	add_brick_trigger(C,block,"light",op_add_light);
	add_brick_trigger(C,block,"obj",op_obj_import);
	add_brick_trigger(C,block,"mn",op_add_mn);
	add_brick_trigger(C,block,"camera",op_add_camera);

	return menu;
}
Esempio n. 5
0
t_node *make_menu_camera(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_camera","menu");
	t_block *block=menu->data;

	add_brick_slider_float(C,block,"eye x",&C->camera->eye[0]);
	add_brick_slider_float(C,block,"eye y",&C->camera->eye[1]);
	add_brick_slider_float(C,block,"eye z",&C->camera->eye[2]);

	add_brick_slider_float(C,block,"pos x",&C->camera->pos[0]);
	add_brick_slider_float(C,block,"pos y",&C->camera->pos[1]);
	add_brick_slider_float(C,block,"pos z",&C->camera->pos[2]);

	return menu;
}
Esempio n. 6
0
File: txt.c Progetto: rvba/minuit
void txt_alphabet_make(void)
{
	t_context *C = ctx_get();
	int i=0;
	float black[]={0,0,0,0};

	i=0;
	char *letter=_alphabet;

	while(*letter)
	{
		C->ui->alphabet[i]=letter_make(*letter,black);
		letter++;
		i++;
	}
}
Esempio n. 7
0
void slave(void)
{
	t_context *C=ctx_get();
	t_app *app = C->app;

	printf("entering slave mode ...\n");

	app->clock->limit=1;
	server_connect(C->server,9901);

	while(1)
	{
		app_sleep(app);
		printf("[%d] hello\n",app->frame);
		//__server(NULL);
	}
}
Esempio n. 8
0
t_node *block_make(const char *name,const char *type)
{
	t_context *C=ctx_get();

	t_node *n_block=scene_add(C->scene,nt_block,name);
	t_node *n_list=scene_add(C->scene,nt_list,name);

	t_block *block=n_block->data;

	set_name(block->type,type);

	block_init(C->scene,block);

	block->cls->link(block,n_list);

	return n_block;
}
Esempio n. 9
0
void screen_block_add(t_screen *screen, t_block *block)
{
	t_context *C = ctx_get();

	if(screen->blocks)
	{
		list_add_data(screen->blocks, block);
	}
	else
	{
		t_node *node = scene_add(C->scene, dt_lst, "lst");
		t_lst *lst = node->data;
		screen->blocks = lst;

		screen_block_add(screen, block);
	}
}
Esempio n. 10
0
void state_brick_edit( t_brick *brick, t_event *e)
{
	ctx_ui_log( "brick_edit");
	t_context *C = ctx_get();
	switch( e->type)
	{
		case RETURNKEY:
		case MOUSE_LEFT_PRESSED:
		case MOUSE_RIGHT_PRESSED:
			brick_edit_stop( C, brick);
			break;
		case SHIFTKEY:
			break;
		default:
			brick_edit_name( C, brick);
			break;
	}
}
Esempio n. 11
0
void state_brick_slider_drag( t_brick *brick, t_event *e)
{
	ctx_ui_log( "brick_slider_drag");
	t_context *C = ctx_get();
	if( e->type == MOUSE_LEFT_RELEASED)
	{
		if( brick->brick_state.use_hold) brick->brick_state.hold = 0;
		ctx_event_add( UI_BRICK_RELEASED);
		BRICK_SWAP( brick, state_brick_slider_default);
	}
	else
	{
		if( C->ui->mouse_delta_x >= 0) brick->state_pressed = BRICK_RIGHT;
		else brick->state_pressed = BRICK_LEFT;
	}

	brick->act( brick);
}
Esempio n. 12
0
t_node *make_menu_draw(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_draw","menu");
	t_block *block=menu->data;

	add_brick_switch(C,block,"face",&C->event->with_face);
	add_brick_switch(C,block,"points",&C->event->with_point);
	add_brick_switch(C,block,"texture",&C->event->with_texture);
	add_brick_switch(C,block,"normal",&C->event->with_normal);
	add_brick_switch(C,block,"light",&C->event->with_light);
	add_brick_switch(C,block,"depth",&C->event->with_depth);
	add_brick_switch(C,block,"blend",&C->event->with_blend);
	add_brick_switch(C,block,"restrict",&C->draw->with_restrict_matrix);
	add_brick_switch(C,block,"direct",&C->draw->mode_direct);

	return menu;
}
Esempio n. 13
0
t_node *op_texture_png_add(t_file *file)
{
	t_context *C = ctx_get();

	t_node *node = scene_add( C->scene, dt_texture, file->id.name);
	t_texture *texture = ( t_texture *) node->data;

	t_image *image = img_read_png( file->path);

	if(image)
	{
		texture_image_bind( texture, image);
	}

	op_texture_store(texture);

	return node;
}
Esempio n. 14
0
void obj_add(const char *object_name,int tot_vert,int tot_face,int tot_quad,int tot_tri)
{
	//printf("adding object:%s\n",object_name);
	t_context *C=ctx_get();
	term_print(C->term,"+ obj");
	t_obj *obj=obj_new(object_name);

	obj->tot_vert=tot_vert;
	obj->tot_face=tot_face;
	obj->tot_quad=tot_quad;
	obj->tot_tri=tot_tri;

	if(tot_vert) obj->verts=(float *)malloc(sizeof(float)*obj->tot_vert*3);
	if(tot_tri) obj->tris=(int *)malloc(sizeof(int)*obj->tot_tri*3);
	if(tot_quad) obj->quads=(int *)malloc(sizeof(int)*obj->tot_quad*4);

	lst_add(OBJECTS,obj,"obj");
}
Esempio n. 15
0
void draw_init(t_draw *draw)
{
	float c[4];
	bzero(c,4);
	cconv(c,draw->background_color);

	// clear
	if(draw->with_clear)
	{
		draw_clear(c[0],c[1],c[2],0);
	}

	// set depth
	if(draw->with_depth)
		glEnable(GL_DEPTH_TEST);
	else
		glDisable(GL_DEPTH_TEST);
	
	// polygon offset
	if(draw->with_polygon_offset)
	{
		glEnable(GL_POLYGON_OFFSET_FILL);
		glPolygonOffset(1.0,1.0);
	}
	else
	{
		glDisable(GL_POLYGON_OFFSET_FILL);
	}

	if(draw->with_blend)
	{
		glEnable(GL_BLEND);
    		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	}
	else
	{
		glDisable(GL_BLEND);
	}

	t_context *C = ctx_get();
	C->event->ui.use_line_global_width = 1;
	skt_update( C);

}
Esempio n. 16
0
void exe_remove_brick(t_action *action)
{
	// remove brick

	t_dict *args = action->args;

	t_brick *_brick = dict_pop_data(args,"brick");
	t_block *block = _brick->block;

	int remove_connected = _brick->brick_state.remove_connected;

	t_plug *plug_intern = &_brick->plug_intern;
	int *slider = plug_intern->data;

	t_lst *bricks=block->bricks;
	t_link *first = bricks->first;
	t_brick *brick=NULL;
	if(first) brick = first->data;

	t_context *C = ctx_get();
	scene_store( C->scene, 1);

	if(brick)
	{
		// check if bricks are not connected
		if(brick_delete(brick,remove_connected))
		{
			// remove link from bricks
			list_link_remove( bricks, first);
			brick_rhizome_setup(brick);
			block->tot_bricks--;
			block->block_state.update_geometry=1;
			block_brick_set_order( block);
			block->pos[1] += brick->geom.height;
		}
		else
		{
			// re-increment slider
			(*slider)++;
		}
	}

	scene_store( C->scene, 0);
}
Esempio n. 17
0
t_node *make_menu_set(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_set","menu");

	t_node *menu_view=make_menu_view();
	add_brick_submenu(C,menu,menu_view,"view");

	t_node *menu_debug=make_menu_debug();
	add_brick_submenu(C,menu,menu_debug,"debug");

	t_node *menu_ui=make_menu_ui();
	add_brick_submenu(C,menu,menu_ui,"ui");

	t_node *menu_app=make_menu_app();
	add_brick_submenu(C,menu,menu_app,"app");

	return menu;
}
Esempio n. 18
0
t_node *make_menu_ui(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_ui","menu");
	t_block *block=menu->data;

	add_brick_switch(C,block,"update links",&C->ui->update_links);
	add_brick_switch(C,block,"fixed menu",&C->ui->fixed_menu);
	add_brick_switch(C,block,"flow brick",&C->ui->flow_brick);
	add_brick_switch(C,block,"selection",&C->ui->object_selection);
	add_brick_switch(C,block,"bitmap font",&C->ui->use_bitmap_font);
	add_brick_switch(C,block,"mouse mode",&C->ui->mouse_mode);
	add_brick_switch(C,block,"show states",&C->ui->show_states);
	add_brick_switch(C,block,"show step",&C->ui->show_step);
	add_brick_switch(C,block,"show brick step",&C->ui->show_brick_step);
	add_brick_switch(C,block,"video",&C->event->video);

	return menu;
}
Esempio n. 19
0
File: vlst.c Progetto: rvba/minuit
t_vlst *vlst_make( const char *name, t_data_type type, int length, int count, void *data)
{
	t_context *C=ctx_get();

	t_node *node_vlst=scene_add(C->scene,dt_vlst,name);
	t_vlst *vlst=node_vlst->data;

	vlst->type = type;
	vlst->length = length;
	vlst->count=count;
	vlst->count_new=vlst->count;

	if(type == dt_int) vlst->size = sizeof(int);
	else if(type == dt_uint) vlst->size = sizeof(unsigned int);
	else if(type == dt_float) vlst->size = sizeof(float);
	else if(type == dt_uchar) vlst->size = sizeof(unsigned char);
	else printf("[ERROR vlst_make] Unknown type %s\n",data_name_get(type));

	if( !data && length && count)
	{
		vlst->data=mem_malloc((vlst->size)*(vlst->length)*(vlst->count));
		if(C->scene->store)
		{
			 scene_add_data_var(C->scene,"vlst_data","v_data",((vlst->size)*(vlst->length)*(vlst->count)),vlst->data);
		}
	}
	else
	{
		vlst->data = data;
	}

	if(C->ui->add_bricks && C->ui->add_bricks_data)
	{
		t_node *node_block=add_block(C,"vlst");
		t_block *block=node_block->data;
		add_part_vlst(C,block,dt_vlst,"vlst",vlst);
		vlst->ref = block;
	}


	return vlst;
}
Esempio n. 20
0
void viewport_draw_outline( t_viewport *viewport)
{
	t_context *C = ctx_get();
	int w = 1;
	float *color = C->ui->front_color;
	float p[3]={ 0, 0, 0};
	float width, height;
	if( viewport->fullscreen)
	{
		width = C->app->window->width;
		height = C->app->window->height;
	}
	else
	{
		vset( p, viewport->x, viewport->y, 0);
		width = viewport->width;
		height = viewport->height;
	}
	skt_line_rectangle( p, width, height, w, color);
}
Esempio n. 21
0
t_node *make_menu_num(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_num","menu");
	t_block *block=menu->data;

	add_brick_trigger(C,block,"int",op_brick_add);
	add_brick_trigger(C,block,"float",op_brick_add);
	add_brick_trigger(C,block,"100",op_brick_add);
	add_brick_trigger(C,block,"10",op_brick_add);
	add_brick_trigger(C,block,".001",op_brick_add);
	add_brick_trigger(C,block,".01",op_brick_add);
	add_brick_trigger(C,block,".1",op_brick_add);
	add_brick_trigger(C,block,"rnd",op_brick_add);

	add_brick_trigger(C,block,"switch",op_brick_add);
	add_brick_trigger(C,block,"const",op_brick_add);

	return menu;
}
Esempio n. 22
0
t_node *make_menu_operators(void)
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_operators","menu");


	t_node *menu_lst=make_menu_lst();
	add_brick_submenu(C,menu,menu_lst,"lst");

	t_node *menu_logic=make_menu_logic();
	add_brick_submenu(C,menu,menu_logic,"logic");

	t_node *menu_maths=make_menu_maths();
	add_brick_submenu(C,menu,menu_maths,"maths");

	t_node *menu_ops=make_menu_ops();
	add_brick_submenu(C,menu,menu_ops,"ops");

	return menu;
}
Esempio n. 23
0
void make_menu_mouse(void) 
{
	t_context *C=ctx_get();
	t_node *menu=block_make("menu_mouse","menu");

	t_node *add = make_menu_node_add();
	t_node *brick = make_menu_brick_add();
	t_node *set = make_menu_set();
	t_node *skt = make_menu_skt();
	t_node *draw = make_menu_draw();
	t_node *cam = make_menu_camera();

	add_brick_submenu(C,menu,add,"add");
	add_brick_submenu(C,menu,brick,"brick");
	add_brick_submenu(C,menu,set,"set");
	add_brick_submenu(C,menu,skt,"sketch");
	add_brick_submenu(C,menu,draw,"draw");
	add_brick_submenu(C,menu,cam,"camera");

}
Esempio n. 24
0
static int init(pam_handle_t *pamh,struct pld_cfg *cfg,struct pld_ctx **ctx,
                const char **username,const char **service)
{
  int rc;
  struct passwd *pwent;
  /* get user name */
  rc=pam_get_user(pamh,username,NULL);
  if (rc!=PAM_SUCCESS)
  {
    pam_syslog(pamh,LOG_ERR,"failed to get user name: %s",pam_strerror(pamh,rc));
    return rc;
  }
  if ((*username==NULL)||((*username)[0]=='\0'))
  {
    pam_syslog(pamh,LOG_ERR,"got empty user name");
    return PAM_USER_UNKNOWN;
  }
  /* check uid */
  if (cfg->minimum_uid>0)
  {
    pwent=pam_modutil_getpwnam(args->pamh,*username);
    if ((pwent!=NULL)&&(pwent->pw_uid<cfg->minimum_uid))
    {
      if (cfg->debug)
        pam_syslog(pamh,LOG_DEBUG,"uid below minimum_uid; user=%s uid=%ld",*username,(long)pwent->pw_uid);
      return cfg->ignore_unknown_user?PAM_IGNORE:PAM_USER_UNKNOWN;
    }
  }
  /* get our context */
  rc=ctx_get(pamh,*username,ctx);
  if (rc!=PAM_SUCCESS)
    return rc;
  /* get service name */
  rc=pam_get_item(pamh,PAM_SERVICE,(const void **)service);
  if (rc!=PAM_SUCCESS)
  {
    pam_syslog(pamh,LOG_ERR,"failed to get service name: %s",pam_strerror(pamh,rc));
    return rc;
  }
  return PAM_SUCCESS;
}
Esempio n. 25
0
t_screen *screen_add_3d(const char *name, void (* draw)(t_screen *s))
{
	t_context *C=ctx_get();

	t_node *node=scene_add(C->scene,dt_screen,name);
	t_screen *screen=node->data;

	screen->keymap=keymap_generic;
	screen->draw=draw;

	lst_add(C->ui->screens,node,name);

	// Lst
	t_node *node_lst = scene_add( C->scene, dt_list, "lst_screen");
	t_lst *lst = node_lst->data;

	screen->viewports = lst;

	// Viewport
	t_node *node_viewport = scene_add( C->scene, dt_viewport, "viewport");
	t_viewport *viewport = node_viewport->data;

	// Camera
	t_node *node_camera = scene_add( C->scene, dt_camera, name);
	t_camera *camera = node_camera->data;
	camera_add_controls( camera);

	viewport->camera = camera;
	viewport_add_controls( viewport);


	screen->width = C->app->window->width;
	screen->height = C->app->window->height;

	viewport->width = C->app->window->width;
	viewport->height = C->app->window->height;

	list_add_data(screen->viewports, viewport);

	return screen;
}
Esempio n. 26
0
File: block.c Progetto: rvba/minuit
t_block *block_dupli(t_block *block)
{
	t_context *C=ctx_get();
	scene_store(C->scene,1);

	t_node *clone_node=add_block(C,block->id.name);
	t_block *clone_block=clone_node->data;

	vcp(clone_block->pos,block->pos);

	clone_block->pos[0]+=10;
	clone_block->pos[1]+=10;

	clone_block->block_state.draw_clone_link = 1;
	t_link *l;
	t_brick *b;

	for(l=block->bricks->first;l;l=l->next)
	{
		b=l->data;
		brick_dupli(clone_block,b);
	}

	if( block->clone)
	{
		clone_block->clone = block->clone;
	}
	else
	{
		clone_block->clone = block;
	}

	t_block *block_parent = clone_block->clone;

	block_parent->clones+=1;

	scene_store(C->scene,0);

	return clone_block;
}
Esempio n. 27
0
t_block *block_rebind(t_scene *sc,void *ptr)
{
	t_block *block=(t_block *)ptr;

	check_init("BLOCK",block->name);
	
	rebind(sc,"block","bricks",(void **)&block->bricks);

	// methods
	block->draw=block_draw;

	// reset
	block->selected=NULL;
	block->submenu=NULL;

	t_context *C=ctx_get();
	block_init(C->scene,block);

	check_check("BLOCK",block->name);

	return block;
}
Esempio n. 28
0
void state_brick_slider_trigger( t_brick *brick, t_event *e)
{
	ctx_ui_log( "brick_slider_trigger");
	t_context *C = ctx_get();
	switch( e->type)
	{
		case MOUSE_LEFT_RELEASED:
			brick->act( brick);
			if( brick->brick_state.use_hold)  brick->brick_state.hold = 0;
			ctx_event_add( UI_BRICK_RELEASED);
			BRICK_SWAP( brick, state_brick_slider_default);
			break;

		case MOUSE_MOTION:
			BRICK_SWAP( brick, state_brick_slider_drag);
			break;

		case MOUSE_LEFT_LONG:
			brick_edit_start( C, brick);
			break;
	}
}
Esempio n. 29
0
void make_menu_object(void)
{
	t_context *C = ctx_get();
	t_node *menu=block_make("menu_node","menu");

	// store menu
	t_block *b=menu->data;
	menu_node=b;

	t_node *add = make_menu_brick_add();

	t_node *draw = scene_node_get(C->scene,"block","menu_draw");
	t_node *sketch = scene_node_get(C->scene,"block","menu_sketch");
	t_node *set = scene_node_get(C->scene,"block","menu_set");
	t_node *menu_object=make_menu_brick_object();

	add_brick_submenu(C,menu,add,"bricks");
	add_brick_submenu(C,menu,menu_object,"object");
	add_brick_submenu(C,menu,draw,"draw");
	add_brick_submenu(C,menu,sketch,"sketch");
	add_brick_submenu(C,menu,set,"set");

}
Esempio n. 30
0
void screen_draw_controls( t_screen *screen)
{
	t_viewport *viewport = screen_viewport_get( screen);

	viewport->use_ui = 1;
	screen_switch_2d( screen);

	glPushMatrix();
	glLoadIdentity();

	if( viewport->show_outline) viewport_draw_outline( viewport);
	if( opt_viewport_show_controls)
	{
		viewport_draw_controls( viewport);
		int height = viewport->controls->height;
		glTranslatef( 0, height, 0);
		t_context *C = ctx_get();
		t_camera *camera = ctx_ui_get_camera( C);
		if( camera) camera_draw_controls( camera);
	}

	glPopMatrix();
}