Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tumble1999/cinnabar
Browse files Browse the repository at this point in the history
  • Loading branch information
SArpnt committed Feb 16, 2021
2 parents e5263bb + e283b2f commit 500cfdf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ sudo pacman -S base-devel cmake sdl2 glew glm
```
### Redhat/Fedora
```bash
sudo dnf install kernel-devel make automake gcc gcc-g++ ninja-build make
sudo dnf install kernel-devel cmake sdl
```
## Build Instructions
```bash
Expand Down Expand Up @@ -72,4 +72,4 @@ Pull requests are welcome. For major changes, please open an issue first to disc

* XML based scene graph import
* Test ON Windows
* Port to Emscripten
* Port to Emscripten
13 changes: 8 additions & 5 deletions engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ int main(int argc, char* argv[]) {
mesh->sendToShader(shader);
ce::Texture* texture = new ce::Texture("uv-map.png");
shader->setInt("uTex", 0);

glm::mat4 proj = glm::perspective(
glm::radians(45.0f), window->getAspectRatio(), 0.1f, 100.0f);

float mouseSensitivity = 0.1f, cameraPitch = 0.0f, cameraYaw = -90.0f;

glm::vec3 cameraPos(0.0f, 0.0f, 3.0f), cameraFront(0.0f, 0.0f, -1.0f),
Expand Down Expand Up @@ -154,15 +158,13 @@ int main(int argc, char* argv[]) {
case SDL_WINDOWEVENT: {
glm::vec2 size = window->getWindowSize();
glViewport(0, 0, size.x, size.y);
proj = glm::perspective(
glm::radians(45.0f), window->getAspectRatio(), 0.1f, 100.0f);
break;
}
}
}

glm::mat4 proj = glm::perspective(
glm::radians(45.0f), window->getAspectRatio(), 0.1f, 100.0f);
shader->setMat4("transform.proj", proj);

// Transform
transform.roll(25.0f * time->getDeltaTime());
transform.yaw(50.0f * time->getDeltaTime());
Expand All @@ -179,8 +181,9 @@ int main(int argc, char* argv[]) {
glm::mat4 view =
glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
shader->setMat4("transform.view", view);
shader->setMat4("transform.proj", proj);

// Render
/* Render */
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Expand Down

0 comments on commit 500cfdf

Please sign in to comment.