/apps/demos/scenery: simpler normal_at(), clean one bit
This commit is contained in:
parent
66b2f04d9d
commit
a472e6af52
@ -332,10 +332,10 @@ static Vec3 normal_at(SceneIngame *scn, Vec2 position) {
|
||||
float const height1 = heightmap[x + 1][y];
|
||||
float const height2 = heightmap[x][y + 1];
|
||||
|
||||
Vec3 const a = { .x = -1, .y = height0 - height1, .z = 0 };
|
||||
Vec3 const a = { .x = 1, .y = height0 - height1, .z = 0 };
|
||||
Vec3 const b = { .x = 0, .y = height0 - height2, .z = -1 };
|
||||
|
||||
return vec3_scale(vec3_norm(vec3_cross(a, b)), -1);
|
||||
return vec3_norm(vec3_cross(a, b));
|
||||
}
|
||||
|
||||
/* TODO: don't operate on triangles, instead interpolate on quads */
|
||||
@ -531,12 +531,8 @@ static void ingame_tick(State *state) {
|
||||
input_action("mouse_capture_toggle", "ESCAPE");
|
||||
input_action("toggle_camera_mode", "C");
|
||||
|
||||
// draw_model("models/test.obj", (Vec3){0}, (Vec3){0,0,1}, (Vec3){1.f / 64,1.f / 64,1.f / 64});
|
||||
// draw_model("models/test2.obj", (Vec3){0}, (Vec3){0,0,1}, (Vec3){1.f / 64,1.f / 64,1.f / 64});
|
||||
// draw_model("models/bunny.obj", (Vec3){0}, (Vec3){0,0,1}, (Vec3){4.,4.,4.});
|
||||
|
||||
if (scn->mouse_captured) {
|
||||
const float sensitivity = 0.4f * (float)DEG2RAD; /* TODO: put this in a better place */
|
||||
const float sensitivity = 0.4f * (float)(M_PI / 180); /* TODO: put this in a better place */
|
||||
scn->yaw += (float)ctx.mouse_movement.x * sensitivity;
|
||||
scn->pitch -= (float)ctx.mouse_movement.y * sensitivity;
|
||||
scn->pitch = clampf(scn->pitch, (float)-M_PI * 0.49f, (float)M_PI * 0.49f);
|
||||
|
Loading…
Reference in New Issue
Block a user