BsMeshProxy.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "BsMeshProxy.h"
  2. #include "BsRenderableProxy.h"
  3. namespace BansheeEngine
  4. {
  5. MeshProxy::MeshProxy(const std::shared_ptr<VertexData>& vertexData,
  6. const IndexBufferPtr& indexBuffer, const SubMesh& subMesh)
  7. :mVertexData(vertexData), mIndexBuffer(indexBuffer), mSubMesh(subMesh)
  8. {
  9. }
  10. void MeshProxy::addRenderableProxy(RenderableSubProxy* proxy)
  11. {
  12. mRenderableProxies.push_back(proxy);
  13. }
  14. void MeshProxy::removeRenderableProxy(RenderableSubProxy* proxy)
  15. {
  16. auto iterFind = std::find(mRenderableProxies.begin(), mRenderableProxies.end(), proxy);
  17. if (iterFind != mRenderableProxies.end())
  18. mRenderableProxies.erase(iterFind);
  19. }
  20. void MeshProxy::updateBounds(const Bounds& bounds)
  21. {
  22. mBounds = bounds;
  23. for (auto& renderableProxy : mRenderableProxies)
  24. {
  25. renderableProxy->markBoundsDirty();
  26. }
  27. }
  28. void MeshProxy::updateData(const std::shared_ptr<VertexData>& vertexData, const IndexBufferPtr& indexBuffer, const SubMesh& subMesh)
  29. {
  30. mVertexData = vertexData;
  31. mIndexBuffer = indexBuffer;
  32. mSubMesh = subMesh;
  33. }
  34. }