BsHandleDrawManager.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGpuParams.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_ED_EXPORT HandleDrawManager
  7. {
  8. struct SolidMaterialData
  9. {
  10. HMaterial material;
  11. // Core
  12. MaterialProxyPtr proxy;
  13. GpuParamMat4 mViewProj;
  14. GpuParamMat4 mViewIT;
  15. };
  16. struct WireMaterialData
  17. {
  18. HMaterial material;
  19. // Core
  20. MaterialProxyPtr proxy;
  21. GpuParamMat4 mViewProj;
  22. };
  23. public:
  24. HandleDrawManager(const HCamera& camera);
  25. ~HandleDrawManager();
  26. void setColor(const Color& color);
  27. void setTransform(const Matrix4& transform);
  28. void drawCube(const Vector3& position, const Vector3& extents);
  29. void drawSphere(const Vector3& position, float radius);
  30. void drawWireCube(const Vector3& position, const Vector3& extents);
  31. void drawWireSphere(const Vector3& position, float radius);
  32. void drawCone(const Vector3& base, const Vector3& normal, float height, float radius);
  33. void drawLine(const Vector3& start, const Vector3& end);
  34. void drawDisc(const Vector3& position, const Vector3& normal, float radius);
  35. void drawWireDisc(const Vector3& position, const Vector3& normal, float radius);
  36. void drawArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
  37. void drawWireArc(const Vector3& position, const Vector3& normal, float radius, Degree startAngle, Degree amountAngle);
  38. void drawRect(const Rect3& area);
  39. void draw();
  40. private:
  41. void coreRender(const CameraProxy& camera);
  42. void coreRenderSolid(Matrix4 viewMatrix, Matrix4 projMatrix, MeshProxyPtr mesh);
  43. void coreRenderWire(Matrix4 viewMatrix, Matrix4 projMatrix, MeshProxyPtr mesh);
  44. void coreUpdateData(const MeshProxyPtr& solidMeshProxy, const MeshProxyPtr& wireMeshProxy);
  45. void initializeCore();
  46. static const UINT32 SPHERE_QUALITY;
  47. static const UINT32 WIRE_SPHERE_QUALITY;
  48. static const UINT32 ARC_QUALITY;
  49. HCamera mCamera;
  50. RenderTargetPtr mSceneRenderTarget;
  51. DrawHelper* mDrawHelper;
  52. TransientMeshPtr mSolidMesh;
  53. TransientMeshPtr mWireMesh;
  54. // Immutable
  55. SolidMaterialData mSolidMaterial;
  56. WireMaterialData mWireMaterial;
  57. // Core
  58. MeshProxyPtr mSolidMeshProxy;
  59. MeshProxyPtr mWireMeshProxy;
  60. };
  61. }