本文整理汇总了C++中Renderable::load_obj方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderable::load_obj方法的具体用法?C++ Renderable::load_obj怎么用?C++ Renderable::load_obj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderable
的用法示例。
在下文中一共展示了Renderable::load_obj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//.........这里部分代码省略.........
}
glp::FragProgram fprog;
fprog.init();
glpx::program_set_source_file(fprog, "glsl/skybox.fp");
if (!fprog.compile())
{
glpx::ProgramLog pl;
MessageBoxA(nullptr, glpx::get_log(fprog, pl),
"FRAGMENT PROGRAM ERROR", MB_OK | MB_ICONSTOP);
fprog.release();
vprog.release();
m_dev.release();
return false;
}
m_skybox_prog.init();
m_skybox_prog.attach(vprog);
m_skybox_prog.attach(fprog);
m_skybox_prog.bind_attrib_loc("point", Renderable::ATTR_LOC_POINT);
if (!m_skybox_prog.link())
{
glpx::ProgramLog pl;
MessageBoxA(nullptr, glpx::get_log(m_renderProg, pl),
"PROGRAM LINK ERROR", MB_OK | MB_ICONSTOP);
m_renderProg.release();
fprog.release();
vprog.release();
m_dev.release();
return false;
}
}
m_timerQuery.init();
m_queryStarted = false;
//################## Renderable objects
Renderable* ren = nullptr;
ren = new Renderable();
if (!ren->load_obj(L"data/objects/pool3.obj.txt", false, false))
return false;
if (!ren->addTextures("base", L"data/textures/simple_diff.jpg", nullptr, nullptr))
return false;
m_objects.push_back(ren);
m_instances.push_back(std::make_pair(math::Mat4x4f(math::Mat4x4f::I), ren));
ren = new Renderable();
if (!ren->load_obj(L"data/objects/ter2.obj.txt", false, false))
return false;
if (!ren->addTextures("base", L"data/textures/simple_diff.jpg", nullptr, nullptr))
return false;
m_objects.push_back(ren);
m_instances.push_back(std::make_pair(math::Mat4x4f(math::Mat4x4f::I), ren));
m_water = new WaterSurface(8.0f, 4.0f, -0.07f, 400, 200, 0.4f, 0.01f, 0.995f, 10000);
if(!m_water->init())
return false;
m_skybox = new Renderable();
if (!m_skybox->load_box(128.0f, 128.0f, 128.0f))
return false;
// TODO: change lines below
if (!m_skybox->addTextures("base", L"data/textures/water_diff.jpg", nullptr, nullptr))
return false;
//################## Textures
m_skybox_cubemap.init();
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_X_POS, L"data/textures/skybox/vanilla_sky_lf.jpg"))
return false;
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_X_NEG, L"data/textures/skybox/vanilla_sky_rt.jpg"))
return false;
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_Y_POS, L"data/textures/skybox/vanilla_sky_up.jpg"))
return false;
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_Y_NEG, L"data/textures/skybox/vanilla_sky_dn.jpg"))
return false;
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_Z_POS, L"data/textures/skybox/vanilla_sky_ft.jpg"))
return false;
if(!glpx::LoadTexCube_RGBA(m_skybox_cubemap, glp::TexCubeBase::CF_Z_NEG, L"data/textures/skybox/vanilla_sky_bk.jpg"))
return false;
m_skybox_cubemap.set_wrapSTR(glp::Tex::WrapMode::WM_CLAMP_TO_EDGE);
m_skybox_cubemap.gen_mipmaps();
glp::Device::enable_cubemap_seamless();
glp::Device::enable_multisample();
glClearDepth(1.0);
glClearColor(0.0f, 0.0f, 0.0f, 1.0);
assert(glGetError() == GL_NO_ERROR);
show();
return true;
}