Guest User

Untitled

a guest
Jan 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. Ogre::Ray ray;
  2. ray.setOrigin(Ogre::Vector3( ray_pos.x, ray_pos.y, ray_pos.z));
  3. ray.setDirection(Ogre::Vector3(ray_dir.x, ray_dir.y, ray_dir.z));
  4. Ogre::Vector3 result;
  5.  
  6. RaycastFromPoint(ray.getOrigin(), ray.getDirection(), result, u1, u2, u3);
  7. float pointZ = out.pointlist[(3*i)+2];
  8.  
  9. if(result.z < pointZ)
  10. {
  11. std::cout << "Remove edge "<< u1 << " "<< u2 << " "<< u3 << std::endl;
  12. Utility::DebugPrimitives::drawSphere( result, 0.3f , "RayMesh"+std::to_string(counter), "SimpleColors/SolidGreen" );
  13.  
  14. cntEdges++;
  15. indices = static_cast<uint16_t *>(indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));
  16.  
  17. for (int i = 0; i<out.numberofedges; i++)
  18. {
  19. if(indices[i] == u1 || indices[i] == u2 || indices[i] == u3)
  20. {
  21. continue;
  22. }
  23.  
  24. out.edgelist[i] = indices[i];
  25.  
  26.  
  27. }
  28. indexBuffer->unlock();
  29.  
  30.  
  31. indices = static_cast<uint16_t *>(indexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD));
  32.  
  33. for (int i = 0; i<numEdges - cntEdges; i++)
  34. {
  35. indices[i] = out.edgelist[i];
  36. }
  37.  
  38. indexBuffer->unlock();
  39.  
  40. }
Add Comment
Please, Sign In to add comment