Skip to content

Commit

Permalink
feat(meshoptimizer): add meshoptimizer bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed Sep 3, 2019
1 parent 172949f commit 5027f72
Show file tree
Hide file tree
Showing 55 changed files with 10,911 additions and 14 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@
.gradle
.DS_Store
*.bat
*.conf
*.dll
*.dylib
*.jar
*.jpg
*.mhr
*.obj
*.ogg
*.sh
*.so
*.ttf
*.wav
*.zip
Expand Down
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/modules/lwjgl/lwjgl.meshoptimizer.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules/samples.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules/templates.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/modules/templates/templates.meshoptimizer.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ improve the chances of a quick and useful response.
|[Assimp](http://www.assimp.org/)|A portable Open Source library to import various well-known 3D model formats in a uniform manner.|
|[bgfx](https://bkaradzic.github.io/bgfx/)|Cross-platform, graphics API agnostic, “Bring Your Own Engine/Framework” style rendering library, licensed under permissive BSD-2 clause open source license.|
|[LibOVR](https://developer.oculus.com/documentation/)|The API of the Oculus SDK.|
|[meshoptimizer](https://github.com/zeux/meshoptimizer)|A library that provides algorithms to help optimize meshes.|
|[NanoSVG](https://github.com/memononen/nanosvg)|A simple stupid SVG parser.|
|[NanoVG](https://github.com/memononen/nanovg)|A small antialiased vector graphics rendering library for OpenGL.|
|[Nuklear](https://github.com/vurtun/nuklear)|A minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain.|
Expand Down
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ enum class Artifacts(
"An extremely fast non-cryptographic hash.",
Platforms.LINUX, Platforms.LINUX_ARM64, Platforms.MACOS, Platforms.WINDOWS, Platforms.WINDOWS_X86
),
MESHOPTIMIZER(
"lwjgl-meshoptimizer", "LWJGL - meshoptimizer bindings",
"A library that provides algorithms to help optimize meshes.",
*Platforms.ALL
),
NANOVG(
"lwjgl-nanovg", "LWJGL - NanoVG & NanoSVG bindings",
"A small antialiased vector graphics rendering library for OpenGL. Also includes NanoSVG, a simple SVG parser.",
Expand Down
5 changes: 5 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@
<compileBinding binding="lmdb"/>
<compileBinding binding="lz4"/>
<compileBinding binding="meow"/>
<compileBinding binding="meshoptimizer"/>
<compileBinding binding="nanovg"/>
<compileBinding binding="nfd"/>
<compileBinding binding="nuklear"/>
Expand Down Expand Up @@ -670,6 +671,7 @@
<include name="org/lwjgl/demo/util/lmdb/**" if:true="${binding.lmdb}"/>
<include name="org/lwjgl/demo/util/lz4/**" if:true="${binding.lz4}"/>
<include name="org/lwjgl/demo/util/meow/**" if:true="${binding.meow}"/>
<include name="org/lwjgl/demo/util/meshoptimizer/**" if:true="${binding.meshoptimizer}"/>
<include name="org/lwjgl/demo/util/nfd/**" if:set="test.nfd"/>
<include name="org/lwjgl/demo/util/par/**" if:set="test.par"/>
<include name="org/lwjgl/demo/util/tinyexr/**" if:set="test.tinyexr"/>
Expand Down Expand Up @@ -1298,6 +1300,9 @@
</natives>
</release-module>

<!-- meshoptimizer -->
<release-module name="meshoptimizer" native-library="lwjgl_meshoptimizer" title="meshoptimizer" if:true="${binding.meshoptimizer}"/>

<!-- NanoVG -->
<release-module name="nanovg" native-library="lwjgl_nanovg" title="NanoVG" if:true="${binding.nanovg}"/>

Expand Down
2 changes: 2 additions & 0 deletions config/build-bindings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ This script is included in /config/build-definitions.xml.
<isset property="build.arch.arm64"/>
</or>
</condition>
<property name="binding.meshoptimizer" value="true"/>
<property name="binding.nanovg" value="true"/>
<condition property="binding.nfd" value="true" else="false"><isset property="notARM"/></condition>
<property name="binding.nuklear" value="true"/>
Expand Down Expand Up @@ -175,6 +176,7 @@ This script is included in /config/build-definitions.xml.
<sequential if:true="${binding.lmdb}"><local name="module"/><property name="module" value="lmdb"/><body/></sequential>
<sequential if:true="${binding.lz4}"><local name="module"/><property name="module" value="lz4"/><body/></sequential>
<sequential if:true="${binding.meow}"><local name="module"/><property name="module" value="meow"/><body/></sequential>
<sequential if:true="${binding.meshoptimizer}"><local name="module"/><property name="module" value="meshoptimizer"/><body/></sequential>
<sequential if:true="${binding.nanovg}"><local name="module"/><property name="module" value="nanovg"/><body/></sequential>
<sequential if:true="${binding.nfd}"><local name="module"/><property name="module" value="nfd"/><body/></sequential>
<sequential if:true="${binding.nuklear}"><local name="module"/><property name="module" value="nuklear"/><body/></sequential>
Expand Down
10 changes: 10 additions & 0 deletions config/linux/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,16 @@
</condition>
<build module="meow" simple="true" flags="-Werror -Wfatal-errors ${meow.flags}" if:true="${binding.meow}"/>

<!-- meshoptimizer -->
<build module="meshoptimizer" simple="true" lang="c++" if:true="${binding.meshoptimizer}">
<beforeCompile>
<compile lang="c++">
<arg value="-I${src.main.rel}"/>
<fileset dir="." includes="${src.main}/*.cpp"/>
</compile>
</beforeCompile>
</build>

<!-- NanoVG -->
<build module="nanovg" simple="true" if:true="${binding.nanovg}">
<source>
Expand Down
10 changes: 10 additions & 0 deletions config/macos/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,16 @@
<!-- Meow -->
<build module="meow" simple="true" flags="-Werror -Wfatal-errors -maes" if:true="${binding.meow}"/>

<!-- meshoptimizer -->
<build module="meshoptimizer" simple="true" lang="c++" if:true="${binding.meshoptimizer}">
<beforeCompile>
<compile lang="c++">
<arg value="-I${src.main.rel}"/>
<fileset dir="." includes="${src.main}/*.cpp"/>
</compile>
</beforeCompile>
</build>

<!-- NanoVG -->
<build module="nanovg" simple="true" if:true="${binding.nanovg}">
<source>
Expand Down
5 changes: 5 additions & 0 deletions config/tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<package name="org.lwjgl.util.libdivide"/>
</packages>
</test>
<test name="meshoptimizer">
<packages>
<package name="org.lwjgl.util.meshoptimizer"/>
</packages>
</test>
<test name="opencl">
<packages>
<package name="org.lwjgl.opencl"/>
Expand Down
10 changes: 10 additions & 0 deletions config/windows/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ EXPORTS
<!-- Meow -->
<build_simple module="meow"/>

<!-- meshoptimizer -->
<build module="meshoptimizer" simple="true" if:true="${binding.meshoptimizer}">
<beforeCompile>
<compile>
<arg value="/I${src.main}"/>
<fileset dir="." includes="${src.main}/*.cpp"/>
</compile>
</beforeCompile>
</build>

<!-- NanoVG -->
<build module="nanovg" simple="true" if:true="${binding.nanovg}">
<compileargs>
Expand Down
2 changes: 2 additions & 0 deletions doc/notes/3.2.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ This build includes the following changes:

#### Bindings

- Added [meshoptimizer](https://github.com/zeux/meshoptimizer) bindings.

#### Improvements

- macOS: Shared libraries are now built with Xcode 10.3 (up from 10.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ class Func(
else
@Suppress("UNCHECKED_CAST") (transform as FunctionTransform<Parameter>).transformCall(autoSize, autoSize.name)
}.let { name ->
if (autoSize.nativeType.mapping === PrimitiveMapping.INT)
if (autoSize.nativeType.mapping === PrimitiveMapping.INT || name.endsWith(".remaining()"))
name
else
"(int)$name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ object RawPointer : ParameterModifier {
override val isSpecial = true
override fun validate(param: Parameter) {
check(param.nativeType.isPointerData) {
"The RawPointer modifier can only modifier to data pointer parameters."
"The RawPointer modifier can only be applied to data pointer parameters."
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ enum class Module(
library = JNILibrary.create("LibMeow"),
arrayOverloads = false
),
MESHOPTIMIZER(
"meshoptimizer",
"org.lwjgl.util.meshoptimizer",
"Contains bindings to ${url("https://github.com/zeux/meshoptimizer", "meshoptimizer")}, a library that provides algorithms to help optimize meshes.",
library = JNILibrary.create("LibMeshOptimizer"),
arrayOverloads = false
),
NANOVG(
"nanovg",
"org.lwjgl.nanovg",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public static void memFree(@Nullable Buffer ptr) {
}

/** {@code CustomBuffer} version of {@link #memFree}. */
public static void memFree(@Nullable CustomBuffer ptr) {
public static void memFree(@Nullable CustomBuffer<?> ptr) {
if (ptr != null) {
nmemFree(ptr.address);
}
Expand Down
21 changes: 21 additions & 0 deletions modules/lwjgl/meshoptimizer/meshoptimizer_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016-2019 Arseny Kapoulkine

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 5027f72

Please sign in to comment.