Skip to content

Commit

Permalink
updates for release 0.7.0 (#146)
Browse files Browse the repository at this point in the history
* correctly handle the error case where ANARI_LIBRARY is queried but empty

* simplify direct linking tutorial, add 'environment' library tutorial

* general CMake cleanups

* remove reliance on match3D + CPM for fetching dependencies

* MSVC build fixes

* python API updates for latest spec changes

* Update jsons to spec state

* Fix some generator issues and updated with new jsons

* implement background images in helide

* bump version number

* update readme

* tutorial cleanups

* update render tests for more robustness and less console output

* Fix header file generation for queries

---------

Co-authored-by: Jakob Progsch <jprogsch@nvidia.com>
  • Loading branch information
jeffamstutz and progschj committed Aug 12, 2023
1 parent e40c3d9 commit 8a67d54
Show file tree
Hide file tree
Showing 89 changed files with 33,260 additions and 11,313 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ docs/out/*
out
CMakeSettings.json
.match3D
.anari_deps

# cts
cts/anari_library_debug*
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

## Establish project

project(anari VERSION 0.4.0 LANGUAGES C CXX)
project(anari VERSION 0.7.0 LANGUAGES C CXX)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
Expand Down Expand Up @@ -65,6 +65,7 @@ add_custom_target(generate_all)
include(cmake/anari_generate_frontend.cmake)
include(cmake/anari_generate_codegen.cmake)
include(cmake/cmake_project_commands.cmake)
include(cmake/anari_sdk_fetch_project.cmake)

## Add library and executable targets

Expand Down Expand Up @@ -128,4 +129,5 @@ install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/cmake
${ANARI_CMAKE_INSTALL_DESTINATION}
FILES_MATCHING
PATTERN *.cmake
PATTERN Findanari.cmake EXCLUDE
)
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ This repository contains the source for the ANARI API SDK. This includes:
- [Unit tests](tests/unit)
- [Render tests](tests/render)

The 1.0 provisional ANARI specification can be found on the Khronos website
The 1.0 ANARI specification can be found on the Khronos website
[here](https://www.khronos.org/registry/ANARI/).

Please note that the example device, sample applications, and tests do not yet
fully cover the entire specification and are still a work-in-progress. These
are expected to be completed in full on or before the official 1.0 ANARI
specification release.

The SDK is tested on Linux, but is also intended to be usable on other operating
systems such as macOS and Windows.

Expand All @@ -45,8 +40,10 @@ Using a tool like `ccmake` or `cmake-gui` will let you see which options are
available to enable. The following CMake options are offered:

- `BUILD_SHARED_LIBS` : build everything as shared libraries or static libraries
- `BUILD_CTS` : build the conformance test suite
- `BUILD_TESTING` : build unit and regression test binaries
- `BUILD_HELIDE_DEVICE` : build the provided example `helide` device implementation
- `BUILD_REMOTE_DEVICE` : build the provided experimental `remote` device implementation
- `BUILD_EXAMPLES` : build example applications
- `BUILD_VIEWER` : build viewer too (needs glfw3) if building examples

Expand All @@ -63,8 +60,6 @@ The ANARI SDK exports CMake targets for the main front-end library and utilities
helper library. The targets which are exported are as follows:

- `anari::anari` : main library target to link with `libanari`
- `anari::anari_utilities` : (DEPRECATED) library target which adds implementation helpers
- `anari::anari_library_debug` : library target for the debug device
- `anari::helium` : (static) library target containing base device implementation abstractions

These targets can be found with CMake via `find_package(anari)`. The examples
Expand Down
12 changes: 6 additions & 6 deletions cmake/Findanari.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ set_target_properties(anari::anari PROPERTIES
"anari"
)

add_library(anari::anari_utilities INTERFACE IMPORTED)
set_target_properties(anari::anari_utilities PROPERTIES
add_library(anari::anari_test_scenes INTERFACE IMPORTED)
set_target_properties(anari::anari_test_scenes PROPERTIES
INTERFACE_LINK_LIBRARIES
"anari_utilities"
"anari_test_scenes"
)

add_library(anari::anari_library_debug INTERFACE IMPORTED)
set_target_properties(anari::anari_library_debug PROPERTIES
add_library(anari::helium INTERFACE IMPORTED)
set_target_properties(anari::helium PROPERTIES
INTERFACE_LINK_LIBRARIES
"anari_library_debug"
"helium"
)
15 changes: 9 additions & 6 deletions cmake/anariConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_dependency(Threads)

include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake")
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Exports.cmake)

check_required_components("@PROJECT_NAME@")
check_required_components(@PROJECT_NAME@)

if (NOT TARGET anari::anari)
message(FATAL_ERROR "CMAKE_PREFIX_PATH or anari_DIR are pointing to an \
Expand All @@ -31,10 +31,13 @@ if (@INSTALL_CODE_GEN_SCRIPTS@)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/anari_generate_codegen.cmake)
endif()

if (TARGET anari::anari_viewer AND NOT ANARI_FOUND)
set(match3D_DIR ${ANARI_DATAROOTDIR}/anari_viewer/match3D_src/cmake)
find_package(match3D REQUIRED stb_image nativefiledialog imnodes)
target_link_libraries(anari::anari_viewer INTERFACE match3D::match3D)
if (@INSTALL_VIEWER_LIBRARY@)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/anari_sdk_fetch_project.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake/cmake_project_commands.cmake)
add_subdirectory(
${ANARI_DATAROOTDIR}/anari_viewer
${CMAKE_CURRENT_BINARY_DIR}/anari_viewer
)
endif()

set(ANARI_FOUND TRUE)
35 changes: 35 additions & 0 deletions cmake/anari_sdk_fetch_project.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Copyright 2023 The Khronos Group
## SPDX-License-Identifier: Apache-2.0

include(FetchContent)

function(anari_sdk_fetch_project)
cmake_parse_arguments(FETCH_SOURCE
"ADD_SUBDIR" # options
"NAME;URL;MD5" # single-arg options
"" # multi-arg options
${ARGN}
)

if (FETCH_SOURCE_MD5)
set(FETCH_SOURCE_MD5_COMMAND URL_MD5 ${FETCH_SOURCE_MD5})
endif()

set(SOURCE ${CMAKE_BINARY_DIR}/deps/source/${FETCH_SOURCE_NAME})

FetchContent_Populate(${FETCH_SOURCE_NAME}
URL ${FETCH_SOURCE_URL}
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/.anari_deps/${FETCH_SOURCE_NAME}
${FETCH_SOURCE_MD5_COMMAND}
SOURCE_DIR ${SOURCE}
)

set("${FETCH_SOURCE_NAME}_LOCATION" ${SOURCE} PARENT_SCOPE)

if (FETCH_SOURCE_ADD_SUBDIR)
add_subdirectory(
${SOURCE}
${CMAKE_BINARY_DIR}/deps/build/${FETCH_SOURCE_NAME}
)
endif()
endfunction()
2 changes: 1 addition & 1 deletion code_gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.12")

find_package(Python3 REQUIRED COMPONENTS Interpreter)

set(API_JSON api/anari_core_1_0.json api/khr_frame_continuation.json)
set(API_JSON api/anari_core_1_0.json api/khr_frame_completion_callback.json)

add_custom_target(generate_type_utility
COMMAND ${Python3_EXECUTABLE} generate_headers.py ${CMAKE_SOURCE_DIR}/libs/anari/include/anari/frontend/type_utility.h ${API_JSON}
Expand Down
8 changes: 8 additions & 0 deletions code_gen/api/anari_core_objects_base_1_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@
"name" : "duration",
"type" : "ANARI_FLOAT32",
"tags" : ["required"]
}, {
"name" : "renderProgress",
"type" : "ANARI_FLOAT32",
"tags" : []
}, {
"name" : "refinementProgress",
"type" : "ANARI_FLOAT32",
"tags" : []
}
],
"channel" : [
Expand Down
48 changes: 48 additions & 0 deletions code_gen/api/khr_area_lights.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,54 @@
"description" : "visibility of the light geometry"
}
]
}, {
"type" : "ANARI_LIGHT",
"name" : "hdri",
"parameters" : [
{
"name" : "visible",
"types" : ["ANARI_BOOL"],
"tags" : [],
"default" : 1,
"description" : "visibility of the light geometry"
}
]
}, {
"type" : "ANARI_LIGHT",
"name" : "ring",
"parameters" : [
{
"name" : "visible",
"types" : ["ANARI_BOOL"],
"tags" : [],
"default" : 1,
"description" : "visibility of the light geometry"
}
]
}, {
"type" : "ANARI_LIGHT",
"name" : "quad",
"parameters" : [
{
"name" : "visible",
"types" : ["ANARI_BOOL"],
"tags" : [],
"default" : 1,
"description" : "visibility of the light geometry"
}
]
}, {
"type" : "ANARI_LIGHT",
"name" : "spot",
"parameters" : [
{
"name" : "visible",
"types" : ["ANARI_BOOL"],
"tags" : [],
"default" : 1,
"description" : "visibility of the light geometry"
}
]
}
]
}
29 changes: 29 additions & 0 deletions code_gen/api/khr_camera_depth_of_field.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"info" : {
"name" : "KHR_CAMERA_DEPTH_OF_FIELD",
"type" : "extension",
"dependencies" : []
},

"objects" : [
{
"type" : "ANARI_CAMERA",
"name" : "default",
"parameters" : [
{
"name" : "apertureRadius",
"types" : ["ANARI_FLOAT32"],
"tags" : [],
"default" : 0,
"description" : "aperture radius"
}, {
"name" : "focusDistance",
"types" : ["ANARI_FLOAT32"],
"tags" : [],
"default" : 1,
"description" : "focus distance"
}
]
}
]
}
47 changes: 47 additions & 0 deletions code_gen/api/khr_camera_motion_transformation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"info" : {
"name" : "KHR_CAMERA_MOTION_TRANSFORMATION",
"type" : "extension",
"dependencies" : []
},

"objects" : [
{
"type" : "ANARI_CAMERA",
"name" : "default",
"parameters" : [
{
"name" : "motion.transform",
"types" : ["ANARI_ARRAY1D"],
"elementType" : ["ANARI_FLOAT32_MAT4"],
"tags" : [],
"description" : "world space transforms uniformly distributed in time"
}, {
"name" : "motion.scale",
"types" : ["ANARI_ARRAY1D"],
"elementType" : ["ANARI_FLOAT32_VEC3"],
"tags" : [],
"description" : "scaling uniformly distributed in time"
}, {
"name" : "motion.rotation",
"types" : ["ANARI_ARRAY1D"],
"elementType" : ["ANARI_FLOAT32_QUAT_IJKW"],
"tags" : [],
"description" : "rotations uniformly distributed in time"
}, {
"name" : "motion.translation",
"types" : ["ANARI_ARRAY1D"],
"elementType" : ["ANARI_FLOAT32_VEC3"],
"tags" : [],
"description" : "translations uniformly distributed in time"
}, {
"name" : "time",
"types" : ["ANARI_FLOAT32_BOX1"],
"tags" : [],
"default" : [0.0, 1.0],
"description" : "time associated with the first and laste entry in the motion.transform array"
}
]
}
]
}
36 changes: 0 additions & 36 deletions code_gen/api/khr_camera_omnidirectional.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,48 +34,12 @@
"tags" : ["direction"],
"default" : [0.0, 1.0, 0.0],
"description" : "camera up direction"
}, {
"name" : "transform",
"types" : ["ANARI_FLOAT32_MAT4"],
"tags" : [],
"default" : [
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
],
"description" : "camera transform"
}, {
"name" : "imageRegion",
"types" : ["ANARI_FLOAT32_BOX2"],
"tags" : [],
"default" : [0.0, 0.0, 1.0, 1.0],
"description" : "region mapped to the frame"
}, {
"name" : "apertureRadius",
"types" : ["ANARI_FLOAT32"],
"tags" : ["canonical"],
"default" : 0,
"description" : "aperture radius"
}, {
"name" : "focusDistance",
"types" : ["ANARI_FLOAT32"],
"tags" : ["canonical"],
"default" : 1,
"description" : "focus distance"
}, {
"name" : "stereoMode",
"types" : ["ANARI_STRING"],
"tags" : [],
"default" : "none",
"values" : ["none", "left", "right", "sideBySide", "topBottom"],
"description" : "stereo mode"
}, {
"name" : "interpupillaryDistance",
"types" : ["ANARI_FLOAT32"],
"tags" : [],
"default" : 0.0635,
"description" : "interpupillary distance for stereo rendering"
}, {
"name" : "layout",
"types" : ["ANARI_STRING"],
Expand Down
Loading

0 comments on commit 8a67d54

Please sign in to comment.