Skip to content

Commit

Permalink
Updated libmorton version to v0.2.2, update namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Forceflow committed Mar 4, 2020
1 parent 162044c commit 9f7b6c6
Show file tree
Hide file tree
Showing 13 changed files with 926 additions and 989 deletions.
4 changes: 2 additions & 2 deletions msvc/vs2019/svo_builder_custom_includes.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<BINARY_OUTPUT_DIR>D:\jeroenb\Binaries\</BINARY_OUTPUT_DIR>
<GLM_DIR>C:\libs\glm\</GLM_DIR>
<BINARY_OUTPUT_DIR>D:\dev\Binaries\</BINARY_OUTPUT_DIR>
<GLM_DIR>D:\dev\libs\glm\</GLM_DIR>
</PropertyGroup>
<PropertyGroup>
<IncludePath>$(GLM_DIR);$(SolutionDir)\..\..\src\libs\libtri\include\;$(IncludePath)</IncludePath>
Expand Down
6 changes: 3 additions & 3 deletions msvc/vs2019/tri_convert_custom_includes.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<BINARY_OUTPUT_DIR>D:\jeroenb\Binaries\</BINARY_OUTPUT_DIR>
<TRIMESH_DIR>C:\libs\trimesh2\</TRIMESH_DIR>
<GLM_DIR>C:\libs\glm\</GLM_DIR>
<BINARY_OUTPUT_DIR>D:\dev\Binaries\</BINARY_OUTPUT_DIR>
<TRIMESH_DIR>D:\dev\libs\trimesh2\</TRIMESH_DIR>
<GLM_DIR>D:\dev\libs\glm\</GLM_DIR>
</PropertyGroup>
<PropertyGroup>
<IncludePath>$(GLM_DIR);$(TRIMESH_DIR)\include\;$(SolutionDir)\..\..\src\libs\libtri\include\;$(IncludePath)</IncludePath>
Expand Down
110 changes: 57 additions & 53 deletions src/libs/libmorton/include/morton.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,69 @@

#include "morton2D.h"
#include "morton3D.h"
#if defined(__BMI2__) || __AVX2__
#include "morton_BMI.h"
#endif

