本文整理汇总了C++中ISkin::GetSkinInitTM方法的典型用法代码示例。如果您正苦于以下问题:C++ ISkin::GetSkinInitTM方法的具体用法?C++ ISkin::GetSkinInitTM怎么用?C++ ISkin::GetSkinInitTM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISkin
的用法示例。
在下文中一共展示了ISkin::GetSkinInitTM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeSkin
bool Exporter::makeSkin(NiTriBasedGeomRef shape, INode *node, FaceGroup &grp, TimeValue t)
{
if (!mExportSkin)
return false;
if (grp.verts.empty())
return false;
//get the skin modifier
Modifier *mod = GetSkin(node);
if (!mod)
return false;
ISkin *skin = (ISkin *) mod->GetInterface(I_SKIN);
if (!skin)
return false;
ISkinContextData *skinData = skin->GetContextInterface(node);
if (!skinData)
return false;
if (grp.strips.empty())
strippify(grp);
// Create new call back to finish export
SkinInstance* si = new SkinInstance(this);
mPostExportCallbacks.push_back(si);
skin->GetSkinInitTM(node, si->bone_init_tm, false);
skin->GetSkinInitTM(node, si->node_init_tm, true);
si->shape = shape;
// Get bone references (may not actually exist in proper structure at this time)
int totalBones = skin->GetNumBones();
si->boneWeights.resize(totalBones);
si->boneList.resize(totalBones);
for (int i=0; i<totalBones; ++i) {
si->boneList[i] = getNode(skin->GetBone(i));
}
vector<int>& vidx = grp.vidx;
int nv = vidx.size();
for (int i=0; i<nv; ++i)
{
int vi = vidx[i];
int nbones = skinData->GetNumAssignedBones(vi);
for (int j=0; j<nbones; ++j)
{
SkinWeight sw;
sw.index = i;
sw.weight = skinData->GetBoneWeight(vi,j);
int boneIndex = skinData->GetAssignedBone(vi,j);
SkinInstance::SkinWeightList& weights = si->boneWeights[boneIndex];
weights.push_back(sw);
}
}
// remove unused bones
vector<NiNodeRef>::iterator bitr = si->boneList.begin();
SkinInstance::BoneWeightList::iterator switr = si->boneWeights.begin();
for (int i=0; i<totalBones; ++i) {
vector<SkinWeight> &weights = (*switr);
if (weights.empty())
{
bitr = si->boneList.erase(bitr);
switr = si->boneWeights.erase(switr);
}
else
{
++bitr, ++switr;
}
}
// Check for dismemberment
if (IsFallout3() || IsSkyrim()) {
Modifier *dismemberSkinMod = GetBSDismemberSkin(node);
if (dismemberSkinMod)
{
if (IBSDismemberSkinModifier *disSkin = (IBSDismemberSkinModifier *) dismemberSkinMod->GetInterface(I_BSDISMEMBERSKINMODIFIER)){
Tab<IBSDismemberSkinModifierData*> modData = disSkin->GetModifierData();
if (modData.Count() >= 1) {
IBSDismemberSkinModifierData* bsdsmd = modData[0];
si->SkinInstConstructor = BSDismemberSkinInstance::Create;
Tab<BSDSPartitionData> &flags = bsdsmd->GetPartitionFlags();
GenericNamedSelSetList &fselSet = bsdsmd->GetFaceSelList();
FaceMap fmap;
NiTriBasedGeomDataRef data = DynamicCast<NiTriBasedGeomData>(shape->GetData());
vector<Triangle> tris = data->GetTriangles();
for (int i=0; i<tris.size(); ++i) {
Triangle tri = tris[i];
fmap[ rotate(tri) ] = i;
}
// Build up list of partitions and face to partition map
si->partitions.resize(flags.Count());
si->facePartList.resize( grp.faces.size(), -1 );
for (int i=0; i<flags.Count(); ++i) {
BodyPartList& bp = si->partitions[i];
//.........这里部分代码省略.........