您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unit_m4函数代码示例

51自学网 2021-06-03 09:10:14
  C++
这篇教程C++ unit_m4函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ED_gpencil_parent_location

/* calculate difference matrix */void ED_gpencil_parent_location(bGPDlayer *gpl, float diff_mat[4][4]){	Object *ob = gpl->parent;	if (ob == NULL) {		unit_m4(diff_mat);		return;	}	else {		if ((gpl->partype == PAROBJECT) || (gpl->partype == PARSKEL)) {			mul_m4_m4m4(diff_mat, ob->obmat, gpl->inverse);			return;		}		else if (gpl->partype == PARBONE) {			bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, gpl->parsubstr);			if (pchan) {				float tmp_mat[4][4];				mul_m4_m4m4(tmp_mat, ob->obmat, pchan->pose_mat);				mul_m4_m4m4(diff_mat, tmp_mat, gpl->inverse);			}			else {				mul_m4_m4m4(diff_mat, ob->obmat, gpl->inverse); /* if bone not found use object (armature) */			}			return;		}		else {			unit_m4(diff_mat); /* not defined type */		}	}}
开发者ID:bdancer,项目名称:blender-for-vray,代码行数:31,


示例2: 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];    int depth_test_enabled;    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);    }    GPU_matrix_push();    if (t->spacetype == SPACE_VIEW3D) {      /* pass */    }    else if (t->spacetype == SPACE_IMAGE) {      GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]);    }    else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {      /* only scale y */      rcti *mask = &t->ar->v2d.mask;      rctf *datamask = &t->ar->v2d.cur;      float xsize = BLI_rctf_size_x(datamask);      float ysize = BLI_rctf_size_y(datamask);      float xmask = BLI_rcti_size_x(mask);      float ymask = BLI_rcti_size_y(mask);      GPU_matrix_scale_2f(1.0f, (ysize / xsize) * (xmask / ymask));    }    depth_test_enabled = GPU_depth_test_enabled();    if (depth_test_enabled) {      GPU_depth_test(false);    }    uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);    immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);    immUniformThemeColor(TH_GRID);    set_inverted_drawing(1);    imm_drawcircball(t->center_global, t->prop_size, imat, pos);    set_inverted_drawing(0);    immUnbindProgram();    if (depth_test_enabled) {      GPU_depth_test(true);    }    GPU_matrix_pop();  }}
开发者ID:dfelinto,项目名称:blender,代码行数:59,


示例3: unit

UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP){	unit_m4(x_up_mat4);	rotate_m4(x_up_mat4, 'Y', -0.5 * M_PI);	unit_m4(y_up_mat4);	rotate_m4(y_up_mat4, 'X', 0.5 * M_PI);	unit_m4(z_up_mat4);	unit_m4(scale_mat4);}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:11,


示例4: 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];		int depth_test_enabled;		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();		copy_v3_v3(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;			if (t->options & CTX_MASK) {				/* untested - mask aspect is TODO */				ED_space_image_get_aspect(t->sa->spacedata.first, &aspx, &aspy);			}			else {				ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);			}			glScalef(1.0f / aspx, 1.0f / aspy, 1.0);		}		depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);		if (depth_test_enabled)			glDisable(GL_DEPTH_TEST);		set_inverted_drawing(1);		drawcircball(GL_LINE_LOOP, center, t->prop_size, imat);		set_inverted_drawing(0);		if (depth_test_enabled)			glEnable(GL_DEPTH_TEST);		glPopMatrix();	}}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:54,


示例5: 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];		int depth_test_enabled;		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();		if (t->spacetype == SPACE_VIEW3D) {			/* pass */		}		else if (t->spacetype == SPACE_IMAGE) {			glScalef(1.0f / t->aspect[0], 1.0f / t->aspect[1], 1.0f);		}		else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) {			/* only scale y */			rcti *mask = &t->ar->v2d.mask;			rctf *datamask = &t->ar->v2d.cur;			float xsize = BLI_rctf_size_x(datamask);			float ysize = BLI_rctf_size_y(datamask);			float xmask = BLI_rcti_size_x(mask);			float ymask = BLI_rcti_size_y(mask);			glScalef(1.0f, (ysize / xsize) * (xmask / ymask), 1.0f);		}		depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);		if (depth_test_enabled)			glDisable(GL_DEPTH_TEST);		set_inverted_drawing(1);		drawcircball(GL_LINE_LOOP, t->center_global, t->prop_size, imat);		set_inverted_drawing(0);		if (depth_test_enabled)			glEnable(GL_DEPTH_TEST);		glPopMatrix();	}}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:52,


