Add perspective-correct texture mapping
This commit is contained in:
5 files changed
+188
-38
No files matched your search
+17
-1
@@ -14,9 +14,23 @@ struct Material
|
||||
ColorF32 kDiffuse;
|
||||
};
|
||||
|
||||
struct Texture
|
||||
{
|
||||
ColorU32 **texels;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
};
|
||||
|
||||
struct TextureCoord
|
||||
{
|
||||
float u;
|
||||
float v;
|
||||
};
|
||||
|
||||
struct Face
|
||||
{
|
||||
unsigned int vertIndex[3];
|
||||
unsigned int textureIndex[3];
|
||||
Vector normal;
|
||||
ColorF32 color;
|
||||
};
|
||||
@@ -32,6 +46,7 @@ struct Mesh_LocalData
|
||||
{
|
||||
std::vector<Vertex> verts;
|
||||
std::vector<Face> faces;
|
||||
std::vector<TextureCoord> uvs;
|
||||
};
|
||||
|
||||
struct Mesh_TransformedData
|
||||
@@ -73,7 +88,8 @@ void CullBackfaces(
|
||||
Point &camPosition);
|
||||
|
||||
void RenderMesh(
|
||||
Engine_Buffer &buffer, Mesh_TransformedData &mesh, bool smooth);
|
||||
Engine_Buffer &buffer, Mesh_TransformedData &mesh, bool smooth, Texture &texture,
|
||||
std::vector<TextureCoord> &uvs);
|
||||
|
||||
|
||||
#define GEOMETRY_H
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
|
||||
int LoadMesh(char *filename, Mesh &mesh);
|
||||
int LoadTexture(char *filename, Texture &texture);
|
||||
|
||||
|
||||
#define LOADER_H
|
||||
|
||||
Reference in new issue
Block a user