Add prism and gif

This commit is contained in:
2025-10-05 21:38:40 +04:00
parent a7acf5dfdc
commit 06d410a519
4 changed files with 19 additions and 6 deletions

View File

@@ -1,8 +1,8 @@
# C 3D Graphic Engine # C 3D Graphic Engine
> **C3DGraphicEngine** - это графический 3D движок, написанный с полного нуля на чистом С! > **C3DGraphicEngine** - это графический 3D движок, написанный с полного нуля на чистом С!
### [Скачайте](https://github.com/StepanovPlaton/C3DGraphicEngine/raw/refs/heads/main/builds/v0.1.exe) и попробуйте сами! ### [Скачайте](https://github.com/StepanovPlaton/C3DGraphicEngine/raw/refs/heads/main/builds/v0.11.exe) и попробуйте сами!
![](./screenshots/demo_render.png) ![](./screenshots/demo_render.gif)
## Стек: ## Стек:
@@ -35,6 +35,7 @@
## Идеи: ## Идеи:
- [ ] Добавить непрозрачность (скрыть невидимые грани) - [ ] Добавить непрозрачность (скрыть невидимые грани)
- [ ] Добавить рендер с помощью X11 и сборку под Unix-подобные системы
- [ ] Добавить алгоритмы создания сложных фигур (додекаэдр, шар и тд.) - [ ] Добавить алгоритмы создания сложных фигур (додекаэдр, шар и тд.)
- [ ] Добавить физику - [ ] Добавить физику
- [ ] Have fun! - [ ] Have fun!

BIN
builds/v0.11.exe Normal file

Binary file not shown.

20
main.c
View File

@@ -18,7 +18,6 @@ int cube_edges[][2] = {{0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6},
{6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}}; {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7}};
Point3D cube_position = {.coordinates = {3.0f, 6.0f, 5.0f}}; Point3D cube_position = {.coordinates = {3.0f, 6.0f, 5.0f}};
float cube_speed[] = {0.03f, 0.0f, 0.0f}; float cube_speed[] = {0.03f, 0.0f, 0.0f};
const Object cube = {.points = cube_points, const Object cube = {.points = cube_points,
.edges = cube_edges, .edges = cube_edges,
.number_of_points = 8, .number_of_points = 8,
@@ -35,7 +34,6 @@ int pyramid_edges[][2] = {{0, 1}, {1, 2}, {2, 3}, {3, 0},
{0, 4}, {1, 4}, {2, 4}, {3, 4}}; {0, 4}, {1, 4}, {2, 4}, {3, 4}};
Point3D pyramid_position = {.coordinates = {6.0f, 3.0f, 5.0f}}; Point3D pyramid_position = {.coordinates = {6.0f, 3.0f, 5.0f}};
float pyramid_speed[] = {0.0f, 0.0f, 0.03f}; float pyramid_speed[] = {0.0f, 0.0f, 0.03f};
const Object pyramid = {.points = pyramid_points, const Object pyramid = {.points = pyramid_points,
.edges = pyramid_edges, .edges = pyramid_edges,
.number_of_points = 5, .number_of_points = 5,
@@ -43,8 +41,22 @@ const Object pyramid = {.points = pyramid_points,
.position = &pyramid_position, .position = &pyramid_position,
.rotate_speed = &pyramid_speed}; .rotate_speed = &pyramid_speed};
const int number_of_objects = 2; Point3D prism_points[] = {{0.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 0.0f},
Object objects[] = {cube, pyramid}; {0.5f, 0.0f, 1.0f}, {0.0f, 1.0f, 0.0f},
{1.0f, 1.0f, 0.0f}, {0.5f, 1.0f, 1.0f}};
int prism_edges[][2] = {{0, 1}, {1, 2}, {2, 0}, {3, 4}, {4, 5},
{5, 3}, {0, 3}, {1, 4}, {2, 5}};
Point3D prism_position = {.coordinates = {10.0f, 10.0f, 10.0f}};
float prism_speed[] = {0.0f, 0.03f, 0.0f};
const Object prism = {.points = prism_points,
.edges = prism_edges,
.number_of_points = 6,
.number_of_edges = 9,
.position = &prism_position,
.rotate_speed = &prism_speed};
const int number_of_objects = 3;
Object objects[] = {cube, pyramid, prism};
Camera camera = {.position = {0.0f, 0.0f, 0.0f}, Camera camera = {.position = {0.0f, 0.0f, 0.0f},
.target = {1.0f, 1.0f, 1.0f}, .target = {1.0f, 1.0f, 1.0f},

BIN
screenshots/demo_render.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB