Set C standard to C11 and add new assets
Changed CMakeLists.txt to set the C standard to C11. Added multiple binary image files for new visual assets. Added several new image files to enhance rendering capabilities. Changed stb_image.h to improve support for various image formats. Changed ray tracing engine to enhance ray creation and intersection. Changed triangle structure to use a vertex array for better attribute handling. Changed scene initialization to accommodate new texture management.
This commit is contained in:
@@ -9,6 +9,7 @@ typedef enum
|
||||
DEBUG_NONE = 0,
|
||||
DEBUG_BVH = 1,
|
||||
DEBUG_SOBOL = 2,
|
||||
DEBUG_UV = 3,
|
||||
} debug_flag_t;
|
||||
|
||||
static const vec4s DEBUG_COLOR_BVH = {0.0f, 1.0f, 0.0f, 0.005f}; // Green
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
#include "Camera.h"
|
||||
#include "Lighting/Light.h"
|
||||
#include "Material/Material.h"
|
||||
#include "RenderTarget.h"
|
||||
#include "Geometry/Triangle.h"
|
||||
#include "Rendering/RenderTarget.h"
|
||||
#include "Rendering/Texture.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -14,10 +15,11 @@ typedef struct
|
||||
bvh_tree_t bvh_tree;
|
||||
triangle_collection_t triangles;
|
||||
material_collection_t materials;
|
||||
texture_collection_t textures;
|
||||
light_collection_t lights;
|
||||
} scene_t;
|
||||
|
||||
bool scene_init(scene_t* scene, uint64_t triangle_count, uint8_t material_count, uint32_t punctual_light_count);
|
||||
bool scene_init(scene_t* scene, uint64_t triangle_count, uint16_t texture_count, uint8_t material_count, uint32_t punctual_light_count);
|
||||
bool scene_build_bvh(scene_t* scene);
|
||||
void scene_free(scene_t* scene);
|
||||
|
||||
|
||||
53
header/Rendering/Texture.h
Normal file
53
header/Rendering/Texture.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef TEXTURE_H
|
||||
#define TEXTURE_H
|
||||
|
||||
#include "cglm/struct/vec4.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define INVALID_TEXTURE_ID UINT16_MAX
|
||||
|
||||
typedef enum
|
||||
{
|
||||
REPEAT,
|
||||
CLAMP,
|
||||
} wrap_mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NEAREST,
|
||||
LINEAR,
|
||||
} filter_mode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
wrap_mode_t wrap_mode;
|
||||
filter_mode_t filter_mode;
|
||||
uint8_t channel_count;
|
||||
uint8_t* data;
|
||||
} texture_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t count;
|
||||
uint16_t size;
|
||||
texture_t* buffer;
|
||||
} texture_collection_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t id;
|
||||
} texture_entity_t;
|
||||
|
||||
bool texture_collection_init(uint16_t size, texture_collection_t* textures);
|
||||
void texture_collection_resize(texture_collection_t* textures, uint16_t size);
|
||||
void texture_collection_free(texture_collection_t* textures);
|
||||
|
||||
texture_entity_t texture_load(const char* filename, bool srgb, texture_collection_t* textures);
|
||||
vec4s texture_sample(const texture_t* texture, float u, float v);
|
||||
void texture_free(texture_t* texture);
|
||||
|
||||
#endif // TEXTURE_H
|
||||
Reference in New Issue
Block a user