示例#1
0
t_jit_err jit_scissors_init(void) 
{
	long attrflags=0;
	void *attr, *mop;
	
	_jit_scissors_class = jit_class_new("jit_scissors", (method)jit_scissors_new, (method)jit_scissors_free,
		sizeof(t_jit_scissors), 0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop, 1, -1); //#inputs, #outputs(variable)
	jit_class_addadornment(_jit_scissors_class, mop);
	//add methods
	jit_class_addmethod(_jit_scissors_class, (method)jit_scissors_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset, "rows", _jit_sym_long, attrflags,
		(method)0, (method)0, calcoffset(t_jit_scissors, rows));
	jit_attr_addfilterset_clip(attr, 1, 16, 1, 1);
	jit_class_addattr(_jit_scissors_class, attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset, "columns", _jit_sym_long, attrflags,
		(method)0, (method)0, calcoffset(t_jit_scissors, cols));
	jit_attr_addfilterset_clip(attr, 1, 16, 1, 1);
	jit_class_addattr(_jit_scissors_class, attr);

	attrflags = JIT_ATTR_GET_OPAQUE_USER | JIT_ATTR_SET_OPAQUE_USER;
	attr = jit_object_new(_jit_sym_jit_attr_offset, "max", _jit_sym_long, attrflags,
		(method)0, (method)0, calcoffset(t_jit_scissors, max));
	jit_class_addattr(_jit_scissors_class, attr);

	jit_class_register(_jit_scissors_class);

	return JIT_ERR_NONE;
}
示例#2
0
t_jit_err jit_glue_init(void) 
{
	long attrflags=0;
	void *attr,*mop,*o;
	
	_jit_glue_class = jit_class_new("jit_glue",(method)jit_glue_new,(method)jit_glue_free,
		sizeof(t_jit_glue),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,-1,1); //#inputs,#outputs(variable)
	o = jit_object_method(mop,_jit_sym_getoutput,1);
	jit_attr_setlong(o,_jit_sym_dimlink,0);
	jit_class_addadornment(_jit_glue_class,mop);
	//add methods
	jit_class_addmethod(_jit_glue_class, (method)jit_glue_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rows",_jit_sym_long,attrflags,
		(method)0,(method)0,calcoffset(t_jit_glue,rows));
	jit_attr_addfilterset_clip(attr,1,16,1,1);
	jit_class_addattr(_jit_glue_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"columns",_jit_sym_long,attrflags,
		(method)0,(method)0,calcoffset(t_jit_glue,cols));
	jit_attr_addfilterset_clip(attr,1,16,1,1);
	jit_class_addattr(_jit_glue_class,attr);

	attrflags = JIT_ATTR_GET_OPAQUE_USER | JIT_ATTR_SET_OPAQUE_USER;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"input",_jit_sym_long,attrflags,
		(method)0,(method)0,calcoffset(t_jit_glue,input));
	jit_class_addattr(_jit_glue_class,attr);

	jit_class_register(_jit_glue_class);

	return JIT_ERR_NONE;
}
示例#3
0
t_jit_err cv_jit_lines_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	
	_cv_jit_lines_class = jit_class_new("cv_jit_lines",(method)cv_jit_lines_new,(method)cv_jit_lines_free,
		sizeof(t_cv_jit_lines),0L);

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output

   	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	output = (t_jit_object *)jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix
   	jit_attr_setlong(output,_jit_sym_minplanecount,4);  //Set output plane count
  	jit_attr_setlong(output,_jit_sym_maxplanecount,4); //4 -> Coordinates of start and end points for each line
  	jit_attr_setlong(output,_jit_sym_mindim,1);  //Only one dimension
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_long);
  	
  	jit_class_addadornment(_cv_jit_lines_class,mop);
  	
	//add methods
	jit_class_addmethod(_cv_jit_lines_class, (method)cv_jit_lines_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"threshold",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,threshold));
	jit_attr_addfilterset_clip(attr,1,255,TRUE,TRUE);	//clip to 1-255
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"resolution",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,resolution));
	jit_attr_addfilterset_clip(attr,1,10,TRUE,TRUE);	//clip to 1-10
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"gap",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,gap));
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"length",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,length));
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"sensitivity",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_lines,sensitivity));
	jit_attr_addfilterset_clip(attr,1,255,TRUE,TRUE);	//clip to 1-255
	jit_class_addattr(_cv_jit_lines_class,attr);
	
	jit_class_register(_cv_jit_lines_class);

	return JIT_ERR_NONE;
}
示例#4
0
t_jit_err cv_jit_LKflow_init(void) 
{
	long 			attrflags=0;
	t_jit_object 	*attr,*mop;
	
	_cv_jit_LKflow_class = jit_class_new("cv_jit_LKflow",(method)cv_jit_LKflow_new,(method)cv_jit_LKflow_free,sizeof(t_cv_jit_LKflow),A_CANT,0L); //A_CANT = untyped

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);
	jit_mop_single_type(mop,_jit_sym_float32);	
	jit_mop_single_planecount(mop,2);	
	jit_class_addadornment(_cv_jit_LKflow_class,mop);
	
	//add methods
	jit_class_addmethod(_cv_jit_LKflow_class, (method)cv_jit_LKflow_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"radius",_jit_sym_long,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_LKflow,radius));
	jit_attr_addfilterset_clip(attr,1,7,TRUE,TRUE);	//clip to 1-7
	jit_class_addattr(_cv_jit_LKflow_class,attr);
	
	jit_class_register(_cv_jit_LKflow_class);

	return JIT_ERR_NONE;
}
示例#5
0
t_jit_err cv_jit_blobs_direction_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_blobs_direction_class = jit_class_new("cv_jit_blobs_direction",(method)cv_jit_blobs_direction_new,(method)cv_jit_blobs_direction_free,
		sizeof(t_cv_jit_blobs_direction),0L); 

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output

   	jit_mop_single_type(mop,_jit_sym_float32);   //Set input type and planecount
   	jit_mop_single_planecount(mop,17);  
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	output = jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix
   	jit_attr_setlong(output,_jit_sym_minplanecount,1);
  	jit_attr_setlong(output,_jit_sym_maxplanecount,1);
  	jit_attr_setlong(output,_jit_sym_mindim,1);
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_float32);
   	   	
	jit_class_addadornment(_cv_jit_blobs_direction_class,mop);
	
	
	//add methods
	jit_class_addmethod(_cv_jit_blobs_direction_class, (method)cv_jit_blobs_direction_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);	

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_blobs_direction,mode));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_blobs_direction_class,attr);
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"flip",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_blobs_direction,flip));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_blobs_direction_class,attr);
		
	jit_class_register(_cv_jit_blobs_direction_class);

	return JIT_ERR_NONE;
}
示例#6
0
int main(void)
{	
	void *p, *q;
	t_jit_object	*attr;
	
	post("jit.openni %s, Copyright (c) 2011 Dale Phurrough. This program comes with ABSOLUTELY NO WARRANTY.", JIT_OPENNI_VERSION);
	post("jit.openni %s, Licensed under the GNU General Public License v3.0 (GPLv3) available at http://www.gnu.org/licenses/gpl-3.0.html", JIT_OPENNI_VERSION);

	// initialize the Jitter class by calling Jitter class's registration function
	jit_openni_init();
	
	// create the Max wrapper class
	setup((t_messlist**)&max_jit_openni_class, (method)max_jit_openni_new, (method)max_jit_openni_free, sizeof(t_max_jit_openni), 0, A_GIMME, 0);
	
	// specify a byte offset to keep additional OBEX information
	p = max_jit_classex_setup(calcoffset(t_max_jit_openni, obex));
	
	// look up the Jitter class in the class registry
	q = jit_class_findbyname(gensym("jit_openni"));    
    
	// add default methods and attributes for MOP max wrapper class, e.g. name, type, dim, planecount, bang, outputmatrix, etc
	max_jit_classex_mop_wrap(p, q, MAX_JIT_MOP_FLAGS_OWN_OUTPUTMATRIX|MAX_JIT_MOP_FLAGS_OWN_JIT_MATRIX|MAX_JIT_MOP_FLAGS_OWN_ADAPT);

	// add custom max wrapper attributes
	attr = jit_object_new(_jit_sym_jit_attr_offset, "skeleton_format", _jit_sym_char, JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW,
			NULL, NULL, calcoffset(t_max_jit_openni, chrSkeletonOutputFormat));
	jit_attr_addfilterset_clip(attr,0,2,TRUE,TRUE);
	max_jit_classex_addattr(p, attr);

	// wrap the Jitter class with the standard methods for Jitter objects, e.g. getattributes, dumpout, maxjitclassaddmethods, etc
	max_jit_classex_standard_wrap(p, q, 0);

    // add methods to the Max wrapper class
	max_addmethod_usurp_low((method)max_jit_openni_outputmatrix, "outputmatrix");	
	max_addmethod_usurp_low((method)max_jit_openni_XMLConfig_read, "read");

	// add an inlet/outlet assistance method; in this case the default matrix-operator (mop) assist fn 
	addmess((method)max_jit_openni_assist, "assist", A_CANT, 0);
	return 0;
}
示例#7
0
t_jit_err jit_gl_videoplane_init(void) 
{
	long attrflags=0;
	long ob3d_flags=0;
	t_jit_object *attr;
	void * ob3d;
	
	_jit_gl_videoplane_class = jit_class_new("jit_gl_videoplane", (method)jit_gl_videoplane_new, (method)jit_gl_videoplane_free,
		sizeof(t_jit_gl_videoplane),A_DEFSYM,0L);
	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_jit_matrix,		"jit_matrix", 			A_USURP_LOW, 0);	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_sendtexture,	"sendtexture", 			A_DEFER_LOW, 0);	

	// set up object extension for 3d object, customized with flags
	ob3d = jit_ob3d_setup(_jit_gl_videoplane_class, calcoffset(t_jit_gl_videoplane, ob3d), ob3d_flags);

	// add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"dim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_videoplane_dim,0/*fix*/,calcoffset(t_jit_gl_videoplane,dim));
	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"displaylist",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_videoplane_displaylist,calcoffset(t_jit_gl_videoplane, displaylist));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"gridmode",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, gridmode));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"interp",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_interp,calcoffset(t_jit_gl_videoplane, interp));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"nudge",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, nudge));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_offset_x",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_offset_x));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_offset_y",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_offset_y));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_scale_x",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_scale_x));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	attr = jit_object_new(_jit_sym_jit_attr_offset,"tex_scale_y",_jit_sym_float32,attrflags,
		(method)0L,(method)jit_gl_videoplane_attr_rebuild,calcoffset(t_jit_gl_videoplane, tex_scale_y));	
	jit_class_addattr(_jit_gl_videoplane_class,attr); 				
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rect_tex",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_rect_tex,calcoffset(t_jit_gl_videoplane, rect_tex));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"client_storage",_jit_sym_long,attrflags,
		(method)0L,(method)jit_gl_videoplane_client_storage,calcoffset(t_jit_gl_videoplane, client_storage));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"colormode",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_videoplane_colormode,calcoffset(t_jit_gl_videoplane, colormode));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);
	CLASS_ATTR_ENUM(_jit_gl_videoplane_class,"colormode",0,"argb uyvy");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"texturename",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_videoplane_texturename,calcoffset(t_jit_gl_videoplane, texturename));	
	jit_class_addattr(_jit_gl_videoplane_class,attr);	

	// define our OB3D draw method.  called in automatic mode by 
	// jit.gl.render or otherwise through ob3d when banged. this 
	// method is A_CANT because our draw setup needs to happen 
	// in the ob3d beforehand to initialize OpenGL state 
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_draw, "ob3d_draw", A_CANT, 0L);
	
	// define our dest_closing and dest_changed methods. 
	// these methods are called by jit.gl.render when the 
	// destination context closes or changes: for example, when 
	// the user moves the window from one monitor to another. Any 
	// resources your object keeps in the OpenGL machine 
	// (e.g. textures, display lists, vertex shaders, etc.) 
	// will need to be freed when closing, and rebuilt when it has 
	// changed. 
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_dest_changed, "dest_changed",	A_CANT, 0L);
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_dest_closing, "dest_closing",	A_CANT, 0L);

	// rebuild_geometry is called if texture units or other 
	// attributes change requiring a rebuild
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_gl_videoplane_rebuild_geometry, "rebuild_geometry", 0L);
	
	// must register for ob3d	
	jit_class_addmethod(_jit_gl_videoplane_class, (method)jit_object_register, 				"register",		A_CANT, 0L);

	jit_class_register(_jit_gl_videoplane_class);

	ps_bind				= gensym("bind");
	ps_unbind			= gensym("unbind");
	ps_jit_gl_texture	= gensym("jit_gl_texture");
	ps_rectangle		= gensym("rectangle");
	ps_colormode		= gensym("colormode");
	ps_mode				= gensym("mode");
	ps_static			= gensym("static");
	ps_dynamic			= gensym("dynamic");
	ps_drawto			= gensym("drawto");
	ps_texture			= gensym("texture");
	ps_filter			= gensym("filter");
	ps_linear			= gensym("linear");
	ps_nearest			= gensym("nearest");

	ps_gridmode			= gensym("gridmode");
	ps_nudge			= gensym("nudge");
	ps_tex_offset_x		= gensym("tex_offset_x");
	ps_tex_offset_y		= gensym("tex_offset_y");
	ps_tex_scale_x		= gensym("tex_scale_x");
	ps_tex_scale_y		= gensym("tex_scale_y");


	return JIT_ERR_NONE;
}
示例#8
0
t_jit_err cv_jit_shift_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_shift_class = jit_class_new("cv_jit_shift",(method)cv_jit_shift_new,(method)cv_jit_shift_free,
		sizeof(t_cv_jit_shift),0L); 

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,0);  //Object has one input and no Jitter output
	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
	jit_class_addadornment(_cv_jit_shift_class,mop);
	
	//add methods
	jit_class_addmethod(_cv_jit_shift_class, (method)cv_jit_shift_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);

	//add attributes	
	attrflags = JIT_ATTR_SET_OPAQUE_USER | JIT_ATTR_GET_OPAQUE_USER;
	//box: the resulting bounding rectangle, passed to the Max wrapper
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"box",_jit_sym_atom,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,boxcount),calcoffset(t_cv_jit_shift,box));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//vertices: the rotated frame that bounds the object
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"vertices",_jit_sym_atom,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,framecount),calcoffset(t_cv_jit_shift,frame));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//Mass: the area's mass
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"mass",_jit_sym_float32,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,mass));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	//rect: the start bounding rectangle
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array,"rect",_jit_sym_long,4,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,rectcount),calcoffset(t_cv_jit_shift,rect));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//Maximum number of iterations
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"maxiters",_jit_sym_long,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,maxiters));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//The minimum displacement
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"distance",_jit_sym_float64,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,epsilon));
	jit_class_addattr(_cv_jit_shift_class,attr);
	
	//The mode, 0: meanshift -- 1: camshift
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_cv_jit_shift,mode));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);
	jit_class_addattr(_cv_jit_shift_class,attr);
			
	jit_class_register(_cv_jit_shift_class);

	return JIT_ERR_NONE;
}
BEGIN_USING_C_LINKAGE
int C74_EXPORT main(void)
{
	t_class         *c;
    t_jit_object	*attr;
    long            attrflags;

	c = class_new("o.jit.pcl.supervoxel", (method)o_jit_pcl_supervoxel_new, (method)o_jit_pcl_supervoxel_free, sizeof(t_o_jit_pcl_supervoxel), NULL, A_GIMME, 0);
	max_jit_class_obex_setup(c, calcoffset(t_o_jit_pcl_supervoxel, obex));
    
    class_addmethod(c, (method)o_jit_pcl_supervoxel_matrix_calc, "jit_matrix", A_GIMME, 0);
	class_addmethod(c, (method)max_jit_mop_assist, "assist", A_CANT, 0);	// standard matrix-operator (mop) assist fn

    attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW ;

    // add attribute(s)
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "disable_transform",
                                          _jit_sym_long,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, disable_transform));
    jit_attr_addfilterset_clip(attr, 0, 1, true, true);
    jit_class_addattr(c, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "voxel_resolution",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, voxel_resolution));
    jit_class_addattr(c, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "seed_resolution",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, seed_resolution));
    
    jit_class_addattr(c, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "color_importance",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, color_importance));
    jit_class_addattr(c, attr);
    
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "spatial_importance",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, spatial_importance));
    jit_class_addattr(c, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "normal_importance",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_o_jit_pcl_supervoxel, normal_importance));
    jit_class_addattr(c, attr);
    
	class_register(CLASS_BOX, c);
	o_jit_pcl_supervoxel_class = c;
	return 0;
}
示例#10
0
t_jit_err jit_freenect_grab_init(void)
{
	long attrflags=0;
	t_jit_object *attr;
	t_jit_object *mop,*output;
	t_atom a[4];
	
	global_id=0;
	x_systhread = NULL;
	x_systhread_cancel=FALSE;
	freenect_active=FALSE;
	open_device_count=0;
	
	s_rgb = gensym("rgb");
	s_RGB = gensym("RGB");
	s_ir = gensym("ir");
	s_IR = gensym("IR");
	
	_jit_freenect_grab_class = jit_class_new("jit_freenect_grab",(method)jit_freenect_grab_new,
											 (method)jit_freenect_grab_free, sizeof(t_jit_freenect_grab),0L);
  	
	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,0,2); //0 inputs, 2 outputs
	
	//Prepare depth image, all values are hard-coded, may need to be queried for safety?
	output = jit_object_method(mop,_jit_sym_getoutput,1);
		
	jit_atom_setsym(a,_jit_sym_float32); //default
	jit_atom_setsym(a+1,_jit_sym_long);
	jit_atom_setsym(a+2,_jit_sym_float64);
	jit_object_method(output,_jit_sym_types,3,a);
	
	jit_atom_setlong(&a[0], DEPTH_WIDTH);
	jit_atom_setlong(&a[1], DEPTH_HEIGHT);
	
	jit_object_method(output, _jit_sym_mindim, 2, a);  //Two dimensions, sizes in atom array
	jit_object_method(output, _jit_sym_maxdim, 2, a);
	
	//Prepare RGB image
	output = jit_object_method(mop,_jit_sym_getoutput,2);
	
	jit_atom_setsym(a,_jit_sym_char); //default
	jit_object_method(output,_jit_sym_types,1,a);
	
	jit_attr_setlong(output,_jit_sym_minplanecount,4);
	jit_attr_setlong(output,_jit_sym_maxplanecount,4);
	
	jit_atom_setlong(&a[0], RGB_WIDTH);
	jit_atom_setlong(&a[1], RGB_HEIGHT);
	
	jit_object_method(output, _jit_sym_mindim, 2, a);
	jit_object_method(output, _jit_sym_maxdim, 2, a);
	
	jit_class_addadornment(_jit_freenect_grab_class,mop);
	
	//add methods
	jit_class_addmethod(_jit_freenect_grab_class, (method)jit_freenect_grab_open, "open", A_GIMME, 0L);
	jit_class_addmethod(_jit_freenect_grab_class, (method)jit_freenect_grab_close, "close", A_GIMME, 0L);
	
	jit_class_addmethod(_jit_freenect_grab_class, (method)jit_freenect_grab_matrix_calc, "matrix_calc", A_CANT, 0L);
	
	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"unique",_jit_sym_char,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,unique));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"threshold",_jit_sym_float32,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,threshold));
	jit_attr_addfilterset_clip(attr,0,0,TRUE,FALSE);
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	//attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"cleardepth",_jit_sym_char,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,clear_depth));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_char,
										  attrflags,(method)NULL,(method)jit_freenect_grab_set_mode,calcoffset(t_jit_freenect_grab,mode));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"format",_jit_sym_atom,
										  attrflags,(method)NULL,(method)jit_freenect_grab_set_format,calcoffset(t_jit_freenect_grab,format));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"tilt",_jit_sym_long,
										  attrflags,(method)jit_freenect_grab_get_tilt,(method)jit_freenect_grab_set_tilt,
										  calcoffset(t_jit_freenect_grab,tilt));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"aligndepth",_jit_sym_char,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,aligndepth));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_OPAQUE;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"index",_jit_sym_long,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,index));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"ndevices",_jit_sym_long,
										  attrflags,(method)jit_freenect_grab_get_ndevices,(method)NULL,calcoffset(t_jit_freenect_grab,ndevices));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array, "accel", _jit_sym_float64, 3, 
										  attrflags, (method)jit_freenect_grab_get_accel,(method)NULL, 
										  calcoffset(t_jit_freenect_grab, accelcount),calcoffset(t_jit_freenect_grab,mks_accel));
	jit_class_addattr(_jit_freenect_grab_class,attr);

	
	attrflags = JIT_ATTR_GET_OPAQUE_USER | JIT_ATTR_SET_OPAQUE_USER;
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,"has_frames",_jit_sym_char,
										  attrflags,(method)NULL,(method)NULL,calcoffset(t_jit_freenect_grab,has_frames));
	jit_class_addattr(_jit_freenect_grab_class,attr);
	
	jit_class_register(_jit_freenect_grab_class);
	
	post("jit.freenect.grab: Copyright 2010, Jean-Marc Pelletier, Nenad Popov and Andrew Roth. Built on %s",DEBUG_TIMESTAMP);
	return JIT_ERR_NONE;
}
示例#11
0
t_jit_err jit_print_init(void)
{
	long attrflags=0;
	t_jit_object *attr;
	t_jit_object *mop;

	_jit_print_class = jit_class_new("jit_print",(method)jit_print_new,(method)jit_print_free,
									 sizeof(t_jit_print),0L);

	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,1,1);
	jit_class_addadornment(_jit_print_class,mop);
	//add methods
	jit_class_addmethod(_jit_print_class, (method)jit_print_matrix_calc, "matrix_calc", A_CANT, 0L);

	//add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = jit_object_new(_jit_sym_jit_attr_offset,"precision",_jit_sym_char,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print,precision));
	jit_attr_addfilterset_clip(attr,0,0,TRUE,FALSE);	//clip to 0-x
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"Precision");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"fieldwidth",_jit_sym_char,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print,fieldwidth));
	jit_attr_addfilterset_clip(attr,0,0,TRUE,FALSE);	//clip to 0-x
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Field Width\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"mode",_jit_sym_char,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print,mode));
	jit_attr_addfilterset_clip(attr,0,2,TRUE,TRUE);	//clip to 0-2
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"Mode");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"zeropad",_jit_sym_char,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print,zeropad));
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Zero Pad\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"planedelim",_jit_sym_symbol,attrflags,
						  (method)jit_print_planedelim_get,(method)jit_print_planedelim_set,0L);
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Plane Delimiter\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"coldelim",_jit_sym_symbol,attrflags,
						  (method)jit_print_coldelim_get,(method)jit_print_coldelim_set,0L);
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Column Delimiter\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"rowdelim",_jit_sym_symbol,attrflags,
						  (method)jit_print_rowdelim_get,(method)jit_print_rowdelim_set,0L);
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"\"Row Delimiter\"");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"title",_jit_sym_symbol,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print, title));
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"Title");
	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"info",_jit_sym_char,attrflags,
						  (method)0L,(method)0L,calcoffset(t_jit_print, info));
	jit_attr_addfilterset_clip(attr,0,2,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_jit_print_class,attr);
	object_addattr_parse(attr,"label",_jit_sym_symbol,0,"Info");
	

	jit_class_register(_jit_print_class);
	ps_null = gensym("");
	ps_tab = gensym("tab");
	ps_cr = gensym("cr");
	ps_space = gensym("space");

	return JIT_ERR_NONE;
}
示例#12
0
t_jit_err cv_jit_features_init(void) 
{
	long attrflags=0;
	t_jit_object *attr,*mop,*output;
	t_symbol *atsym;
	
	atsym = gensym("jit_attr_offset");
	
	_cv_jit_features_class = jit_class_new("cv_jit_features",(method)cv_jit_features_new,(method)cv_jit_features_free,
		sizeof(t_cv_jit_features),A_CANT,0L); //A_CANT = untyped

	//add mop
	mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop,1,1);  //Object has one input and one output
	output = (t_jit_object *)jit_object_method(mop,_jit_sym_getoutput,1); //Get a pointer to the output matrix

   	jit_mop_single_type(mop,_jit_sym_char);   //Set input type and planecount
   	jit_mop_single_planecount(mop,1);  
   	
   	jit_mop_output_nolink(mop,1); //Turn off output linking so that output matrix does not adapt to input
   	
   	jit_attr_setlong(output,_jit_sym_minplanecount,2);  //Two planes, holding the feature's coordinates 
  	jit_attr_setlong(output,_jit_sym_maxplanecount,2);
  	jit_attr_setlong(output,_jit_sym_mindim,1); //Only one dimension
  	jit_attr_setlong(output,_jit_sym_maxdim,1);
  	jit_attr_setsym(output,_jit_sym_types,_jit_sym_float32); //Coordinates are returned with sub-pixel accuracy
   	   	
	jit_class_addadornment(_cv_jit_features_class,mop);
	
	
	//add methods
	jit_class_addmethod(_cv_jit_features_class, (method)cv_jit_features_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);	

	//add attributes	
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	
	//threshold
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"threshold",_jit_sym_float64,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,threshold));			
	jit_attr_addfilterset_clip(attr,0.001,1,TRUE,TRUE);	//clip to 0.001-1
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//minimum distance
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"distance",_jit_sym_float64,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,distance));			
	jit_attr_addfilterset_clip(attr,0,0,TRUE,FALSE);	//clip to 0
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//roi
	attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset_array, "roi", _jit_sym_long, 4, attrflags, (method)0L, (method)0L, calcoffset(t_cv_jit_features, roicount),calcoffset(t_cv_jit_features,roi));
	jit_class_addattr(_cv_jit_features_class, attr);
	
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"useroi",_jit_sym_char,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,useroi));			
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_features_class, attr);
	
	//Precision
	attr = (t_jit_object *)jit_object_new(	_jit_sym_jit_attr_offset,"precision",_jit_sym_char,attrflags,(method)0L,(method)0L,calcoffset(t_cv_jit_features,precision));			
	jit_attr_addfilterset_clip(attr,0,1,TRUE,TRUE);	//clip to 0-1
	jit_class_addattr(_cv_jit_features_class, attr);
			
	jit_class_register(_cv_jit_features_class);

	return JIT_ERR_NONE;
}
t_jit_err jit_gl_terrain_init(void) 
{
	long attrflags=0;
	long ob3d_flags=0;
	t_jit_object *attr;
	void * ob3d;

	//try to add matrix inside
		t_atom a;
	void *o,*mop;

	_jit_gl_terrain_class = jit_class_new("jit_gl_terrain", (method)jit_gl_terrain_new, (method)jit_gl_terrain_free,
		sizeof(t_jit_gl_terrain),A_CANT,0L); //A_CANT = untyped
	
	// set up object extension for 3d object, customized with flags
	ob3d = jit_ob3d_setup(_jit_gl_terrain_class, calcoffset(t_jit_gl_terrain, ob3d), ob3d_flags);

/*
	//add mop
	mop = jit_object_new(_jit_sym_jit_mop,2,1);
	jit_mop_single_type(mop,_jit_sym_char);	
	o = jit_object_method(mop,_jit_sym_getinput,2);
	jit_attr_setlong(o,_jit_sym_dimlink,0);
	jit_atom_setlong(&a,256);
	jit_object_method(o,_jit_sym_mindim,1,&a);
	jit_object_method(o,_jit_sym_maxdim,1,&a);
	jit_class_addadornment(_jit_gl_terrain_class,mop);

*/

	// add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;

	// jkc email method
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_jit_matrix, "jit_matrix",A_USURP_LOW, 0);	



	// shape
	attr = jit_object_new(_jit_sym_jit_attr_offset,"shape",_jit_sym_symbol,attrflags,
		(method)0L,(method)jit_gl_terrain_shape,calcoffset(t_jit_gl_terrain, shape));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"dim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_terrain_dim,0/*fix*/,calcoffset(t_jit_gl_terrain,dim));
	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"displaylist",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_displaylist,calcoffset(t_jit_gl_terrain, displaylist));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	attr = jit_object_new(_jit_sym_jit_attr_offset,"gridmode",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, gridmode));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	


	attr = jit_object_new(_jit_sym_jit_attr_offset,"calc_norms",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, calc_norms));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	//doesnt work right now. cant call gl ops from draw_grid
	attr = jit_object_new(_jit_sym_jit_attr_offset,"draw_norms",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, draw_norms));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"shift",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_shift,calcoffset(t_jit_gl_terrain, shift));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"dir",_jit_sym_char,attrflags,
		(method)0L,(method)jit_gl_terrain_shift,calcoffset(t_jit_gl_terrain, shift));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