示例6: unit_m4

void TransformReader::get_node_mat(float mat[4][4],                                   COLLADAFW::Node *node,                                   std::map<COLLADAFW::UniqueId, Animation> *animation_map,                                   Object *ob,                                   float parent_mat[4][4]){  float cur[4][4];  float copy[4][4];  unit_m4(mat);  for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {    COLLADAFW::Transformation *tm = node->getTransformations()[i];    COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();    switch (type) {      case COLLADAFW::Transformation::MATRIX:        // When matrix AND Trans/Rot/Scale are defined for a node,        // then this is considered as redundant information.        // So if we find a Matrix we use that and return.        dae_matrix_to_mat4(tm, mat);        if (parent_mat) {          mul_m4_m4m4(mat, parent_mat, mat);        }        return;      case COLLADAFW::Transformation::TRANSLATE:        dae_translate_to_mat4(tm, cur);        break;      case COLLADAFW::Transformation::ROTATE:        dae_rotate_to_mat4(tm, cur);        break;      case COLLADAFW::Transformation::SCALE:        dae_scale_to_mat4(tm, cur);        break;      case COLLADAFW::Transformation::LOOKAT:        fprintf(stderr, "|!     LOOKAT transformations are not supported yet./n");        break;      case COLLADAFW::Transformation::SKEW:        fprintf(stderr, "|!     SKEW transformations are not supported yet./n");        break;    }    copy_m4_m4(copy, mat);    mul_m4_m4m4(mat, copy, cur);    if (animation_map) {      // AnimationList that drives this Transformation      const COLLADAFW::UniqueId &anim_list_id = tm->getAnimationList();      // store this so later we can link animation data with ob      Animation anim = {ob, node, tm};      (*animation_map)[anim_list_id] = anim;    }  }  if (parent_mat) {    mul_m4_m4m4(mat, parent_mat, mat);  }}
开发者ID:dfelinto,项目名称:blender,代码行数:60,


示例7: gp_point_conversion_init

/* Init handling for space-conversion function (from passed-in parameters) */void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc){	ScrArea *sa = CTX_wm_area(C);	ARegion *ar = CTX_wm_region(C);		/* zero out the storage (just in case) */	memset(r_gsc, 0, sizeof(GP_SpaceConversion));	unit_m4(r_gsc->mat);		/* store settings */	r_gsc->sa = sa;	r_gsc->ar = ar;	r_gsc->v2d = &ar->v2d;		/* init region-specific stuff */	if (sa->spacetype == SPACE_VIEW3D) {		wmWindow *win = CTX_wm_window(C);		Scene *scene = CTX_data_scene(C);		View3D *v3d = (View3D *)CTX_wm_space_data(C);		RegionView3D *rv3d = ar->regiondata;				/* init 3d depth buffers */		view3d_operator_needs_opengl(C);				view3d_region_operator_needs_opengl(win, ar);		ED_view3d_autodist_init(scene, ar, v3d, 0);				/* for camera view set the subrect */		if (rv3d->persp == RV3D_CAMOB) {			ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &r_gsc->subrect_data, true); /* no shift */			r_gsc->subrect = &r_gsc->subrect_data;		}	}}
开发者ID:Brachi,项目名称:blender,代码行数:35,


示例8: env_rotate_scene

void env_rotate_scene(Render *re, float mat[4][4], int do_rotate){	GroupObject *go;	ObjectRen *obr;	ObjectInstanceRen *obi;	LampRen *lar = NULL;	HaloRen *har = NULL;	float imat[3][3], mat_inverse[4][4], smat[4][4], tmat[4][4], cmat[3][3], tmpmat[4][4];	int a;		if (do_rotate == 0) {		invert_m4_m4(tmat, mat);		copy_m3_m4(imat, tmat);				copy_m4_m4(mat_inverse, mat);	}	else {		copy_m4_m4(tmat, mat);		copy_m3_m4(imat, mat);				invert_m4_m4(mat_inverse, tmat);	}	for (obi = re->instancetable.first; obi; obi = obi->next) {		/* append or set matrix depending on dupli */		if (obi->flag & R_DUPLI_TRANSFORMED) {			copy_m4_m4(tmpmat, obi->mat);			mul_m4_m4m4(obi->mat, tmat, tmpmat);		}		else if (do_rotate == 1)			copy_m4_m4(obi->mat, tmat);		else			unit_m4(obi->mat);		copy_m3_m4(cmat, obi->mat);		invert_m3_m3(obi->nmat, cmat);		transpose_m3(obi->nmat);		/* indicate the renderer has to use transform matrices */		if (do_rotate == 0)			obi->flag &= ~R_ENV_TRANSFORMED;		else {			obi->flag |= R_ENV_TRANSFORMED;			copy_m4_m4(obi->imat, mat_inverse);		}	}		for (obr = re->objecttable.first; obr; obr = obr->next) {		for (a = 0; a < obr->tothalo; a++) {			if ((a & 255) == 0) har = obr->bloha[a >> 8];			else har++;					mul_m4_v3(tmat, har->co);		}		/* imat_ren is needed for correct texture coordinates */		mul_m4_m4m4(obr->ob->imat_ren, re->viewmat, obr->ob->obmat);		invert_m4(obr->ob->imat_ren);	}
开发者ID:JasonWilkins,项目名称:blender-viewport_fx,代码行数:60,


示例9: object_solver_inverted_matrix

static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat[4][4]){  bool found = false;  for (bConstraint *con = ob->constraints.first; con != NULL; con = con->next) {    const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);    if (cti == NULL) {      continue;    }    if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {      bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;      if (!found) {        Object *cam = data->camera ? data->camera : scene->camera;        BKE_object_where_is_calc_mat4(cam, invmat);      }      mul_m4_m4m4(invmat, invmat, data->invmat);      found = true;    }  }  if (found) {    invert_m4(invmat);  }  else {    unit_m4(invmat);  }}
开发者ID:dfelinto,项目名称:blender,代码行数:25,


