Official 3.0.0 release source code.

This commit is contained in:
HARFANG 3D (admin) 2021-10-13 14:40:31 +02:00
parent 65097de4f7
commit 41ae735ab8
2116 changed files with 422963 additions and 436 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/.vscode
**/__pycache__
**/imgui.ini
build
**/.vscode/**
/tools/fbx_converter/tests/config.h
/harfang/tests/data_compiled/**

38
.gitmodules vendored Normal file
View File

@ -0,0 +1,38 @@
[submodule "extern/openal-soft"]
path = extern/openal-soft
url = https://github.com/kcat/openal-soft.git
[submodule "extern/openvr"]
path = extern/openvr
url = https://github.com/ValveSoftware/openvr.git
branch = v1.3.22
[submodule "extern/googletest"]
path = extern/googletest
url = https://github.com/google/googletest.git
[submodule "extern/glfw"]
path = extern/glfw
url = https://github.com/glfw/glfw.git
branch = 3.3.2
[submodule "extern/bgfx/bgfx"]
path = extern/bgfx/bgfx
url = https://github.com/bkaradzic/bgfx
[submodule "extern/bgfx/bx"]
path = extern/bgfx/bx
url = https://github.com/bkaradzic/bx
[submodule "extern/bgfx/bimg"]
path = extern/bgfx/bimg
url = https://github.com/bkaradzic/bimg
[submodule "doc/tutorials"]
path = doc/tutorials
url = ../tutorials-hg2.git
[submodule "extern/cmft"]
path = extern/cmft
url = https://github.com/ejulien/cmft.git
[submodule "extern/recastnavigation"]
path = extern/recastnavigation
url = https://github.com/recastnavigation/recastnavigation.git
[submodule "extern/meshoptimizer"]
path = extern/meshoptimizer
url = https://github.com/zeux/meshoptimizer.git
[submodule "tools/assimp_converter/assimp"]
path = tools/assimp_converter/assimp
url = https://github.com/harfang3d/assimp

402
CMakeLists.txt Normal file
View File

@ -0,0 +1,402 @@
cmake_minimum_required(VERSION 3.16.2)
include(CMakePackageConfigHelpers)
project(harfang CXX C)
set(CMAKE_CXX_STANDARD 14)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
file(READ harfang/version.txt HG_VERSION)
string(STRIP ${HG_VERSION} HG_VERSION)
# Debug/tooling options
# -----------------------------------------------------------------------------
option(HG_ENABLE_TSA "Harfang: Enable TSA" OFF)
option(HG_ENABLE_TSAN "Harfang: Enable TSAN" OFF)
option(HG_ENABLE_ASAN "Harfang: Enable ASAN" OFF)
# Build options
# -----------------------------------------------------------------------------
option(HG_BUILD_ASSIMP_CONVERTER "Harfang: Build Assimp converter" ON)
option(HG_BUILD_FBX_CONVERTER "Harfang: Build FBX converter" ON)
option(HG_BUILD_GLTF_EXPORTER "Harfang: Build GLTF exporter" ON)
option(HG_BUILD_GLTF_IMPORTER "Harfang: Build GLTF importer" ON)
option(HG_BUILD_ASSETC "Harfang: Build AssetC" ON)
option(HG_BUILD_CPP_SDK "Harfang: Build C++ SDK" OFF)
option(HG_BUILD_TESTS "Harfang: Build Unit tests" OFF)
option(HG_BUILD_DOCS "Harfang: Build documentation" OFF)
option(HG_BUILD_HG_LUA "Harfang: Build Harfang Lua extension" OFF)
option(HG_BUILD_HG_PYTHON "Harfang: Build Harfang CPython 3.2+ extension" OFF)
option(HG_BUILD_HG_GO "Harfang: Build Harfang Go extension" OFF)
option(HG_EMBEDDED "Harfang: Build for embedded system" OFF)
option(HG_USE_GLFW "Harfang: Use GLFW backend" ON)
option(HG_USE_GLFW_WAYLAND "Harfang: Use GLFW Wayland backend" OFF)
option(HG_USE_EGL "Harfang: Use EGL for GL context management" OFF)
option(HG_ENABLE_BULLET3_SCENE_PHYSICS "Harfang: Scene physics using Bullet Dynamics" ON)
option(HG_ENABLE_RECAST_DETOUR_API "Harfang: Enable Recast/Detour API" ON)
option(HG_ENABLE_OPENVR_API "Harfang: Enable OpenVR API" OFF)
option(HG_ENABLE_SRANIPAL_API "Harfang: Enable VIVE Eye and Facial Tracking SDK (SRanipal) API" OFF)
set(HG_FABGEN_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../fabgen" CACHE PATH "Harfang: Path to FabGen script installation")
get_filename_component(HG_FABGEN_PATH ${HG_FABGEN_PATH} REALPATH)
# Configuration constraints
# -----------------------------------------------------------------------------
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
message(STATUS "! Forcing build type to RelWithDebInfo since CMAKE_BUILD_TYPE is not set")
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
endif()
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
message(STATUS "! Forcing embedded build since system processor is 'arm'")
set(HG_EMBEDDED ON FORCE)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
message(STATUS "! Disabling GLFW since building for Emscripten")
set(HG_USE_GLFW OFF FORCE)
endif()
if(HG_EMBEDDED)
message(STATUS "! Forcing EGL for GL context management since building for embedded")
set(HG_USE_EGL ON FORCE)
endif()
if(NOT HG_BUILD_HG_PYTHON)
message(STATUS "! Disabling Harfang CPython install since the module is not being build")
endif()
if(NOT HG_BUILD_HG_GO)
message(STATUS "! Disabling Harfang Go install since the module is not being build")
endif()
if(HG_ENABLE_SRANIPAL_API)
if (NOT HG_ENABLE_OPENVR_API)
message(STATUS "! Enabling OpenVR API")
set(HG_ENABLE_OPENVR_API ON FORCE)
endif()
endif()
# Configuration flags
# -----------------------------------------------------------------------------
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Building for 64-bit")
add_definitions(-DMARCH_WORD_SIZE=64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
message(STATUS "Building for 32-bit")
add_definitions(-DMARCH_WORD_SIZE=32)
endif()
if(HG_USE_GLFW_WAYLAND)
add_compile_definitions(HG_USE_GLFW_WAYLAND)
endif()
if(HG_USE_GLFW)
add_compile_definitions(HG_USE_GLFW)
endif()
if(HG_EMBEDDED)
add_compile_definitions(HG_EMBEDDED)
endif()
if(MSVC)
add_compile_options(/MP /fp:fast /permissive-) # use /GL for LTGC
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _ENABLE_EXTENDED_ALIGNED_STORAGE)
#add_compile_options(/Od /Zi /Zo)
add_link_options(/DEBUG)
#add_link_options(/LTCG)
elseif(ANDROID)
add_compile_definitions(ANDROID)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
message(STATUS "Emscripten sets")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --bind -fPIC -DEMSCRIPTEN -s USE_SDL=2 -s USE_WEBGL2=1 -s FULL_ES3=1 -s ALLOW_MEMORY_GROWTH=1 -s OFFSCREENCANVAS_SUPPORT=1 -s LLD_REPORT_UNDEFINED -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s FORCE_FILESYSTEM=1 -DBGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION=30")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --bind -fPIC -DEMSCRIPTEN -s USE_SDL=2 -s USE_WEBGL2=1 -s FULL_ES3=1 -s ALLOW_MEMORY_GROWTH=1 -s OFFSCREENCANVAS_SUPPORT=1 -s LLD_REPORT_UNDEFINED -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 -s FORCE_FILESYSTEM=1 -DBGFX_CONFIG_RENDERER_OPENGLES_MIN_VERSION=30")
# without pthread and with wasm
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -s WASM=1 -Oz -DNDEBUG -s DISABLE_EXCEPTION_CATCHING=0 -s FORCE_FILESYSTEM=1")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -s WASM=1 -Oz -DNDEBUG -s DISABLE_EXCEPTION_CATCHING=0 -s FORCE_FILESYSTEM=1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -s WASM=1 -O0 -DNDEBUG -g4 -s ASSERTIONS=2 -s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -s WASM=1 -O0 -DNDEBUG -g4 -s ASSERTIONS=2 -s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1")
else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT APPLE)
set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH $ORIGIN)
endif()
# gcc 7.4.0 + shaderc workaround ...
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "7.4.0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG" CACHE STRING "" FORCE)
endif()
endif()
endif()
if(HG_ENABLE_TSA)
message(STATUS "Building with thread safety analysis")
add_compile_options(-Wthread-safety)
endif()
if(HG_ENABLE_ASAN)
message(STATUS "Building with address-sanitizer support")
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-limit-debug-info)
add_link_options(-fsanitize=address)
endif()
if(HG_ENABLE_TSAN)
message(STATUS "Building with thread-sanitizer support")
add_compile_options(-fsanitize=thread -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-limit-debug-info)
add_link_options(-fsanitize=thread)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od /Ob0 /Zi")
set(CMAKE_RELWITHDEBINFO_POSTFIX "")
else()
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O0")
endif()
if(HG_ENABLE_OPENVR_API)
add_compile_definitions(HG_ENABLE_OPENVR_API)
endif()
if(HG_ENABLE_BULLET3_SCENE_PHYSICS)
add_compile_definitions(HG_ENABLE_BULLET3_SCENE_PHYSICS)
endif()
if(HG_ENABLE_SRANIPAL_API)
add_compile_definitions(HG_ENABLE_SRANIPAL_API)
endif()
if(HG_ENABLE_RECAST_DETOUR_API)
add_compile_definitions(HG_ENABLE_RECAST_DETOUR_API)
endif()
if(NOT HG_GRAPHIC_API)
if(MSVC)
set(HG_GRAPHIC_API "DX11")
elseif(HG_EMBEDDED)
set(HG_GRAPHIC_API "GLES")
else()
set(HG_GRAPHIC_API "GL")
endif()
endif(NOT HG_GRAPHIC_API)
add_compile_definitions(HG_GRAPHIC_API="${HG_GRAPHIC_API}")
# Dependencies
# -----------------------------------------------------------------------------
if(NOT Python3_FOUND)
if(HG_BUILD_HG_PYTHON)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
else()
find_package(Python3 COMPONENTS Interpreter REQUIRED)
endif()
endif()
if(HG_BUILD_DOCS)
find_package(Doxygen REQUIRED)
endif()
# Install helper
# -----------------------------------------------------------------------------
if(NOT HG_HOST_PREFIX)
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} HG_HOST_PREFIX)
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
string(APPEND HG_HOST_PREFIX "-x64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*")
string(APPEND HG_HOST_PREFIX "-x86")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
string(APPEND HG_HOST_PREFIX "-aarch64")
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
string(APPEND HG_HOST_PREFIX "-arm")
endif()
endif(NOT HG_HOST_PREFIX)
if(NOT HG_TARGET_PREFIX)
string(TOLOWER ${CMAKE_SYSTEM_NAME} HG_TARGET_PREFIX)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
string(APPEND HG_TARGET_PREFIX "-x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
string(APPEND HG_TARGET_PREFIX "-aarch64")
endif()
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
string(APPEND HG_TARGET_PREFIX "-x86")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
string(APPEND HG_TARGET_PREFIX "-arm")
endif()
endif()
endif(NOT HG_TARGET_PREFIX)
get_directory_property(_hasParent PARENT_DIRECTORY)
if(_hasParent) # after 3.21 use if(NOT PROJECT_IS_TOP_LEVEL)
set(HG_HOST_PREFIX ${HG_TARGET_PREFIX} PARENT_SCOPE)
set(HG_TARGET_PREFIX ${HG_TARGET_PREFIX} PARENT_SCOPE)
set(HG_GRAPHIC_API ${HG_GRAPHIC_API} PARENT_SCOPE)
endif()
unset(_hasParent)
set(CppSdkLibraryDestination cppsdk/lib/$<CONFIG>)
set(CppSdkRuntimeDestination cppsdk/bin/$<CONFIG>)
set(CppSdkHeadersDestination cppsdk/include)
function(install_cppsdk_target TARGET)
if(NOT HG_BUILD_CPP_SDK)
return()
endif()
get_target_property(TargetType ${TARGET} TYPE)
if ((TargetType STREQUAL "STATIC_LIBRARY") OR MSVC)
set(LibraryDestination ${CppSdkLibraryDestination})
else()
set(LibraryDestination ${CppSdkRuntimeDestination})
endif()
install(
TARGETS ${TARGET}
EXPORT cppsdkTargets
COMPONENT cppsdk
PUBLIC_HEADER DESTINATION ${CppSdkHeadersDestination}/${TARGET}
ARCHIVE DESTINATION ${CppSdkLibraryDestination}
LIBRARY DESTINATION ${LibraryDestination}
RUNTIME DESTINATION ${CppSdkRuntimeDestination}
INCLUDES DESTINATION ${CppSdkHeadersDestination}
)
endfunction(install_cppsdk_target)
# All targets
# -----------------------------------------------------------------------------
SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
if(HG_ENABLE_BULLET3_SCENE_PHYSICS)
list(APPEND HG_BINDING_DEFINES_LIST "HG_ENABLE_BULLET3_SCENE_PHYSICS")
endif()
if(HG_BINDING_DEFINES_LIST)
list(JOIN HG_BINDING_DEFINES_LIST "," HG_BINDING_DEFINES_LIST)
set(HG_BINDING_DEFINES "--defines" ${HG_BINDING_DEFINES_LIST})
endif()
if( HG_BUILD_CPP_SDK OR HG_BUILD_ASSIMP_CONVERTER OR HG_BUILD_FBX_CONVERTER OR HG_BUILD_GLTF_EXPORTER OR HG_BUILD_GLTF_IMPORTER OR HG_BUILD_ASSETC )
add_subdirectory(extern)
add_subdirectory(binding)
endif()
add_subdirectory(harfang)
if(NOT HG_BUILD_CPP_SDK)
set_target_properties(engine script foundation platform PROPERTIES EXCLUDE_FROM_ALL TRUE) # [EJ] EXCLUDE_FROM_ALL is set to enable minimal build for docs only configuration
endif()
add_subdirectory(tools)
add_subdirectory(languages)
if(HG_BUILD_DOCS)
add_subdirectory(doc)
endif()
# Setup/recap dump
# -----------------------------------------------------------------------------
message(STATUS "")
message(STATUS "Configuration report:")
message(STATUS "=====================")
message(STATUS "Harfang version: " ${HG_VERSION})
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
message(STATUS "System processor: " ${CMAKE_SYSTEM_PROCESSOR})
message(STATUS "Graphic API: " ${HG_GRAPHIC_API})
message(STATUS "Host prefix: " ${HG_HOST_PREFIX})
message(STATUS "Target prefix: " ${HG_TARGET_PREFIX})
message(STATUS "Enable TSA=" ${HG_ENABLE_TSA})
message(STATUS "Enable TSAN=" ${HG_ENABLE_TSAN})
message(STATUS "Enable ASAN=" ${HG_ENABLE_ASAN})
message(STATUS "Build Assimp converter=" ${HG_BUILD_ASSIMP_CONVERTER})
message(STATUS "Build FBX converter=" ${HG_BUILD_FBX_CONVERTER})
message(STATUS "Build GLTF exporter=" ${HG_BUILD_GLTF_EXPORTER})
message(STATUS "Build GLTF importer=" ${HG_BUILD_GLTF_IMPORTER})
message(STATUS "Build AssetC=" ${HG_BUILD_ASSETC})
message(STATUS "Build C++ SDK=" ${HG_BUILD_CPP_SDK})
message(STATUS "Build documentation=" ${HG_BUILD_DOCS})
message(STATUS "Build Lua extension=" ${HG_BUILD_HG_LUA})
message(STATUS "Build CPython module=" ${HG_BUILD_HG_PYTHON})
if(HG_BUILD_HG_PYTHON)
message(STATUS " Using CPython libraries: " ${Python3_LIBRARIES})
message(STATUS " Install CPython module to " ${Python3_EXECUTABLE})
endif()
message(STATUS "Build Go module=" ${HG_BUILD_HG_GO})
message(STATUS "Embedded system build=" ${HG_EMBEDDED})
message(STATUS "Binding defines=" ${HG_BINDING_DEFINES})
message(STATUS "Available APIs:")
message(STATUS " - Core")
if(HG_ENABLE_BULLET3_SCENE_PHYSICS)
message(STATUS " - Bullet Dynamics")
endif()
if(HG_ENABLE_OPENVR_API)
message(STATUS " - OpenVR")
endif()
if(HG_ENABLE_SRANIPAL_API)
message(STATUS " - Sranipal")
endif()
if(HG_ENABLE_RECAST_DETOUR_API)
message(STATUS " - RecastDetour")
endif()
message(STATUS "Use GLFW backend=" ${HG_USE_GLFW})
message(STATUS "Use GLFW Wayland backend=" ${HG_USE_GLFW_WAYLAND})
message(STATUS "EGL for GL context management=" ${HG_USE_EGL})
message(STATUS "Fabgen dir: " ${HG_FABGEN_PATH})
message(STATUS "Installation dir: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "")
# [WARNING] Don't forget to add any new shared library target to this list!
set(HG_SHARED_LIBRARY_TARGETS "hg::glfw;hg::libluadll")
if(HG_ENABLE_OPENVR_API)
list(APPEND HG_SHARED_LIBRARY_TARGETS OpenVR)
endif()
if(HG_BUILD_CPP_SDK)
write_basic_package_version_file( harfangConfigVersion.cmake VERSION ${HG_VERSION} COMPATIBILITY SameMajorVersion )
configure_package_config_file( harfang/cmake/harfangConfig.cmake.in harfangConfig.cmake INSTALL_DESTINATION cmake INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} )
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/harfangConfigVersion.cmake
${CMAKE_CURRENT_BINARY_DIR}/harfangConfig.cmake
DESTINATION cppsdk/cmake
)
install(
EXPORT cppsdkTargets
DESTINATION cppsdk/cmake
NAMESPACE hg::
COMPONENT cppsdk
)
endif()

3633
LICENSE

File diff suppressed because it is too large Load Diff

17
_clang-format Normal file
View File

@ -0,0 +1,17 @@
BreakBeforeBraces: Attach
ColumnLimit: 160
UseTab: Always
TabWidth: 4
IndentWidth: 4
IndentCaseLabels: true
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlwaysBreakTemplateDeclarations: false
AlignTrailingComments: false
AllowShortBlocksOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowAllParametersOfDeclarationOnNextLine: true
BinPackParameters: true
BinPackArguments: true
AlwaysBreakTemplateDeclarations: false

54
binding/CMakeLists.txt Normal file
View File

@ -0,0 +1,54 @@
add_custom_command(
OUTPUT
${CMAKE_BINARY_DIR}/binding/bind_Lua.cpp
${CMAKE_BINARY_DIR}/binding/bind_Lua.h
${CMAKE_BINARY_DIR}/binding/fabgen.h
COMMAND
${Python3_EXECUTABLE} bind.py ${CMAKE_CURRENT_SOURCE_DIR}/bind_harfang.py --lua --embedded --prefix hg_lua --out ${CMAKE_BINARY_DIR}/binding ${HG_BINDING_DEFINES}
MAIN_DEPENDENCY
${CMAKE_CURRENT_SOURCE_DIR}/bind_harfang.py
WORKING_DIRECTORY
${HG_FABGEN_PATH}
COMMENT
"Generating Harfang binding for embedded Lua: python=${Python3_EXECUTABLE} fabgen=${HG_FABGEN_PATH} srcdir=${CMAKE_CURRENT_SOURCE_DIR} dstdir=${CMAKE_BINARY_DIR}")
# [EJ] Use an object library so that this fairly expensive source is only built
# once. A static libray won't work here since bind_Lua.cpp really is a part of
# the engine library.
add_library(
bind_hg_lua
OBJECT
${CMAKE_BINARY_DIR}/binding/bind_Lua.cpp
${CMAKE_BINARY_DIR}/binding/bind_Lua.h
${CMAKE_BINARY_DIR}/binding/fabgen.h)
set_target_properties(bind_hg_lua PROPERTIES FOLDER "harfang")
target_link_libraries(bind_hg_lua jsonhpp libluadll imgui)
target_include_directories(bind_hg_lua
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/binding>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../harfang>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern/bgfx/bgfx/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern/bgfx/bimg/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern/bgfx/bx/include>
$<INSTALL_INTERFACE:${CppSdkHeadersDestination}>
)
if(HG_ENABLE_RECAST_DETOUR_API)
target_include_directories(bind_hg_lua
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern/recastnavigation/DetourCrowd/Include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../extern/recastnavigation/Detour/Include>
)
endif()
set_target_properties(bind_hg_lua PROPERTIES PUBLIC_HEADER "${CMAKE_BINARY_DIR}/binding/bind_Lua.h;${CMAKE_BINARY_DIR}/binding/fabgen.h")
if(HG_BUILD_CPP_SDK)
install(
TARGETS bind_hg_lua
EXPORT cppsdkTargets
PUBLIC_HEADER DESTINATION cppsdk/include
COMPONENT cppsdk
)
endif()

4341
binding/bind_harfang.py Normal file

File diff suppressed because it is too large Load Diff

5
binding/fabgen.h Normal file
View File

@ -0,0 +1,5 @@
// FABgen .h
#pragma once
enum OwnershipPolicy { NonOwning, Copy, Owning };

10
contributors.md Normal file
View File

@ -0,0 +1,10 @@
# HARFANG Contributors
(sorted alphabetically by surname)
* Vincent Cruz
* Camille Dudognon
* François Gutherz
* Emmanuel Julien
* Eric Kernin
* Thomas "Scorpheus" Simonnet

33
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,33 @@
# Generates the Harfang API XML description used to generate the documentation.
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/harfang/api.xml
COMMAND
${Python3_EXECUTABLE} bind.py ${CMAKE_CURRENT_SOURCE_DIR}/../binding/bind_harfang.py --xml --out ${CMAKE_CURRENT_BINARY_DIR}/harfang ${HG_BINDING_DEFINES}
MAIN_DEPENDENCY
${CMAKE_SOURCE_DIR}/binding/bind_harfang.py
WORKING_DIRECTORY
${HG_FABGEN_PATH}
COMMENT
"Generating Harfang API description file")
# online docs
add_custom_target(online_docs ALL
${Python3_EXECUTABLE} doc_to_html.py --project_name Harfang --doc_path doc --api_path ${CMAKE_CURRENT_BINARY_DIR}/harfang/api.xml --out_path ${CMAKE_INSTALL_PREFIX}/online_docs --version ${HG_VERSION} --online
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/harfang/api.xml)
install(DIRECTORY img DESTINATION online_docs COMPONENT online_docs)
set_target_properties(online_docs PROPERTIES FOLDER "harfang/doc")
# offline docs
configure_file(doc/index.html.in ${CMAKE_INSTALL_PREFIX}/offline_docs/index.html @ONLY IMMEDIATE)
add_custom_target(offline_docs ALL
${Python3_EXECUTABLE} doc_to_html.py --project_name Harfang --doc_path doc --api_path ${CMAKE_CURRENT_BINARY_DIR}/harfang/api.xml --out_path ${CMAKE_INSTALL_PREFIX}/offline_docs --version ${HG_VERSION}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/harfang/api.xml)
install(DIRECTORY img DESTINATION offline_docs/content COMPONENT offline_docs)
set_target_properties(offline_docs PROPERTIES FOLDER "harfang/doc")

1
doc/doc/ARGB32.md Normal file
View File

@ -0,0 +1 @@
Create a 32 bit integer ARGB color.

View File

@ -0,0 +1 @@
Convert a 32 bit integer ARGB color to RGBA.

1
doc/doc/Abs.md Normal file
View File

@ -0,0 +1 @@
Return the absolute value of the function input. For vectors, the absolute value is applied to each component individually and the resulting vector is returned.

View File

@ -0,0 +1,3 @@
Mount a local filesystem folder as an assets source.
See [man.Assets].

View File

@ -0,0 +1,3 @@
Mount an archive stored on the local filesystem as an assets source.
See [man.Assets].

1
doc/doc/AlphaScale.md Normal file
View File

@ -0,0 +1 @@
Scale the alpha component of the input color.

3
doc/doc/ApplyBloom.md Normal file
View File

@ -0,0 +1,3 @@
Process `input` texture and generate a bloom overlay on top of `output`, input and output must be of the same size.
Use [CreateBloomFromFile]/[CreateBloomFromAssets] to create a [Bloom] object and [DestroyBloom] to destroy its internal resources after usage.

3
doc/doc/ApplySAO.md Normal file
View File

@ -0,0 +1,3 @@
Process `input` depth texture and generate an ambient occlusion overlay in `output`, input and output must be of the same size.
Use [CreateSAO] to create a [SAO] object and [DestroySAO] to destroy its internal resources after usage.

1
doc/doc/AudioInit.md Normal file
View File

@ -0,0 +1 @@
Initialize the audio system.

1
doc/doc/AudioShutdown.md Normal file
View File

@ -0,0 +1 @@
Shutdown the audio system.

0
doc/doc/Axis.md Normal file
View File

1
doc/doc/BaseToEuler.md Normal file
View File

@ -0,0 +1 @@
Compute the Euler angles triplet for the provided `z` direction. The up-vector `y` can be provided to improve coherency of the returned values over time.

1
doc/doc/BlendMode.md Normal file
View File

@ -0,0 +1 @@
Control the compositing mode used to draw primitives.

3
doc/doc/Bloom.md Normal file
View File

@ -0,0 +1,3 @@
Bloom post-process object holding internal states and resources.
Create with [CreateBloomFromAssets] or [CreateBloomFromFile], use with [ApplyBloom], finally call [DestroyBloom] to dispose of resources when done.

3
doc/doc/Camera.md Normal file
View File

@ -0,0 +1,3 @@
Add this component to a [Node] to implement the camera aspect.
Create a camera component with [Scene_CreateCamera], use [CreateCamera] to create a complete camera node.

1
doc/doc/Camera_GetFov.md Normal file
View File

@ -0,0 +1 @@
Return the camera field of view.

View File

@ -0,0 +1 @@
Return `true` if orthographic projection is used, `false` if perspective projection.

View File

@ -0,0 +1 @@
Return the camera far clipping plane.

View File

@ -0,0 +1 @@
Return the camera near clipping plane.

1
doc/doc/Camera_SetFov.md Normal file
View File

@ -0,0 +1 @@
Set the camera field of view.

View File

@ -0,0 +1 @@
Configure the camera to use orthographic or perspective projection.

View File

@ -0,0 +1 @@
Set the camera far clipping plane.

View File

@ -0,0 +1 @@
Set the camera near clipping plane.

1
doc/doc/Canvas.md Normal file
View File

@ -0,0 +1 @@
Holds the canvas properties of a scene, see the `canvas` member of class [Scene].

View File

@ -0,0 +1,5 @@
Capture a texture content to a [Picture]. Return the frame counter at which the capture will be complete.
A [Picture] object can be accessed by the CPU.
This function is asynchronous and its result will not be available until the returned frame counter is equal or greater to the frame counter returned by [Frame].

View File

@ -0,0 +1 @@
Cast a [Pipeline] object to [ForwardPipeline].

1
doc/doc/Ceil.md Normal file
View File

@ -0,0 +1 @@
Returns a vector whose elements are equal to the nearest integer greater than or equal to the vector elements.

1
doc/doc/ChromaScale.md Normal file
View File

@ -0,0 +1 @@
Return a copy of the color with its saturation scaled as specified.

1
doc/doc/Clamp.md Normal file
View File

@ -0,0 +1 @@
Return a vector whose elements are equal to the vector elements clipped to the specified interval.

1
doc/doc/ClampLen.md Normal file
View File

@ -0,0 +1 @@
Returns a vector in the same direction as the specified vector, but with its length clipped by the specified interval.

1
doc/doc/ClassifyLine.md Normal file
View File

@ -0,0 +1 @@
Return `true` if the provided line intersect the bounding volume, `false` otherwise.

View File

@ -0,0 +1 @@
Return `true` if the provided segment intersect the bounding volume, `false` otherwise.

5
doc/doc/CleanPath.md Normal file
View File

@ -0,0 +1,5 @@
Cleanup a local filesystem path according to the host platform conventions.
- Remove redundant folder separators.
- Remove redundant `.` and `..` folder entries.
- Ensure forward slash (`/`) folder separators on Unix and back slash (`\`) folder separators on Windows.

View File

@ -0,0 +1 @@
Convert a 3d position in clip space (homogeneous space) to a 2d position on screen.

1
doc/doc/Close.md Normal file
View File

@ -0,0 +1 @@
Close a file handle.

3
doc/doc/Cm.md Normal file
View File

@ -0,0 +1,3 @@
Convert a value in centimeters to the Harfang internal unit system.
See [man.UnitSystem].

1
doc/doc/Collision.md Normal file
View File

@ -0,0 +1 @@
Collision component, see [man.Physics].

View File

@ -0,0 +1 @@
Return the collision shape mass in Kg.

View File

@ -0,0 +1 @@
Return the [CollisionType] of a [Collision] component.

View File

@ -0,0 +1 @@
Set the collision shape mass in Kg.

View File

@ -0,0 +1 @@
Set the [CollisionType] of a [Collision] component.

1
doc/doc/Color.md Normal file
View File

@ -0,0 +1 @@
Four-component RGBA color object.

View File

@ -0,0 +1 @@
Create a color from a 32 bit ABGR integer.

View File

@ -0,0 +1 @@
Create a color from a 32 bit RGBA integer.

1
doc/doc/ColorFromVec4.md Normal file
View File

@ -0,0 +1 @@
Create a color from a 4d vector.

View File

@ -0,0 +1 @@
Create a color from a 3d vector, alpha defaults to 1.

View File

@ -0,0 +1 @@
Return a 4-dimensional vector as a color.

1
doc/doc/ColorI.md Normal file
View File

@ -0,0 +1 @@
Create a color from integer values in the [0;255] range.

1
doc/doc/ColorToABGR32.md Normal file
View File

@ -0,0 +1 @@
Return a 32 bit ABGR integer from a color.

View File

@ -0,0 +1 @@
Return the grayscale representation of a color. A weighted average is used to account for human perception of colors.

1
doc/doc/ColorToRGBA32.md Normal file
View File

@ -0,0 +1 @@
Return a 32 bit RGBA integer from a color.

View File

@ -0,0 +1 @@
Construct a new color object. The red, green, blue and alpha components are in normalized range [0;1].

View File

@ -0,0 +1 @@
Returns a projection matrix from a 2D space to the 3D world, as required by [SetViewTransform] for example.

View File

@ -0,0 +1,3 @@
Compute the aspect ratio factor for the provided viewport dimensions. Use this method to compute aspect ratio for landscape display.
See [ComputeAspectRatioY].

View File

@ -0,0 +1,3 @@
Compute the aspect ratio factor for the provided viewport dimensions. Use this method to compute aspect ratio for portrait display.
See [ComputeAspectRatioX].

View File

@ -0,0 +1 @@
Compute the bounding sphere for the provided axis-aligned bounding box.

View File

@ -0,0 +1,7 @@
Compute an orthographic projection matrix.
An orthographic projection has no perspective and all lines parrallel in 3d space will still appear parrallel on screen after projection using the returned matrix.
The `size` parameter controls the extends of the projected view. When projecting a 3d world this parameter is expressed in meters. Use the `aspect_ratio` parameter to prevent distortion from induced by non-square viewport.
See [ComputeAspectRatioX] or [ComputeAspectRatioY] to compute an aspect ratio factor in paysage or portrait mode.

View File

@ -0,0 +1,5 @@
Compute an orthographic view state.
The `size` parameter controls the extends of the projected view. When projecting a 3d world this parameter is expressed in meters. Use the `aspect_ratio` parameter to prevent distortion from induced by non-square viewport.
See [ComputeOrthographicProjectionMatrix], [ComputeAspectRatioX] and [ComputeAspectRatioY].

View File

@ -0,0 +1,3 @@
Compute a perspective projection matrix, , `fov` is the field of view angle, see [Deg] and [Rad].
See [ZoomFactorToFov], [FovToZoomFactor], [ComputeAspectRatioX] and [ComputeAspectRatioY].

View File

@ -0,0 +1,3 @@
Compute a perspective view state.
See [ComputePerspectiveProjectionMatrix], [ZoomFactorToFov], [FovToZoomFactor], [ComputeAspectRatioX] and [ComputeAspectRatioY].

View File

@ -0,0 +1,3 @@
Compute a render state to control subsequent render calls culling mode, blending mode, Z mask, etc... The same render state can be used by different render calls.
See [DrawLines], [DrawTriangles] and [DrawModel].

View File

@ -0,0 +1 @@
Compute a sorting key to control the rendering order of a display list, `view_depth` is expected in view space.

View File

@ -0,0 +1 @@
Compute a sorting key to control the rendering order of a display list.

View File

@ -0,0 +1 @@
Compute the height of a text string.

View File

@ -0,0 +1 @@
Compute the width and height of a text string.

View File

@ -0,0 +1 @@
Create a parameter structure for a crowd agent to be used with a [Crowd] object.

1
doc/doc/Contact.md Normal file
View File

@ -0,0 +1 @@
Object containing the world space position, normal and depth of a contact as reported by the collision system.

1
doc/doc/Contains.md Normal file
View File

@ -0,0 +1 @@
Return `true` if the provided position is inside the bounding volume, `false` otherwise.

3
doc/doc/CopyDir.md Normal file
View File

@ -0,0 +1,3 @@
Copy a directory on the local filesystem, this function does not recurse through subdirectories.
See [CopyDirRecursive].

View File

@ -0,0 +1 @@
Copy a directory on the local filesystem, recurse through subdirectories.

1
doc/doc/CopyFile.md Normal file
View File

@ -0,0 +1 @@
Copy a file on the local filesystem.

View File

@ -0,0 +1,3 @@
Compute the cosine interpolated value between `y0` and `y1` at `t`.
See [LinearInterpolate], [CubicInterpolate] and [HermiteInterpolate].

3
doc/doc/CreateBloom.md Normal file
View File

@ -0,0 +1,3 @@
Create a bloom postprocess and its resources.
See [ApplyBloom] and [DestroyBloom].

1
doc/doc/CreateCamera.md Normal file
View File

@ -0,0 +1 @@
Create a new [Node] with a [Transform] and [Camera] components.

View File

@ -0,0 +1,3 @@
Create a capsule render model.
See [CreateCubeModel], [CreateConeModel], [CreateCylinderModel], [CreatePlaneModel], [CreateSphereModel] and [DrawModel].

View File

@ -0,0 +1,3 @@
Create a cone render model.
See [CreateCubeModel], [CreateConeModel], [CreateCylinderModel], [CreatePlaneModel], [CreateSphereModel] and [DrawModel].

View File

@ -0,0 +1,3 @@
Create a cube render model.
See [CreateCubeModel], [CreateConeModel], [CreateCylinderModel], [CreatePlaneModel], [CreateSphereModel] and [DrawModel].

View File

@ -0,0 +1,3 @@
Create a cylinder render model.
See [CreateCubeModel], [CreateConeModel], [CreateCylinderModel], [CreatePlaneModel], [CreateSphereModel] and [DrawModel].

View File

@ -0,0 +1,3 @@
Create a forward pipeline and its resources.
See [DestroyForwardPipeline].

View File

@ -0,0 +1,3 @@
Create a framebuffer and its texture attachments.
See [DestroyFrameBuffer].

View File

@ -0,0 +1,5 @@
Helper function to create a [Node] with a [Transform] and an [Instance] component.
The instance component will be setup and its resources loaded from the assets system.
See [man.Assets].

View File

@ -0,0 +1,5 @@
Helper function to create a [Node] with a [Transform] and an [Instance] component.
The instance component will be setup and its resources loaded from the local filesystem.
See [man.Assets].

View File

@ -0,0 +1 @@
Helper function to create a [Node] with a [Transform] and a [Light] component.

View File

@ -0,0 +1 @@
Create a new [Node] with a [LuaScript] component.

View File

@ -0,0 +1,3 @@
Helper function to create a material.
See [SetMaterialProgram], [SetMaterialValue] and [SetMaterialTexture].

View File

@ -0,0 +1,5 @@
This function scans the material program uniforms and creates a corresponding entry in the material if missing.
Resources are loaded from the asset system if a default uniform value requires it.
See [man.Assets].

View File

@ -0,0 +1,3 @@
This function scans the material program uniforms and creates a corresponding entry in the material if missing.
Resources are loaded from the local filesystem if a default uniform value requires it.

View File

@ -0,0 +1,3 @@
Create a navigation mesh query from a navigation mesh.
See [FindNavigationPathTo] to perform an actual query.

1
doc/doc/CreateObject.md Normal file
View File

@ -0,0 +1 @@
Create a [Node] with a [Transform] and [Object] components.

View File

@ -0,0 +1 @@
Create a [Node] with a [Transform] and a [Camera] component.

Some files were not shown because too many files have changed in this diff Show More