pctm + foundation for obj models

This commit is contained in:
2026-02-22 14:32:52 +01:00
parent 7ca48a5080
commit c051008287
16 changed files with 279 additions and 185 deletions
+4 -2
View File
@@ -4,9 +4,11 @@
#include <SDL3/SDL.h>
#include "math.hpp"
#include "assetloader.hpp"
void rasterizeTriangle(SDL_Renderer *renderer, const DeltaVector2 &a, const DeltaVector2 &b, const DeltaVector2 &c);
// void rasterizeTriangle(SDL_Renderer *renderer, const DeltaVector2 &a, const DeltaVector2 &b, const DeltaVector2 &c);
void rasterizeTriangleFast(SDL_Surface* surface, const DeltaVector2& v0, const DeltaVector2& v1, const DeltaVector2& v2, uint32_t color);
void rasterizeTriangleSurface(SDL_Surface* surface, const DeltaVector2& v0, const DeltaVector2& v1, const DeltaVector2& v2, uint32_t color, float u0, float v0_uv, float u1, float v1_uv, float u2, float v2_uv);
void rasterizeTriangleSurface(DeltaAssetLoader& assets, std::vector<float>& depthbuffer, SDL_Surface* surface, const DeltaVector3& v0, const DeltaVector3& v1, const DeltaVector3& v2, const std::string& textureID, float u0, float v0_uv, float u1, float v1_uv, float u2, float v2_uv);
void setPixel(SDL_Surface* surface, int x, int y, uint32_t color);
uint32_t getPixel(SDL_Surface* surface, int x, int y);
#endif
+3 -3
View File
@@ -11,9 +11,9 @@ class DeltaCamera {
DeltaCamera() {pos = DeltaVector3(); angle = DeltaVector2();};
DeltaCamera(float x, float y, float z);
DeltaVector3 translatePoint(const DeltaVector3 &worldPos);
DeltaVector2 projectPointVec(const DeltaVector3 &worldPos);
int projectTriangle(const DeltaTriangle &in, DeltaTriangle2D &out1, DeltaTriangle2D &out2);
DeltaVector2 projectPoint(float worldX, float worldY, float worldZ);
DeltaVector3 projectPointVec(const DeltaVector3 &worldPos);
int projectTriangle(const DeltaRenderTriangle &in, DeltaTriangle &out1, DeltaTriangle &out2, DeltaTriangle2D &uv1, DeltaTriangle2D &uv2);
DeltaVector3 projectPoint(float worldX, float worldY, float worldZ);
};
#endif