Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
cmake_minimum_required(VERSION 3.9)

set(CMAKE_CXX_FLAGS -std=c++17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/modules)

find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
# cmath on MSVC needs this to define M_PI etc.
add_compile_definitions(_USE_MATH_DEFINES)

# skip OpenMP on MSVC as it doesn't support OpenMP 3.0 unsigned loops
if (!MSVC)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
endif()

add_subdirectory(src)
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#+BEGIN_SRC bash
pushd vcpkg
./bootstrap-vcpkg.sh
./vcpkg install magnum-integration[imgui]
./vcpkg install magnum-integration[imgui] eigen3 egl-registry
popd
#+END_SRC

Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
find_package(Eigen3 CONFIG REQUIRED)

add_library(WaveGrid WaveGrid.cpp Enviroment.cpp Grid.cpp ProfileBuffer.cpp Spectrum.cpp ${Environment_RCS})
target_link_libraries(WaveGrid Eigen3::Eigen)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eigen3 does not have any libraries, it's header only?!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's required to setup the correct include paths for the project. Maybe that's a MSVC thing but I don't think it hurts anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


add_subdirectory(tests)
add_subdirectory(visualization)
Expand Down
2 changes: 1 addition & 1 deletion src/Enviroment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace WaterWavelets {

auto &raw_data = harbor_data;

const int N = sqrt(raw_data.size());
const int N = sqrt(sizeof(raw_data) / sizeof(float));

auto data_grid = [](int i, int j) -> float {
// outside of the data grid just return some high arbitrary number
Expand Down
2 changes: 1 addition & 1 deletion src/data/harbor_data.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/island_data.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/math/interpolation/DomainInterpolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <iostream>

#include <eigen3/Eigen/Dense>
#include <Eigen/Dense>

/*
* Domain inteprolation - Interpolates function values only for pointS in the
Expand Down
2 changes: 1 addition & 1 deletion src/math/interpolation/ValueTraits.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <eigen3/Eigen/Dense>
#include <Eigen/Dense>

template <class T> struct ValueTraits {

Expand Down
1 change: 1 addition & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_executable(integration_test integration_test.cpp)
target_link_libraries(integration_test Eigen3::Eigen)
1 change: 0 additions & 1 deletion src/visualization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ find_package(Magnum REQUIRED
SceneGraph
Sdl2Application)

# find_package(imgui REQUIRED ImGui)
find_package(MagnumIntegration CONFIG REQUIRED ImGui)

message("ImGui Found: ${ImGUi_FOUND}")
Expand Down
13 changes: 13 additions & 0 deletions src/visualization/base/SceneBase3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ SceneBase3D::SceneBase3D(const Arguments &arguments)
Renderer::enable(Renderer::Feature::FaceCulling);
Renderer::enable(Renderer::Feature::Multisampling);

Renderer::setBlendEquation(Renderer::BlendEquation::Add, Renderer::BlendEquation::Add);
Renderer::setBlendFunction(Renderer::BlendFunction::SourceAlpha, Renderer::BlendFunction::OneMinusSourceAlpha);

/* Configure camera */
viewportEvent(GL::defaultFramebuffer.viewport().size()); // set up camera

Expand All @@ -31,8 +34,18 @@ void SceneBase3D::drawEvent() {

_camera.draw(_drawables);

Renderer::enable(Renderer::Feature::Blending);
Renderer::enable(Renderer::Feature::ScissorTest);
Renderer::disable(Renderer::Feature::FaceCulling);
Renderer::disable(Renderer::Feature::DepthTest);

drawGui();

Renderer::enable(Renderer::Feature::DepthTest);
Renderer::enable(Renderer::Feature::FaceCulling);
Renderer::disable(Renderer::Feature::ScissorTest);
Renderer::disable(Renderer::Feature::Blending);

swapBuffers();
redraw();
}
Expand Down
2 changes: 0 additions & 2 deletions src/visualization/drawables/Primitives3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ Sphere::Sphere(SceneBase3D::Object3D *parent, SceneGraph::DrawableGroup3D *group

auto meshData = Primitives::UVSphere::solid(rings, segments);

#warning "Normals are incorrect!"

_data.resize(meshData.positions(0).size());
for (size_t i = 0; i < meshData.positions(0).size(); i++) {
_data[i].position = Matrix4::rotationX(Rad{M_PI / 2})
Expand Down