1
0
Fork 0
2018-soft-3d-renderer/Source/Geometry.hpp

86 lines
1.0 KiB
C++

#pragma once
#include "Color.hpp"
#include "Point.hpp"
#include "Vec.hpp"
#include <cstdint>
const int FACE_LIMIT = 30000;
const int MATERIAL_LIMIT = 5;
const int TEXTURE_SIZE_LIMIT = 1024;
const int VERTEX_LIMIT = 20000;
struct Texture
{
ColorU32 texels[TEXTURE_SIZE_LIMIT][TEXTURE_SIZE_LIMIT];
unsigned int width;
unsigned int height;
};
struct TextureList
{
Texture data[MATERIAL_LIMIT];
};
struct Material
{
ColorF32 ambient;
ColorF32 diffuse;
ColorF32 specular;
float glossiness;
float opacity;
};
struct MaterialList
{
Material data[MATERIAL_LIMIT];
unsigned long size;
};
struct UV
{
float u;
float v;
};
struct UVList
{
UV data[VERTEX_LIMIT];
unsigned long size;
};
struct Vertex
{
Point position;
Vector normal;
ColorF32 color;
};
struct VertexList
{
Vertex data[VERTEX_LIMIT];
unsigned long size;
};
struct Face
{
int vertIndex[3];
int uvIndex[3];
int materialIndex;
};
struct FaceList
{
Face data[FACE_LIMIT];
unsigned long size;
};
struct Mesh
{
Point position;
Point rotation;
float scale;
};