Skip to content

Commit

Permalink
merge with upstream/main + minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasDworschak committed Jan 16, 2024
2 parents 49ba057 + cb24c7b commit 25877a3
Show file tree
Hide file tree
Showing 57 changed files with 300 additions and 179 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/webassembly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: "webassembly"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v13
with:
version: 3.1.37
- uses: actions/checkout@v3
- name: Install Qt native version (required by webassembly version)
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.6.1'
host: linux
target: 'desktop'
arch: gcc_64
dir: '${{github.workspace}}/qt'
install-deps: 'true'
modules: 'qtcharts qtpositioning'

- name: Set QT_HOST_PATH
run: echo "QT_HOST_PATH=${Qt6_DIR}" >> "$GITHUB_ENV"

- name: Install Linux Dependencies
run: sudo apt-get install -y build-essential ninja-build

- name: Install Qt Webassembly version
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.6.1'
host: linux
target: 'desktop'
arch: wasm_singlethread
dir: '${{github.workspace}}/qt'
install-deps: 'true'
modules: 'qtcharts'

- name: Make qt webassembly binaries executable
run: |
chmod u+x ${Qt6_DIR}/bin/*
- name: Verify emcc
run: emcc -v

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "install-dir=${{ github.workspace }}/install" >> "$GITHUB_OUTPUT"
- name: Configure CMake
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}/lib/cmake
run: >
${Qt6_DIR}/bin/qt-cmake
-G Ninja
-B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_BUILD_TYPE=Release
-DALP_WWW_INSTALL_DIR=${{ steps.strings.outputs.install-dir }}
-DALP_ENABLE_ADDRESS_SANITIZER=ON
-DALP_ENABLE_ASSERTS=ON
-DFMT_INSTALL=OFF
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --target install

- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: webassembly_out
path: ${{ steps.strings.outputs.install-dir }}
if-no-files-found: error

- name: Create index.html
run: |
echo "<html>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <head>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <title>AlpineMaps build</title>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </head>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <body>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <ul>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./alpineapp.html">AlpineMaps App</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./plain_renderer.html">plain renderer</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./unittests_radix.html">unittests_radix</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./unittests_nucleus.html">unittests_nucleus</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " <li><a href="./unittests_gl_engine.html">unittests_gl_engine</li>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </ul>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo " </body>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo "</html>" >> ${{ steps.strings.outputs.install-dir }}/index.html
echo "" >> ${{ steps.strings.outputs.install-dir }}/index.html
- name: Create Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ steps.strings.outputs.install-dir }}

- name: Debug output
run: echo ${{ github.event_name }}

deploy:
if: github.event_name == 'push'
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v4

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

- name: Debug output
run: echo ${{ steps.deployment.outputs.page_url }}
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################

cmake_minimum_required(VERSION 3.24)
cmake_minimum_required(VERSION 3.25)
project(alpine-renderer LANGUAGES CXX)

option(ALP_UNITTESTS "include unit test targets in the buildsystem" ON)
Expand Down
1 change: 0 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################

cmake_minimum_required(VERSION 3.24)
project(alpine-renderer-app LANGUAGES CXX)

qt_add_executable(alpineapp
Expand Down
2 changes: 2 additions & 0 deletions app/GnssInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ void GnssInformation::position_updated(const QGeoPositionInfo& position)
m_horizontal_accuracy = position.attribute(QGeoPositionInfo::Attribute::HorizontalAccuracy);
m_timestamp = position.timestamp();
emit information_updated();
#else
Q_UNUSED(position);
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions app/HotReloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
#include <QQmlApplicationEngine>

HotReloader::HotReloader(QQmlApplicationEngine* engine, QString directory, QObject* parent)
: m_engine(engine)
, QObject { parent }
: QObject { parent }
, m_engine(engine)
{
m_watcher = new QFileSystemWatcher(this);
directory.replace("file:/", "");
m_watcher->addPath(directory);
qDebug("watching %s", directory.toStdString().c_str());

connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, [this, &engine](const QString& path) {
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString&) {
qDebug("watched_source_changed");
emit watched_source_changed();
});
Expand Down
8 changes: 5 additions & 3 deletions app/TerrainRendererItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ QQuickFramebufferObject::Renderer* TerrainRendererItem::createRenderer() const
});
connect(this, &TerrainRendererItem::tile_cache_size_changed, tile_scheduler, &nucleus::tile_scheduler::Scheduler::set_ram_quad_limit);
connect(tile_scheduler, &nucleus::tile_scheduler::Scheduler::quads_requested, this, [this](const std::vector<tile::Id>& ids) {
const_cast<TerrainRendererItem*>(this)->set_queued_tiles(ids.size());
const_cast<TerrainRendererItem*>(this)->set_queued_tiles(unsigned(ids.size()));
});
connect(tile_scheduler, &nucleus::tile_scheduler::Scheduler::quad_received, this, [this]() {
const_cast<TerrainRendererItem*>(this)->set_queued_tiles(std::max(this->queued_tiles(), 1u) - 1);
Expand Down Expand Up @@ -515,10 +515,12 @@ void TerrainRendererItem::init_after_creation_slot() {
emit shared_config_changed(m_shared_config);
}

void TerrainRendererItem::datetime_changed(const QDateTime& new_datetime) {
void TerrainRendererItem::datetime_changed(const QDateTime&)
{
recalculate_sun_angles();
}

void TerrainRendererItem::gl_sundir_date_link_changed(bool new_value) {
void TerrainRendererItem::gl_sundir_date_link_changed(bool)
{
recalculate_sun_angles();
}
8 changes: 0 additions & 8 deletions app/timing/TimerFrontendManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,3 @@ void TimerFrontendManager::receive_measurements(QList<nucleus::timing::TimerRepo
}
emit updateTimingList(m_timer);
}

TimerFrontendManager::TimerFrontendManager(const TimerFrontendManager &src)
:m_timer(src.m_timer)
{
#ifdef ALP_ENABLE_TRACK_OBJECT_LIFECYCLE
qDebug() << "TimerFrontendManager()";
#endif
}
3 changes: 1 addition & 2 deletions app/timing/TimerFrontendManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class TimerFrontendManager : public QObject
Q_OBJECT

public:
TimerFrontendManager(const TimerFrontendManager& src);
~TimerFrontendManager();
TimerFrontendManager(QObject* parent = nullptr);
~TimerFrontendManager() override;

public slots:
void receive_measurements(QList<nucleus::timing::TimerReport> values);
Expand Down
7 changes: 5 additions & 2 deletions app/timing/TimerFrontendObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ float TimerFrontendObject::get_average() {
}

TimerFrontendObject::TimerFrontendObject(QObject* parent, const QString& name, const QString& group, const int queue_size, const float average_weight, const float first_value)
:QObject(parent), m_queue_size(queue_size), m_name(name), m_group(group)
: QObject(parent)
, m_name(name)
, m_group(group)
, m_queue_size(queue_size)
{
m_color = timer_colors[timer_color_index++ % (sizeof(timer_colors) / sizeof(timer_colors[0]))];
m_new_weight = average_weight;
m_old_weight = 1.0 - m_new_weight;
m_old_weight = 1.0f - m_new_weight;
m_quick_average = first_value;
#ifdef ALP_ENABLE_TRACK_OBJECT_LIFECYCLE
qDebug() << "TimerFrontendObject(name=" << m_name << ")";
Expand Down
2 changes: 1 addition & 1 deletion app/timing/TimerFrontendObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TimerFrontendObject : public QObject {
TimerFrontendObject(QObject* parent, const QString& name, const QString& group, const int queue_size = 30, const float average_weight = 1.0/30.0f, const float first_value = 0.0 );
~TimerFrontendObject();

bool operator!=(const TimerFrontendObject& rhs) const
bool operator!=(const TimerFrontendObject&) const
{
// ToDo compare for difference
return true;
Expand Down
10 changes: 7 additions & 3 deletions cmake/alp_add_git_repository.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#############################################################################
# Alpine Terrain Renderer
# Alpine Radix
# Copyright (C) 2023 Adam Celarek <family name at cg tuwien ac at>
#
# This program is free software: you can redistribute it and/or modify
Expand All @@ -25,7 +25,7 @@ find_package(Git 2.22 REQUIRED)
# with upstream.

function(alp_add_git_repository name)
set(options DO_NOT_ADD_SUBPROJECT)
set(options DO_NOT_ADD_SUBPROJECT NOT_SYSTEM)
set(oneValueArgs URL COMMITISH DESTINATION_PATH)
set(multiValueArgs )
cmake_parse_arguments(PARSE_ARGV 1 PARAM "${options}" "${oneValueArgs}" "${multiValueArgs}")
Expand Down Expand Up @@ -91,6 +91,10 @@ function(alp_add_git_repository name)
endif()

if (NOT ${PARAM_DO_NOT_ADD_SUBPROJECT})
add_subdirectory(${repo_dir} ${CMAKE_BINARY_DIR}/alp_external/${name})
if (NOT ${PARAM_NOT_SYSTEM})
add_subdirectory(${repo_dir} ${CMAKE_BINARY_DIR}/alp_external/${name} SYSTEM)
else()
add_subdirectory(${repo_dir} ${CMAKE_BINARY_DIR}/alp_external/${name})
endif()
endif()
endfunction()
1 change: 0 additions & 1 deletion gl_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################

cmake_minimum_required(VERSION 3.24)
project(alpine-renderer-gl_engine LANGUAGES CXX)

# If true the shaders will be loaded from the given ALP_SHADER_NETWORK_URL and can be reloaded
Expand Down
22 changes: 11 additions & 11 deletions gl_engine/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ QImage::Format qimage_format(Framebuffer::ColourFormat f)
return QImage::Format_Invalid;
}


void Framebuffer::recreate_texture(int index) {
if (index == -1) {
void Framebuffer::recreate_texture(size_t index)
{
if (index == size_t(-1)) {
if (m_depth_format != DepthFormat::None) {
m_depth_texture->destroy();
m_depth_texture->setFormat(internal_format_qt(m_depth_format));
Expand Down Expand Up @@ -203,8 +203,8 @@ void Framebuffer::recreate_texture(int index) {
}

void Framebuffer::recreate_all_textures() {
recreate_texture(-1);
for (int i = 0; i < m_colour_textures.size(); i++)
recreate_texture(size_t(-1));
for (size_t i = 0; i < m_colour_textures.size(); i++)
recreate_texture(i);
}

Expand All @@ -215,7 +215,7 @@ Framebuffer::Framebuffer(DepthFormat depth_format, std::vector<TextureDefinition
m_size(init_size)
{

for (int i = 0; i < m_colour_definitions.size(); i++) {
for (size_t i = 0; i < m_colour_definitions.size(); i++) {
auto colorTexture = std::make_unique<QOpenGLTexture>(QOpenGLTexture::Target::Target2D);
m_colour_textures.push_back(std::move(colorTexture));
}
Expand Down Expand Up @@ -254,7 +254,7 @@ void Framebuffer::bind()

void Framebuffer::bind_colour_texture(unsigned index, unsigned location)
{
assert(index >= 0 && index < m_colour_textures.size());
assert(index < m_colour_textures.size());
m_colour_textures[index]->bind(location);
}

Expand All @@ -269,12 +269,12 @@ std::unique_ptr<QOpenGLTexture> Framebuffer::take_and_replace_colour_attachment(
std::unique_ptr<QOpenGLTexture> tmp = std::move(m_colour_textures[index]);
m_colour_textures[index] = std::make_unique<QOpenGLTexture>(QOpenGLTexture::Target::Target2D);
recreate_texture(index);
return std::move(tmp);
return tmp;
}

QImage Framebuffer::read_colour_attachment(unsigned index)
{
assert(index >= 0 && index < m_colour_textures.size());
assert(index < m_colour_textures.size());

auto texFormat = m_colour_definitions[index].format;

Expand All @@ -299,7 +299,7 @@ QImage Framebuffer::read_colour_attachment(unsigned index)

std::array<uchar, 4> Framebuffer::read_colour_attachment_pixel(unsigned index, const glm::dvec2& normalised_device_coordinates)
{
assert(index >= 0 && index < m_colour_textures.size());
assert(index < m_colour_textures.size());

auto texFormat = m_colour_definitions[index].format;
assert(texFormat == ColourFormat::RGBA8);
Expand All @@ -320,7 +320,7 @@ std::array<uchar, 4> Framebuffer::read_colour_attachment_pixel(unsigned index, c

void Framebuffer::read_colour_attachment_pixel(unsigned index, const glm::dvec2& normalised_device_coordinates, void* target)
{
assert(index >= 0 && index < m_colour_textures.size());
assert(index < m_colour_textures.size());

auto texFormat = m_colour_definitions[index].format;

Expand Down
2 changes: 1 addition & 1 deletion gl_engine/Framebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Framebuffer
unsigned m_frame_buffer = -1;
glm::uvec2 m_size;
// Recreates the OpenGL-Texture for the given index. An index of -1 recreates the depth-buffer.
void recreate_texture(int index);
void recreate_texture(size_t index);
// Calls recreate_texture for all the buffers that are attached to this FBO (depth and colour)
void recreate_all_textures();

Expand Down
4 changes: 2 additions & 2 deletions gl_engine/SSAO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ SSAO::~SSAO() {
}

void SSAO::draw(Framebuffer* gbuffer, helpers::ScreenQuadGeometry* geometry,
const nucleus::camera::Definition& camera, unsigned int kernel_size, unsigned int blur_level) {
const nucleus::camera::Definition&, unsigned int kernel_size, unsigned int blur_level)
{
m_ssaobuffer->bind();
auto p = m_ssao_program.get();
p->bind();
Expand Down Expand Up @@ -120,7 +121,6 @@ void SSAO::draw(Framebuffer* gbuffer, helpers::ScreenQuadGeometry* geometry,
m_ssaobuffer->unbind();
p->release();
}

}

void SSAO::resize(glm::uvec2 vp_size) {
Expand Down
Loading

0 comments on commit 25877a3

Please sign in to comment.