本文整理汇总了C++中MeshModel::transform方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshModel::transform方法的具体用法?C++ MeshModel::transform怎么用?C++ MeshModel::transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshModel
的用法示例。
在下文中一共展示了MeshModel::transform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseMeshInfo
static void parseMeshInfo(MeshModel* root, float curr_time)
{
_log("OBJECT_NODE_TAG");
enterChunk();
std::string name, inst;
Vector pivot;
Animation anim;
unsigned short id = 65535, parent = 65535, flags1, flags2;
Box box = Box(Vector(), Vector());
Vector box_centre;
while (int chunk_id = nextChunk()) {
switch (chunk_id) {
case 0xb030: //NODE_ID
in.sgetn((char*)&id, 2);
_log("NODE_ID: " + itoa(id));
break;
case 0xb010: //NODE_HDR
name = parseString();
in.sgetn((char*)&flags1, 2);
in.sgetn((char*)&flags2, 2);
in.sgetn((char*)&parent, 2);
_log("NODE_HDR: name=" + name + " parent=" + itoa(parent));
break;
case 0xb011: //INSTANCE NAME
inst = parseString();
_log("INSTANCE_NAME: " + inst);
break;
case 0xb013: //PIVOT
in.sgetn((char*)&pivot, 12);
if (conv)
pivot = conv_tform * pivot;
_log("PIVOT: " + ftoa(pivot.x) + "," + ftoa(pivot.y) + "," + ftoa(pivot.z));
break;
case 0xb014: //BOUNDBOX
in.sgetn((char*)&(box.a), 12);
in.sgetn((char*)&(box.b), 12);
box_centre = box.centre();
if (conv)
box_centre = conv_tform * box_centre;
_log("BOUNDBOX: min=" + ftoa(box.a.x) + "," + ftoa(box.a.y) + "," + ftoa(box.a.z) + " max=" + ftoa(box.b.x)
+ "," + ftoa(box.b.y) + "," + ftoa(box.b.z));
break;
case 0xb020: //POS_TRACK_TAG
case 0xb021: //ROT_TRACK_TAG
case 0xb022: //SCALE_TRACK_TAG
if (!collapse)
parseAnimKeys(&anim, chunk_id);
break;
}
}
leaveChunk();
MeshModel* p = root;
if (parent != 65535) {
std::map<int, MeshModel*>::const_iterator it = id_map.find(parent);
if (it == id_map.end())
return;
p = it->second;
}
MeshModel* mesh = 0;
if (name == "$$$DUMMY") {
mesh = new MeshModel();
mesh->SetName(inst);
mesh->SetParent(p);
} else {
std::map<std::string, MeshModel*>::const_iterator it = name_map.find(name);
if (it == name_map.end())
return;
mesh = it->second;
name_map.erase(name);
if (pivot != Vector()) {
mesh->transform(-pivot);
}
Transform t = mesh->GetWorldTransform();
mesh->SetParent(p);
mesh->SetWorldTransform(t);
}
mesh->setAnimation(anim);
if (id != 65535)
id_map[id] = mesh;
}