void TrackType3D::build_part(const TrackPart &part, const Profile &profile, const Point &offset, GL::MeshBuilder &bld, unsigned &base_index)
{
float plen = part.get_length();
- unsigned nsegs = (part.is_curved() ? static_cast<unsigned>(plen*16)+1 : 1);
+ unsigned nsegs = (part.is_curved() ? static_cast<unsigned>(plen*32)+1 : 1);
unsigned n_points = profile.get_n_points();
for(unsigned i=0; i<=nsegs; ++i)
}
// Setup OpenGL
- GL::enable(GL::DEPTH_TEST);
- GL::enable(GL::BLEND);
- GL::blend_func(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA);
GL::enable(GL_CULL_FACE);
pipeline = new GL::Pipeline(window.get_width(), window.get_height(), false);
pipeline->set_camera(&camera);
- pipeline->add_renderable(layout_3d->get_scene());
+ pipeline->add_renderable_for_pass(layout_3d->get_scene(), 0);
if(base_object)
- pipeline->add_renderable(*base_object);
+ pipeline->add_renderable_for_pass(*base_object, 0);
+ pipeline->add_renderable_for_pass(layout_3d->get_endpoint_scene(), "unlit");
light.set_position(0, -0.259, 0.966, 0);
lighting.attach(0, light);
- GL::PipelinePass *pass = &pipeline->add_pass(GL::Tag());
+ GL::PipelinePass *pass = &pipeline->add_pass(0);
pass->lighting = &lighting;
+ pass->depth_test = &GL::DepthTest::lequal();
+
+ pass = &pipeline->add_pass("unlit");
+ pass->depth_test = &GL::DepthTest::lequal();
+ pass->blend = &GL::Blend::alpha();
camera.set_up_direction(GL::Vector3(0, 0, 1));
view_all();
void Designer::edit_route(Route &r)
{
+ if(!cur_route)
+ pipeline->add_renderable_for_pass(layout_3d->get_path_scene(), "unlit");
+
cur_route = &r;
show_route(r);
}
void Designer::render()
{
- GL::clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT);
- GL::enable(GL::DEPTH_TEST);
- GL::Texture::unbind();
+ GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT|GL::DEPTH_BUFFER_BIT);
if(mode==CATALOGUE)
{
else
{
pipeline->render_all();
- layout_3d->get_endpoint_scene().render();
- if(cur_route)
- layout_3d->get_path_scene().render();
GL::enable(GL_CULL_FACE);
- GL::disable(GL::DEPTH_TEST);
overlay->render(0);
- GL::enable(GL::DEPTH_TEST);
+ GL::Bind bind_depth(GL::DepthTest::lequal());
manipulator.render();
if(mode==MEASURE)
measure.render();
GL::disable(GL::DEPTH_TEST);
+ GL::Bind bind_blend(GL::Blend::alpha());
root->render();
+ GL::Texture::unbind();
}
Track3D *Designer::pick_track(int x, int y)