示例10: 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,


示例11: v2_quad_corners_to_mat4

/* Use 2D quad corners to create a matrix that set * a [-1..1] quad at the right position. */static void v2_quad_corners_to_mat4(float corners[4][2], float r_mat[4][4]){  unit_m4(r_mat);  sub_v2_v2v2(r_mat[0], corners[1], corners[0]);  sub_v2_v2v2(r_mat[1], corners[3], corners[0]);  mul_v2_fl(r_mat[0], 0.5f);  mul_v2_fl(r_mat[1], 0.5f);  copy_v2_v2(r_mat[3], corners[0]);  add_v2_v2(r_mat[3], r_mat[0]);  add_v2_v2(r_mat[3], r_mat[1]);}
开发者ID:dfelinto,项目名称:blender,代码行数:13,


示例12: particle_system_minmax

static void particle_system_minmax(Scene *scene,                                   Object *object,                                   ParticleSystem *psys,                                   float radius,                                   float min[3], float max[3]){	const float size[3] = {radius, radius, radius};	const float cfra = BKE_scene_frame_get(scene);	ParticleSettings *part = psys->part;	ParticleSimulationData sim = {NULL};	ParticleData *pa = NULL;	int i;	int total_particles;	float mat[4][4], imat[4][4];	INIT_MINMAX(min, max);	if (part->type == PART_HAIR) {		/* TOOD(sergey): Not supported currently. */		return;	}	unit_m4(mat);	psys_render_set(object, psys, mat, mat, 1, 1, 0);	sim.scene = scene;	sim.ob = object;	sim.psys = psys;	sim.psmd = psys_get_modifier(object, psys);	invert_m4_m4(imat, object->obmat);	total_particles = psys->totpart + psys->totchild;	psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);	for (i = 0, pa = psys->particles; i < total_particles; i++, pa++) {		float co_object[3], co_min[3], co_max[3];		ParticleKey state;		state.time = cfra;		if (!psys_get_particle_state(&sim, i, &state, 0)) {			continue;		}		mul_v3_m4v3(co_object, imat, state.co);		sub_v3_v3v3(co_min, co_object, size);		add_v3_v3v3(co_max, co_object, size);		minmax_v3v3_v3(min, max, co_min);		minmax_v3v3_v3(min, max, co_max);	}	if (psys->lattice_deform_data) {		end_latt_deform(psys->lattice_deform_data);		psys->lattice_deform_data = NULL;	}	psys_render_restore(object, psys);}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:54,


