Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. // Node highlighting
  2. if (m_enable_highlighting) {
  3. u8 day = m_highlight_mesh_color.getRed();
  4. u8 night = m_highlight_mesh_color.getGreen();
  5. video::SColor hc;
  6. finalColorBlend(hc, day, night, daynight_ratio);
  7. float sin_r = 0.07 * sin(1.5 * time);
  8. float sin_g = 0.07 * sin(1.5 * time + irr::core::PI * 0.5);
  9. float sin_b = 0.07 * sin(1.5 * time + irr::core::PI);
  10. float base = 0.8;
  11. if (crack != -1)
  12. base -= crack * 0.1;
  13. hc.setRed(core::clamp(core::round32(hc.getRed() * (base + sin_r)), 0, 255));
  14. hc.setGreen(core::clamp(core::round32(hc.getGreen() * (base + sin_g)), 0, 255));
  15. hc.setBlue(core::clamp(core::round32(hc.getBlue() * (base + sin_b)), 0, 255));
  16.  
  17. for(std::list<u32>::iterator
  18. i = m_highlighted_materials.begin();
  19. i != m_highlighted_materials.end(); i++)
  20. {
  21. scene::IMeshBuffer *buf = m_mesh->getMeshBuffer(*i);
  22. video::S3DVertex *vertices = (video::S3DVertex*)buf->getVertices();
  23. for (u32 j = 0; j < buf->getVertexCount() ;j++)
  24. vertices[j].Color = hc;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement