Vector3 orb_directionality = {1.0f, 1.0f, 1.0f};
int map_visible = 0;
-int draw_collision_mesh = 1;
+int barrow_visible = 1;
+int draw_collision_mesh = 0;
typedef void(*renderfunc)();
typedef void(*controlfunc)();
BeginMode3D(cam);
BeginShaderMode(shader);
- DrawModelEx(floor_model, floor_position, floor_rotation_axis, floor_rotation, floor_extent, DARKGRAY);
- DrawModelEx(barrow_model, barrow_position, barrow_rotation_axis, barrow_rotation, barrow_extent, DARKGRAY);
+ if (barrow_visible)
+ {
+ DrawModelEx(floor_model, floor_position, floor_rotation_axis, floor_rotation, floor_extent, DARKGRAY);
+ DrawModelEx(barrow_model, barrow_position, barrow_rotation_axis, barrow_rotation, barrow_extent, DARKGRAY);
+ }
+
if (draw_collision_mesh)
{
- //DrawMesh(barrow_model.meshes[0], barrow_model.materials[0], barrow_mat);
+ DrawMesh(barrow_model.meshes[0], barrow_model.materials[0], barrow_mat);
}
+ EndShaderMode();
+
for (int n = 0; n < room_count; n++)
{
Vector3 each = room_positions[n];
- DrawSphere(each, 1.0, RED);
+ DrawSphere(each, 0.1, RED);
}
+
+ map_center.y = 1.2f;
DrawSphere(map_center, 1.0, SKYBLUE);
DrawSphere(barrow_position, 1.0, GREEN);
DrawSphere(floor_position, 1.0, PURPLE);
- //for (int n = 0; n < spawn_spoke_count; n++)
- //{
- // Ray* each = &spawn_spoke_rays[n];
- // DrawRay(*each, RED);
- //}
//DrawRay(player_collide_ray, RED);
- EndShaderMode();
EndMode3D();
orb_normal_color = ColorNormalize(orb_color);
cam.target.y -= DEG2RAD * 20.0;
}
+ if (IsKeyReleased(KEY_B))
+ {
+ barrow_visible = !barrow_visible;
+ }
+
if (IsKeyReleased(KEY_M))
{
map_visible = !map_visible;
player_collision = GetRayCollisionMesh(player_collide_ray, barrow_model.meshes[0U], barrow_mat);
player_rotation = new_player_rotation;
- if (player_collision.hit && player_collision.distance < 1.30f)
+ if (false && player_collision.hit && player_collision.distance < 1.30f)
{
player_velocity.x *= -1.05;
}
hand_rotation = 0.0f;
}
- printf("center room %f %f %f\n", V3_UNROLL(room_positions[0]));
+ Vector3 axis = map_center;
+ float angle = DEG2RAD*0.0f;
for (int n = 0; n < room_count; n++)
{
// Scale room positions down from gentime positions
- printf("room at %f %f %f\n", V3_UNROLL(room_positions[n]));
- //room_positions[n].x -= barrow_image.width/2.0f;
- room_positions[n].x -= 1.0f;
- //room_positions[n].z -= barrow_image.height;
- //room_positions[n] = Vector3Multiply(room_positions[n], barrow_scale_factor);
- //room_positions[n] = Vector3Add(room_positions[n], barrow_size);
- //room_positions[n] = Vector3Add(room_positions[n], map_center);
+ printf("room %d at %f %f %f\n", n, V3_UNROLL(room_positions[n]));
+ room_positions[n].x /= 4;
+ room_positions[n].z /= 4;
+ room_positions[n].y += 0.6f;
+ room_positions[n] = Vector3RotateByAxisAngle(room_positions[n], axis, angle);
printf("room moved to %f %f %f\n", V3_UNROLL(room_positions[n]));
}
- /* Setup Rays for visualizing spawn contact points */
- spawn_spoke_count = room_count;
- spawn_spoke_rays = malloc(sizeof(Ray) * spawn_spoke_count);
- for (int n = 0; n < spawn_spoke_count; n++)
- {
- Ray* each = &spawn_spoke_rays[n];
- each->position = room_positions[n+1];
- each->position = Vector3Add(each->position, floor_position);
- each->direction = Vector3Subtract(each->position, cam.position);
- printf("Initialized a ray at {%f %f %f} to {%f %f %f}\n",
- V3_UNROLL(each->position), V3_UNROLL(each->direction));
- printf("\tfrom room position {%f %f %f}\n", V3_UNROLL(room_positions[n+1]));
- }
-
/* Grab the full transformation matrix of the upper barrow for use in collision */
/* Apparently matrix work needs to be normalized. */
{
cam.fovy = 90.0f;
cam.projection = CAMERA_PERSPECTIVE;
- /* eye in the sky */
- //cam.position.y += 64;
-
/*
I know these are good at 60 fps. Per-second speed to move to FPS/independent movement.
*/
#include "external/stb_image_write.h"
#include "external/stb_image_resize2.h"
-#define SHADOW 1
+#define SHADOW 0
#if SHADOW
#define printf(a,...)
#endif
+#define V3_UNROLL(v3) v3.x, v3.y, v3.z
+#define V3_FORMAT(v3) #v3 ":{%.4f %.4f %.4f}"
+
FVec2 ** grid;
FVec2 ** grid_prime;
FVec2 ** grid_temp;
/* Set up seed-points to create connected rooms */
const int seed_count = room_count;
- const float small_room_radius = 10.0f;
+ const float small_room_radius = 8.0f;
const float phase = ((rand() % 360)/(float)360) * (M_PI*2);
for (int n = 0; n < seed_count; n++)
{
/* Generate n seeds at even radial points, random phase offset */
float angle = ((float)n/(float)seed_count) * (M_PI * 2);
- float dist_offset = ((rand() % 14)+1);
+ float dist_offset = ((rand() % 14) + 1);
angle += phase;
int seed_x = ((cosf(angle) * (dist_offset + (grid_size.x/4.0f))) + (grid_size.x/2.0f));
int seed_y = ((sinf(angle) * (dist_offset + (grid_size.y/4.0f))) + (grid_size.y/2.0f));
- // TODO: One of these will probably have to be mirrored.
- room_positions[n] = (Vector3){.x = seed_x, .y = 0.0f, .z = seed_y};
- printf("Set room %d to {%f %f %f}\n", n, VEC3_UNROLL(room_positions[n]));
+ // Swap dimensions prepping for rendering
+ room_positions[n] = (Vector3){.x = seed_y, .y = 0.0f, .z = seed_x};
+ // mirror this across axis
+ room_positions[n].z = grid_size.y - room_positions[n].z;
+ printf("Set room %d to {%f %f %f}\n", n, V3_UNROLL(room_positions[n]));
grid[seed_x][seed_y].b = 1.0f;
grid[seed_x][seed_y].c = 0.0f;
const float y_end = (seed_y+((small_room_radius)));
const float distance_seed_to_center = sqrtf(pow(seed_x - center_x, 2) + pow(seed_y - center_y, 2));
- for (int x = x_start; x < x_end; x++)
- {
- for (int y = y_start; y < y_end; y++)
- {
- const float distance_from_center = sqrtf(((x-center_x)*(x-center_x))+((y-center_y)*(y-center_y)));
- if (distance_from_center >= distance_seed_to_center)
- {
- grid[x][y].c = 1.0f;
- }
- }
- }
+ const int generate_room = true;
+ if (generate_room)
+ {
+ for (int x = x_start; x < x_end; x++)
+ {
+ for (int y = y_start; y < y_end; y++)
+ {
+ const float distance_from_center = sqrtf(((x-center_x)*(x-center_x))+((y-center_y)*(y-center_y)));
+ if (distance_from_center >= distance_seed_to_center)
+ {
+ grid[x][y].c = 1.0f;
+ }
+ }
+ }
+ }
}
return 0;
while(!should_quit) {}
- printf("Opts: {\nIterations: %d\nTime delta: %f\nDiffA: %f\nDiffB: %f\nFeed: %f\nKill: %f\n\n}\n", active_opt.max_iterations, active_opt.delta_t, active_opt.diff_a, active_opt.diff_b, active_opt.feed, active_opt.kill);
+ //printf("Opts: {\nIterations: %d\nTime delta: %f\nDiffA: %f\nDiffB: %f\nFeed: %f\nKill: %f\n\n}\n", active_opt.max_iterations, active_opt.delta_t, active_opt.diff_a, active_opt.diff_b, active_opt.feed, active_opt.kill);
/* png for the heightmap */
unsigned char barrow_mesh_buffer[grid_size.x][grid_size.y];