本文整理汇总了C++中ModelLoader::ReadModel方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelLoader::ReadModel方法的具体用法?C++ ModelLoader::ReadModel怎么用?C++ ModelLoader::ReadModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelLoader
的用法示例。
在下文中一共展示了ModelLoader::ReadModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
Object::Object()
{
try
{
position = { { 0., 0., 0. }, 0., 0., -1, 0, 0, false };
scale = .1f;
ModelLoader modelLoader;
model = modelLoader.ReadModel("resources\\objects\\Captain America.obj", "resources\\objects\\Captain America.mtl");
if (!model)
{
throw "Can't load player's geometry";
}
else
{
boundingBox.isShowing = false;
calculateSizes();
glGenBuffers(1, &tid);
glBindBuffer(GL_ARRAY_BUFFER, tid);
glBufferData(GL_ARRAY_BUFFER, model->UV_vertices.size()*sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, model->UV_vertices.size()*sizeof(float), &model->UV_vertices[0]);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glGenBuffers(1, &nid);
glBindBuffer(GL_ARRAY_BUFFER, nid);
glBufferData(GL_ARRAY_BUFFER, model->normals.size()*sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, model->normals.size()*sizeof(float), &model->normals[0]);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glGenBuffers(1, &vid);
glBindBuffer(GL_ARRAY_BUFFER, vid);
glBufferData(GL_ARRAY_BUFFER, model->vertices.size()*sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, model->vertices.size()*sizeof(float), &model->vertices[0]);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glGenBuffers(1, &bbvid);
glBindBuffer(GL_ARRAY_BUFFER, bbvid);
glBufferData(GL_ARRAY_BUFFER, 72 * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, 0, 72 * sizeof(float), &boundingBox.coords[0]);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
}
catch (const char* error)
{
model = NULL;
std::cout << error << std::endl;
}
}