Skip to content

Commit

Permalink
last minute fixes for submission
Browse files Browse the repository at this point in the history
  • Loading branch information
bozbalci committed Jan 13, 2020
1 parent f4168b8 commit 6524bcf
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 59 deletions.
8 changes: 6 additions & 2 deletions assignments/hw3/src/flat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
// Uncomment the following line to enable debug messages.
// #define DEBUG

#define DO_NOT_ADD_GAZE_WHEN_RECALCULATING

GLuint ProgramShaderId;

constexpr auto WINDOW_SIZE = 1000;
Expand Down Expand Up @@ -269,7 +271,9 @@ struct UIState {
auto PitchInRadians = glm::radians(Pitch);

Camera.Gaze = glm::normalize(
#ifndef DO_NOT_ADD_GAZE_WHEN_RECALCULATING
CAMERA_INITIAL.Gaze +
#endif
glm::vec3(std::cos(YawInRadians) * std::cos(PitchInRadians),
std::sin(PitchInRadians),
std::sin(YawInRadians) * std::cos(PitchInRadians)));
Expand Down Expand Up @@ -479,7 +483,7 @@ class Shader
struct HW3Utility {
// INPUT PATHS
std::string VertexShaderPath = "shaders/flat.vert";
std::string FragmentShaderPath = "shaders/flat.frag";
std::string FragmentShaderPath = "shaders/common.frag";
std::string HeightMapPath;
std::string TexturePath;

Expand Down Expand Up @@ -722,7 +726,7 @@ struct HW3Utility {
void MainLoop()
{
while (!glfwWindowShouldClose(Window)) {
auto BGColor = glm::min(1.0f, glm::abs(TheState.Speed) / 5.0f);
constexpr auto BGColor = 0.0f;
glClearColor(BGColor, BGColor, BGColor, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Expand Down
File renamed without changes.
51 changes: 0 additions & 51 deletions assignments/hw3/src/shaders/sphere.frag

This file was deleted.

6 changes: 4 additions & 2 deletions assignments/hw3/src/sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ struct UIState {
auto PitchInRadians = glm::radians(Pitch);

Camera.Gaze = glm::normalize(
#ifndef DO_NOT_ADD_GAZE_WHEN_RECALCULATING
CAMERA_INITIAL.Gaze +
#endif
glm::vec3(std::cos(YawInRadians) * std::cos(PitchInRadians),
std::sin(PitchInRadians),
std::sin(YawInRadians) * std::cos(PitchInRadians)));
Expand Down Expand Up @@ -476,7 +478,7 @@ class Shader
struct HW3Utility {
// INPUT PATHS
std::string VertexShaderPath = "shaders/sphere.vert";
std::string FragmentShaderPath = "shaders/sphere.frag";
std::string FragmentShaderPath = "shaders/common.frag";
std::string HeightMapPath;
std::string TexturePath;

Expand Down Expand Up @@ -745,7 +747,7 @@ struct HW3Utility {
void MainLoop()
{
while (!glfwWindowShouldClose(Window)) {
auto BGColor = glm::min(1.0f, glm::abs(TheState.Speed) / 5.0f);
constexpr auto BGColor = 0.0f;
glClearColor(BGColor, BGColor, BGColor, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Expand Down
9 changes: 7 additions & 2 deletions assignments/hw3/src/templates/__base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
// Uncomment the following line to enable debug messages.
// #define DEBUG

{% block Preamble %}
{% endblock %}

GLuint ProgramShaderId;

constexpr auto WINDOW_SIZE = 1000;
Expand Down Expand Up @@ -267,7 +270,9 @@ struct UIState {
auto PitchInRadians = glm::radians(Pitch);

Camera.Gaze = glm::normalize(
CAMERA_INITIAL.Gaze +
#ifndef DO_NOT_ADD_GAZE_WHEN_RECALCULATING
CAMERA_INITIAL.Gaze +
#endif
glm::vec3(std::cos(YawInRadians) * std::cos(PitchInRadians),
std::sin(PitchInRadians),
std::sin(YawInRadians) * std::cos(PitchInRadians)));
Expand Down Expand Up @@ -698,7 +703,7 @@ struct HW3Utility {
void MainLoop()
{
while (!glfwWindowShouldClose(Window)) {
auto BGColor = glm::min(1.0f, glm::abs(TheState.Speed) / 5.0f);
constexpr auto BGColor = 0.0f;
glClearColor(BGColor, BGColor, BGColor, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Expand Down
6 changes: 5 additions & 1 deletion assignments/hw3/src/templates/flat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

{% block Variant %}flat{% endblock %}
{% block VertexShaderPath %}shaders/flat.vert{% endblock %}
{% block FragmentShaderPath %}shaders/flat.frag{% endblock %}
{% block FragmentShaderPath %}shaders/common.frag{% endblock %}
{% block HeightFactorInitial %}10.f{% endblock %}
{% block PitchInitial %}0.0f{% endblock %};
{% block YawInitial %}90.0f{% endblock %};

{% block Preamble %}
#define DO_NOT_ADD_GAZE_WHEN_RECALCULATING
{% endblock %}

{% block CameraPosition %}
{
(float)TextureWidth / 2.0f,
Expand Down
2 changes: 1 addition & 1 deletion assignments/hw3/src/templates/sphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block Variant %}sphere{% endblock %}
{% block VertexShaderPath %}shaders/sphere.vert{% endblock %}
{% block FragmentShaderPath %}shaders/sphere.frag{% endblock %}
{% block FragmentShaderPath %}shaders/common.frag{% endblock %}
{% block HeightFactorInitial %}0.0f{% endblock %}
{% block PitchInitial %}0.0f{% endblock %};
{% block YawInitial %}90.0f{% endblock %};
Expand Down

0 comments on commit 6524bcf

Please sign in to comment.