|
@@ -4,7 +4,7 @@ int main(){
|
|
|
// get RasterIver context
|
|
// get RasterIver context
|
|
|
RasterIver *ri = RI_get_ri();
|
|
RasterIver *ri = RI_get_ri();
|
|
|
|
|
|
|
|
- ri->debug_memory = 1;
|
|
|
|
|
|
|
+ ri->debug_memory = 0;
|
|
|
|
|
|
|
|
RI_init(1000, 1000, "This is RasterIver 2.0!!");
|
|
RI_init(1000, 1000, "This is RasterIver 2.0!!");
|
|
|
|
|
|
|
@@ -12,11 +12,11 @@ int main(){
|
|
|
|
|
|
|
|
// data for loading files
|
|
// data for loading files
|
|
|
char *filenames[] = {"objects/unit_cube.obj", "objects/cow-nonormals.obj", "objects/test_guy.obj", "objects/unit_plane.obj"};
|
|
char *filenames[] = {"objects/unit_cube.obj", "objects/cow-nonormals.obj", "objects/test_guy.obj", "objects/unit_plane.obj"};
|
|
|
- RI_texture_creation_data texture_creation_info[3] = {{"textures/bill_mcdinner.png", {0, 0}}, {"textures/this is the floor.png", {0, 0}}, {"textures/test_guy_texture.png", {0, 0}}};
|
|
|
|
|
|
|
+ RI_texture_creation_data texture_creation_info[4] = {{"textures/bill_mcdinner.png", {0, 0}}, {"textures/this is the floor.png", {0, 0}}, {"textures/test_guy_texture.png", {0, 0}}, {"textures/THIS IS THE WALL.png", {0, 0}}};
|
|
|
|
|
|
|
|
// requesting assets
|
|
// requesting assets
|
|
|
RI_mesh* meshes = RI_request_meshes(4, filenames, 0);
|
|
RI_mesh* meshes = RI_request_meshes(4, filenames, 0);
|
|
|
- RI_texture* textures = RI_request_textures(3, texture_creation_info);
|
|
|
|
|
|
|
+ RI_texture* textures = RI_request_textures(4, texture_creation_info);
|
|
|
RI_material* materials = RI_request_materials(4);
|
|
RI_material* materials = RI_request_materials(4);
|
|
|
RI_actor* actors = RI_request_actors(4);
|
|
RI_actor* actors = RI_request_actors(4);
|
|
|
RI_scene* scenes = RI_request_scenes(1);
|
|
RI_scene* scenes = RI_request_scenes(1);
|
|
@@ -30,16 +30,20 @@ int main(){
|
|
|
// textures
|
|
// textures
|
|
|
RI_texture* test_object_texture = &textures[0];
|
|
RI_texture* test_object_texture = &textures[0];
|
|
|
RI_texture* floor_texture = &textures[1];
|
|
RI_texture* floor_texture = &textures[1];
|
|
|
|
|
+ RI_texture* wall_texture = &textures[3];
|
|
|
|
|
|
|
|
// materials
|
|
// materials
|
|
|
RI_material* floor_material = &materials[0];
|
|
RI_material* floor_material = &materials[0];
|
|
|
- floor_material->flags = RI_MATERIAL_HAS_TEXTURE | RI_MATERIAL_DOUBLE_SIDED;
|
|
|
|
|
|
|
+ floor_material->flags = RI_MATERIAL_HAS_TEXTURE | RI_MATERIAL_DOUBLE_SIDED | RI_MATERIAL_USE_UV_LOOP_MULTIPLIER;
|
|
|
floor_material->texture_reference = floor_texture;
|
|
floor_material->texture_reference = floor_texture;
|
|
|
floor_material->albedo = 0xFFFFFFFF;
|
|
floor_material->albedo = 0xFFFFFFFF;
|
|
|
-
|
|
|
|
|
|
|
+ floor_material->uv_loop_multiplier = (RI_vector_2f){25, 25};
|
|
|
|
|
+
|
|
|
RI_material* wall_material = &materials[1];
|
|
RI_material* wall_material = &materials[1];
|
|
|
- wall_material->flags = RI_MATERIAL_DOUBLE_SIDED;
|
|
|
|
|
|
|
+ wall_material->flags = RI_MATERIAL_DOUBLE_SIDED | RI_MATERIAL_HAS_TEXTURE | RI_MATERIAL_USE_UV_RENDER_RESOLUTION;
|
|
|
wall_material->albedo = 0xFF7777FF;
|
|
wall_material->albedo = 0xFF7777FF;
|
|
|
|
|
+ wall_material->texture_reference = wall_texture;
|
|
|
|
|
+ wall_material->texture_render_size = (RI_vector_2f){200, 400};
|
|
|
|
|
|
|
|
RI_material* test_object_material = &materials[2];
|
|
RI_material* test_object_material = &materials[2];
|
|
|
test_object_material->flags = RI_MATERIAL_HAS_TEXTURE;
|
|
test_object_material->flags = RI_MATERIAL_HAS_TEXTURE;
|
|
@@ -86,6 +90,8 @@ int main(){
|
|
|
scene->FOV = 1.5; // 90 degrees in radians
|
|
scene->FOV = 1.5; // 90 degrees in radians
|
|
|
scene->minimum_clip_distance = 0.1;
|
|
scene->minimum_clip_distance = 0.1;
|
|
|
|
|
|
|
|
|
|
+ RI_euler_rotation_to_quaternion(&scene->camera_rotation, (RI_vector_3f){0, 0, 0});
|
|
|
|
|
+
|
|
|
double y_rotation = 0;
|
|
double y_rotation = 0;
|
|
|
|
|
|
|
|
while (running){
|
|
while (running){
|
|
@@ -93,11 +99,14 @@ int main(){
|
|
|
|
|
|
|
|
RI_euler_rotation_to_quaternion(&screen->transform.rotation, (RI_vector_3f){-3.14159 / 2, 0, ri->frame * 0.03});
|
|
RI_euler_rotation_to_quaternion(&screen->transform.rotation, (RI_vector_3f){-3.14159 / 2, 0, ri->frame * 0.03});
|
|
|
|
|
|
|
|
- scene->camera_position = (RI_vector_3f){cos(ri->frame * 0.07) * 10 * sin(ri->frame * 0.2), sin(ri->frame * 0.07) * 10 * sin(ri->frame * 0.2), -300};
|
|
|
|
|
|
|
+ // scene->camera_position = (RI_vector_3f){cos(ri->frame * 0.07) * 10 * sin(ri->frame * 0.2), sin(ri->frame * 0.07) * 10 * sin(ri->frame * 0.2), -300};
|
|
|
scene->camera_position = (RI_vector_3f){0, 0, -300};
|
|
scene->camera_position = (RI_vector_3f){0, 0, -300};
|
|
|
- scene->camera_rotation = (RI_vector_4f){0, 1, 0, 0};
|
|
|
|
|
|
|
+
|
|
|
|
|
+ wall->transform.scale.x = fabs(sin(y_rotation)) * 100 + 70;
|
|
|
|
|
+
|
|
|
|
|
+ // RI_euler_rotation_to_quaternion(&scene->camera_rotation, (RI_vector_3f){0, y_rotation * .01 + 1.5, 0});
|
|
|
|
|
|
|
|
- RI_euler_rotation_to_quaternion(&floor->transform.rotation, (RI_vector_3f){0, y_rotation, 0});
|
|
|
|
|
|
|
+ // RI_euler_rotation_to_quaternion(&floor->transform.rotation, (RI_vector_3f){0, y_rotation, 0});
|
|
|
|
|
|
|
|
RI_euler_rotation_to_quaternion(&test_object->transform.rotation, (RI_vector_3f){y_rotation, y_rotation, y_rotation});
|
|
RI_euler_rotation_to_quaternion(&test_object->transform.rotation, (RI_vector_3f){y_rotation, y_rotation, y_rotation});
|
|
|
// RI_euler_rotation_to_quaternion(&test_object->transform.rotation, (RI_vector_3f){0, y_rotation, 0});
|
|
// RI_euler_rotation_to_quaternion(&test_object->transform.rotation, (RI_vector_3f){0, y_rotation, 0});
|