| 611 | } |
| 612 | |
| 613 | void render(const wf::scene::render_instruction_t& data, std::vector<wf::auxilliary_buffer_t>& buffers) |
| 614 | { |
| 615 | data.pass->custom_gles_subpass([&] |
| 616 | { |
| 617 | if (program.get_program_id(wf::TEXTURE_TYPE_RGBA) == 0) |
| 618 | { |
| 619 | load_program(); |
| 620 | } |
| 621 | |
| 622 | GL_CALL(glClear(GL_DEPTH_BUFFER_BIT)); |
| 623 | background->render_frame(data.target, animation); |
| 624 | |
| 625 | auto vp = calculate_vp_matrix(data.target); |
| 626 | |
| 627 | program.use(wf::TEXTURE_TYPE_RGBA); |
| 628 | GL_CALL(glEnable(GL_DEPTH_TEST)); |
| 629 | GL_CALL(glDepthFunc(GL_LESS)); |
| 630 | |
| 631 | static GLfloat vertexData[] = { |
| 632 | -0.5, 0.5, |
| 633 | 0.5, 0.5, |
| 634 | 0.5, -0.5, |
| 635 | -0.5, -0.5 |
| 636 | }; |
| 637 | |
| 638 | static GLfloat coordData[] = { |
| 639 | 0.0f, 1.0f, |
| 640 | 1.0f, 1.0f, |
| 641 | 1.0f, 0.0f, |
| 642 | 0.0f, 0.0f |
| 643 | }; |
| 644 | |
| 645 | program.attrib_pointer("position", 2, 0, vertexData); |
| 646 | program.attrib_pointer("uvPosition", 2, 0, coordData); |
| 647 | program.uniformMatrix4f("VP", vp); |
| 648 | if (tessellation_support) |
| 649 | { |
| 650 | program.uniform1i("deform", use_deform); |
| 651 | program.uniform1i("light", use_light); |
| 652 | program.uniform1f("ease", |
| 653 | animation.cube_animation.ease_deformation); |
| 654 | } |
| 655 | |
| 656 | /* We render the cube in two stages, based on winding. |
| 657 | * By using two stages, we ensure that we first render the cube sides |
| 658 | * that are on the back, and then we render those at the front, so we |
| 659 | * don't have to use depth testing and we also can support alpha cube. */ |
| 660 | GL_CALL(glEnable(GL_CULL_FACE)); |
| 661 | render_cube(GL_CCW, buffers); |
| 662 | render_cube(GL_CW, buffers); |
| 663 | GL_CALL(glDisable(GL_CULL_FACE)); |
| 664 | |
| 665 | GL_CALL(glDisable(GL_DEPTH_TEST)); |
| 666 | program.deactivate(); |
| 667 | }); |
| 668 | } |
| 669 | |
| 670 | wf::effect_hook_t pre_hook = [=] () |
no test coverage detected