-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d-render.c
35 lines (31 loc) · 849 Bytes
/
3d-render.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <raylib.h>
int main() {
int factor = 80;
int screenWidth = factor * 16;
int screenHeight = factor * 9;
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(screenWidth, screenHeight, "Just trying something");
SetTargetFPS(60);
SetTraceLogLevel(LOG_ALL);
Camera3D camera = {
.position = {20, 20, 20},
.target = {0, 0, 0},
.up = {0, 1, 0},
.fovy = 90,
.projection = CAMERA_PERSPECTIVE,
};
Vector3 cube_position = {0, 0, 0};
Mesh cube_mesh = GenMeshCube(4.0f, 4.0f, 4.0f);
Model cube_model = LoadModelFromMesh(cube_mesh);
while (!WindowShouldClose()) {
float delta = GetFrameTime();
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
DrawModel(cube_model, cube_position, 1.0f, RED);
EndMode3D();
EndDrawing();
}
CloseWindow();
return 0;
}