//	post("before attrib_jit_sym_float32\, MAXGRID\, attrflags\,");
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"pos",_jit_sym_float32, MAXGRID, attrflags,		//add 64floats to pos
		(method)0L,(method)jit_gl_terrain_pos,0/*fix*/,calcoffset(t_jit_gl_terrain, pos));	
//	jit_attr_addfilterset_clip(attr,MAXGRID,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
//	post("after attrib_jit_sym_float32\, MAXGRID\, attrflags\,");


	attr = jit_object_new(_jit_sym_jit_attr_offset,"om",_jit_sym_char,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, om));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	attr = jit_object_new(_jit_sym_jit_attr_offset,"getindice",0L,attrflags,
		(method)0L,(method)0L,calcoffset(t_jit_gl_terrain, getindice));	
	jit_class_addattr(_jit_gl_terrain_class,attr);	


	//added 27.4.2004
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"coords",_jit_sym_float32,2,attrflags,
		(method)0L,(method)jit_gl_terrain_coords,0/*fix*/,calcoffset(t_jit_gl_terrain,coords));
	jit_class_addattr(_jit_gl_terrain_class,attr);	



	//heaedxyz method from gl_ruttetra; get to find which y we want
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"head_xyz",_jit_sym_float32,3,attrflags,
		(method)0L,(method)jit_gl_terrain_head_xyz,0/*fix*/,calcoffset(t_jit_gl_terrain,head_xyz));
