本文整理汇总了C++中copy_m4_m4函数的典型用法代码示例。如果您正苦于以下问题:C++ copy_m4_m4函数的具体用法?C++ copy_m4_m4怎么用?C++ copy_m4_m4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了copy_m4_m4函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PyObjectPlus
BL_ArmatureConstraint::BL_ArmatureConstraint(
BL_ArmatureObject *armature,
bPoseChannel *posechannel,
bConstraint *constraint,
KX_GameObject* target,
KX_GameObject* subtarget)
: PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature)
{
m_target = target;
m_blendtarget = (target) ? target->GetBlenderObject() : NULL;
m_subtarget = subtarget;
m_blendsubtarget = (subtarget) ? subtarget->GetBlenderObject() : NULL;
m_pose = m_subpose = NULL;
if (m_blendtarget) {
copy_m4_m4(m_blendmat, m_blendtarget->obmat);
if (m_blendtarget->type == OB_ARMATURE)
m_pose = m_blendtarget->pose;
}
if (m_blendsubtarget) {
copy_m4_m4(m_blendsubmat, m_blendsubtarget->obmat);
if (m_blendsubtarget->type == OB_ARMATURE)
m_subpose = m_blendsubtarget->pose;
}
if (m_target)
m_target->RegisterObject(m_armature);
if (m_subtarget)
m_subtarget->RegisterObject(m_armature);
BLI_snprintf(m_name, sizeof(m_name), "%s:%s", m_posechannel->name, m_constraint->name);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:29,代码来源:BL_ArmatureConstraint.cpp
示例2: copy_pose_channel_data
static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan)
{
bConstraint *pcon, *con;
copy_v3_v3(pchan->loc, chan->loc);
copy_v3_v3(pchan->size, chan->size);
copy_v3_v3(pchan->eul, chan->eul);
copy_v3_v3(pchan->rotAxis, chan->rotAxis);
pchan->rotAngle = chan->rotAngle;
copy_qt_qt(pchan->quat, chan->quat);
pchan->rotmode = chan->rotmode;
copy_m4_m4(pchan->chan_mat, (float(*)[4])chan->chan_mat);
copy_m4_m4(pchan->pose_mat, (float(*)[4])chan->pose_mat);
pchan->flag = chan->flag;
pchan->roll1 = chan->roll1;
pchan->roll2 = chan->roll2;
pchan->curveInX = chan->curveInX;
pchan->curveInY = chan->curveInY;
pchan->curveOutX = chan->curveOutX;
pchan->curveOutY = chan->curveOutY;
pchan->scaleIn = chan->scaleIn;
pchan->scaleOut = chan->scaleOut;
con = chan->constraints.first;
for (pcon = pchan->constraints.first; pcon && con; pcon = pcon->next, con = con->next) {
pcon->enforce = con->enforce;
pcon->headtail = con->headtail;
}
}
开发者ID:UPBGE,项目名称:blender,代码行数:30,代码来源:action.c
示例3: MEM_callocN
static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[4][4], int lay,
int persistent_id[MAX_DUPLI_RECUR], int level, int index, int type, short flag)
{
DupliObject *dob = MEM_callocN(sizeof(DupliObject), "dupliobject");
int i;
BLI_addtail(lb, dob);
dob->ob = ob;
copy_m4_m4(dob->mat, mat);
copy_m4_m4(dob->omat, ob->obmat);
dob->origlay = ob->lay;
dob->type = type;
dob->animated = (type == OB_DUPLIGROUP) && (flag & DUPLILIST_ANIMATED);
ob->lay = lay;
/* set persistent id, which is an array with a persistent index for each level
* (particle number, vertex number, ..). by comparing this we can find the same
* dupli object between frames, which is needed for motion blur. last level
* goes first in the array. */
dob->persistent_id[0] = index;
for (i = 1; i < level; i++)
dob->persistent_id[i] = persistent_id[level - 1 - i];
/* metaballs never draw in duplis, they are instead merged into one by the basis
* mball outside of the group. this does mean that if that mball is not in the
* scene, they will not show up at all, limitation that should be solved once. */
if (ob->type == OB_MBALL)
dob->no_draw = TRUE;
return dob;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:31,代码来源:anim.c
示例4: BLI_listbase_count
DupliApplyData *duplilist_apply(Object *ob, Scene *scene, ListBase *duplilist)
{
DupliApplyData *apply_data = NULL;
int num_objects = BLI_listbase_count(duplilist);
if (num_objects > 0) {
DupliObject *dob;
int i;
apply_data = MEM_mallocN(sizeof(DupliApplyData), "DupliObject apply data");
apply_data->num_objects = num_objects;
apply_data->extra = MEM_mallocN(sizeof(DupliExtraData) * (size_t) num_objects,
"DupliObject apply extra data");
for (dob = duplilist->first, i = 0; dob; dob = dob->next, ++i) {
/* copy obmat from duplis */
copy_m4_m4(apply_data->extra[i].obmat, dob->ob->obmat);
/* make sure derivedmesh is calculated once, before drawing */
if (scene && !(dob->ob->transflag & OB_DUPLICALCDERIVED) && dob->ob->type == OB_MESH) {
mesh_get_derived_final(scene, dob->ob, scene->customdata_mask);
dob->ob->transflag |= OB_DUPLICALCDERIVED;
}
copy_m4_m4(dob->ob->obmat, dob->mat);
/* copy layers from the main duplicator object */
apply_data->extra[i].lay = dob->ob->lay;
dob->ob->lay = ob->lay;
}
}
return apply_data;
}
开发者ID:DrangPo,项目名称:blender,代码行数:32,代码来源:object_dupli.c
示例5: 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,代码来源:envmap.c
示例6: group_duplilist
static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int persistent_id[MAX_DUPLI_RECUR],
int level, short flag)
{
DupliObject *dob;
Group *group;
GroupObject *go;
float mat[4][4], tmat[4][4], id;
if (ob->dup_group == NULL) return;
group = ob->dup_group;
/* simple preventing of too deep nested groups */
if (level > MAX_DUPLI_RECUR) return;
/* handles animated groups, and */
/* we need to check update for objects that are not in scene... */
if (flag & DUPLILIST_DO_UPDATE) {
/* note: update is optional because we don't always need object
* transformations to be correct. Also fixes bug [#29616]. */
group_handle_recalc_and_update(scene, ob, group);
}
if (group_is_animated(ob, group))
flag |= DUPLILIST_ANIMATED;
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) {
/* group dupli offset, should apply after everything else */
if (!is_zero_v3(group->dupli_ofs)) {
copy_m4_m4(tmat, go->ob->obmat);
sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
mult_m4_m4m4(mat, ob->obmat, tmat);
}
else {
mult_m4_m4m4(mat, ob->obmat, go->ob->obmat);
}
dob = new_dupli_object(lb, go->ob, mat, ob->lay, persistent_id, level, id, OB_DUPLIGROUP, flag);
/* check the group instance and object layers match, also that the object visible flags are ok. */
if ((dob->origlay & group->layer) == 0 ||
((G.is_rendering == FALSE) && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
((G.is_rendering == TRUE) && dob->ob->restrictflag & OB_RESTRICT_RENDER))
{
dob->no_draw = TRUE;
}
if (go->ob->transflag & OB_DUPLI) {
copy_m4_m4(dob->ob->obmat, dob->mat);
object_duplilist_recursive(&group->id, scene, go->ob, lb, ob->obmat, persistent_id, level + 1, id, flag);
copy_m4_m4(dob->ob->obmat, dob->omat);
}
}
}
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:58,代码来源:anim.c
示例7: mesh_deform_bind
void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexcos, int totvert, float cagemat[][4])
{
MeshDeformBind mdb;
MVert *mvert;
int a;
waitcursor(1);
start_progress_bar();
memset(&mdb, 0, sizeof(MeshDeformBind));
/* get mesh and cage mesh */
mdb.vertexcos= MEM_callocN(sizeof(float)*3*totvert, "MeshDeformCos");
mdb.totvert= totvert;
mdb.cagedm= mesh_create_derived_no_deform(scene, mmd->object, NULL, CD_MASK_BAREMESH);
mdb.totcagevert= mdb.cagedm->getNumVerts(mdb.cagedm);
mdb.cagecos= MEM_callocN(sizeof(*mdb.cagecos)*mdb.totcagevert, "MeshDeformBindCos");
copy_m4_m4(mdb.cagemat, cagemat);
mvert= mdb.cagedm->getVertArray(mdb.cagedm);
for(a=0; a<mdb.totcagevert; a++)
copy_v3_v3(mdb.cagecos[a], mvert[a].co);
for(a=0; a<mdb.totvert; a++)
mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a*3);
/* solve */
#if 0
if(mmd->mode == MOD_MDEF_VOLUME)
harmonic_coordinates_bind(scene, mmd, &mdb);
else
heat_weighting_bind(scene, dm, mmd, &mdb);
#else
harmonic_coordinates_bind(scene, mmd, &mdb);
#endif
/* assign bind variables */
mmd->bindcagecos= (float*)mdb.cagecos;
mmd->totvert= mdb.totvert;
mmd->totcagevert= mdb.totcagevert;
copy_m4_m4(mmd->bindmat, mmd->object->obmat);
/* transform bindcagecos to world space */
for(a=0; a<mdb.totcagevert; a++)
mul_m4_v3(mmd->object->obmat, mmd->bindcagecos+a*3);
/* free */
mdb.cagedm->release(mdb.cagedm);
MEM_freeN(mdb.vertexcos);
/* compact weights */
modifier_mdef_compact_influences((ModifierData*)mmd);
end_progress_bar();
waitcursor(0);
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:56,代码来源:meshlaplacian.c
示例8: bc_get_property_matrix
void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node &node)
{
// bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name);
float mat[4][4];
float bone_rest_mat[4][4]; /* derived from bone->arm_mat */
float parent_rest_mat[4][4]; /* derived from bone->parent->arm_mat */
bool has_restmat = bc_get_property_matrix(bone, "rest_mat", mat);
if (!has_restmat) {
/* Have no restpose matrix stored, try old style <= Blender 2.78 */
bc_create_restpose_mat(this->export_settings, bone, bone_rest_mat, bone->arm_mat, true);
if (is_export_root(bone)) {
copy_m4_m4(mat, bone_rest_mat);
}
else {
Matrix parent_inverse;
bc_create_restpose_mat(
this->export_settings, bone->parent, parent_rest_mat, bone->parent->arm_mat, true);
invert_m4_m4(parent_inverse, parent_rest_mat);
mul_m4_m4m4(mat, parent_inverse, bone_rest_mat);
}
// OPEN_SIM_COMPATIBILITY
if (export_settings.get_open_sim()) {
// Remove rotations vs armature from transform
// parent_rest_rot * mat * irest_rot
Matrix workmat;
copy_m4_m4(workmat, bone_rest_mat);
workmat[3][0] = workmat[3][1] = workmat[3][2] = 0.0f;
invert_m4(workmat);
mul_m4_m4m4(mat, mat, workmat);
if (!is_export_root(bone)) {
copy_m4_m4(workmat, parent_rest_mat);
workmat[3][0] = workmat[3][1] = workmat[3][2] = 0.0f;
mul_m4_m4m4(mat, workmat, mat);
}
}
}
if (this->export_settings.get_limit_precision()) {
bc_sanitize_mat(mat, LIMITTED_PRECISION);
}
TransformWriter::add_joint_transform(node, mat, NULL, this->export_settings, has_restmat);
}
开发者ID:dfelinto,项目名称:blender,代码行数:56,代码来源:ArmatureExporter.cpp
示例9: bundle_midpoint
static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
{
MovieClip *clip = BKE_object_movieclip_get(scene, ob, false);
MovieTracking *tracking;
MovieTrackingObject *object;
bool ok = false;
float min[3], max[3], mat[4][4], pos[3], cammat[4][4];
if (!clip)
return;
tracking = &clip->tracking;
copy_m4_m4(cammat, ob->obmat);
BKE_tracking_get_camera_object_matrix(scene, ob, mat);
INIT_MINMAX(min, max);
for (object = tracking->objects.first; object; object = object->next) {
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
MovieTrackingTrack *track = tracksbase->first;
float obmat[4][4];
if (object->flag & TRACKING_OBJECT_CAMERA) {
copy_m4_m4(obmat, mat);
}
else {
float imat[4][4];
BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, scene->r.cfra, imat);
invert_m4(imat);
mul_m4_m4m4(obmat, cammat, imat);
}
while (track) {
if ((track->flag & TRACK_HAS_BUNDLE) && TRACK_SELECTED(track)) {
ok = 1;
mul_v3_m4v3(pos, obmat, track->bundle_pos);
minmax_v3v3_v3(min, max, pos);
}
track = track->next;
}
}
if (ok) {
mid_v3_v3v3(vec, min, max);
}
}
开发者ID:diekev,项目名称:blender,代码行数:51,代码来源:view3d_snap.c
示例10: copy_m4_m4
void BL_ArmatureConstraint::RestoreTarget()
{
if (m_constraint && !(m_constraint->flag&CONSTRAINT_OFF) && (!m_blendtarget || m_target)) {
if (m_blendtarget) {
copy_m4_m4(m_blendtarget->obmat, m_blendmat);
if (m_pose)
m_blendtarget->pose = m_pose;
}
if (m_blendsubtarget && m_subtarget) {
copy_m4_m4(m_blendsubtarget->obmat, m_blendsubmat);
if (m_subpose)
m_blendsubtarget->pose = m_subpose;
}
}
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:15,代码来源:BL_ArmatureConstraint.cpp
示例11: float
/* 'rotmat' can be obedit->obmat when uv project is used.
* 'winx' and 'winy' can be from scene->r.xsch/ysch */
UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, float winy)
{
UvCameraInfo uci;
Camera *camera= ob->data;
uci.do_pano = (camera->flag & CAM_PANORAMA);
uci.do_persp = (camera->type==CAM_PERSP);
uci.camangle= lens_to_angle(camera->lens) / 2.0f;
uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
/* account for scaled cameras */
copy_m4_m4(uci.caminv, ob->obmat);
normalize_m4(uci.caminv);
if (invert_m4(uci.caminv)) {
UvCameraInfo *uci_pt;
/* normal projection */
if(rotmat) {
copy_m4_m4(uci.rotmat, rotmat);
uci.do_rotmat= 1;
}
else {
uci.do_rotmat= 0;
}
/* also make aspect ratio adjustment factors */
if (winx > winy) {
uci.xasp= 1.0f;
uci.yasp= winx / winy;
}
else {
uci.xasp= winy / winx;
uci.yasp= 1.0f;
}
/* include 0.5f here to move the UVs into the center */
uci.shiftx = 0.5f - (camera->shiftx * uci.xasp);
uci.shifty = 0.5f - (camera->shifty * uci.yasp);
uci_pt= MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
*uci_pt= uci;
return uci_pt;
}
return NULL;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:50,代码来源:uvproject.c
示例12: rna_Object_mat_convert_space
/* Convert a given matrix from a space to another (using the object and/or a bone as reference). */
static void rna_Object_mat_convert_space(Object *ob,
ReportList *reports,
bPoseChannel *pchan,
float *mat,
float *mat_ret,
int from,
int to)
{
copy_m4_m4((float(*)[4])mat_ret, (float(*)[4])mat);
/* Error in case of invalid from/to values when pchan is NULL */
if (pchan == NULL) {
if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
const char *identifier = NULL;
RNA_enum_identifier(space_items, from, &identifier);
BKE_reportf(reports,
RPT_ERROR,
"'from_space' '%s' is invalid when no pose bone is given!",
identifier);
return;
}
if (ELEM(to, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
const char *identifier = NULL;
RNA_enum_identifier(space_items, to, &identifier);
BKE_reportf(reports,
RPT_ERROR,
"'to_space' '%s' is invalid when no pose bone is given!",
identifier);
return;
}
}
BKE_constraint_mat_convertspace(ob, pchan, (float(*)[4])mat_ret, from, to, false);
}
开发者ID:dfelinto,项目名称:blender,代码行数:35,代码来源:rna_object_api.c
示例13: BKE_object_eval_parent
/* NOTE: based on solve_parenting(), but with the cruft stripped out */
void BKE_object_eval_parent(EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob)
{
Object *par = ob->parent;
float totmat[4][4];
float tmat[4][4];
float locmat[4][4];
DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
/* get local matrix (but don't calculate it, as that was done already!) */
// XXX: redundant?
copy_m4_m4(locmat, ob->obmat);
/* get parent effect matrix */
BKE_object_get_parent_matrix(scene, ob, par, totmat);
/* total */
mul_m4_m4m4(tmat, totmat, ob->parentinv);
mul_m4_m4m4(ob->obmat, tmat, locmat);
/* origin, for help line */
if ((ob->partype & PARTYPE) == PARSKEL) {
copy_v3_v3(ob->orig, par->obmat[3]);
}
else {
copy_v3_v3(ob->orig, totmat[3]);
}
}
开发者ID:DrangPo,项目名称:blender,代码行数:32,代码来源:object_update.c
示例14: get_active_constraints
void AnimationExporter::calc_ob_mat_at_time(Object *ob, float ctime , float mat[][4])
{
ListBase *conlist = get_active_constraints(ob);
bConstraint *con;
for (con = (bConstraint *)conlist->first; con; con = con->next) {
ListBase targets = {NULL, NULL};
bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
if (cti && cti->get_constraint_targets) {
bConstraintTarget *ct;
Object *obtar;
cti->get_constraint_targets(con, &targets);
for (ct = (bConstraintTarget *)targets.first; ct; ct = ct->next) {
obtar = ct->tar;
if (obtar) {
BKE_animsys_evaluate_animdata(scene, &obtar->id, obtar->adt, ctime, ADT_RECALC_ANIM);
BKE_object_where_is_calc_time(scene, obtar, ctime);
}
}
if (cti->flush_constraint_targets)
cti->flush_constraint_targets(con, &targets, 1);
}
}
BKE_object_where_is_calc_time(scene, ob, ctime);
copy_m4_m4(mat, ob->obmat);
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:29,代码来源:AnimationExporter.cpp
示例15: 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,代码来源:TransformReader.cpp
示例16: BL_MeshDeformer
BL_SkinDeformer::BL_SkinDeformer(
BL_DeformableGameObject *gameobj,
struct Object *bmeshobj_old, // Blender object that owns the new mesh
struct Object *bmeshobj_new, // Blender object that owns the original mesh
class RAS_MeshObject *mesh,
bool release_object,
bool recalc_normal,
BL_ArmatureObject* arma) :
BL_MeshDeformer(gameobj, bmeshobj_old, mesh),
m_armobj(arma),
m_lastArmaUpdate(-1),
//m_defbase(&bmeshobj_old->defbase),
m_releaseobject(release_object),
m_recalcNormal(recalc_normal),
m_copyNormals(false),
m_dfnrToPC(NULL)
{
// this is needed to ensure correct deformation of mesh:
// the deformation is done with Blender's armature_deform_verts() function
// that takes an object as parameter and not a mesh. The object matrice is used
// in the calculation, so we must use the matrix of the original object to
// simulate a pure replacement of the mesh.
copy_m4_m4(m_obmat, bmeshobj_new->obmat);
m_deformflags = get_deformflags(bmeshobj_new);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:25,代码来源:BL_SkinDeformer.cpp
示例17: envmap_transmatrix
static void envmap_transmatrix(float mat[4][4], int part)
{
float tmat[4][4], eul[3], rotmat[4][4];
eul[0] = eul[1] = eul[2] = 0.0;
if (part == 0) { /* neg z */
/* pass */
}
else if (part == 1) { /* pos z */
eul[0] = M_PI;
}
else if (part == 2) { /* pos y */
eul[0] = M_PI / 2.0;
}
else if (part == 3) { /* neg x */
eul[0] = M_PI / 2.0;
eul[2] = M_PI / 2.0;
}
else if (part == 4) { /* neg y */
eul[0] = M_PI / 2.0;
eul[2] = M_PI;
}
else { /* pos x */
eul[0] = M_PI / 2.0;
eul[2] = -M_PI / 2.0;
}
copy_m4_m4(tmat, mat);
eul_to_mat4(rotmat, eul);
mul_m4_m4m4(mat, tmat, rotmat);
}
开发者ID:wisaac407,项目名称:blender,代码行数:32,代码来源:envmap.c
示例18: BKE_object_eval_uber_transform
void BKE_object_eval_uber_transform(EvaluationContext *UNUSED(eval_ctx),
Scene *UNUSED(scene),
Object *ob)
{
/* TODO(sergey): Currently it's a duplicate of logic in BKE_object_handle_update_ex(). */
// XXX: it's almost redundant now...
/* Handle proxy copy for target, */
if (ob->id.lib && ob->proxy_from) {
if (ob->proxy_from->proxy_group) {
/* Transform proxy into group space. */
Object *obg = ob->proxy_from->proxy_group;
float imat[4][4];
invert_m4_m4(imat, obg->obmat);
mul_m4_m4m4(ob->obmat, imat, ob->proxy_from->obmat);
/* Should always be true. */
if (obg->dup_group) {
add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
}
}
else
copy_m4_m4(ob->obmat, ob->proxy_from->obmat);
}
ob->recalc &= ~(OB_RECALC_OB | OB_RECALC_TIME);
if (ob->data == NULL) {
ob->recalc &= ~OB_RECALC_DATA;
}
}
开发者ID:DrangPo,项目名称:blender,代码行数:29,代码来源:object_update.c
示例19: RE_NewRender
/* copy current render */
static Render *envmap_render_copy(Render *re, EnvMap *env)
{
Render *envre;
float viewscale;
int cuberes;
envre = RE_NewRender("Envmap");
env->lastsize = re->r.size;
cuberes = (env->cuberes * re->r.size) / 100;
cuberes &= 0xFFFC;
/* this flag has R_ZTRA in it for example */
envre->flag = re->flag;
/* set up renderdata */
envre->r = re->r;
envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR);
envre->r.layers.first = envre->r.layers.last = NULL;
envre->r.filtertype = 0;
envre->r.tilex = envre->r.xsch / 2;
envre->r.tiley = envre->r.ysch / 2;
envre->r.size = 100;
envre->r.yasp = envre->r.xasp = 1;
RE_InitState(envre, NULL, &envre->r, NULL, cuberes, cuberes, NULL);
envre->main = re->main;
envre->scene = re->scene; /* unsure about this... */
envre->scene_color_manage = re->scene_color_manage;
envre->lay = re->lay;
/* view stuff in env render */
viewscale = (env->type == ENV_PLANE) ? env->viewscale : 1.0f;
RE_SetEnvmapCamera(envre, env->object, viewscale, env->clipsta, env->clipend);
copy_m4_m4(envre->viewmat_orig, re->viewmat_orig);
/* callbacks */
envre->display_draw = re->display_draw;
envre->ddh = re->ddh;
envre->test_break = re->test_break;
envre->tbh = re->tbh;
/* and for the evil stuff; copy the database... */
envre->totvlak = re->totvlak;
envre->totvert = re->totvert;
envre->tothalo = re->tothalo;
envre->totstrand = re->totstrand;
envre->totlamp = re->totlamp;
envre->sortedhalos = re->sortedhalos;
envre->lights = re->lights;
envre->objecttable = re->objecttable;
envre->customdata_names = re->customdata_names;
envre->raytree = re->raytree;
envre->totinstance = re->totinstance;
envre->instancetable = re->instancetable;
envre->objectinstance = re->objectinstance;
envre->qmcsamplers = re->qmcsamplers;
return envre;
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:61,代码来源:envmap.c
示例20: BKE_pose_eval_bone
void BKE_pose_eval_bone(EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob,
bPoseChannel *pchan)
{
DEG_debug_print_eval_subdata(
__func__, ob->id.name, ob, "pchan", pchan->name, pchan);
BLI_assert(ob->type == OB_ARMATURE);
bArmature *arm = (bArmature *)ob->data;
if (arm->edbo || (arm->flag & ARM_RESTPOS)) {
Bone *bone = pchan->bone;
if (bone) {
copy_m4_m4(pchan->pose_mat, bone->arm_mat);
copy_v3_v3(pchan->pose_head, bone->arm_head);
copy_v3_v3(pchan->pose_tail, bone->arm_tail);
}
}
else {
/* TODO(sergey): Currently if there are constraints full transform is being
* evaluated in BKE_pose_constraints_evaluate.
*/
if (pchan->constraints.first == NULL) {
if (pchan->flag & POSE_IKTREE || pchan->flag & POSE_IKSPLINE) {
/* pass */
}
else {
if ((pchan->flag & POSE_DONE) == 0) {
/* TODO(sergey): Use time source node for time. */
float ctime = BKE_scene_frame_get(scene); /* not accurate... */
BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1);
}
}
}
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:35,代码来源:armature_update.c
注:本文中的copy_m4_m4函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论