Skip to content

Commit

Permalink
Merge branch '2021_updates_part2'
Browse files Browse the repository at this point in the history
  • Loading branch information
pierremoreau committed Sep 27, 2021
2 parents 15e2a2b + dedd28b commit 02afbb6
Show file tree
Hide file tree
Showing 19 changed files with 401 additions and 249 deletions.
89 changes: 89 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,95 @@
Revision history for CG_Labs


v2020.1 2020-09-27
==================

New features
------------

* Allow hiding the control points from the GUI in the second assignment of
EDAF80.
* Allow pausing the wave animation from the GUI in the fourth assignment of
EDAF80.

Improvements
------------

* Several debug improvements:
- Ask for a debug context;
- Re-work which debug messages are enabled and disabled, and how push and pop
groups are printed.
- Always show shader compilation and link logs when available, rather than
only when it fialed;
- Label vertex arrays, buffers, and textures when importing new objects via
`bonobo::loadObjects()`;
- Add new debug helpers to reduce casting-related warning messages;
- Enable mipmaps even for opacity textures.

Fixes
-----

* Disable file logging when unable to open the file.
* Unlock the mutex on shutdown when file logging was disabled.
* Add missing includes.
* Tell MSVC to use UTF-8 for source and executable character sets.
* Fix more typos.
* Avoid mismatching type assignments in the basis vector shader.
* Fix framework deinitialisation in the first assignment of EDAF80.
* Address several compilation warnings.


v2021.0 2021-09-01
==================

New features
------------

* Time the different steps in `bonobo::loadObjects()` to easily determine which
parts are taking longer.
* Add helper code to render a right-handed orthonormal basis.
* Add elapsed time queries to the second assignment of EDAN35, allowing to
measure the time taken by the different passes.

Breaking changes
----------------

* `bonobo::createProgram()` takes shader files relative to the “shaders/” folder.

Improvements
------------

* Switch away from Travis CI and AppVeyor, and use GitHub Actions instead.
* Add a more detailed build guide.
* Avoid loading unused materials in `bonobo::loadObjects()`
* Several performance and code improvements in the second assignment of EDAN35.
* Various improvements to the `InputHandler` class, included a rework of the
modifier handling that should fix some issues.
* Label shader programs to help with debugging.
* Remove duplicated shaders.

Fixes
-----

* Fixed typos.
* Fix the rendering of shadow maps in the second assignment of EDAN35.
* Dereference a CMake variable before using it in a generator expression.


Removal
-------

* Drop `GLStateInspection` and `GLStateInspectionView`; debuggers provide more
details than those and at a finer granularity.

Dependencies updates
--------------------

* Update Dear ImGui to 1.84.2.
* Update the referenced commits for stb.
* Update the referenced commits for tinyfiledialogs.


