--- /dev/null
+# Blender 3.6.0
+# www.blender.org
+o Cube
+v -1.000000 1.000000 1.000000
+v -1.000000 -1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 1.000000 1.000000
+v 1.000000 -1.000000 1.000000
+v 1.000000 1.000000 -1.000000
+v 1.000000 -1.000000 -1.000000
+vn -0.0000 1.0000 -0.0000
+vn -0.0000 -0.0000 -1.0000
+vn 1.0000 -0.0000 -0.0000
+vn -0.0000 -1.0000 -0.0000
+vn -1.0000 -0.0000 -0.0000
+vn -0.0000 -0.0000 1.0000
+vt 0.875000 0.500000
+vt 0.625000 0.750000
+vt 0.625000 0.500000
+vt 0.375000 1.000000
+vt 0.375000 0.750000
+vt 0.625000 0.000000
+vt 0.375000 0.250000
+vt 0.375000 0.000000
+vt 0.375000 0.500000
+vt 0.125000 0.750000
+vt 0.125000 0.500000
+vt 0.625000 0.250000
+vt 0.875000 0.750000
+vt 0.625000 1.000000
+s 0
+f 5/1/1 3/2/1 1/3/1
+f 3/2/2 8/4/2 4/5/2
+f 7/6/3 6/7/3 8/8/3
+f 2/9/4 8/10/4 6/11/4
+f 1/3/5 4/5/5 2/9/5
+f 5/12/6 2/9/6 6/7/6
+f 5/1/1 7/13/1 3/2/1
+f 3/2/2 7/14/2 8/4/2
+f 7/6/3 5/12/3 6/7/3
+f 2/9/4 4/5/4 8/10/4
+f 1/3/5 3/2/5 4/5/5
+f 5/12/6 1/3/6 2/9/6
camera{Vector3{0.0F, 0.0F, 0.0F}, Vector3{0.0F, 0.0F, -1.0F},
Vector3{0.0F, 1.0F, 0.0F}, 80.0F, CAMERA_PERSPECTIVE},
flags(),
- TEMP_cube(GenMeshCube(2.0F, 2.0F, 2.0F)),
- TEMP_default_material(LoadMaterialDefault()),
+ TEMP_cube_model(LoadModel("res/test_cube.obj")),
+ TEMP_cube_texture(LoadTexture("res/test_cube_texture.png")),
TEMP_matrix(get_identity_matrix()),
- TEMP_offset_matrix(translate_matrix_z(-4.0F)),
- TEMP_value(0.0F) {}
+ TEMP_permanent_matrix(get_identity_matrix()),
+ TEMP_value(0.0F),
+ TEMP_current_state(0) {
+ TEMP_cube_model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture =
+ TEMP_cube_texture;
+}
TRunnerScreen::~TRunnerScreen() {
- UnloadMesh(TEMP_cube);
- UnloadMaterial(TEMP_default_material);
+ UnloadTexture(TEMP_cube_texture);
+ UnloadModel(TEMP_cube_model);
}
bool TRunnerScreen::update(float dt) {
if (TEMP_value < PI / 2.0F) {
TEMP_matrix = get_rotation_matrix_about_z(TEMP_value);
} else if (TEMP_value < PI) {
+ if (TEMP_current_state == 0) {
+ TEMP_current_state = 1;
+ TEMP_permanent_matrix =
+ TEMP_permanent_matrix * get_rotation_matrix_about_z(PI / 2.0F);
+ } else if (TEMP_current_state != 1) {
+ assert(!"unreachable");
+ }
TEMP_matrix = get_rotation_matrix_about_y(TEMP_value - PI / 2.0F);
} else if (TEMP_value < PI * 3.0F / 2.0F) {
+ if (TEMP_current_state == 1) {
+ TEMP_current_state = 2;
+ TEMP_permanent_matrix =
+ TEMP_permanent_matrix * get_rotation_matrix_about_y(PI / 2.0F);
+ } else if (TEMP_current_state != 2) {
+ assert(!"unreachable");
+ }
TEMP_matrix = get_rotation_matrix_about_x(TEMP_value - PI);
} else {
+ if (TEMP_current_state == 2) {
+ TEMP_current_state = 0;
+ TEMP_permanent_matrix =
+ TEMP_permanent_matrix * get_rotation_matrix_about_x(PI / 2.0F);
+ } else {
+ assert(!"unreachable");
+ }
TEMP_value -= PI * 3.0F / 2.0F;
TEMP_matrix = get_rotation_matrix_about_z(TEMP_value);
}
ClearBackground(PixelToColor(Pixel::PIXEL_SKY));
BeginMode3D(camera);
- DrawMesh(TEMP_cube, TEMP_default_material, TEMP_matrix * TEMP_offset_matrix);
+ // DrawMesh(TEMP_cube, TEMP_default_material, TEMP_matrix *
+ // TEMP_offset_matrix);
+ DrawModel(Model{.transform = TEMP_cube_model.transform *
+ TEMP_permanent_matrix * TEMP_matrix,
+ .meshCount = TEMP_cube_model.meshCount,
+ .materialCount = TEMP_cube_model.materialCount,
+ .meshes = TEMP_cube_model.meshes,
+ .materials = TEMP_cube_model.materials,
+ .meshMaterial = TEMP_cube_model.meshMaterial,
+ .boneCount = TEMP_cube_model.boneCount,
+ .bones = TEMP_cube_model.bones,
+ .bindPose = TEMP_cube_model.bindPose},
+ Vector3{0.0F, 0.0F, -4.0F}, 1.0F, WHITE);
EndMode3D();
EndDrawing();