1
0
Fork 0
2018-soft-3d-renderer/include/geometry.h

93 lines
1.1 KiB
C
Raw Normal View History

2018-09-05 02:50:27 +00:00
#ifndef GEOMETRY_H
#include "color.h"
2018-09-05 02:50:27 +00:00
#include "point.h"
#include <cstdint>
2018-09-05 02:50:27 +00:00
2018-09-20 02:14:45 +00:00
// CONSTANTS
#define FACE_LIMIT (30000)
#define MATERIAL_LIMIT (5)
#define TEXTURE_SIZE_LIMIT (1024)
#define VERTEX_LIMIT (20000)
2018-09-19 01:19:13 +00:00
// STRUCTURES
struct Texture
{
2018-09-19 01:19:13 +00:00
ColorU32 texels[TEXTURE_SIZE_LIMIT][TEXTURE_SIZE_LIMIT];
unsigned int width;
unsigned int height;
};
2018-09-15 01:46:30 +00:00
struct TextureList
{
Texture data[MATERIAL_LIMIT];
size_t size;
};
struct Material
{
ColorF32 ambient;
ColorF32 diffuse;
ColorF32 specular;
2018-09-21 03:06:27 +00:00
float glossiness;
2018-09-15 01:46:30 +00:00
float opacity;
};
struct MaterialList
{
Material data[MATERIAL_LIMIT];
size_t size;
};
struct UV
{
float u;
float v;
};
2018-09-15 01:46:30 +00:00
struct UVList
2018-09-05 02:50:27 +00:00
{
2018-09-15 01:46:30 +00:00
UV data[VERTEX_LIMIT];
size_t size;
2018-09-11 02:51:59 +00:00
};
struct Vertex
{
2018-09-21 02:37:48 +00:00
Point position;
2018-09-11 02:51:59 +00:00
Vector normal;
ColorF32 color;
};
2018-09-15 01:46:30 +00:00
struct VertexList
2018-09-11 02:51:59 +00:00
{
2018-09-15 01:46:30 +00:00
Vertex data[VERTEX_LIMIT];
size_t size;
};
2018-09-15 01:46:30 +00:00
struct Face
{
2018-09-15 01:46:30 +00:00
int vertIndex[3];
int uvIndex[3];
int materialIndex;
};
struct FaceList
{
Face data[FACE_LIMIT];
size_t size;
2018-09-05 02:50:27 +00:00
};
struct Mesh
{
Point position;
2018-09-19 02:18:58 +00:00
Point rotation;
float scale;
2018-09-05 02:50:27 +00:00
};
#define GEOMETRY_H
#endif