use perspective projection
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
perSystem = { config, system, pkgs, self', inputs', ... }: {
|
perSystem = { config, system, pkgs, self', inputs', ... }: {
|
||||||
|
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
devShells = {
|
||||||
|
bash = pkgs.mkShellNoCC {
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
clang
|
clang
|
||||||
@@ -25,5 +26,33 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
zsh = pkgs.mkShellNoCC {
|
||||||
|
|
||||||
|
packages = with pkgs; [
|
||||||
|
clang
|
||||||
|
|
||||||
|
glfw
|
||||||
|
glew
|
||||||
|
|
||||||
|
sdl3
|
||||||
|
|
||||||
|
curl
|
||||||
|
glm
|
||||||
|
nlohmann_json
|
||||||
|
stb
|
||||||
|
|
||||||
|
gamenetworkingsockets
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
exec zsh
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
default = self'.devShells.bash;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,12 +94,26 @@ void Sandbox::run() {
|
|||||||
|
|
||||||
static glm::mat4 orthoCamera, perspCamera, cameraTransform;
|
static glm::mat4 orthoCamera, perspCamera, cameraTransform;
|
||||||
|
|
||||||
|
/*
|
||||||
cameraTransform = glm::mat4(1.0f);
|
cameraTransform = glm::mat4(1.0f);
|
||||||
cameraTransform = glm::translate(cameraTransform, camPos);
|
cameraTransform = glm::translate(cameraTransform, camPos);
|
||||||
cameraTransform = glm::rotate(cameraTransform, camRot.x, glm::vec3(1.0f, 0.0f, 0.0f));
|
cameraTransform = glm::rotate(cameraTransform, camRot.x, glm::vec3(1.0f, 0.0f, 0.0f));
|
||||||
cameraTransform = glm::rotate(cameraTransform, camRot.y, glm::vec3(0.0f, 1.0f, 0.0f));
|
cameraTransform = glm::rotate(cameraTransform, camRot.y, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
cameraTransform = glm::rotate(cameraTransform, camRot.z, glm::vec3(0.0f, 0.0f, 1.0f));
|
cameraTransform = glm::rotate(cameraTransform, camRot.z, glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
*/
|
||||||
|
|
||||||
|
cameraTransform = glm::lookAt(
|
||||||
|
camPos,
|
||||||
|
glm::normalize(glm::vec3(glm::cos(camRot.y) * glm::cos(camRot.x), glm::sin(camRot.x), glm::sin(camRot.y) * glm::cos(camRot.x))),
|
||||||
|
glm::vec3(0.0f, 1.0f, 0.0f)
|
||||||
|
);
|
||||||
|
/*
|
||||||
|
cameraTransform = glm::lookAt(
|
||||||
|
camPos,
|
||||||
|
glm::vec3(0.0f, 0.0f, 0.0f),
|
||||||
|
glm::vec3(0.0f, 1.0f, 0.0f)
|
||||||
|
);
|
||||||
|
*/
|
||||||
int w, h;
|
int w, h;
|
||||||
window->getSize(w, h);
|
window->getSize(w, h);
|
||||||
|
|
||||||
@@ -124,7 +138,8 @@ void Sandbox::run() {
|
|||||||
//gridTransform = glm::scale(gridTransform, glm::vec3(800.0f));
|
//gridTransform = glm::scale(gridTransform, glm::vec3(800.0f));
|
||||||
|
|
||||||
|
|
||||||
cubeTransform = orthoCamera * cubeTransform;
|
//cubeTransform = orthoCamera * cubeTransform;
|
||||||
|
cubeTransform = perspCamera * cubeTransform;
|
||||||
|
|
||||||
//gridTransform = orthoCamera * gridTransform;
|
//gridTransform = orthoCamera * gridTransform;
|
||||||
|
|
||||||
@@ -158,11 +173,11 @@ void Sandbox::run() {
|
|||||||
ImGui::SliderFloat("yaw", &rot.y, -3.14159265359f, 3.14159265359f);
|
ImGui::SliderFloat("yaw", &rot.y, -3.14159265359f, 3.14159265359f);
|
||||||
ImGui::SliderFloat("roll", &rot.z, -3.14159265359f, 3.14159265359f);
|
ImGui::SliderFloat("roll", &rot.z, -3.14159265359f, 3.14159265359f);
|
||||||
|
|
||||||
ImGui::SliderFloat("scale", &scale, 0.1f, 1000.0f);
|
ImGui::SliderFloat("scale", &scale, 0.1f, 10.0f);
|
||||||
|
|
||||||
ImGui::SliderFloat("x", &pos.x, -100.0f, 100.0f);
|
ImGui::SliderFloat("x", &pos.x, -10.0f, 10.0f);
|
||||||
ImGui::SliderFloat("y", &pos.y, -100.0f, 100.0f);
|
ImGui::SliderFloat("y", &pos.y, -10.0f, 10.0f);
|
||||||
ImGui::SliderFloat("z", &pos.z, -100.0f, 100.0f);
|
ImGui::SliderFloat("z", &pos.z, -10.0f, 10.0f);
|
||||||
|
|
||||||
ImGui::Text("Camera Properties");
|
ImGui::Text("Camera Properties");
|
||||||
|
|
||||||
@@ -170,9 +185,9 @@ void Sandbox::run() {
|
|||||||
ImGui::SliderFloat("c_yaw", &camRot.y, -3.14159265359f, 3.14159265359f);
|
ImGui::SliderFloat("c_yaw", &camRot.y, -3.14159265359f, 3.14159265359f);
|
||||||
ImGui::SliderFloat("c_roll", &camRot.z, -3.14159265359f, 3.14159265359f);
|
ImGui::SliderFloat("c_roll", &camRot.z, -3.14159265359f, 3.14159265359f);
|
||||||
|
|
||||||
ImGui::SliderFloat("c_x", &camPos.x, -100.0f, 100.0f);
|
ImGui::SliderFloat("c_x", &camPos.x, -10.0f, 10.0f);
|
||||||
ImGui::SliderFloat("c_y", &camPos.y, -100.0f, 100.0f);
|
ImGui::SliderFloat("c_y", &camPos.y, -10.0f, 10.0f);
|
||||||
ImGui::SliderFloat("c_z", &camPos.z, -100.0f, 100.0f);
|
ImGui::SliderFloat("c_z", &camPos.z, -10.0f, 10.0f);
|
||||||
|
|
||||||
|
|
||||||
if(ImGui::Button("Reset Window Size")) {
|
if(ImGui::Button("Reset Window Size")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user