当前位置: 首页>>代码示例>>C++>>正文


C++ Geometry::Translate方法代码示例

本文整理汇总了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);
}
开发者ID:tygill,项目名称:Racer,代码行数:8,代码来源:ObjectMan.cpp

示例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;
}
开发者ID:tygill,项目名称:Racer,代码行数:67,代码来源:ObjectMan.cpp


注:本文中的Geometry::Translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。