本文整理汇总了C++中VisualServer::skeleton_bone_set_transform方法的典型用法代码示例。如果您正苦于以下问题:C++ VisualServer::skeleton_bone_set_transform方法的具体用法?C++ VisualServer::skeleton_bone_set_transform怎么用?C++ VisualServer::skeleton_bone_set_transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualServer
的用法示例。
在下文中一共展示了VisualServer::skeleton_bone_set_transform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _notification
void Skeleton::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_WORLD: {
if (dirty) {
dirty = false;
_make_dirty(); // property make it dirty
}
} break;
case NOTIFICATION_EXIT_WORLD: {
} break;
case NOTIFICATION_TRANSFORM_CHANGED: {
if (dirty)
break; //will be eventually updated
//if moved, just update transforms
VisualServer *vs = VisualServer::get_singleton();
const Bone *bonesptr = bones.ptr();
int len = bones.size();
Transform global_transform = get_global_transform();
Transform global_transform_inverse = global_transform.affine_inverse();
for (int i = 0; i < len; i++) {
const Bone &b = bonesptr[i];
vs->skeleton_bone_set_transform(skeleton, i, global_transform * (b.transform_final * global_transform_inverse));
}
} break;
case NOTIFICATION_UPDATE_SKELETON: {
VisualServer *vs = VisualServer::get_singleton();
Bone *bonesptr = bones.ptrw();
int len = bones.size();
vs->skeleton_allocate(skeleton, len); // if same size, nothin really happens
// pose changed, rebuild cache of inverses
if (rest_global_inverse_dirty) {
// calculate global rests and invert them
for (int i = 0; i < len; i++) {
Bone &b = bonesptr[i];
if (b.parent >= 0)
b.rest_global_inverse = bonesptr[b.parent].rest_global_inverse * b.rest;
else
b.rest_global_inverse = b.rest;
}
for (int i = 0; i < len; i++) {
Bone &b = bonesptr[i];
b.rest_global_inverse.affine_invert();
}
rest_global_inverse_dirty = false;
}
Transform global_transform = get_global_transform();
Transform global_transform_inverse = global_transform.affine_inverse();
for (int i = 0; i < len; i++) {
Bone &b = bonesptr[i];
if (b.disable_rest) {
if (b.enabled) {
Transform pose = b.pose;
if (b.custom_pose_enable) {
pose = b.custom_pose * pose;
}
if (b.parent >= 0) {
b.pose_global = bonesptr[b.parent].pose_global * pose;
} else {
b.pose_global = pose;
}
} else {
if (b.parent >= 0) {
b.pose_global = bonesptr[b.parent].pose_global;
} else {
b.pose_global = Transform();
}
}
} else {
if (b.enabled) {
Transform pose = b.pose;
if (b.custom_pose_enable) {
//.........这里部分代码省略.........