2018-09-05 02:50:27 +00:00
|
|
|
#ifndef GEOMETRY_H
|
|
|
|
|
2018-09-06 02:26:54 +00:00
|
|
|
#include "color.h"
|
2018-09-05 02:50:27 +00:00
|
|
|
#include "point.h"
|
2018-09-06 01:53:11 +00:00
|
|
|
#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
|
2018-09-14 01:57:06 +00:00
|
|
|
struct Texture
|
|
|
|
{
|
2018-09-19 01:19:13 +00:00
|
|
|
ColorU32 texels[TEXTURE_SIZE_LIMIT][TEXTURE_SIZE_LIMIT];
|
2018-09-14 01:57:06 +00:00
|
|
|
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
|
2018-09-14 01:57:06 +00:00
|
|
|
{
|
|
|
|
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-11 03:11:52 +00:00
|
|
|
};
|
|
|
|
|
2018-09-15 01:46:30 +00:00
|
|
|
struct Face
|
2018-09-11 03:11:52 +00:00
|
|
|
{
|
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
|
|
|
|
{
|
2018-09-06 01:48:27 +00:00
|
|
|
Point position;
|
2018-09-19 02:18:58 +00:00
|
|
|
Point rotation;
|
2018-09-06 01:48:27 +00:00
|
|
|
float scale;
|
2018-09-05 02:50:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define GEOMETRY_H
|
|
|
|
#endif
|
|
|
|
|