softwareRenderer.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef SRENDERER_H
  2. #define SRENDERER_H
  3. #include "rasterizer.h"
  4. #include "buffer.h"
  5. #include "mesh.h"
  6. #include "camera.h"
  7. class SoftwareRenderer {
  8. public:
  9. //Dummy Constructor / Destructor
  10. SoftwareRenderer();
  11. ~SoftwareRenderer();
  12. //Creates all buffers and preps everything for for rendering
  13. bool startUp(int w, int h);
  14. void shutDown();
  15. //This could be expanded with more methods
  16. // to draw different types of meshes or models
  17. void drawTriangularMesh(Mesh * triMesh);
  18. void clearBuffers();
  19. Buffer<Uint32>* getRenderTarget();
  20. void setCameraToRenderFrom(Camera * camera);
  21. private:
  22. //Buffer methods
  23. bool createBuffers(int w, int h);
  24. //Primitive building methods
  25. void buildTri(Vector3 &f, Vector3 *trianglePrim, std::vector<Vector3> &verts);
  26. //Culling methods
  27. bool backFaceCulling(Vector3 *trianglePrim, float &intensity);
  28. //Pointer to the scene's target camera
  29. Camera * mCamera;
  30. Buffer<float> * zBuffer;
  31. Buffer<Uint32> * pixelBuffer;
  32. };
  33. #endif