Update project files and enhance rendering system

Added:
- Updated `.gitignore` to ignore the `[Bb]uild/` directory.
- Additional tasks added to the roadmap in `README.md` for light unit standardization and GPU backend support.

Changed:
- Removed line in `settings.json` that disabled error squiggles for C/C++ code.
- Modified `Triangle.h` to include `material_id` in `triangle_t` and reorganized properties.
- Reordered parameters in `triangle_collection_init` for clarity.
- Updated `shading_context_t` in `Material.h` and added size parameter to `material_create`.
- Streamlined initialization in `scene_init` and updated `scene_free` for proper resource management.
- Updated `window_create` in `Window.h` to accept a `render_job_t` parameter.
- Introduced `renderer_start` in `Renderer.c` to handle rendering jobs and optimized pixel rendering logic.
This commit is contained in:
2025-04-23 22:24:02 +09:00
parent 9cc420693c
commit 17872804c5
24 changed files with 523083 additions and 807 deletions

View File

@@ -11,7 +11,6 @@ typedef struct
float focal_length;
float size_x;
float size_y;
float aspect_ratio;
float fov_x;
float fov_y;

18
header/Rendering/Debug.h Normal file
View File

@@ -0,0 +1,18 @@
#ifndef DEBUG_H
#define DEBUG_H
#include "Rendering/Scene.h"
#include "Algorithm/RayIntersection.h"
typedef enum
{
DEBUG_NONE = 0,
DEBUG_BVH = 1,
DEBUG_SOBOL = 2,
} debug_flag_t;
static const vec4s DEBUG_COLOR_BVH = {0.0f, 1.0f, 0.0f, 0.005f}; // Green
vec4s render_debug(scene_t* scene, ray_t ray, uint16_t sample_index, int flag);
#endif // DEBUG_H

View File

@@ -0,0 +1,37 @@
# ifndef RENDERER_H
#define RENDERER_H
#include "Rendering/Debug.h"
#include "Rendering/Scene.h"
typedef enum
{
PROGRESSIVE = 0,
TILE_BASED = 1,
} rendering_type_t;
typedef struct
{
uint32_t width;
uint32_t height;
uint32_t sample_count;
uint8_t max_depth;
uint32_t bucket_size;
} rendering_config_t;
typedef struct
{
scene_t* scene;
render_target_t* render_target;
const rendering_config_t* config;
rendering_type_t rendering_type;
debug_flag_t rendering_flag;
bool is_done;
} render_job_t;
void renderer_start(render_job_t* job);
#endif // RENDERER_H

View File

@@ -8,33 +8,6 @@
#include "RenderTarget.h"
#include "Geometry/Triangle.h"
typedef struct
{
uint32_t width;
uint32_t height;
uint32_t sample_count;
uint8_t max_depth;
uint32_t bucket_size;
} rendering_config_t;
typedef struct
{
vec3s coord;
uint32_t tile_count_x;
uint32_t tile_count_y;
bool is_init;
bool is_done;
} rendering_context_t;
typedef struct
{
uint32_t x;
uint32_t y;
uint32_t width;
uint32_t height;
} tile_t;
typedef struct
{
camera_t camera;
@@ -45,11 +18,8 @@ typedef struct
} scene_t;
bool scene_init(uint64_t triangle_count, uint8_t material_count, uint32_t punctual_light_count, scene_t* scene);
bool scene_init(scene_t* scene, uint64_t triangle_count, uint8_t material_count, uint32_t punctual_light_count);
bool scene_build_bvh(scene_t* scene);
void scene_free(scene_t* scene);
bool scene_build_bvh(scene_t* scene);
bool scene_render_tile(scene_t* scene, rendering_context_t* ctx, rendering_config_t config, uint32_t tile_index, int rendering_flags, render_target_t* render_target, tile_t* tile_out);
bool scene_render(scene_t* scene, rendering_config_t config, int rendering_flags, render_target_t* render_targetg);
#endif // SCENE_H