本文整理汇总了C++中Geometry::Translate方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::Translate方法的具体用法?C++ Geometry::Translate怎么用?C++ Geometry::Translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::Translate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateObjectsWithInput
void ObjectMan::UpdateObjectsWithInput()
{
Geometry* car = GetInstance()->objectMap[CAR];
float z = InputMan::GetMovementBackward() - InputMan::GetMovementForward();
float x = InputMan::GetMovementRight() - InputMan::GetMovementLeft();
bool accel = InputMan::GetAccel();
car->Translate(accel * x * TRANSLATE_SCALE, 0.0, accel * z * TRANSLATE_SCALE);
}
示例2: LoadObjects
void ObjectMan::LoadObjects()
{
ifstream enlistments(ENLISTMENTS);
if(!enlistments.is_open())
{
cout << "Bad models.enlistments file:" << endl
<< "\tMake sure you have a models.enlistments file in your models "
<< "directory that contains the names of each object. Leave off the "
<< "file extension. Textures should have the same name." << endl;
return;
}
cout << "Loading Objects:" << endl;
while(enlistments.good())
{
string line;
getline(enlistments, line);
if (line.find("#") == 0 || line.empty())
{
// Comment or empty line in enlistments - skip over it
continue;
}
string obj_id;
string filename;
float tx, ty, tz, rx, ry, rz, sx, sy, sz;
string parent_id;
istringstream iss(line);
iss >> obj_id;
iss >> filename;
iss >> tx;
iss >> ty;
iss >> tz;
iss >> rx;
iss >> ry;
iss >> rz;
iss >> sx;
iss >> sy;
iss >> sz;
iss >> parent_id;
bool collidable = false;
if (filename.find("::") != string::npos)
{
collidable = true;
filename = filename.substr(0, filename.find("::"));
}
Geometry* obj = LoadObject(obj_id, filename, collidable, parent_id);
cout << "\t\tTransformations...";
obj->Translate(tx, ty, tz);
obj->Rotate(rx, ry, rz);
obj->Scale(sx, sy, sz);
cout << "DONE." << endl;
LoadTexture(obj_id, filename);
}
cout << "Loading Complete." << endl << endl;
}