// Functions under this are stubs which will always point to fastest implementation at the moment
//-----------------------------------------------------------------------------------------------
namespace libmorton {
// Functions under this are stubs which will always point to fastest implementation at the moment
//-----------------------------------------------------------------------------------------------

// ENCODING
// ENCODING
#if defined(__BMI2__) || __AVX2__
inline uint_fast32_t morton2D_32_encode(const uint_fast16_t x, const uint_fast16_t y) {
return m2D_e_BMI<uint_fast32_t, uint_fast16_t>(x, y);
}
inline uint_fast64_t morton2D_64_encode(const uint_fast32_t x, const uint_fast32_t y) {
return m2D_e_BMI<uint_fast64_t, uint_fast32_t>(x, y);
}
inline uint_fast32_t morton3D_32_encode(const uint_fast16_t x, const uint_fast16_t y, const uint_fast16_t z) {
return m3D_e_BMI<uint_fast32_t, uint_fast16_t>(x, y, z);
}
inline uint_fast64_t morton3D_64_encode(const uint_fast32_t x, const uint_fast32_t y, const uint_fast32_t z) {
return m3D_e_BMI<uint_fast64_t, uint_fast32_t>(x, y, z);
}
inline uint_fast32_t morton2D_32_encode(const uint_fast16_t x, const uint_fast16_t y) {
return m2D_e_BMI<uint_fast32_t, uint_fast16_t>(x, y);
}
inline uint_fast64_t morton2D_64_encode(const uint_fast32_t x, const uint_fast32_t y) {
return m2D_e_BMI<uint_fast64_t, uint_fast32_t>(x, y);
}
inline uint_fast32_t morton3D_32_encode(const uint_fast16_t x, const uint_fast16_t y, const uint_fast16_t z) {
return m3D_e_BMI<uint_fast32_t, uint_fast16_t>(x, y, z);
}
inline uint_fast64_t morton3D_64_encode(const uint_fast32_t x, const uint_fast32_t y, const uint_fast32_t z) {
return m3D_e_BMI<uint_fast64_t, uint_fast32_t>(x, y, z);
}
#else
inline uint_fast32_t morton2D_32_encode(const uint_fast16_t x, const uint_fast16_t y) {
return m2D_e_sLUT<uint_fast32_t, uint_fast16_t>(x, y);
}
inline uint_fast64_t morton2D_64_encode(const uint_fast32_t x, const uint_fast32_t y) {
return m2D_e_sLUT<uint_fast64_t, uint_fast32_t>(x, y);
}
inline uint_fast32_t morton3D_32_encode(const uint_fast16_t x, const uint_fast16_t y, const uint_fast16_t z) {
return m3D_e_sLUT<uint_fast32_t, uint_fast16_t>(x, y, z);
}
inline uint_fast64_t morton3D_64_encode(const uint_fast32_t x, const uint_fast32_t y, const uint_fast32_t z) {
return m3D_e_sLUT<uint_fast64_t, uint_fast32_t>(x, y, z);
}
inline uint_fast32_t morton2D_32_encode(const uint_fast16_t x, const uint_fast16_t y) {
return m2D_e_sLUT<uint_fast32_t, uint_fast16_t>(x, y);
}
inline uint_fast64_t morton2D_64_encode(const uint_fast32_t x, const uint_fast32_t y) {
return m2D_e_sLUT<uint_fast64_t, uint_fast32_t>(x, y);
}
inline uint_fast32_t morton3D_32_encode(const uint_fast16_t x, const uint_fast16_t y, const uint_fast16_t z) {
return m3D_e_sLUT<uint_fast32_t, uint_fast16_t>(x, y, z);
}
inline uint_fast64_t morton3D_64_encode(const uint_fast32_t x, const uint_fast32_t y, const uint_fast32_t z) {
return m3D_e_sLUT<uint_fast64_t, uint_fast32_t>(x, y, z);
}
#endif

// DECODING
// DECODING
#if defined(__BMI2__) || __AVX2__
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) {
m2D_d_BMI<uint_fast32_t, uint_fast16_t>(morton, x, y);
}
inline void morton2D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y) {
m2D_d_BMI<uint_fast64_t, uint_fast32_t>(morton, x, y);
}
inline void morton3D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y, uint_fast16_t& z) {
m3D_d_BMI<uint_fast32_t, uint_fast16_t>(morton, x, y, z);
}
inline void morton3D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y, uint_fast32_t& z) {
m3D_d_BMI<uint_fast64_t, uint_fast32_t>(morton, x, y, z);
}
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) {
m2D_d_BMI<uint_fast32_t, uint_fast16_t>(morton, x, y);
}
inline void morton2D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y) {
m2D_d_BMI<uint_fast64_t, uint_fast32_t>(morton, x, y);
}
inline void morton3D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y, uint_fast16_t& z) {
m3D_d_BMI<uint_fast32_t, uint_fast16_t>(morton, x, y, z);
}
inline void morton3D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y, uint_fast32_t& z) {
m3D_d_BMI<uint_fast64_t, uint_fast32_t>(morton, x, y, z);
}
#else
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) {
m2D_d_sLUT<uint_fast32_t, uint_fast16_t>(morton, x, y);
}
inline void morton2D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y) {
m2D_d_sLUT<uint_fast64_t, uint_fast32_t>(morton, x, y);
}
inline void morton3D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y, uint_fast16_t& z) {
m3D_d_sLUT<uint_fast32_t, uint_fast16_t>(morton, x, y, z);
}
inline void morton3D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y, uint_fast32_t& z) {
m3D_d_sLUT<uint_fast64_t, uint_fast32_t>(morton, x, y, z);
}
#endif
inline void morton2D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y) {
m2D_d_sLUT<uint_fast32_t, uint_fast16_t>(morton, x, y);
}
inline void morton2D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y) {
m2D_d_sLUT<uint_fast64_t, uint_fast32_t>(morton, x, y);
}
inline void morton3D_32_decode(const uint_fast32_t morton, uint_fast16_t& x, uint_fast16_t& y, uint_fast16_t& z) {
m3D_d_sLUT<uint_fast32_t, uint_fast16_t>(morton, x, y, z);
}
inline void morton3D_64_decode(const uint_fast64_t morton, uint_fast32_t& x, uint_fast32_t& y, uint_fast32_t& z) {
m3D_d_sLUT<uint_fast64_t, uint_fast32_t>(morton, x, y, z);
}
#endif
}
Loading

0 comments on commit 9f7b6c6

Please sign in to comment.