Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

98 add mesh optimizer template module #401

Merged
Merged
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
8 changes: 8 additions & 0 deletions CMake/BuildUtils/MeshOptimizer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##########################
# Builds Library For ERS #
##########################

ERSBuildLogger(${Green} "Configuring Meshoptimizer Library")
add_subdirectory(${LIB_DIR}/meshoptimizer)
disable_target_warnings(meshoptimizer)
ERSBuildLogger(${BoldGreen} "Finished Configuring Meshoptimizer Library")
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ include(${CMAKE_BUILD_UTILS_DIR}/Tracy.cmake)
include(${CMAKE_BUILD_UTILS_DIR}/OpenXR.cmake)
include(${CMAKE_BUILD_UTILS_DIR}/PyBind11.cmake)
include(${CMAKE_BUILD_UTILS_DIR}/OZZ-Animation.cmake)

include(${CMAKE_BUILD_UTILS_DIR}/MeshOptimizer.cmake)


# ADD INTERNAL SUBDIRECTORIES
add_subdirectory(${SRC_DIR}/Internal/MeshOptimizerInterface)


# ADD CORE SUBDIRECTORIES
add_subdirectory(${SRC_DIR}/Core/Utils/ERS_CLASS_LoggingSystem)
add_subdirectory(${SRC_DIR}/Core/Utils/ERS_CLASS_HardwareInformation)
add_subdirectory(${SRC_DIR}/Core/Utils/ERS_CLASS_InputOutputSubsystem)
Expand Down
28 changes: 28 additions & 0 deletions Source/Internal/MeshOptimizerInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
########################################################################
# This file is part of the BrainGenix-ERS Environment Rendering System #
########################################################################


# Create Library (Name Should Be Parent Dir Name)
add_library(ERS_MeshOptimizer

# Add Source Files (.cpp)
"ERS_MeshOptimizer.cpp"

# Add Header Files (.h)
"ERS_MeshOptimizer.h"

${BACKWARD_ENABLE}
)

# Link 3rd Party Libs
target_link_libraries(ERS_MeshOptimizer
MeshOptimizer
)

# Link Internal Libs
target_link_libraries(ERS_MeshOptimizer
ERS_CLASS_LoggingSystem
)

target_include_directories(ERS_MeshOptimizer PUBLIC ./)
13 changes: 13 additions & 0 deletions Source/Internal/MeshOptimizerInterface/ERS_MeshOptimizer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//======================================================================//
// This file is part of the BrainGenix-ERS Environment Rendering System //
//======================================================================//

#include <ERS_MeshOptimizer.h>


namespace ERS {




}
38 changes: 38 additions & 0 deletions Source/Internal/MeshOptimizerInterface/ERS_MeshOptimizer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//======================================================================//
// This file is part of the BrainGenix-ERS Environment Rendering System //
//======================================================================//

#pragma once

// Standard Libraries (BG convention: use <> instead of "")
#include <string>


// Third-Party Libraries (BG convention: use <> instead of "")
#include <meshoptimizer.h>

// Internal Libraries (BG convention: use <> instead of "")
#include <ERS_CLASS_LoggingSystem.h>

namespace ERS {

/**
* @brief This class provides functionality to remesh an input mesh with various amounts of optimization.
*
*/
class MeshOptimizer {

private:



public:

MeshOptimizer();
~MeshOptimizer();


};


}
10 changes: 10 additions & 0 deletions Source/Internal/MeshOptimizerInterface/ERS_OptimzationType.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//======================================================================//
// This file is part of the BrainGenix-ERS Environment Rendering System //
//======================================================================//


namespace ERS {



}
20 changes: 20 additions & 0 deletions Source/Internal/MeshOptimizerInterface/ERS_OptimzationType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//======================================================================//
// This file is part of the BrainGenix-ERS Environment Rendering System //
//======================================================================//

#pragma once


// Standard Libraries (BG convention: use <> instead of "")

// Third-Party Libraries (BG convention: use <> instead of "")

// Internal Libraries (BG convention: use <> instead of "")



namespace ERS {



}
13 changes: 13 additions & 0 deletions Third-Party/meshoptimizer/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Standard: Cpp03
UseTab: ForIndentation
TabWidth: 4
IndentWidth: 4
AccessModifierOffset: -4
BreakBeforeBraces: Allman
IndentCaseLabels: false
ColumnLimit: 0
PointerAlignment: Left
BreakConstructorInitializersBeforeComma: true
NamespaceIndentation: None
AlignEscapedNewlines: DontAlign
AlignAfterOpenBracket: DontAlign
8 changes: 8 additions & 0 deletions Third-Party/meshoptimizer/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://editorconfig.org/ for more info

[*]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Bug report
about: Create a report if you believe you've found a bug in this project; please use GitHub Discussions instead if you think the bug may be in your code.
title: ''
labels: bug
assignees: ''

---
5 changes: 5 additions & 0 deletions Third-Party/meshoptimizer/.github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Help and support
url: https://github.com/zeux/meshoptimizer/discussions
about: Please use GitHub Discussions if you have questions or need help.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---
142 changes: 142 additions & 0 deletions Third-Party/meshoptimizer/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
name: build

