Image barrow_image;
Texture barrow_texture;
-Texture albedo_texture;
+Texture barrow_albedo;
Model barrow_model;
Mesh barrow_meshes[1U];
-Material barrow_material;
-Matrix barrow_transform;
Vector3 barrow_position;
Vector3 barrow_scale;
+Vector3 barrow_rotation_axis;
+float barrow_rotation;
+
+Image floor_image;
+Texture floor_texture;
+Texture floor_albedo;
+Model floor_model;
+Mesh floor_meshes[1U];
+Vector3 floor_position;
+Vector3 floor_scale;
+Vector3 floor_rotation_axis;
+float floor_rotation;
Shader shader;
int cam_position_shader_loc;
float rotate_speed = 0.8f;
float rotate_speed_decay = 0.10f;
+Vector3 unit_vec3 = {1.0f, 1.0f, 1.0f};
+
void process_inputs()
{
/* I guess GetRayCollisionMesh is the best solution here
screen_dims_shader_loc = GetShaderLocation(shader, "screen_dims");
while(!IsShaderReady(shader)){}
- //barrow_position = (Vector3){-8.0f, 0.0f, -8.0f};
- barrow_position = (Vector3){-8.0f, 0.0f, -8.0f};
+ barrow_position = (Vector3){0.0f, 0.0f, 0.0f};
barrow_image = LoadImage("./barrow.png");
- albedo_texture = LoadTexture("./barrow_albedo.png");
+ barrow_albedo = LoadTexture("./barrow_albedo.png");
barrow_scale = (Vector3){barrow_image.width/6.0f, 8.0f, barrow_image.height/6.0f};
+ barrow_rotation_axis = (Vector3){1.0f, 0.0f, 0.0f};
+ barrow_rotation = 180.0f;
while(!IsImageReady(barrow_image)){}
barrow_texture = LoadTextureFromImage(barrow_image);
while(!IsTextureReady(barrow_texture)){}
- while(!IsTextureReady(albedo_texture)){}
+ while(!IsTextureReady(barrow_albedo)){}
+
+ floor_image = LoadImage("./floor.png");
+ floor_albedo = LoadTexture("./floor_albedo.png");
+ floor_scale = (Vector3){floor_image.width/6.0f, 1.0f, floor_image.height/6.0f};
+ floor_position = (Vector3){0.0f, -3.0f, -floor_scale.z};
+ floor_rotation_axis = (Vector3){0.0f, 0.0f, floor_image.width};
+ floor_rotation = 0.0f;
+
+ while(!IsImageReady(floor_image)){}
+ while(!IsTextureReady(floor_albedo)){}
/* Might want to replace barrow_scale with just img dimensions. */
- barrow_meshes[0U] = GenMeshHeightmap(barrow_image, barrow_scale);
+ barrow_meshes[0U] = GenMeshHeightmap(barrow_image, unit_vec3);
barrow_model = LoadModelFromMesh(barrow_meshes[0]);
- barrow_model.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = albedo_texture;
- barrow_model.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = albedo_texture;
+ barrow_model.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = barrow_albedo;
+ barrow_model.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = barrow_albedo;
barrow_model.materials[0].shader = shader;
+ floor_meshes[0U] = GenMeshHeightmap(floor_image, unit_vec3);
+ floor_model = LoadModelFromMesh(floor_meshes[0]);
+ floor_model.materials[0].maps[MATERIAL_MAP_ALBEDO].texture = floor_albedo;
+ floor_model.materials[0].maps[MATERIAL_MAP_ROUGHNESS].texture = floor_albedo;
+ floor_model.materials[0].shader = shader;
+
cam = (Camera3D){0};
cam.position = barrow_position;
- cam.position.y += 2.0f;
+ cam.position.y -= 0.5f;
cam.position.x = barrow_scale.x/2 + barrow_position.x;
- cam.target = (Vector3){0.0f, cam.position.y * 0.1, 0.0f};
+ cam.target = (Vector3){0.0f, cam.position.y - 12.0f, 0.0f};
cam.up = (Vector3){0.0f, 1.0f, 0.0f};
cam.fovy = 75.0f;
cam.projection= CAMERA_PERSPECTIVE;
BeginMode3D(cam);
BeginShaderMode(shader);
- DrawModel(barrow_model, barrow_position, 1.0f, DARKGRAY);
+ DrawModelEx(barrow_model, barrow_position, barrow_rotation_axis, barrow_rotation, barrow_scale, DARKGRAY);
+ DrawModelEx(floor_model, floor_position, floor_rotation_axis, floor_rotation, floor_scale, DARKGRAY);
EndShaderMode();
EndMode3D();
}
char mesh_name[64] = {0};
+ char floor_mesh_name[64] = {0};
char albedo_name[64] = {0};
+ char floor_albedo_name[64] = {0};
sprintf(mesh_name, "./%s.png", active_opt.name);
sprintf(albedo_name, "./%s_albedo.png", active_opt.name);
+ sprintf(floor_mesh_name, "./floor.png");
+ sprintf(floor_albedo_name, "./floor_albedo.png");
stbir_resize_uint8_linear(
(unsigned char*)mesh_buffer, pgrid_size.x, pgrid_size.y, sizeof(uint8_t) * pgrid_size.x,
stbi_write_png(mesh_name, pgrid_size.x*img_export_scale.x, pgrid_size.y*img_export_scale.y, 1, large_mesh_buffer, pgrid_size.x * sizeof(uint8_t)*img_export_scale.x);
stbi_write_png(albedo_name, pgrid_size.x*img_export_scale.x, pgrid_size.y*img_export_scale.y, 4, large_albedo_buffer, pgrid_size.x * sizeof(uint32_t)*img_export_scale.x);
+ stbi_flip_vertically_on_write(1);
+ stbi_write_png(floor_mesh_name, pgrid_size.x*img_export_scale.x, pgrid_size.y*img_export_scale.y, 1, large_mesh_buffer, pgrid_size.x * sizeof(uint8_t)*img_export_scale.x);
+ stbi_write_png(floor_albedo_name, pgrid_size.x*img_export_scale.x, pgrid_size.y*img_export_scale.y, 4, large_albedo_buffer, pgrid_size.x * sizeof(uint32_t)*img_export_scale.x);
+
cleanup();
return 0;
}