示例13: unit_m4

void TransformReader::dae_translate_to_mat4(COLLADAFW::Transformation *tm, float m[][4]){	COLLADAFW::Translate *tra = (COLLADAFW::Translate*)tm;	COLLADABU::Math::Vector3& t = tra->getTranslation();	unit_m4(m);	m[3][0] = (float)t[0];	m[3][1] = (float)t[1];	m[3][2] = (float)t[2];}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:11,


示例14: BKE_tracking_stabilization_data_to_mat4

/* Get 4x4 transformation matrix which corresponds to * stabilization data and used for easy coordinate * transformation. * * NOTE: The reason it is 4x4 matrix is because it's *       used for OpenGL drawing directly. */void BKE_tracking_stabilization_data_to_mat4(int width, int height, float aspect,                                             float translation[2], float scale, float angle,                                             float mat[4][4]){	float translation_mat[4][4], rotation_mat[4][4], scale_mat[4][4],	      center_mat[4][4], inv_center_mat[4][4],	      aspect_mat[4][4], inv_aspect_mat[4][4];	float scale_vector[3] = {scale, scale, scale};	unit_m4(translation_mat);	unit_m4(rotation_mat);	unit_m4(scale_mat);	unit_m4(center_mat);	unit_m4(aspect_mat);	/* aspect ratio correction matrix */	aspect_mat[0][0] = 1.0f / aspect;	invert_m4_m4(inv_aspect_mat, aspect_mat);	/* image center as rotation center	 *	 * Rotation matrix is constructing in a way rotation happens around image center,	 * and it's matter of calculating translation in a way, that applying translation	 * after rotation would make it so rotation happens around median point of tracks	 * used for translation stabilization.	 */	center_mat[3][0] = (float)width / 2.0f;	center_mat[3][1] = (float)height / 2.0f;	invert_m4_m4(inv_center_mat, center_mat);	size_to_mat4(scale_mat, scale_vector);       /* scale matrix */	add_v2_v2(translation_mat[3], translation);  /* translation matrix */	rotate_m4(rotation_mat, 'Z', angle);         /* rotation matrix */	/* compose transformation matrix */	mul_serie_m4(mat, translation_mat, center_mat, aspect_mat, rotation_mat, inv_aspect_mat,	             scale_mat, inv_center_mat, NULL);}
开发者ID:dimilar,项目名称:blender-libmv,代码行数:45,


示例15: BKE_texture_mapping_default

void BKE_texture_mapping_default(TexMapping *texmap, int type){	memset(texmap, 0, sizeof(TexMapping));	texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;	texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;	unit_m4(texmap->mat);	texmap->projx = PROJ_X;	texmap->projy = PROJ_Y;	texmap->projz = PROJ_Z;	texmap->mapping = MTEX_FLAT;	texmap->type = type;}
开发者ID:mgschwan,项目名称:blensor,代码行数:14,


示例16: make_duplis_group

/* OB_DUPLIGROUP */static void make_duplis_group(const DupliContext *ctx){	bool for_render = ctx->eval_ctx->for_render;	Object *ob = ctx->object;	Group *group;	GroupObject *go;	float group_mat[4][4];	int id;	bool animated, hide;	if (ob->dup_group == NULL) return;	group = ob->dup_group;	/* combine group offset and obmat */	unit_m4(group_mat);	sub_v3_v3(group_mat[3], group->dupli_ofs);	mul_m4_m4m4(group_mat, ob->obmat, group_mat);	/* don't access 'ob->obmat' from now on. */	/* handles animated groups */	/* we need to check update for objects that are not in scene... */	if (ctx->do_update) {		/* note: update is optional because we don't always need object		 * transformations to be correct. Also fixes bug [#29616]. */		BKE_group_handle_recalc_and_update(ctx->eval_ctx, ctx->scene, ob, group);	}	animated = BKE_group_is_animated(group, ob);	for (go = group->gobject.first, id = 0; go; go = go->next, id++) {		/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */		if (go->ob != ob) {			float mat[4][4];			/* group dupli offset, should apply after everything else */			mul_m4_m4m4(mat, group_mat, go->ob->obmat);			/* check the group instance and object layers match, also that the object visible flags are ok. */			hide = (go->ob->lay & group->layer) == 0 ||			       (for_render ? go->ob->restrictflag & OB_RESTRICT_RENDER : go->ob->restrictflag & OB_RESTRICT_VIEW);			make_dupli(ctx, go->ob, mat, id, animated, hide);			/* recursion */			make_recursive_duplis(ctx, go->ob, group_mat, id, animated);		}	}}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:50,


