Beispiel #1
0
t_jit_err jit_tml_fakeDepth_init(void) 
{
    long attrflags=0;
    t_jit_object *attr;
    t_jit_object *mop, *o;
	
	
    _jit_tml_fakeDepth_class = jit_class_new("jit_tml_fakeDepth",(method)jit_tml_fakeDepth_new,(method)jit_tml_fakeDepth_free,
						 sizeof(t_jit_tml_fakeDepth),A_CANT,0L); //A_CANT = untyped

    // add mop
    mop = jit_object_new(_jit_sym_jit_mop,2,1);	// 1 matrix input / 1 matrix output

    // need this for getting correct matrix_info from 2nd input matrix....  (see jit.concat.c...)
    jit_mop_input_nolink(mop,2);
    o= jit_object_method(mop,_jit_sym_getinput,2);
    jit_object_method(o,_jit_sym_ioproc,jit_mop_ioproc_copy_adapt); 
	
    jit_class_addadornment(_jit_tml_fakeDepth_class,mop);
	
    // add methods
    jit_class_addmethod(_jit_tml_fakeDepth_class, (method)jit_tml_fakeDepth_matrix_calc, "matrix_calc", A_CANT, 0L);
	
	//Add attributes
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;	

		
    jit_class_register(_jit_tml_fakeDepth_class);

    return JIT_ERR_NONE;
}
t_jit_err jit_ys_pixelweightmat_init(void) 
{
    long attrflags=0;
    t_jit_object *attr;
    t_jit_object *mop, *o;
	
	
    _jit_ys_pixelweightmat_class = jit_class_new("jit_ys_pixelweightmat",(method)jit_ys_pixelweightmat_new,(method)jit_ys_pixelweightmat_free,
						 sizeof(t_jit_ys_pixelweightmat),A_CANT,0L); //A_CANT = untyped

    // add mop
    mop = jit_object_new(_jit_sym_jit_mop,2,1);	// 1 matrix input / 1 matrix output

    // need this for getting correct matrix_info from 2nd input matrix....  (see jit.concat.c...)
    jit_mop_input_nolink(mop,2);
    o= jit_object_method(mop,_jit_sym_getinput,2);
    jit_object_method(o,_jit_sym_ioproc,jit_mop_ioproc_copy_adapt); 
	
    jit_class_addadornment(_jit_ys_pixelweightmat_class,mop);
	
    // add methods
    jit_class_addmethod(_jit_ys_pixelweightmat_class, (method)jit_ys_pixelweightmat_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_array,"param",_jit_sym_float32,
							JIT_MATRIX_MAX_PLANECOUNT, attrflags,(method)0L,(method)0L,
							calcoffset(t_jit_ys_pixelweightmat,paramcount),calcoffset(t_jit_ys_pixelweightmat,param));
	jit_class_addattr(_jit_ys_pixelweightmat_class,attr);

		
    jit_class_register(_jit_ys_pixelweightmat_class);

    return JIT_ERR_NONE;
}
t_jit_err jit_tml_constellations_init(void) 
{
	long attrflags=0;
	t_jit_object *attr;
	t_jit_object *mop, *o;
	
	//Create class with given constructors & destructors
	_jit_tml_constellations_class = jit_class_new("jit_tml_constellations",(method)jit_tml_constellations_new,(method)jit_tml_constellations_free,
		sizeof(t_jit_tml_constellations),A_CANT,0L); //A_CANT = untyped

	// 2 matrix input / 3 matrix output
	mop = (t_jit_object*)jit_object_new(_jit_sym_jit_mop,2,3);

	// need this for getting correct matrix_info from 2nd input matrix....  (see jit.concat.c...)
	jit_mop_input_nolink(mop,2);
	 o= (t_jit_object*)jit_object_method(mop,_jit_sym_getinput,2);
	jit_object_method(o,_jit_sym_ioproc,jit_mop_ioproc_copy_adapt); 
	
	jit_class_addadornment(_jit_tml_constellations_class,mop);
	
	// add methods
	jit_class_addmethod(_jit_tml_constellations_class, (method)jit_tml_constellations_matrix_calc, "matrix_calc", A_CANT, 0L);
	
	// Add attribute -- invert (0 or 1) - go from white/black to black/white
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "invert", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setInvert,
							calcoffset(t_jit_tml_constellations, invert));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- minimum blob size (since blobs get huge)
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "minBlobSize", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setMinBlobSize,
							calcoffset(t_jit_tml_constellations, minBlobSize));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- threshold (error)
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "threshold", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setThreshold,
							calcoffset(t_jit_tml_constellations, threshold));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- threshold on the movement
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "movementThreshold", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setMovementThreshold,
							calcoffset(t_jit_tml_constellations, movementThreshold));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- rate of learning (how many frames until stability?)
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "learnRate", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setLearnRate,
							calcoffset(t_jit_tml_constellations, learnRate));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- ptCount - the number of points to use for outline.
	attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
	attr = (t_jit_object*)jit_object_new(_jit_sym_jit_attr_offset, "ptCount", _jit_sym_long,
							attrflags, (method)0L,
							(method)jit_tml_constellations_setPtCount,
							calcoffset(t_jit_tml_constellations, ptCount));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	
	// Add attribute -- grays (error)
	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)jit_tml_constellations_setRadius,
							calcoffset(t_jit_tml_constellations, radius));
	jit_class_addattr(_jit_tml_constellations_class, attr);
	
	//Done!	
	jit_class_register(_jit_tml_constellations_class);

	return JIT_ERR_NONE;
}
t_jit_err jit_pcl_concavehull_init(void)
{
    long			attrflags = JIT_ATTR_GET_DEFER_LOW | JIT_ATTR_SET_USURP_LOW;
    t_jit_object	*attr;
    t_jit_object	*mop;
    t_atom a[1];
    
    s_jit_pcl_concavehull_class = jit_class_new("jit_pcl_concavehull", (method)jit_pcl_concavehull_new, (method)jit_pcl_concavehull_free, sizeof(t_jit_pcl_concavehull), 0);
    
    // add matrix operator (mop)
    // args are  num inputs and num outputs
    mop = (t_jit_object *)jit_object_new(_jit_sym_jit_mop, 1, 1);
    jit_mop_input_nolink(mop,1);
    
    
    attr = (t_jit_object *)jit_object_method(mop, _jit_sym_getinput, 1);
    jit_attr_setlong(attr,_jit_sym_dimlink,0);
    jit_attr_setlong(attr,_jit_sym_typelink,0);
    jit_attr_setlong(attr,_jit_sym_planelink,0);
    jit_object_method(attr,_jit_sym_ioproc,jit_mop_ioproc_copy_adapt);
    jit_atom_setsym(a, _jit_sym_float32);
    jit_object_method(attr, _jit_sym_types,1, a);
    
    attr = (t_jit_object *)jit_object_method(mop, _jit_sym_getoutput, 1);
    jit_attr_setlong(attr, _jit_sym_dimlink,0);
    
    jit_class_addadornment(s_jit_pcl_concavehull_class, mop);
    
    
    
    // add method(s)
    jit_class_addmethod(s_jit_pcl_concavehull_class, (method)jit_pcl_concavehull_matrix_calc, "matrix_calc", A_CANT, 0);
    
    // add attribute(s)
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "leafsize",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_jit_pcl_concavehull, leafsize));
    
    jit_class_addattr(s_jit_pcl_concavehull_class, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "npoints",
                                          _jit_sym_long,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_jit_pcl_concavehull, npoints));
    jit_attr_addfilterget_clip(attr, 1, 10000, true, false);
    jit_class_addattr(s_jit_pcl_concavehull_class, attr);

    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "stdthresh",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_jit_pcl_concavehull, stdthresh));
    
    jit_class_addattr(s_jit_pcl_concavehull_class, attr);
    
    attr = (t_jit_object *)jit_object_new(_jit_sym_jit_attr_offset,
                                          "alpha",
                                          _jit_sym_float64,
                                          attrflags,
                                          (method)NULL, (method)NULL,
                                          calcoffset(t_jit_pcl_concavehull, alpha));
    
    jit_class_addattr(s_jit_pcl_concavehull_class, attr);
    
    // finalize class
    jit_class_register(s_jit_pcl_concavehull_class);
    return JIT_ERR_NONE;
}