t_xray_jit_cellcoords *xray_jit_cellcoords_new(void) { t_xray_jit_cellcoords *x; t_jit_matrix_info info; void *m; if (x=(t_xray_jit_cellcoords *)jit_object_alloc(_xray_jit_cellcoords_class)) { x->plane = 0; x->out_mode = 0; //initialize internal matrix jit_matrix_info_default(&info); info.type = _jit_sym_char; info.planecount = 2; x->temp_name = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); m = jit_object_method(m, _jit_sym_register, x->temp_name); //Register matrix name if(!m) error("could not allocate internal matrix!"); jit_object_attach(x->temp_name, x); x->temp = m; } else { x = NULL; } return x; }
void legion_outputErrorMatrix(t_legion *x){ void *m; t_jit_matrix_info info; char *bp, *p; int row, col, i; jit_matrix_info_default(&info); info.type = _jit_sym_float64; info.planecount = 1; info.dim[0] = x->t_numRows; info.dim[1] = x->t_numColumns; t_symbol *name = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); //m = jit_object_method(m, _jit_sym_register, name); m = jit_object_register(m, name); //jit_object_method(m, gensym("setinfo"), &info); info.dimstride[0] = sizeof(double); info.dimstride[1] = info.dimstride[0] * info.dim[0]; post("%d %d", info.dimstride[0], info.dimstride[1]); jit_object_method(m, _jit_sym_getdata, &bp); for(row = 0; row < x->t_numRows; row++){ for(col = 0; col < x->t_numColumns; col++){ i = (row * x->t_numRows) + col; p = bp + (i / info.dim[0]) * info.dimstride[1] + (i % info.dim[0]) * info.dimstride[0]; *((double *)p) = x->t_rosom[row][col].error; post("%d [%d, %d] %f %p", i, row, col, x->t_rosom[row][col].error, p); } } t_atom a; SETSYM(&a, name); outlet_anything(x->t_out, _jit_sym_jit_matrix, 1, &a); }
t_jit_tml_gl_videoplane *jit_gl_videoplane_new(t_symbol * dest_name) { t_jit_tml_gl_videoplane *x; t_atom rav[4]; t_atom *av=rav; // make jit object if (x = (t_jit_tml_gl_videoplane *)jit_object_alloc(_jit_tml_gl_videoplane_class)) { // create and attach ob3d jit_ob3d_new(x, dest_name); // set instance variable defaults x->dim[0] = 20; x->dim[1] = 20; x->chunk = jit_glchunk_grid_new(_jit_sym_gl_quad_grid, 12, x->dim[0], x->dim[1]); x->recalc = 1; x->displaylist = 0; x->dlref = 0; x->gridmode = 0; x->interp = 1; x->tex_offset_x = 0.; x->tex_offset_y = 0.; x->tex_scale_x = 1.; x->tex_scale_y = 1.; x->nudge = 0.0001; // hack for edges x->rect_tex = 1; x->client_storage = PLATFORM_DYNAMIC_TEX; x->colormode = gensym("argb"); jit_atom_setfloat(av,1.); jit_atom_setfloat(av+1,1.); jit_atom_setfloat(av+2,1.); jit_atom_setfloat(av+3,1.); jit_object_method(x,gensym("color"),4,av); x->texture = jit_object_new(ps_jit_gl_texture,jit_attr_getsym(x,ps_drawto)); if (x->texture) { x->texturename = jit_symbol_unique(); jit_attr_setsym(x->texture,_jit_sym_name,x->texturename); jit_attr_setsym(x->texture,gensym("defaultimage"),gensym("black")); jit_attr_setlong(x->texture,ps_rectangle,x->rect_tex); jit_attr_setsym(x->texture,ps_mode,x->client_storage?ps_dynamic:ps_static); jit_attr_setsym(x,ps_texture,x->texturename); } else { error("jit.tml.gl.videoplane: could not create texture"); x->texturename = _jit_sym_nothing; } } else { error("jit.tml.gl.videoplane: Failed at jit_object_alloc"); x = NULL; } return x; }
t_xray_jit_fdm *xray_jit_fdm_new(void) { t_xray_jit_fdm *x; void *m; t_jit_matrix_info info; if (x=(t_xray_jit_fdm *)jit_object_alloc(_xray_jit_fdm_class)) { x->spacestep = 1.0; x->direction = ps_x; x->calced = 0; x->dim[0] = 1; x->dim[1] = 1; //create internal matrix jit_matrix_info_default(&info); info.type = _jit_sym_float32; info.planecount = 1; x->previousName = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); m = jit_object_method(m, _jit_sym_register, x->previousName); //Register matrix name if(!m) error("could not allocate internal matrix!"); jit_object_attach(x->previousName, x); x->previous = m; } else { x = NULL; } return x; }
t_jit_field_mesh *jit_field_mesh_new(void) { t_jit_field_mesh *x; if((x=(t_jit_field_mesh *)jit_object_alloc(_jit_field_mesh_class))) { x->vertex_matrix = (t_jit_object *)jit_object_new(gensym("jit_matrix_wrapper"), jit_symbol_unique(), 0, NULL); x->normal_matrix = (t_jit_object *)jit_object_new(gensym("jit_matrix_wrapper"), jit_symbol_unique(), 0, NULL); x->index_matrix = (t_jit_object *)jit_object_new(gensym("jit_matrix_wrapper"), jit_symbol_unique(), 0, NULL); x->mode = gensym("mesh"); x->isolevel = 0; } else { x = NULL; } return x; }
t_jit_gl_hap *jit_gl_hap_new(t_symbol * dest_name) { t_jit_gl_hap *x; if (x = (t_jit_gl_hap *)jit_object_alloc(_jit_gl_hap_class)) { jit_ob3d_new(x, dest_name); jit_gl_hap_new_native(x); x->has_video = 0; x->file = _jit_sym_nothing; x->texoutput = jit_object_new(gensym("jit_gl_texture"), dest_name); jit_attr_setsym(x->texoutput,gensym("defaultimage"),gensym("black")); jit_attr_setsym(x->texoutput,_jit_sym_name,jit_symbol_unique()); jit_attr_setlong(x->texoutput, gensym("flip"), 0); x->hapglsl = jit_object_new(gensym("jit_gl_shader"), dest_name); x->buffer = NULL; x->hap_format = JIT_GL_HAP_PF_NONE; x->useshader = 0; x->validframe = 0; x->movieloaded = 0; x->deletetex = 0; x->texture = 0; x->dim[0] = x->dim[1] = 0; x->backingWidth = x->backingHeight = 0; x->roundedWidth = x->roundedHeight = 0; x->internalFormat = x->newInternalFormat = 0; x->newDataLength = x->rowLength = 0; x->target = 0; x->fboid = 0; x->direction = 1; x->suppress_loopnotify=0; x->userloop = 0; x->prevtime = 0; x->flipped = 0; x->adapt = 1; x->fps = 0; x->duration = 0; x->timescale = 0; x->framecount = 0; x->loop = JIT_GL_HAP_LOOP_ON; x->loopflags = 0; x->autostart = 1; x->rate = 1; x->vol = 1; x->rate_preserves_pitch = 1; x->looppoints[0] = x->looppoints[1] = -1; x->loopreport = 0; x->framereport = 0; } else { x = NULL; } return x; }
t_xray_jit_colormap *xray_jit_colormap_new(void) { t_xray_jit_colormap *x; void *m; t_jit_matrix_info info; if (x=(t_xray_jit_colormap *)jit_object_alloc(_xray_jit_colormap_class)) { x->mode = 0; jit_matrix_info_default(&info); info.dimcount = 1; info.type = _jit_sym_float32; info.planecount = 3; x->Colorname = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); m = jit_object_method(m, _jit_sym_register, x->Colorname); //Register matrix name if(!m) error("could not allocate internal matrix!"); jit_object_attach(x->Colorname, x); x->Color = m; jit_matrix_info_default(&info); info.dimcount = 1; info.type = _jit_sym_float32; info.planecount = 1; x->Countname = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); m = jit_object_method(m, _jit_sym_register, x->Countname); //Register matrix name if(!m) error("could not allocate internal matrix!"); jit_object_attach(x->Countname, x); x->Count = m; } else { x = NULL; } return x; }
t_xray_jit_levelsetseg *xray_jit_levelsetseg_new(void) { t_xray_jit_levelsetseg *x; void *m; t_jit_matrix_info info; t_atom a; if (x=(t_xray_jit_levelsetseg *)jit_object_alloc(_xray_jit_levelsetseg_class)) { x->evolve = 0; x->smooth = 0; x->point[0] = 160; x->point[1] = 120; x->pointcount = 2; x->radius = 4; x->cycles = 7; x->Na = 7; x->Ng = 3; x->Ns = 5; x->gaussKernel = NULL; jit_atom_setlong(&a, 5); xray_jit_levelsetseg_Ng(x, 0L, 1, &a); //allocate and initialize linked-list DLLcreateList( &(x->L_in) ); DLLcreateList( &(x->L_out) ); x->inside = (t_RegionStats *)jit_getbytes(sizeof(t_RegionStats)); x->outside = (t_RegionStats *)jit_getbytes(sizeof(t_RegionStats)); sqrtTwoPi = jit_math_sqrt(2*jit_math_acos(-1)); //setup backgFloat matrix jit_matrix_info_default(&info); info.type = _jit_sym_char; info.planecount = 1; x->phiName = jit_symbol_unique(); m = jit_object_new(_jit_sym_jit_matrix, &info); m = jit_object_method(m, _jit_sym_register, x->phiName); //Register matrix name if(!m) error("could not allocate internal matrix!"); jit_object_attach(x->phiName, x); x->phi = m; } else { x = NULL; } return x; }
void *max_jit_notify_new(t_symbol *s, long argc, t_atom *argv) { t_max_jit_notify *x; void *o; if (x=(t_max_jit_notify *)max_jit_obex_new(max_jit_notify_class,gensym("jit_notify"))) { if (o=jit_object_new(gensym("jit_notify"))) { max_jit_mop_setup_simple(x,o,argc,argv); max_jit_attr_args(x,argc,argv); //NOTIFY EXAMPLE: GENERATING A UNIQUE NAME + ASSOCIATING WITH JIT OBJECT(SERVER) x->servername = jit_symbol_unique(); jit_object_method(o,_jit_sym_register,x->servername); //this registers w/ the name jit_object_attach(x->servername,x); //this attaches max object(client) with jit object(server) } else { error("jit.notify: could not allocate object"); freeobject(x); } } return (x); }
t_jit_gl_lua *jit_gl_lua_new(t_symbol * dest_name) { t_jit_gl_lua *x; if (x=(t_jit_gl_lua *)jit_object_alloc(_jit_gl_lua_class)) { // create and attach ob3d jit_ob3d_new(x, dest_name); x->max_wrapper = NULL; //Lua x->lua = NULL; //lua file x->file = _jit_sym_nothing; x->file_volume = 0; x->texthandle = 0; x->file_watcher = NULL; x->textsize = 0; x->autowatch = 1; x->file_path[0] = '\0'; x->path = _jit_sym_nothing; x->drawinfo.ob3d = NULL; x->lua_unique_name = jit_symbol_unique(); x->gc = 1; x->memsize = 0; x->inlets = 1; x->outlets = 1; x->last_inlet = 0; lua_setup_lua(x); } else { x = NULL; } return x; }