Initial upload

This commit is contained in:
2025-04-15 11:29:46 +09:00
commit b915d56f73
212 changed files with 43262 additions and 0 deletions

25
header/Rendering/Camera.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef CAMERA_H
#define CAMERA_H
#include "cglm/struct/vec3.h"
#include "cglm/types-struct.h"
typedef struct
{
vec3s position;
vec3s forward;
vec3s up;
vec3s right;
float focal_length;
float size_x;
float size_y;
float aspect_ratio;
float fov_x;
float fov_y;
} camera_t;
camera_t camera_create(vec3s position, vec3s forward, vec3s up, float focal_length, float size_x, float aspect_ratio);
#endif // CAMERA_H

View File

@@ -0,0 +1,19 @@
#ifndef RENDERTARGET_H
#define RENDERTARGET_H
#include "cglm/types-struct.h"
#include <stdint.h>
typedef struct
{
vec4s* buffer;
uint32_t width;
uint32_t height;
} render_target_t;
render_target_t render_target_create(uint32_t width, uint32_t height);
vec4s render_target_get_pixel(render_target_t* render_target, uint32_t x, uint32_t y);
void render_target_set_pixel(render_target_t* render_target, uint32_t x, uint32_t y, vec4s color);
void render_target_free(render_target_t* target);
#endif // RENDERTARGET_H

30
header/Rendering/Scene.h Normal file
View File

@@ -0,0 +1,30 @@
#ifndef SCENE_H
#define SCENE_H
#include "Camera.h"
#include "RenderTarget.h"
#include "Material.h"
#include "Triangle.h"
typedef struct
{
uint32_t width;
uint32_t height;
uint32_t sample_count;
uint8_t max_depth;
uint32_t tile_size;
} rendering_config_t;
typedef struct
{
camera_t camera;
triangle_collection_t triangles;
material_collection_t materials;
} scene_t;
scene_t scene_create(uint64_t triangle_count, uint8_t material_count);
render_target_t scene_render(scene_t* scene, rendering_config_t config);
void scene_free(scene_t* scene);
#endif // SCENE_H