on:
push:
branches:
- 'master'
pull_request:

jobs:
unix:
strategy:
matrix:
os: [ubuntu, macos]
name: ${{matrix.os}}
runs-on: ${{matrix.os}}-latest
steps:
- uses: actions/checkout@v1
- name: make test
run: |
make -j2 config=sanitize test
make -j2 config=debug test
make -j2 config=release test
make -j2 config=coverage test
- name: make gltfpack
run: |
make -j2 config=release gltfpack
strip gltfpack
- name: upload coverage
run: |
find . -type f -name '*.gcno' -exec gcov -p {} +
sed -i -e "s/#####\(.*\)\(\/\/ unreachable.*\)/ -\1\2/" *.gcov
bash <(curl -s https://codecov.io/bash) -f './src*.gcov' -X search -t ${{secrets.CODECOV_TOKEN}} -B ${{github.ref}}

windows:
runs-on: windows-latest
strategy:
matrix:
arch: [Win32, x64]
steps:
- uses: actions/checkout@v1
- name: cmake configure
run: cmake . -DMESHOPT_BUILD_DEMO=ON -DMESHOPT_BUILD_GLTFPACK=ON -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -A ${{matrix.arch}}
- name: cmake test
shell: bash # necessary for fail-fast
run: |
cmake --build . -- -property:Configuration=Debug -verbosity:minimal
Debug/demo.exe demo/pirate.obj
cmake --build . -- -property:Configuration=Release -verbosity:minimal
Release/demo.exe demo/pirate.obj

nodejs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: test decoder
run: node js/meshopt_decoder.test.js
- name: test simd decoder
run: node --experimental-wasm-simd js/meshopt_decoder.test.js
- name: test encoder
run: node js/meshopt_encoder.test.js
- name: test simplifier
run: node js/meshopt_simplifier.test.js

gltfpack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
repository: KhronosGroup/glTF-Sample-Models
path: glTF-Sample-Models
- name: make
run: make -j2 config=sanitize gltfpack
- name: test
run: find glTF-Sample-Models/2.0/ -name *.gltf -or -name *.glb | xargs -d '\n' ./gltfpack -cc -test
- name: pack
run: find glTF-Sample-Models/2.0/ -name *.gltf | grep -v glTF-Draco | grep -v glTF-KTX-BasisU | xargs -d '\n' -I '{}' ./gltfpack -i '{}' -o '{}pack.gltf'
- name: validate
run: |
curl -sL $VALIDATOR | tar xJ
find glTF-Sample-Models/2.0/ -name *.gltfpack.gltf | xargs -d '\n' -L 1 ./gltf_validator -r -a
env:
VALIDATOR: https://github.com/KhronosGroup/glTF-Validator/releases/download/2.0.0-dev.3.3/gltf_validator-2.0.0-dev.3.3-linux64.tar.xz

gltfpackjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: install wasi
run: |
curl -sL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$VERSION/wasi-sdk-$VERSION.0-linux.tar.gz | tar xz
curl -sL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$VERSION/libclang_rt.builtins-wasm32-wasi-$VERSION.0.tar.gz | tar xz -C wasi-sdk-$VERSION.0
curl -sL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$VERSION/wasi-sysroot-$VERSION.0.tar.gz | tar xz
mv wasi-sdk-$VERSION.0 wasi-sdk
env:
VERSION: 16
- name: build
run: |
make -B WASMCC=wasi-sdk/bin/clang++ WASI_SDK=./wasi-sysroot gltf/library.wasm
make -B WASMCC=wasi-sdk/bin/clang++ WASI_SDK=./wasi-sysroot js/meshopt_decoder.js js/meshopt_decoder.module.js
make -B WASMCC=wasi-sdk/bin/clang++ WASI_SDK=./wasi-sysroot js/meshopt_encoder.js js/meshopt_encoder.module.js
make -B WASMCC=wasi-sdk/bin/clang++ WASI_SDK=./wasi-sysroot js/meshopt_simplifier.js js/meshopt_simplifier.module.js
git status
- name: test
run: |
node gltf/cli.js -i demo/pirate.obj -o pirate.glb -v
node gltf/cli.js -i `pwd`/pirate.glb -o pirate-repack.glb -cc -v
wc -c pirate.glb pirate-repack.glb
node js/meshopt_decoder.test.js
node js/meshopt_encoder.test.js
node js/meshopt_simplifier.test.js

arm64:
runs-on: ubuntu-latest
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
- uses: docker://multiarch/ubuntu-core:arm64-focal
with:
args: 'uname -a'
- uses: actions/checkout@v1
- name: make test
uses: docker://multiarch/ubuntu-core:arm64-focal
with:
args: 'bash -c "apt-get update && apt-get install -y build-essential && make -j2 config=coverage test"'
- name: upload coverage
run: |
find . -type f -name '*.gcno' -exec gcov -p {} +
sed -i -e "s/#####\(.*\)\(\/\/ unreachable.*\)/ -\1\2/" *.gcov
bash <(curl -s https://codecov.io/bash) -f './src*.gcov' -X search -t ${{secrets.CODECOV_TOKEN}} -B ${{github.ref}}

iphone:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: make
run: make -j2 config=iphone
Loading