GraphicsApi.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "DXBuffer.h"
  3. #include "Mat4.h"
  4. #include "Vec2.h"
  5. namespace Framework
  6. {
  7. class NativeWindow;
  8. class Image;
  9. class Texture;
  10. class Cam3D;
  11. class Model3DList;
  12. class Model3DData;
  13. enum GraphicApiType;
  14. enum TextureDirection;
  15. struct DiffuseLight
  16. {
  17. Vec3<float> direction;
  18. Vec3<float> color;
  19. };
  20. struct PointLight
  21. {
  22. Vec3<float> position;
  23. Vec3<float> color;
  24. float radius;
  25. };
  26. class GraphicsApi : public virtual ReferenceCounter
  27. {
  28. protected:
  29. GraphicApiType typ;
  30. NativeWindow* fenster;
  31. Vec2<int> backBufferSize;
  32. Model3DList* modelList;
  33. int nextModelId;
  34. ReadWriteLock rwLock;
  35. bool fullScreen;
  36. public:
  37. DLLEXPORT GraphicsApi(GraphicApiType typ);
  38. DLLEXPORT virtual ~GraphicsApi();
  39. DLLEXPORT virtual void initialize(
  40. NativeWindow* fenster, Vec2<int> backBufferSize, bool fullScreen);
  41. DLLEXPORT virtual void beginFrame(
  42. bool fill2D = 0, bool fill3D = 0, int fillColor = 0);
  43. DLLEXPORT virtual void renderKamera(Cam3D* zKamera);
  44. DLLEXPORT virtual void renderKamera(Cam3D* zKamera, Texture* zTarget);
  45. DLLEXPORT virtual void presentFrame() = 0;
  46. DLLEXPORT virtual Texture* createOrGetTexture(const char* name,
  47. Image* b = 0,
  48. TextureDirection dir = (TextureDirection)0);
  49. DLLEXPORT GraphicApiType getTyp() const;
  50. DLLEXPORT Vec2<int> getBackBufferSize() const;
  51. DLLEXPORT bool isFullScreen() const;
  52. DLLEXPORT virtual Image* zUIRenderImage() const = 0;
  53. //! returns the specified model without increased reference counter
  54. DLLEXPORT virtual Model3DData* zModel(const char* name);
  55. //! returns the specified model with increased reference counter
  56. DLLEXPORT virtual Model3DData* getModel(const char* name);
  57. //! creates a new empty Model3DData object if the model does not exist
  58. //! yet
  59. DLLEXPORT virtual Model3DData* createModel(const char* name);
  60. //! check if a model exists
  61. DLLEXPORT virtual bool hasModel(const char* name);
  62. //! creates a StructuredBuffer that is stored in the GPU memory and can
  63. //! be used as a shader resource
  64. //! \param eSize the size of one element of the buffer in bytes
  65. DLLEXPORT virtual DXBuffer* createStructuredBuffer(int eSize) = 0;
  66. DLLEXPORT virtual bool renderGuiBefore3D() const;
  67. };
  68. } // namespace Framework