#ifndef GEOMETRY_H #include "color.h" #include "engine.h" #include "point.h" #include #include // STRUCTURES struct Material { bool smooth; ColorF32 kAmbient; 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; }; struct Vertex { Point point; Vector normal; ColorF32 color; }; struct Mesh_LocalData { std::vector verts; std::vector faces; std::vector uvs; }; struct Mesh_TransformedData { std::vector verts; std::vector faces; }; struct Mesh { inline Mesh(void) { position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; rotation[0] = 0.0f; rotation[1] = 0.0f; rotation[2] = 0.0f; scale = 1.0f; } Point position; float rotation[3]; float scale; Material material; Mesh_LocalData local; Mesh_TransformedData transformed; }; // PUBLIC FUNCTIONS void CullBackfaces( Mesh_LocalData &local, Mesh_TransformedData &transformed, Point &camPosition); void RenderMesh( Engine_Buffer &buffer, Mesh_TransformedData &mesh, Texture &texture, std::vector &uvs); #define GEOMETRY_H #endif