v2020.1 2020-09-29
==================

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif ()
# Set project attributes.
project (
CG_Labs
VERSION 2020.1
VERSION 2021.1
DESCRIPTION [[Repository for Computer Graphics courses EDAF80 and EDAN35 at Lund University, Sweden.]]
HOMEPAGE_URL [[https://github.com/LUGGPublic/CG_Labs/]]
LANGUAGES CXX C
Expand Down
2 changes: 1 addition & 1 deletion shaders/common/basis.frag
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 410

in VS_OUT {
flat uint axis_index;
flat int axis_index;
} vs_out;

out vec4 frag_color;
Expand Down
2 changes: 1 addition & 1 deletion shaders/common/basis.vert
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ uniform float thickness_scale;
uniform float length_scale;

out VS_OUT {
flat uint axis_index;
flat int axis_index;
} vs_out;


Expand Down
8 changes: 4 additions & 4 deletions src/EDAF80/assignment1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ int main()
if (objects.empty()) {
LogError("Failed to load the sphere geometry: exiting.");

bonobo::deinit();

return EXIT_FAILURE;
}
bonobo::mesh_data const& sphere = objects.front();
Expand All @@ -75,8 +77,7 @@ int main()
if (celestial_body_shader == 0u) {
LogError("Failed to generate the “Celestial Body” shader program: exiting.");

Log::View::Destroy();
Log::Destroy();
bonobo::deinit();

return EXIT_FAILURE;
}
Expand All @@ -88,8 +89,7 @@ int main()
if (celestial_ring_shader == 0u) {
LogError("Failed to generate the “Celestial Ring” shader program: exiting.");

Log::View::Destroy();
Log::Destroy();
bonobo::deinit();

return EXIT_FAILURE;
}
Expand Down
15 changes: 11 additions & 4 deletions src/EDAF80/assignment2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ edaf80::Assignment2::run()
// always be changed at runtime through the "Scene Controls" window.
bool interpolate = true;

// Set whether to show the control points or not; it can always be changed
// at runtime through the "Scene Controls" window.
bool show_control_points = true;

auto circle_rings = Node();
circle_rings.set_geometry(shape);
circle_rings.set_program(&fallback_shader, set_uniforms);
Expand Down Expand Up @@ -159,7 +163,7 @@ edaf80::Assignment2::run()
auto lastTime = std::chrono::high_resolution_clock::now();

std::int32_t program_index = 0;
float ellapsed_time_s = 0.0f;
float elapsed_time_s = 0.0f;
auto cull_mode = bonobo::cull_mode_t::disabled;
auto polygon_mode = bonobo::polygon_mode_t::fill;
bool show_logs = true;
Expand All @@ -181,7 +185,7 @@ edaf80::Assignment2::run()
glfwPollEvents();
inputHandler.Advance();
mCamera.Update(deltaTimeUs, inputHandler);
ellapsed_time_s += std::chrono::duration<float>(deltaTimeUs).count();
elapsed_time_s += std::chrono::duration<float>(deltaTimeUs).count();

if (inputHandler.GetKeycodeState(GLFW_KEY_F3) & JUST_RELEASED)
show_logs = !show_logs;
Expand Down Expand Up @@ -225,8 +229,10 @@ edaf80::Assignment2::run()
}

circle_rings.render(mCamera.GetWorldToClipMatrix());
for (auto const& control_point : control_points) {
control_point.render(mCamera.GetWorldToClipMatrix());
if (show_control_points) {
for (auto const& control_point : control_points) {
control_point.render(mCamera.GetWorldToClipMatrix());
}
}

bool const opened = ImGui::Begin("Scene Controls", nullptr, ImGuiWindowFlags_None);
Expand All @@ -241,6 +247,7 @@ edaf80::Assignment2::run()
circle_rings.set_program(selection_result.program, set_uniforms);
}
ImGui::Separator();
ImGui::Checkbox("Show control points", &show_control_points);
ImGui::Checkbox("Enable interpolation", &interpolate);
ImGui::Checkbox("Use linear interpolation", &use_linear);
ImGui::SliderFloat("Catmull-Rom tension", &catmull_rom_tension, 0.0f, 1.0f);
Expand Down
8 changes: 6 additions & 2 deletions src/EDAF80/assignment4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ edaf80::Assignment4::run()
// (Check how it was done in assignment 3.)
//

float ellapsed_time_s = 0.0f;
float elapsed_time_s = 0.0f;

//
// Todo: Load your geometry
Expand All @@ -75,6 +75,7 @@ edaf80::Assignment4::run()

auto lastTime = std::chrono::high_resolution_clock::now();

bool pause_animation = true;
auto cull_mode = bonobo::cull_mode_t::disabled;
auto polygon_mode = bonobo::polygon_mode_t::fill;
bool show_logs = true;
Expand All @@ -90,7 +91,9 @@ edaf80::Assignment4::run()
auto const nowTime = std::chrono::high_resolution_clock::now();
auto const deltaTimeUs = std::chrono::duration_cast<std::chrono::microseconds>(nowTime - lastTime);
lastTime = nowTime;
ellapsed_time_s += std::chrono::duration<float>(deltaTimeUs).count();
if (!pause_animation) {
elapsed_time_s += std::chrono::duration<float>(deltaTimeUs).count();
}

auto& io = ImGui::GetIO();
inputHandler.SetUICapture(io.WantCaptureMouse, io.WantCaptureKeyboard);
Expand Down Expand Up @@ -155,6 +158,7 @@ edaf80::Assignment4::run()

bool opened = ImGui::Begin("Scene Control", nullptr, ImGuiWindowFlags_None);
if (opened) {
ImGui::Checkbox("Pause animation", &pause_animation);
auto const cull_mode_changed = bonobo::uiSelectCullMode("Cull mode", cull_mode);
if (cull_mode_changed) {
changeCullMode(cull_mode);
Expand Down
2 changes: 1 addition & 1 deletion src/EDAF80/parametric_shapes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ parametric_shapes::createCircleRing(float const radius,

glBindBuffer(GL_ARRAY_BUFFER, 0u);

data.indices_nb = index_sets.size() * 3u;
data.indices_nb = static_cast<GLsizei>(index_sets.size() * 3u);
glGenBuffers(1, &data.ibo);
assert(data.ibo != 0u);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, data.ibo);
Expand Down
Loading

0 comments on commit 02afbb6

Please sign in to comment.