示例17: unit_m4

void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob){	float cur[4][4];	float copy[4][4];	unit_m4(mat);		for (unsigned int i = 0; i < node->getTransformations().getCount(); i++) {		COLLADAFW::Transformation *tm = node->getTransformations()[i];		COLLADAFW::Transformation::TransformationType type = tm->getTransformationType();		switch (type) {			case COLLADAFW::Transformation::MATRIX:				// XXX why does this return and discard all following transformations?				dae_matrix_to_mat4(tm, mat);				return;			case COLLADAFW::Transformation::TRANSLATE:				dae_translate_to_mat4(tm, cur);				break;			case COLLADAFW::Transformation::ROTATE:				dae_rotate_to_mat4(tm, cur);				break;			case COLLADAFW::Transformation::SCALE:				dae_scale_to_mat4(tm, cur);				break;			case COLLADAFW::Transformation::LOOKAT:			case COLLADAFW::Transformation::SKEW:				fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet./n");				break;		}		copy_m4_m4(copy, mat);		mul_m4_m4m4(mat, copy, cur);				if (animation_map) {			// AnimationList that drives this Transformation			const COLLADAFW::UniqueId& anim_list_id = tm->getAnimationList();					// store this so later we can link animation data with ob			Animation anim = {ob, node, tm};			(*animation_map)[anim_list_id] = anim;		}	}}
开发者ID:244xiao,项目名称:blender,代码行数:45,


示例18: object_warp_calc_view_matrix

static void object_warp_calc_view_matrix(float r_mat_view[4][4], float r_center_view[3],                                         Object *obedit, float viewmat[4][4], const float center[3],                                         const float offset_angle){	float mat_offset[4][4];	float viewmat_roll[4][4];	/* apply the rotation offset by rolling the view */	unit_m4(mat_offset);	rotate_m4(mat_offset, 'Z', offset_angle);	mul_m4_m4m4(viewmat_roll, mat_offset, viewmat);	/* apply the view and the object matrix */	mul_m4_m4m4(r_mat_view, viewmat_roll, obedit->obmat);	/* get the view-space cursor */	mul_v3_m4v3(r_center_view, viewmat_roll, center);}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:18,


示例19: dupli_render_particle_set

/* mostly a copy from convertblender.c */static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int enable){	/* ugly function, but we need to set particle systems to their render	 * settings before calling object_duplilist, to get render level duplis */	Group *group;	GroupObject *go;	ParticleSystem *psys;	DerivedMesh *dm;	float mat[4][4];	unit_m4(mat);	if (level >= MAX_DUPLI_RECUR)		return;		if (ob->transflag & OB_DUPLIPARTS) {		for (psys = ob->particlesystem.first; psys; psys = psys->next) {			if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {				if (enable)					psys_render_set(ob, psys, mat, mat, 1, 1, 0.f);				else					psys_render_restore(ob, psys);			}		}		if (enable) {			/* this is to make sure we get render level duplis in groups:			 * the derivedmesh must be created before init_render_mesh,			 * since object_duplilist does dupliparticles before that */			dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL);			dm->release(dm);			for (psys = ob->particlesystem.first; psys; psys = psys->next)				psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;		}	}	if (ob->dup_group == NULL) return;	group = ob->dup_group;	for (go = group->gobject.first; go; go = go->next)		dupli_render_particle_set(scene, go->ob, level + 1, enable);}
开发者ID:wisaac407,项目名称:blender,代码行数:44,


示例20: init_context

/* create initial context for root object */static void init_context(DupliContext *r_ctx, EvaluationContext *eval_ctx, Scene *scene, Object *ob, float space_mat[4][4], bool update){	r_ctx->eval_ctx = eval_ctx;	r_ctx->scene = scene;	/* don't allow BKE_object_handle_update for viewport during render, can crash */	r_ctx->do_update = update && !(G.is_rendering && eval_ctx->mode != DAG_EVAL_RENDER);	r_ctx->animated = false;	r_ctx->group = NULL;	r_ctx->object = ob;	if (space_mat)		copy_m4_m4(r_ctx->space_mat, space_mat);	else		unit_m4(r_ctx->space_mat);	r_ctx->lay = ob->lay;	r_ctx->level = 0;	r_ctx->gen = get_dupli_generator(r_ctx);	r_ctx->duplilist = NULL;}
开发者ID:DrangPo,项目名称:blender,代码行数:22,


示例21: BKE_lattice_resize

void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb){	BPoint *bp;	int i, u, v, w;	float fu, fv, fw, uc, vc, wc, du = 0.0, dv = 0.0, dw = 0.0;	float *co, (*vertexCos)[3] = NULL;		/* vertex weight groups are just freed all for now */	if (lt->dvert) {		free_dverts(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw);		lt->dvert = NULL;	}		while (uNew * vNew * wNew > 32000) {		if (uNew >= vNew && uNew >= wNew) uNew--;		else if (vNew >= uNew && vNew >= wNew) vNew--;		else wNew--;	}	vertexCos = MEM_mallocN(sizeof(*vertexCos) * uNew * vNew * wNew, "tmp_vcos");	calc_lat_fudu(lt->flag, uNew, &fu, &du);	calc_lat_fudu(lt->flag, vNew, &fv, &dv);	calc_lat_fudu(lt->flag, wNew, &fw, &dw);	/* If old size is different then resolution changed in interface,	 * try to do clever reinit of points. Pretty simply idea, we just	 * deform new verts by old lattice, but scaling them to match old	 * size first.	 */	if (ltOb) {		if (uNew != 1 && lt->pntsu != 1) {			fu = lt->fu;			du = (lt->pntsu - 1) * lt->du / (uNew - 1);		}		if (vNew != 1 && lt->pntsv != 1) {			fv = lt->fv;			dv = (lt->pntsv - 1) * lt->dv / (vNew - 1);		}		if (wNew != 1 && lt->pntsw != 1) {			fw = lt->fw;			dw = (lt->pntsw - 1) * lt->dw / (wNew - 1);		}	}	co = vertexCos[0];	for (w = 0, wc = fw; w < wNew; w++, wc += dw) {		for (v = 0, vc = fv; v < vNew; v++, vc += dv) {			for (u = 0, uc = fu; u < uNew; u++, co += 3, uc += du) {				co[0] = uc;				co[1] = vc;				co[2] = wc;			}		}	}		if (ltOb) {		float mat[4][4];		int typeu = lt->typeu, typev = lt->typev, typew = lt->typew;		/* works best if we force to linear type (endpoints match) */		lt->typeu = lt->typev = lt->typew = KEY_LINEAR;		/* prevent using deformed locations */		BKE_displist_free(&ltOb->disp);		copy_m4_m4(mat, ltOb->obmat);		unit_m4(ltOb->obmat);		lattice_deform_verts(ltOb, NULL, NULL, vertexCos, uNew * vNew * wNew, NULL, 1.0f);		copy_m4_m4(ltOb->obmat, mat);		lt->typeu = typeu;		lt->typev = typev;		lt->typew = typew;	}	lt->fu = fu;	lt->fv = fv;	lt->fw = fw;	lt->du = du;	lt->dv = dv;	lt->dw = dw;	lt->pntsu = uNew;	lt->pntsv = vNew;	lt->pntsw = wNew;	MEM_freeN(lt->def);	lt->def = MEM_callocN(lt->pntsu * lt->pntsv * lt->pntsw * sizeof(BPoint), "lattice bp");		bp = lt->def;		for (i = 0; i < lt->pntsu * lt->pntsv * lt->pntsw; i++, bp++) {		copy_v3_v3(bp->vec, vertexCos[i]);	}	MEM_freeN(vertexCos);}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:100,


