本文整理汇总了C++中Body::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ Body::Load方法的具体用法?C++ Body::Load怎么用?C++ Body::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body::Load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Star
Body *Body::Unserialize(Serializer::Reader &_rd, Space *space)
{
Serializer::Reader rd = _rd.RdSection("Body");
Body *b = 0;
Object::Type type = Object::Type(rd.Int32());
switch (type) {
case Object::STAR:
b = new Star(); break;
case Object::PLANET:
b = new Planet();
break;
case Object::SPACESTATION:
b = new SpaceStation(); break;
case Object::SHIP:
b = new Ship(); break;
case Object::PLAYER:
b = new Player(); break;
case Object::MISSILE:
b = new Missile(); break;
case Object::PROJECTILE:
b = new Projectile(); break;
case Object::CARGOBODY:
b = new CargoBody(); break;
case Object::HYPERSPACECLOUD:
b = new HyperspaceCloud(); break;
default:
assert(0);
}
b->Load(rd, space);
return b;
}
示例2: Star
Body *Body::Unserialize(Serializer::Reader &_rd, Space *space)
{
Serializer::Reader rd = _rd.RdSection("Body");
Body *b = 0;
Object::Type type = Object::Type(rd.Int32());
switch (type) {
case Object::STAR:
b = new Star(); break;
case Object::PLANET:
b = new Planet();
break;
case Object::SPACESTATION:
b = new SpaceStation(); break;
case Object::SHIP:
b = new Ship(); break;
case Object::PLAYER:
b = new Player(); break;
case Object::MISSILE:
b = new Missile(); break;
case Object::PROJECTILE:
b = new Projectile(); break;
case Object::CARGOBODY:
b = new CargoBody(); break;
case Object::HYPERSPACECLOUD:
b = new HyperspaceCloud(); break;
default:
assert(0);
}
b->Load(rd, space);
// must SetFrame() correctly so ModelBodies can add geom to space
Frame *f = b->m_frame;
b->m_frame = 0;
b->SetFrame(f);
//
b->SetPosition(rd.Vector3d());
matrix4x4d m;
for (int i=0; i<16; i++) m[i] = rd.Double();
b->SetRotMatrix(m);
return b;
}