本文整理汇总了C++中TransformPtr::world方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformPtr::world方法的具体用法?C++ TransformPtr::world怎么用?C++ TransformPtr::world使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformPtr
的用法示例。
在下文中一共展示了TransformPtr::world方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessEntities
void GuiMeshRender::ProcessEntities(const EntityMap &entities) {
if (entities.empty()) {
//printf("Warning: GuiMeshRender: Entity list is empty\n");
return;
}
EntityMap::const_iterator it, ite;
GuiMeshPtr mesh;
TransformPtr transform;
mat4 model, view, projection, model_view, mvp;
mat3 normal;
// warning: make sure the values here are all floats
projection = glm::ortho(0.0f, 800.0f, 600.0f, 0.0f, -1.0f, 1.0f);
for (it = entities.begin(), ite = entities.end(); it != ite; ++it) {
mesh = gui_mesh_mapper_(it->second);
transform = transform_mapper_(it->second);
model = transform->world();
model_view = model; // camera does not need to effect this
mvp = projection * model_view;
normal = inverse(transpose(mat3(model_view)));
shared_ptr<BasicMaterial> material = boost::dynamic_pointer_cast<BasicMaterial>(mesh->material);
vec4 light_pos = material->light_position_;
// hack to have light move with world
// todo: implement light as entity
material->light_position_ = model_view * light_pos;
// do things like setup colors and lights
// and attach shader program
mesh->material->PreRender();
material->light_position_ = light_pos;
// push matrices up
mesh->material->PushMatrices(model_view, projection, mvp, normal);
// call draw
mesh->geometry->Draw();
// let go of shader program
mesh->material->PostRender();
}
}