示例22: make_duplis_font

static void make_duplis_font(const DupliContext *ctx){	Object *par = ctx->object;	GHash *family_gh;	Object *ob;	Curve *cu;	struct CharTrans *ct, *chartransdata = NULL;	float vec[3], obmat[4][4], pmat[4][4], fsize, xof, yof;	int text_len, a;	size_t family_len;	const wchar_t *text = NULL;	bool text_free = false;	/* font dupliverts not supported inside groups */	if (ctx->group)		return;	copy_m4_m4(pmat, par->obmat);	/* in par the family name is stored, use this to find the other objects */	BKE_vfont_to_curve_ex(G.main, par, FO_DUPLI, NULL,	                      &text, &text_len, &text_free, &chartransdata);	if (text == NULL || chartransdata == NULL) {		return;	}	cu = par->data;	fsize = cu->fsize;	xof = cu->xof;	yof = cu->yof;	ct = chartransdata;	/* cache result */	family_len = strlen(cu->family);	family_gh = BLI_ghash_int_new_ex(__func__, 256);	/* advance matching BLI_strncpy_wchar_from_utf8 */	for (a = 0; a < text_len; a++, ct++) {		ob = find_family_object(cu->family, family_len, (unsigned int)text[a], family_gh);		if (ob) {			vec[0] = fsize * (ct->xof - xof);			vec[1] = fsize * (ct->yof - yof);			vec[2] = 0.0;			mul_m4_v3(pmat, vec);			copy_m4_m4(obmat, par->obmat);			if (UNLIKELY(ct->rot != 0.0f)) {				float rmat[4][4];				zero_v3(obmat[3]);				unit_m4(rmat);				rotate_m4(rmat, 'Z', -ct->rot);				mul_m4_m4m4(obmat, obmat, rmat);			}			copy_v3_v3(obmat[3], vec);			make_dupli(ctx, ob, obmat, a, false, false);		}	}	if (text_free) {		MEM_freeN((void *)text);	}	BLI_ghash_free(family_gh, NULL, NULL);	MEM_freeN(chartransdata);}
开发者ID:DrangPo,项目名称:blender,代码行数:75,