//s	jit_attr_addfilterset_clip(attr,2,0,TRUE,FALSE);
	jit_class_addattr(_jit_gl_terrain_class,attr);	
	
	
		//max gldim
	attr = jit_object_new(_jit_sym_jit_attr_offset_array,"maxdim",_jit_sym_long,2,attrflags,
		(method)0L,(method)jit_gl_terrain_maxdim,0/*fix*/,calcoffset(t_jit_gl_terrain,maxdim));
	jit_class_addattr(_jit_gl_terrain_class,attr);	

	// handle draw method.  called in automatic mode by jit.gl.render, or otherwise through ob3d when banged.
	// this is A_CANT because draw setup needs to happen in the ob3d beforehand. 
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_draw, "ob3d_draw", A_CANT, 0L);
	
	// handle dest_changed method.
	// this method is called by jit.render when the destination context changes: for example,
	// when the user moves the window from one monitor to another.  Anything your object keeps
	// in the OpenGL machine -- textures, display lists, vertex shaders, etc. -- will need to
	// be rebuilt here. 
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_dest_changed, "dest_changed", A_CANT, 0L);


	
	// must register for ob3d	
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_object_register, 			"register",		A_CANT, 0L);
	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_dest_closing, 	"dest_closing",	A_CANT, 0L);


	//add matrix methods
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_matrix_calc, 		"matrix_calc", 		A_CANT, 0L);


	// jkc fix
//	jit_class_addmethod(_jit_gl_terrain_class, (method)jit_gl_terrain_jit_matrix, "jit_matrix",A_USURP_LOW, 0);	



	jit_class_register(_jit_gl_terrain_class);

	ps_terrain 			= gensym("terrain");

	return JIT_ERR_NONE;
}