AudioOut2(int channels):Node(CONTROL_GRP){ n_channels = channels; for(int i = 0; i< channels;i++){ inputs.push_back(input<audio>()); register_input(inputs[i]); } }
static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { switch (p->state->fog_distance_mode) { case FDM_EYE_RADIAL: /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */ input = get_eye_position(p); emit_op2(p, OPCODE_DP3, fog, WRITEMASK_X, input, input); emit_op1(p, OPCODE_RSQ, fog, WRITEMASK_X, fog); emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, fog); break; case FDM_EYE_PLANE: /* Z = Ze */ input = get_eye_position_z(p); emit_op1(p, OPCODE_MOV, fog, WRITEMASK_X, input); break; case FDM_EYE_PLANE_ABS: /* Z = abs(Ze) */ input = get_eye_position_z(p); emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input); break; default: assert(0); break; /* can't happen */ } } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input); } emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p)); }
static void emit_passthrough( struct tnl_program *p, GLuint input, GLuint output ) { struct ureg out = register_output(p, output); emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input)); }
static struct ureg get_eye_normal( struct tnl_program *p ) { if (is_undef(p->eye_normal)) { struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, STATE_MATRIX_INVTRANS, mvinv ); p->eye_normal = reserve_temp(p); /* Transform to eye space: */ emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal ); /* Normalize/Rescale: */ if (p->state->normalize) { emit_normalize_vec3( p, p->eye_normal, p->eye_normal ); } else if (p->state->rescale_normals) { struct ureg rescale = register_param2(p, STATE_INTERNAL, STATE_NORMAL_SCALE); emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal, swizzle1(rescale, X)); } } return p->eye_normal; }
Phasor::Phasor(int _freq):Node(AUDIO_GRP){ register_output<audio>(); register_input(target_freq); freq = _freq; target_freq.value = freq; phase = 0; }
static bool_t realview_register_keyboard(struct resource_t * res) { struct input_t * input; char name[64]; input = malloc(sizeof(struct input_t)); if(!input) return FALSE; snprintf(name, sizeof(name), "%s.%d", res->name, res->id); input->name = strdup(name); input->type = INPUT_TYPE_KEYBOARD; input->init = input_init; input->exit = input_exit; input->ioctl = input_ioctl; input->suspend = input_suspend, input->resume = input_resume, input->priv = res; if(register_input(input)) return TRUE; free(input->name); free(input); return FALSE; }
static struct ureg get_material( struct tnl_program *p, GLuint side, GLuint property ) { GLuint attrib = material_attrib(side, property); if (p->color_materials & (1<<attrib)) return register_input(p, VERT_ATTRIB_COLOR0); else if (p->materials & (1<<attrib)) { /* Put material values in the GENERIC slots -- they are not used * for anything in fixed function mode. */ return register_input( p, attrib + VERT_ATTRIB_GENERIC0 ); } else return register_param3( p, STATE_MATERIAL, side, property ); }
static struct ureg get_transformed_normal( struct tnl_program *p ) { if (is_undef(p->transformed_normal) && !p->state->need_eye_coords && !p->state->normalize && !(p->state->need_eye_coords == p->state->rescale_normals)) { p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL ); } else if (is_undef(p->transformed_normal)) { struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL ); struct ureg mvinv[3]; struct ureg transformed_normal = reserve_temp(p); if (p->state->need_eye_coords) { register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2, STATE_MATRIX_INVTRANS, mvinv ); /* Transform to eye space: */ emit_matrix_transform_vec3( p, transformed_normal, mvinv, normal ); normal = transformed_normal; } /* Normalize/Rescale: */ if (p->state->normalize) { emit_normalize_vec3( p, transformed_normal, normal ); normal = transformed_normal; } else if (p->state->need_eye_coords == p->state->rescale_normals) { /* This is already adjusted for eye/non-eye rendering: */ struct ureg rescale = register_param2(p, STATE_INTERNAL, STATE_NORMAL_SCALE); emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale ); normal = transformed_normal; } assert(normal.file == PROGRAM_TEMPORARY); p->transformed_normal = normal; } return p->transformed_normal; }
AudioOut::AudioOut(int _buffersize):Node(AUDIO_GRP){ cnt = 0; buffersize = _buffersize; buffer = new audio[_buffersize]; register_input(in); in.value = 0.0; in.set = false; }
static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; GLuint useabs = p->state->fog_source_is_depth && p->state->fog_option && (p->state->fog_option != FOG_EXP2); if (p->state->fog_source_is_depth) { input = swizzle1(get_eye_position(p), Z); } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); } if (p->state->fog_option && p->state->tnl_do_vertex_fog) { struct ureg params = register_param2(p, STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED); struct ureg tmp = get_temp(p); struct ureg id = get_identity_param(p); emit_op1(p, OPCODE_MOV, fog, 0, id); if (useabs) { emit_op1(p, OPCODE_ABS, tmp, 0, input); } switch (p->state->fog_option) { case FOG_LINEAR: { emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input, swizzle1(params,X), swizzle1(params,Y)); emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); break; } case FOG_EXP: emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input, swizzle1(params,Z)); emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp)); break; case FOG_EXP2: emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W)); emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp); emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp)); break; } release_temp(p, tmp); } else { /* results = incoming fog coords (compute fog per-fragment later) * * KW: Is it really necessary to do anything in this case? */ emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, 0, input); } }
static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { input = swizzle1(get_eye_position(p), Z); } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); } if (p->state->fog_mode && p->state->tnl_do_vertex_fog) { struct ureg params = register_param2(p, STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED); struct ureg tmp = get_temp(p); GLboolean useabs = (p->state->fog_mode != FOG_EXP2); if (useabs) { emit_op1(p, OPCODE_ABS, tmp, 0, input); } switch (p->state->fog_mode) { case FOG_LINEAR: { struct ureg id = get_identity_param(p); emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input, swizzle1(params,X), swizzle1(params,Y)); emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */ emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W)); break; } case FOG_EXP: emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input, swizzle1(params,Z)); emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); break; case FOG_EXP2: emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W)); emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp); emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp)); break; } release_temp(p, tmp); } else { /* results = incoming fog coords (compute fog per-fragment later) * * KW: Is it really necessary to do anything in this case? * BP: Yes, we always need to compute the absolute value, unless * we want to push that down into the fragment program... */ GLboolean useabs = GL_TRUE; emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input); } }
static __init void realview_mouse_init(void) { if(! clk_get_rate("kclk", 0)) { LOG_E("can't get the clock of 'kclk'"); return; } if(!register_input(&realview_mouse)) LOG_E("failed to register input '%s'", realview_mouse.name); }
ATTR_COLD void matrix_solver_t::start() { register_output("Q_sync", m_Q_sync); register_input("FB_sync", m_fb_sync); connect_direct(m_fb_sync, m_Q_sync); save(NLNAME(m_last_step)); save(NLNAME(m_cur_ts)); save(NLNAME(m_stat_calculations)); save(NLNAME(m_stat_newton_raphson)); save(NLNAME(m_stat_vsolver_calls)); save(NLNAME(m_iterative_fail)); save(NLNAME(m_iterative_total)); }
static void build_fog( struct tnl_program *p ) { struct ureg fog = register_output(p, VERT_RESULT_FOGC); struct ureg input; if (p->state->fog_source_is_depth) { input = get_eye_position_z(p); } else { input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X); } /* result.fog = {abs(f),0,0,1}; */ emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input); emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p)); }
static void build_hpos( struct tnl_program *p ) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg hpos = register_output( p, VERT_RESULT_HPOS ); struct ureg mvp[4]; if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, 0, mvp ); emit_matrix_transform_vec4( p, hpos, mvp, pos ); } else { register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3, STATE_MATRIX_TRANSPOSE, mvp ); emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos ); } }
static bool_t gpio_register_keyboard(struct resource_t * res) { struct key_gpio_data_t * rdat = (struct key_gpio_data_t *)res->data; struct key_gpio_private_data_t * dat; struct input_t * input; char name[64]; if(!rdat->buttons) return FALSE; if(rdat->nbutton <= 0) return FALSE; dat = malloc(sizeof(struct key_gpio_private_data_t)); if(!dat) return FALSE; input = malloc(sizeof(struct input_t)); if(!input) { free(dat); return FALSE; } snprintf(name, sizeof(name), "%s.%d", res->name, res->id); dat->state = NULL; dat->rdat = rdat; input->name = strdup(name); input->type = INPUT_TYPE_KEYBOARD; input->init = input_init; input->exit = input_exit; input->ioctl = input_ioctl; input->suspend = input_suspend, input->resume = input_resume, input->priv = dat; if(register_input(input)) return TRUE; free(input->priv); free(input->name); free(input); return FALSE; }
void register_button_press(struct ir_remote *remote, struct ir_ncode *ncode, ir_code code, int reps) { if(reps == 0 && release_remote != NULL) { release_remote2 = release_remote; release_ncode2 = release_ncode; release_code2 = release_code; } release_remote = remote; release_ncode = ncode; release_code = code; release_reps = reps; release_gap = remote->max_remaining_gap; register_input(); }
void register_button_press(struct ir_remote *remote, struct ir_ncode *ncode, ir_code code, int reps) { if (reps == 0 && release_remote != NULL) { release_remote2 = release_remote; release_ncode2 = release_ncode; release_code2 = release_code; } release_remote = remote; release_ncode = ncode; release_code = code; release_reps = reps; release_gap = upper_limit(remote, remote->max_total_signal_length - remote->min_gap_length) + receive_timeout(upper_limit(remote, remote->min_gap_length)) + 10000; /* some additional safety margin */ LOGPRINTF(1, "release_gap: %lu", release_gap); register_input(); }
static struct ureg get_eye_position_z( struct tnl_program *p ) { if (!is_undef(p->eye_position)) return swizzle1(p->eye_position, Z); if (is_undef(p->eye_position_z)) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg modelview[4]; p->eye_position_z = reserve_temp(p); register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, 0, modelview ); emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]); } return p->eye_position_z; }
static struct ureg get_eye_z( struct tnl_program *p ) { if (!is_undef(p->eye_position)) { return swizzle1(p->eye_position, Z); } else if (!is_undef(p->eye_z)) { struct ureg pos = register_input( p, BRW_ATTRIB_POS ); struct ureg modelview2; p->eye_z = reserve_temp(p); register_matrix_param6( p, STATE_MATRIX, STATE_MODELVIEW, 0, 2, 1, STATE_MATRIX, &modelview2 ); emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); emit_op2(p, OPCODE_DP4, p->eye_z, WRITEMASK_Z, pos, modelview2); } return swizzle1(p->eye_z, Z) }
void register_main() { struct sockaddr_in servaddr; struct hostent* server; int sock; clientInfo c_info; int flag; print_head(); if(register_connnet(&servaddr,server,&sock)==RET_ERR) { exit(0); } while(1) { system("clear"); print_head(); register_input(&c_info); if(!register_is(sock,&c_info)) { printf("\t\t注册成功\n"); printf("按任意键回到主菜单\n"); close(sock); getchar(); getchar(); return ; } printf("姓名必须唯一\n"); getchar(); printf("\t\t是否继续注册?y/n "); if(getchar()!='y') break; while(getchar()!='\n'); } //scanf("%d",&flag); }
static struct ureg get_eye_position( struct tnl_program *p ) { if (is_undef(p->eye_position)) { struct ureg pos = register_input( p, VERT_ATTRIB_POS ); struct ureg modelview[4]; p->eye_position = reserve_temp(p); if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, 0, modelview ); emit_matrix_transform_vec4(p, p->eye_position, modelview, pos); } else { register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3, STATE_MATRIX_TRANSPOSE, modelview ); emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos); } } return p->eye_position; }
static void init_ui_elements(unsigned int max_x, unsigned int max_y) { ssize_t title_len; title_len = asprintf(&title, "/* %s-%s */", PKGNAME, VERSION); assert( title_len > 0 ); pw_input = init_input((unsigned int)(max_x / 2)-PASSWD_XRELPOS, (unsigned int)(max_y / 2)-PASSWD_YRELPOS, PASSWD_WIDTH, "PASSWORD: "******"[%c]"); higher = init_statusbar(0, max_x, A_BOLD | COLOR_PAIR(3), higher_statusbar_update); lower = init_statusbar(max_y - 1, max_x, COLOR_PAIR(3), lower_statusbar_update); netinfo = init_statusbar(2, max_x, COLOR_PAIR(2), netinfo_statusbar_update); uninfo = init_statusbar(1, max_x, COLOR_PAIR(2), uninfo_statusbar_update); busywnd = init_txtwindow_centered(INFOWND_WIDTH, INFOWND_HEIGHT, busywnd_update); errwnd = init_txtwindow_centered(INFOWND_WIDTH, INFOWND_HEIGHT, NULL); register_input(NULL, pw_input, passwd_input_cb); register_statusbar(higher); register_statusbar(lower); register_statusbar(netinfo); register_statusbar(uninfo); register_anic_default(heartbeat); register_txtwindow(busywnd); register_txtwindow(errwnd); activate_input(pw_input); set_statusbar_text(higher, title, title_len); }
/** * Pass-though per-vertex point size, from user's point size array. */ static void build_array_pointsize( struct tnl_program *p ) { struct ureg in = register_input(p, VERT_ATTRIB_POINT_SIZE); struct ureg out = register_output(p, VERT_RESULT_PSIZ); emit_op1(p, OPCODE_MOV, out, WRITEMASK_X, in); }
static void build_texture_transform( struct tnl_program *p ) { GLuint i, j; for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) continue; if (p->state->unit[i].texgen_enabled || p->state->unit[i].texmat_enabled) { GLuint texmat_enabled = p->state->unit[i].texmat_enabled; struct ureg out = register_output(p, VERT_RESULT_TEX0 + i); struct ureg out_texgen = undef; if (p->state->unit[i].texgen_enabled) { GLuint copy_mask = 0; GLuint sphere_mask = 0; GLuint reflect_mask = 0; GLuint normal_mask = 0; GLuint modes[4]; if (texmat_enabled) out_texgen = get_temp(p); else out_texgen = out; modes[0] = p->state->unit[i].texgen_mode0; modes[1] = p->state->unit[i].texgen_mode1; modes[2] = p->state->unit[i].texgen_mode2; modes[3] = p->state->unit[i].texgen_mode3; for (j = 0; j < 4; j++) { switch (modes[j]) { case TXG_OBJ_LINEAR: { struct ureg obj = register_input(p, VERT_ATTRIB_POS); struct ureg plane = register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_OBJECT_S + j); emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, obj, plane ); break; } case TXG_EYE_LINEAR: { struct ureg eye = get_eye_position(p); struct ureg plane = register_param3(p, STATE_TEXGEN, i, STATE_TEXGEN_EYE_S + j); emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j, eye, plane ); break; } case TXG_SPHERE_MAP: sphere_mask |= WRITEMASK_X << j; break; case TXG_REFLECTION_MAP: reflect_mask |= WRITEMASK_X << j; break; case TXG_NORMAL_MAP: normal_mask |= WRITEMASK_X << j; break; case TXG_NONE: copy_mask |= WRITEMASK_X << j; } } if (sphere_mask) { build_sphere_texgen(p, out_texgen, sphere_mask); } if (reflect_mask) { build_reflect_texgen(p, out_texgen, reflect_mask); } if (normal_mask) { struct ureg normal = get_transformed_normal(p); emit_op1(p, OPCODE_MOV, out_texgen, normal_mask, normal ); } if (copy_mask) { struct ureg in = register_input(p, VERT_ATTRIB_TEX0+i); emit_op1(p, OPCODE_MOV, out_texgen, copy_mask, in ); } } if (texmat_enabled) { struct ureg texmat[4]; struct ureg in = (!is_undef(out_texgen) ? out_texgen : register_input(p, VERT_ATTRIB_TEX0+i)); if (p->mvp_with_dp4) { register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, 0, texmat ); emit_matrix_transform_vec4( p, out, texmat, in ); } else { register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3, STATE_MATRIX_TRANSPOSE, texmat ); emit_transpose_matrix_transform_vec4( p, out, texmat, in ); } } release_temps(p); } else { emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i); } } }
EchoFloatNode::EchoFloatNode():Node(CONTROL_GRP){ register_input(f); }
static __init void gpio_button_init(void) { if(!register_input(&gpio_button)) LOG_E("failed to register input '%s'", gpio_button.name); }
static __init void gpio_keypad_init(void) { if(!register_input(&gpio_keypad)) LOG_E("failed to register input '%s'", gpio_keypad.name); }
ClipNode():Node(CONTROL_GRP){ register_input(i1); register_input(i2); register_output<audio>(); }
AudioOut3():Node(AUDIO_GRP){ it = 0; register_input(i1); register_input(i2); }