rasterizer.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef RASTERIZER_H
  2. #define RASTERIZER_H
  3. #include "SDL.h"
  4. #include "buffer.h"
  5. #include "vector3.h"
  6. #include "shader.h"
  7. class Rasterizer{
  8. public:
  9. static void drawTriangles(Vector3 *vertices, IShader &shader, Buffer<Uint32> *pixelBuffer, Buffer<float> *zBuffer, float intensity);
  10. static void drawWireFrame(Vector3 *vertices, IShader &shader, Buffer<Uint32> *pixelBuffer);
  11. static void testPattern(Buffer<Uint32> *pixelBuffer);
  12. static void makeCoolPattern(Buffer<Uint32> *pixelBuffer);
  13. static void drawLine(Vector3 &vertex1, Vector3 &vertex2, const Uint32 &color, Buffer<Uint32> *pixelBuffer);
  14. private:
  15. Rasterizer(){};
  16. //Setting this equal to the same pixel format our textures are in
  17. static const Uint32 PIXEL_FORMAT = SDL_PIXELFORMAT_RGBA8888;
  18. static const SDL_PixelFormat* mappingFormat;
  19. //Some basic colors
  20. static const Uint32 white;
  21. static const Uint32 red;
  22. static const Uint32 green;
  23. static const Uint32 blue;
  24. };
  25. #endif