示例23: make_duplis_group

/* OB_DUPLIGROUP */static void make_duplis_group(const DupliContext *ctx){	bool for_render = (ctx->eval_ctx->mode == DAG_EVAL_RENDER);	Object *ob = ctx->object;	Group *group;	GroupObject *go;	float group_mat[4][4];	int id;	bool animated, hide;	if (ob->dup_group == NULL) return;	group = ob->dup_group;	/* combine group offset and obmat */	unit_m4(group_mat);	sub_v3_v3(group_mat[3], group->dupli_ofs);	mul_m4_m4m4(group_mat, ob->obmat, group_mat);	/* don't access 'ob->obmat' from now on. */	/* handles animated groups */	/* we need to check update for objects that are not in scene... */	if (ctx->do_update) {		/* note: update is optional because we don't always need object		 * transformations to be correct. Also fixes bug [#29616]. */		BKE_group_handle_recalc_and_update(ctx->eval_ctx, ctx->scene, ob, group);	}	animated = BKE_group_is_animated(group, ob);	for (go = group->gobject.first, id = 0; go; go = go->next, id++) {		/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */		if (go->ob != ob) {			float mat[4][4];			/* Special case for instancing dupli-groups, see: T40051			 * this object may be instanced via dupli-verts/faces, in this case we don't want to render			 * (blender convention), but _do_ show in the viewport.			 *			 * Regular objects work fine but not if we're instancing dupli-groups,			 * because the rules for rendering aren't applied to objects they instance.			 * We could recursively pass down the 'hide' flag instead, but that seems unnecessary.			 */			if (for_render && go->ob->parent && go->ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES)) {				continue;			}			/* group dupli offset, should apply after everything else */			mul_m4_m4m4(mat, group_mat, go->ob->obmat);			/* check the group instance and object layers match, also that the object visible flags are ok. */			hide = (go->ob->lay & group->layer) == 0 ||			       (for_render ? go->ob->restrictflag & OB_RESTRICT_RENDER : go->ob->restrictflag & OB_RESTRICT_VIEW);			make_dupli(ctx, go->ob, mat, id, animated, hide);			/* recursion */			make_recursive_duplis(ctx, go->ob, group_mat, id, animated);		}	}}
开发者ID:DrangPo,项目名称:blender,代码行数:62,



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


C++ unit_name_from_path函数代码示例
C++ unitChanged函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。