当前位置: 首页>>代码示例>>C++>>正文


C++ VECCOPY函数代码示例

本文整理汇总了C++中VECCOPY函数的典型用法代码示例。如果您正苦于以下问题:C++ VECCOPY函数的具体用法?C++ VECCOPY怎么用?C++ VECCOPY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VECCOPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: float

ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
	float (*co)[3], float (*color)[3], float *area, int totpoint)
{
	ScatterTree *tree;
	ScatterPoint *points, **refpoints;
	int i;

	/* allocate tree */
	tree= MEM_callocN(sizeof(ScatterTree), "ScatterTree");
	tree->scale= scale;
	tree->error= error;
	tree->totpoint= totpoint;

	tree->ss[0]= ss[0];
	tree->ss[1]= ss[1];
	tree->ss[2]= ss[2];

	points= MEM_callocN(sizeof(ScatterPoint)*totpoint, "ScatterPoints");
	refpoints= MEM_callocN(sizeof(ScatterPoint*)*totpoint, "ScatterRefPoints");

	tree->points= points;
	tree->refpoints= refpoints;

	/* build points */
	INIT_MINMAX(tree->min, tree->max);

	for(i=0; i<totpoint; i++) {
		VECCOPY(points[i].co, co[i]);
		VECCOPY(points[i].rad, color[i]);
		points[i].area= fabsf(area[i])/(tree->scale*tree->scale);
		points[i].back= (area[i] < 0.0f);

		mul_v3_fl(points[i].co, 1.0f/tree->scale);
		DO_MINMAX(points[i].co, tree->min, tree->max);

		refpoints[i]= points + i;
	}

	return tree;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:40,代码来源:sss.c

示例2: colorfn

static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
{
	float col[4];
	
	tex_input_rgba(col, in[0], p, thread);

	col[0] = 1.0f - col[0];
	col[1] = 1.0f - col[1];
	col[2] = 1.0f - col[2];
	
	VECCOPY(out, col);
	out[3] = col[3];
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:13,代码来源:TEX_invert.c

示例3: vol_trace_behind

static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *col)
{
	Isect isect;
	
	VECCOPY(isect.start, co);
	VECCOPY(isect.vec, shi->view);
	isect.labda = FLT_MAX;
	
	isect.mode= RE_RAY_MIRROR;
	isect.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK;
	isect.orig.ob = (void*) shi->obi;
	isect.orig.face = (void*)vlr;
	isect.last_hit = NULL;
	isect.lay= -1;
	
	/* check to see if there's anything behind the volume, otherwise shade the sky */
	if(RE_rayobject_raycast(R.raytree, &isect)) {
		shade_intersection(shi, col, &isect);
	} else {
		shadeSkyView(col, co, shi->view, NULL, shi->thread);
		shadeSunView(col, shi->view);
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:23,代码来源:volumetric.c

示例4: fluid_get_bb

void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
		 /*RET*/ float start[3], /*RET*/ float size[3] )
{
	float bbsx=0.0, bbsy=0.0, bbsz=0.0;
	float bbex=1.0, bbey=1.0, bbez=1.0;
	int i;
	float vec[3];

	VECCOPY(vec, mvert[0].co); 
	Mat4MulVecfl(obmat, vec);
	bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2];
	bbex = vec[0]; bbey = vec[1]; bbez = vec[2];

	for(i = 1; i < totvert; i++) {
		VECCOPY(vec, mvert[i].co);
		Mat4MulVecfl(obmat, vec);

		if(vec[0] < bbsx){ bbsx= vec[0]; }
		if(vec[1] < bbsy){ bbsy= vec[1]; }
		if(vec[2] < bbsz){ bbsz= vec[2]; }
		if(vec[0] > bbex){ bbex= vec[0]; }
		if(vec[1] > bbey){ bbey= vec[1]; }
		if(vec[2] > bbez){ bbez= vec[2]; }
	}

	// return values...
	if(start) {
		start[0] = bbsx;
		start[1] = bbsy;
		start[2] = bbsz;
	} 
	if(size) {
		size[0] = bbex-bbsx;
		size[1] = bbey-bbsy;
		size[2] = bbez-bbsz;
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:37,代码来源:fluidsim.c

示例5: vol_get_bounds

static int vol_get_bounds(ShadeInput *shi, float *co, float *vec, float *hitco, Isect *isect, int intersect_type)
{
	/* XXX TODO - get raytrace max distance from object instance's bounding box */
	/* need to account for scaling only, but keep coords in camera space...
	 * below code is WIP and doesn't work!
	VecSubf(bb_dim, shi->obi->obr->boundbox[1], shi->obi->obr->boundbox[2]);
	Mat3MulVecfl(shi->obi->nmat, bb_dim);
	maxsize = VecLength(bb_dim);
	*/
	
	VECCOPY(isect->start, co);
	VECCOPY(isect->vec, vec );
	isect->labda = FLT_MAX;
	isect->mode= RE_RAY_MIRROR;
	isect->last_hit = NULL;
	isect->lay= -1;
	
	if (intersect_type == VOL_BOUNDS_DEPTH) {
		isect->skip = RE_SKIP_VLR_NEIGHBOUR;
		isect->orig.face = (void*)shi->vlr;
		isect->orig.ob = (void*)shi->obi;
	} else { // if (intersect_type == VOL_BOUNDS_SS) {
		isect->skip= 0;
		isect->orig.face= NULL;
		isect->orig.ob = NULL;
	}
	
	if(RE_rayobject_raycast(R.raytree, isect))
	{
		hitco[0] = isect->start[0] + isect->labda*isect->vec[0];
		hitco[1] = isect->start[1] + isect->labda*isect->vec[1];
		hitco[2] = isect->start[2] + isect->labda*isect->vec[2];
		return 1;
	} else {
		return 0;
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:37,代码来源:volumetric.c

示例6: sk_straightenStroke

void sk_straightenStroke(SK_Stroke *stk, int start, int end, float p_start[3], float p_end[3])
{
	SK_Point pt1, pt2;
	SK_Point *prev, *next;
	float delta_p[3];
	int i, total;

	total = end - start;

	sub_v3_v3v3(delta_p, p_end, p_start);

	prev = stk->points + start;
	next = stk->points + end;

	VECCOPY(pt1.p, p_start);
	VECCOPY(pt1.no, prev->no);
	pt1.mode = prev->mode;
	pt1.type = prev->type;

	VECCOPY(pt2.p, p_end);
	VECCOPY(pt2.no, next->no);
	pt2.mode = next->mode;
	pt2.type = next->type;

	sk_insertStrokePoint(stk, &pt1, start + 1); /* insert after start */
	sk_insertStrokePoint(stk, &pt2, end + 1); /* insert before end (since end was pushed back already) */

	for (i = 1; i < total; i++)
	{
		float delta = (float)i / (float)total;
		float *p = stk->points[start + 1 + i].p;

		VECCOPY(p, delta_p);
		mul_v3_fl(p, delta);
		add_v3_v3(p, p_start);
	}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:37,代码来源:sketch.c

示例7: PyErr_SetString

static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args )
{
	VectorObject *pt, *line_1, *line_2;
	float pt_in[3], pt_out[3], l1[3], l2[3];
	float lambda;
	PyObject *ret;
	
	if( !PyArg_ParseTuple ( args, "O!O!O!",
	&vector_Type, &pt,
	&vector_Type, &line_1,
	&vector_Type, &line_2)
	  ) {
		PyErr_SetString( PyExc_TypeError, "expected 3 vector types\n" );
		return NULL;
	}
	
	if(!BaseMath_ReadCallback(pt) || !BaseMath_ReadCallback(line_1) || !BaseMath_ReadCallback(line_2))
		return NULL;
	
	/* accept 2d verts */
	if (pt->size==3) { VECCOPY(pt_in, pt->vec);}
	else { pt_in[2]=0.0;	VECCOPY2D(pt_in, pt->vec) }
	
	if (line_1->size==3) { VECCOPY(l1, line_1->vec);}
	else { l1[2]=0.0;	VECCOPY2D(l1, line_1->vec) }
	
	if (line_2->size==3) { VECCOPY(l2, line_2->vec);}
	else { l2[2]=0.0;	VECCOPY2D(l2, line_2->vec) }
	
	/* do the calculation */
	lambda = lambda_cp_line_ex(pt_in, l1, l2, pt_out);
	
	ret = PyTuple_New(2);
	PyTuple_SET_ITEM( ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL) );
	PyTuple_SET_ITEM( ret, 1, PyFloat_FromDouble(lambda) );
	return ret;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:37,代码来源:Geometry.c

示例8: VECCOPY2D

static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObject* args)
{
	VectorObject *pt, *line_1, *line_2;
	float pt_in[3], pt_out[3], l1[3], l2[3];
	float lambda;
	PyObject *ret;
	
	if(!PyArg_ParseTuple(args, "O!O!O!:intersect_point_line",
		&vector_Type, &pt,
		&vector_Type, &line_1,
		&vector_Type, &line_2)
	) {
		return NULL;
	}
	
	if(BaseMath_ReadCallback(pt) == -1 || BaseMath_ReadCallback(line_1) == -1 || BaseMath_ReadCallback(line_2) == -1)
		return NULL;
	
	/* accept 2d verts */
	if (pt->size==3) { VECCOPY(pt_in, pt->vec);}
	else { pt_in[2]=0.0;	VECCOPY2D(pt_in, pt->vec) }
	
	if (line_1->size==3) { VECCOPY(l1, line_1->vec);}
	else { l1[2]=0.0;	VECCOPY2D(l1, line_1->vec) }
	
	if (line_2->size==3) { VECCOPY(l2, line_2->vec);}
	else { l2[2]=0.0;	VECCOPY2D(l2, line_2->vec) }
	
	/* do the calculation */
	lambda= closest_to_line_v3(pt_out, pt_in, l1, l2);
	
	ret= PyTuple_New(2);
	PyTuple_SET_ITEM(ret, 0, newVectorObject(pt_out, 3, Py_NEW, NULL));
	PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(lambda));
	return ret;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:36,代码来源:mathutils_geometry.c

示例9: compute_radiance

static void compute_radiance(ScatterTree *tree, float *co, float *rad)
{
	ScatterResult result;
	float rdsum[3], backrad[3], backrdsum[3];

	memset(&result, 0, sizeof(result));

	traverse_octree(tree, tree->root, co, 1, &result);

	/* the original paper doesn't do this, but we normalize over the
	   sampled area and multiply with the reflectance. this is because
	   our point samples are incomplete, there are no samples on parts
	   of the mesh not visible from the camera. this can not only make
	   it darker, but also lead to ugly color shifts */

	VecMulf(result.rad, tree->ss[0]->frontweight);
	VecMulf(result.backrad, tree->ss[0]->backweight);

	VECCOPY(rad, result.rad);
	VECADD(backrad, result.rad, result.backrad);

	VECCOPY(rdsum, result.rdsum);
	VECADD(backrdsum, result.rdsum, result.backrdsum);

	if(rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
	if(rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
	if(rdsum[2] > 1e-16f) rad[2]= tree->ss[2]->color*rad[2]/rdsum[2];

	if(backrdsum[0] > 1e-16f) backrad[0]= tree->ss[0]->color*backrad[0]/backrdsum[0];
	if(backrdsum[1] > 1e-16f) backrad[1]= tree->ss[1]->color*backrad[1]/backrdsum[1];
	if(backrdsum[2] > 1e-16f) backrad[2]= tree->ss[2]->color*backrad[2]/backrdsum[2];

	rad[0]= MAX2(rad[0], backrad[0]);
	rad[1]= MAX2(rad[1], backrad[1]);
	rad[2]= MAX2(rad[2], backrad[2]);
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:36,代码来源:sss.c

示例10: VerifyStorage

//void where_is_pose (Object *ob);
//void armature_deform_verts(Object *armOb, Object *target, float (*vertexCos)[3], int numVerts, int deformflag);
bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
{
    /* See if the armature has been updated for this frame */
    if (PoseUpdated()) {
        float obmat[4][4];	// the original object matrice

        /* XXX note: where_is_pose() (from BKE_armature.h) calculates all matrices needed to start deforming */
        /* but it requires the blender object pointer... */
        Object* par_arma = m_armobj->GetArmatureObject();

        if(!shape_applied) {
            /* store verts locally */
            VerifyStorage();

            /* duplicate */
            for (int v =0; v<m_bmesh->totvert; v++)
                VECCOPY(m_transverts[v], m_bmesh->mvert[v].co);
        }

        m_armobj->ApplyPose();

        // save matrix first
        Mat4CpyMat4(obmat, m_objMesh->obmat);
        // set reference matrix
        Mat4CpyMat4(m_objMesh->obmat, m_obmat);

        armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL );

        // restore matrix
        Mat4CpyMat4(m_objMesh->obmat, obmat);

#ifdef __NLA_DEFNORMALS
        if (m_recalcNormal)
            RecalcNormals();
#endif

        /* Update the current frame */
        m_lastArmaUpdate=m_armobj->GetLastFrame();

        m_armobj->RestorePose();
        /* dynamic vertex, cannot use display list */
        m_bDynamic = true;
        /* indicate that the m_transverts and normals are up to date */
        return true;
    }

    return false;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:50,代码来源:BL_SkinDeformer.cpp

示例11: font_duplilist

static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, int animated)
{
	Object *ob, *obar[256];
	Curve *cu;
	struct chartrans *ct, *chartransdata;
	float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof;
	int slen, a;
	
	/* simple preventing of too deep nested groups */
	if(level>MAX_DUPLI_RECUR) return;
	
	Mat4CpyMat4(pmat, par->obmat);
	
	/* in par the family name is stored, use this to find the other objects */
	
	chartransdata= BKE_text_to_curve(scene, par, FO_DUPLI);
	if(chartransdata==0) return;
	
	memset(obar, 0, 256*sizeof(void *));
	
	cu= par->data;
	slen= strlen(cu->str);
	fsize= cu->fsize;
	xof= cu->xof;
	yof= cu->yof;
	
	ct= chartransdata;
	
	for(a=0; a<slen; a++, ct++) {
		
		ob= find_family_object(obar, cu->family, cu->str[a]);
		if(ob) {
			vec[0]= fsize*(ct->xof - xof);
			vec[1]= fsize*(ct->yof - yof);
			vec[2]= 0.0;
			
			Mat4MulVecfl(pmat, vec);
			
			Mat4CpyMat4(obmat, par->obmat);
			VECCOPY(obmat[3], vec);
			
			new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
		}
	}
	
	MEM_freeN(chartransdata);
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:47,代码来源:anim.c

示例12: vol_get_reflection_color

/* Uses same physically based scattering parameter as in transmission calculations, 
 * along with artificial reflection scale/reflection color tint */
static void vol_get_reflection_color(ShadeInput *shi, float *ref_col, float *co)
{
	float scatter = shi->mat->vol.scattering;
	float reflection= shi->mat->vol.reflection;
	VECCOPY(ref_col, shi->mat->vol.reflection_col);
	
	if (shi->mat->mapto_textured & (MAP_SCATTERING+MAP_REFLECTION_COL))
		do_volume_tex(shi, co, MAP_SCATTERING+MAP_REFLECTION_COL, ref_col, &scatter);
	
	/* only one single float parameter at a time... :s */
	if (shi->mat->mapto_textured & (MAP_REFLECTION))
		do_volume_tex(shi, co, MAP_REFLECTION, NULL, &reflection);
	
	ref_col[0] = reflection * ref_col[0] * scatter;
	ref_col[1] = reflection * ref_col[1] * scatter;
	ref_col[2] = reflection * ref_col[2] * scatter;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:19,代码来源:volumetric.c

示例13: get_lamp

static int get_lamp(Scene *scene, float *light)
{	
	Base *base_tmp = NULL;	
	for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) 	
	{		
		if(base_tmp->object->type == OB_LAMP) 		
		{			
			Lamp *la = (Lamp *)base_tmp->object->data;	

			if(la->type == LA_LOCAL)			
			{				
				VECCOPY(light, base_tmp->object->obmat[3]);				
				return 1;			
			}		
		}	
	}	
	return 0;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:18,代码来源:smoke.c

示例14: planeProjection

static void planeProjection(TransInfo *t, float in[3], float out[3]) {
	float vec[3], factor, norm[3];

	add_v3_v3v3(vec, in, t->con.center);
	getViewVector(t, vec, norm);

	sub_v3_v3v3(vec, out, in);

	factor = dot_v3v3(vec, norm);
	if (fabs(factor) <= 0.001) {
		return; /* prevent divide by zero */
	}
	factor = dot_v3v3(vec, vec) / factor;

	VECCOPY(vec, norm);
	mul_v3_fl(vec, factor);

	add_v3_v3v3(out, in, vec);
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:19,代码来源:transform_constraints.c

示例15: drawPropCircle

/* called from drawview.c, as an extra per-window draw option */
void drawPropCircle(const struct bContext *C, TransInfo *t)
{
	if (t->flag & T_PROP_EDIT) {
		RegionView3D *rv3d = CTX_wm_region_view3d(C);
		float tmat[4][4], imat[4][4];
		float center[3];

		UI_ThemeColor(TH_GRID);

		if(t->spacetype == SPACE_VIEW3D && rv3d != NULL)
		{
			copy_m4_m4(tmat, rv3d->viewmat);
			invert_m4_m4(imat, tmat);
		}
		else
		{
			unit_m4(tmat);
			unit_m4(imat);
		}

		glPushMatrix();

		VECCOPY(center, t->center);

		if((t->spacetype == SPACE_VIEW3D) && t->obedit)
		{
			mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
		}
		else if(t->spacetype == SPACE_IMAGE)
		{
			float aspx, aspy;

			ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
			glScalef(1.0f/aspx, 1.0f/aspy, 1.0);
		}

		set_inverted_drawing(1);
		drawcircball(GL_LINE_LOOP, center, t->prop_size, imat);
		set_inverted_drawing(0);

		glPopMatrix();
	}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:44,代码来源:transform_constraints.c


注:本文中的VECCOPY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。