Hull is now movable, tweaked camera movement.
parent
4448059ce8
commit
c6daa7ec21
|
@ -97,7 +97,7 @@ inline void CameraState_Update(
|
||||||
float mouse_dx,
|
float mouse_dx,
|
||||||
float mouse_dy,
|
float mouse_dy,
|
||||||
float accel[3]) {
|
float accel[3]) {
|
||||||
const float mouse_sensitivity = 15.0f;
|
const float mouse_sensitivity = 20.0f;
|
||||||
|
|
||||||
camera_state->heading -= dt * mouse_dx * mouse_sensitivity * M_PI / 180.f;
|
camera_state->heading -= dt * mouse_dx * mouse_sensitivity * M_PI / 180.f;
|
||||||
if (camera_state->heading < -M_PI) {
|
if (camera_state->heading < -M_PI) {
|
||||||
|
|
|
@ -473,6 +473,11 @@ void SimulatorSceneRender(srcmdbuf* render_commands) {
|
||||||
|
|
||||||
sch_hull box_hull;
|
sch_hull box_hull;
|
||||||
srmeshdata* box_hull_mesh;
|
srmeshdata* box_hull_mesh;
|
||||||
|
simd4x4f box_hull_trasform {
|
||||||
|
simd4f_create(1.f, 0.f, 0.0, 0.f),
|
||||||
|
simd4f_create(0.f, 1.f, 0.f, 0.f),
|
||||||
|
simd4f_create(0.f, 0.f, 1.f, 0.f),
|
||||||
|
simd4f_create(0.f, 0.f, 0.f, 1.f)};
|
||||||
|
|
||||||
void SconvHUllSceneInit() {
|
void SconvHUllSceneInit() {
|
||||||
sch_create_unitbox(&box_hull);
|
sch_create_unitbox(&box_hull);
|
||||||
|
@ -605,11 +610,21 @@ void SconvHullSceneRender(srcmdbuf* render_commands) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ImGuizmo::Manipulate(
|
||||||
|
(float*)&(gCameraState->mtxView),
|
||||||
|
(float*)&(gProjMatrix),
|
||||||
|
ImGuizmo::TRANSLATE,
|
||||||
|
ImGuizmo::WORLD,
|
||||||
|
(float*)(&box_hull_trasform),
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
// Render hull
|
// Render hull
|
||||||
srcmd cmd;
|
srcmd cmd;
|
||||||
cmd.type = SrndrCmdTypeMesh;
|
cmd.type = SrndrCmdTypeMesh;
|
||||||
cmd.color = simd4f_create(1.f, 1.f, 1.f, 1.f);
|
cmd.color = simd4f_create(1.f, 1.f, 1.f, 1.f);
|
||||||
simd4x4f_identity(&cmd.mat);
|
cmd.mat = box_hull_trasform;
|
||||||
cmd.meshdata = box_hull_mesh;
|
cmd.meshdata = box_hull_mesh;
|
||||||
|
|
||||||
srcmdbuf_add(render_commands, &cmd);
|
srcmdbuf_add(render_commands, &cmd);
|
||||||
|
@ -765,7 +780,7 @@ int main() {
|
||||||
SconvHUllSceneInit();
|
SconvHUllSceneInit();
|
||||||
|
|
||||||
simd4x4f_translation(&gCameraState->mtxView, 0.1f, 0.1f, -0.5f);
|
simd4x4f_translation(&gCameraState->mtxView, 0.1f, 0.1f, -0.5f);
|
||||||
simd4f eye = simd4f_create(0.f, 0.f, 10.f, 1.f);
|
simd4f eye = simd4f_create(5.f, 4.f, 5.f, 1.f);
|
||||||
|
|
||||||
simd4x4f_lookat(
|
simd4x4f_lookat(
|
||||||
&gCameraState->mtxView,
|
&gCameraState->mtxView,
|
||||||
|
@ -842,24 +857,31 @@ int main() {
|
||||||
|
|
||||||
if (gControlMode == ControlModeFirstPersonView) {
|
if (gControlMode == ControlModeFirstPersonView) {
|
||||||
float camera_accel[3] = {0.f, 0.f, 0.f};
|
float camera_accel[3] = {0.f, 0.f, 0.f};
|
||||||
|
float accel_scale = 100.0;
|
||||||
|
|
||||||
|
if (glfwGetKey(gWindow, GLFW_KEY_LEFT_SHIFT)) {
|
||||||
|
accel_scale *= 3.;
|
||||||
|
} else if (glfwGetKey(gWindow, GLFW_KEY_LEFT_CONTROL)) {
|
||||||
|
accel_scale /= 3.;
|
||||||
|
}
|
||||||
|
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_W)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_W)) {
|
||||||
camera_accel[0] -= 100.f;
|
camera_accel[0] -= accel_scale;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_S)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_S)) {
|
||||||
camera_accel[0] += 100.f;
|
camera_accel[0] += accel_scale;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_C)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_C)) {
|
||||||
camera_accel[1] -= 100.f;
|
camera_accel[1] -= accel_scale;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_SPACE)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_SPACE)) {
|
||||||
camera_accel[1] += 100.f;
|
camera_accel[1] += accel_scale;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_A)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_A)) {
|
||||||
camera_accel[2] -= 100.f;
|
camera_accel[2] -= accel_scale;
|
||||||
}
|
}
|
||||||
if (glfwGetKey(gWindow, GLFW_KEY_D)) {
|
if (glfwGetKey(gWindow, GLFW_KEY_D)) {
|
||||||
camera_accel[2] += 100.f;
|
camera_accel[2] += accel_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraState_Update(
|
CameraState_Update(
|
||||||
|
|
Loading…
Reference in New Issue