cleanup and refactoring
This commit is contained in:
parent
2302158928
commit
76f6bf62a4
1285 changed files with 757994 additions and 8 deletions
66
raytracer/.clang-format
Normal file
66
raytracer/.clang-format
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: '-2'
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignConsecutiveDeclarations: 'true'
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'false'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'true'
|
||||
AlwaysBreakTemplateDeclarations: 'true'
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'false'
|
||||
ExperimentalAutoDetectBinPacking: 'false'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: 'false'
|
||||
BreakConstructorInitializersBeforeComma: 'true'
|
||||
ColumnLimit: '120'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
Cpp11BracedListStyle: 'true'
|
||||
IndentCaseLabels: 'true'
|
||||
IndentWidth: '2'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'true'
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '2'
|
||||
NamespaceIndentation: None
|
||||
ObjCSpaceBeforeProtocolList: 'true'
|
||||
PointerAlignment: Left
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: Never
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '2'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
Standard: Cpp11
|
||||
TabWidth: '2'
|
||||
UseTab: Never
|
||||
SortIncludes: 'false'
|
||||
ReflowComments: 'false'
|
||||
BraceWrapping: {
|
||||
AfterClass: 'true'
|
||||
AfterControlStatement: 'true'
|
||||
AfterEnum: 'true'
|
||||
AfterFunction: 'true'
|
||||
AfterNamespace: 'false'
|
||||
AfterStruct: 'true'
|
||||
AfterUnion: 'true'
|
||||
BeforeCatch: 'true'
|
||||
BeforeElse: 'true'
|
||||
IndentBraces: 'false'
|
||||
}
|
||||
PenaltyExcessCharacter: 1
|
||||
PenaltyBreakBeforeFirstCallParameter: 40
|
||||
PenaltyBreakFirstLessLess: 1
|
||||
PenaltyBreakComment: 30
|
||||
PenaltyBreakString: 30
|
||||
PenaltyReturnTypeOnItsOwnLine: 9999
|
||||
54
raytracer/CMakeLists.txt
Normal file
54
raytracer/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
cmake_minimum_required(VERSION 3.9.6 FATAL_ERROR)
|
||||
project(vk_raytracing_tutorial)
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# look for nvpro_core 1) as a sub-folder 2) at some other locations
|
||||
# this cannot be put anywhere else since we still didn't find setup.cmake yet
|
||||
if(NOT BASE_DIRECTORY)
|
||||
|
||||
find_path(BASE_DIRECTORY
|
||||
NAMES nvpro_core/cmake/setup.cmake
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
REQUIRED
|
||||
DOC "Directory containing nvpro_core"
|
||||
)
|
||||
endif()
|
||||
|
||||
## Various functions and macros REQUIRED
|
||||
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/setup.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
else()
|
||||
message(FATAL_ERROR "could not find base directory, please set BASE_DIRECTORY to folder containing nvpro_core")
|
||||
endif()
|
||||
|
||||
set(TUTO_KHR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(/wd26812) # 'enum class' over 'enum'
|
||||
add_definitions(/wd26451) # Arithmetic overflow, casting 4 byte value to 8 byte value
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# Package shared by all projects
|
||||
_add_package_VulkanSDK()
|
||||
_add_package_ImGUI()
|
||||
_add_nvpro_core_lib()
|
||||
|
||||
message(STATUS "COPY ${CMAKE_CURRENT_SOURCE_DIR}/media to ${OUTPUT_PATH}")
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/media DESTINATION ${OUTPUT_PATH})
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# Sub examples
|
||||
add_subdirectory(ray_tracing_gltf)
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------
|
||||
# Install - copying the media directory
|
||||
install(DIRECTORY "media"
|
||||
CONFIGURATIONS Release
|
||||
DESTINATION "bin_${ARCH}")
|
||||
install(DIRECTORY "media"
|
||||
CONFIGURATIONS Debug
|
||||
DESTINATION "bin_${ARCH}_debug")
|
||||
36
raytracer/CONTRIBUTING
Normal file
36
raytracer/CONTRIBUTING
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
https://developercertificate.org/
|
||||
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
49
raytracer/README.md
Normal file
49
raytracer/README.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||

|
||||
|
||||
# NVIDIA Vulkan Ray Tracing Tutorials
|
||||
|
||||

|
||||
|
||||
|
||||
The focus of this repository and the provided code is to showcase a basic integration of
|
||||
[`ray tracing`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#ray-tracing) and [`ray traversal`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#ray-traversal) within an existing Vulkan sample, using the
|
||||
[`VK_KHR_acceleration_structure`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_acceleration_structure), [`VK_KHR_ray_tracing_pipeline`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_tracing_pipeline) and [`VK_KHR_ray_query`](https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VK_KHR_ray_query) extensions.
|
||||
|
||||
## Setup
|
||||
|
||||
To be able to compile and run those examples, please follow the [setup](docs/setup.md) instructions. Find more over nvpro-samples setup at: https://github.com/nvpro-samples/build_all.
|
||||
|
||||
## Tutorials
|
||||
|
||||
The [first tutorial](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tutorial.md.html) starts from a very simple Vulkan application. It loads a OBJ file and uses the rasterizer to render it. The tutorial then adds, **step-by-step**, all that is needed to be able to ray trace the scene.
|
||||
|
||||
-------
|
||||
### Ray Tracing Tutorial: :arrow_forward: **[Start Here](https://nvpro-samples.github.io/vk_raytracing_tutorial_KHR/vkrt_tutorial.md.html)** :arrow_backward:
|
||||
|
||||
-------
|
||||
|
||||
|
||||
## Extra Tutorials
|
||||
|
||||
All other tutorials start from the end of the _first_ ray tracing tutorial and also provide step-by-step instructions to modify and add methods and functions for that extra section.
|
||||
|
||||
|
||||
|
||||
Tutorial | Details
|
||||
---------|--------
|
||||
 | [Any Hit Shader](ray_tracing_anyhit)<br>Implements transparent materials by adding a new shader to the Hit group and using the material information to discard hits over time. Adds an anyhit (.ahit) shader to the ray tracing pipeline. Creates simple transparency by randomly letting the ray hit or not.
|
||||
 | [Jitter Camera](ray_tracing_jitter_cam)<br> Anti-aliases the image by accumulating small variations of rays over time. Generates random ray directions. Read/write/accumulates the final image.
|
||||
 | [Thousands of Objects](ray_tracing_instances) <br> The current example allocates memory for each object, each of which has several buffers. This shows how to get around Vulkan's limits on the total number of memory allocations by using a memory allocator. Extends the limit of 4096 memory allocations. Uses these memory allocators: DMA, VMA.
|
||||
 | [Reflections](ray_tracing_reflections) <br> Reflections can be implemented by shooting new rays from the closest hit shader, or by iteratively shooting them from the raygen shader. This example shows the limitations and differences of these implementations. Calls traceRayEXT() from the closest hit shader (recursive). Adds more data to the ray payload to continue the ray from the raygen shader.
|
||||
 | [Multiple Closest Hits Shader and Shader Records](ray_tracing_manyhits) <br> Explains how to add more closest hit shaders, choose which instance uses which shader, add data per SBT that can be retrieved in the shader, and more. One closest hit shader per object. Sharing closest hit shaders for some objects. Passing a shader record to the closest hit shader.
|
||||
 | [Animation](ray_tracing_animation) <br> This tutorial shows how animating the transformation matrices of the instances (TLAS) and animating the vertices of an object (BLAS) in a compute shader could be done. Refitting top level acceleration structures. Refitting bottom level acceleration structures.
|
||||
 | [Intersection Shader](ray_tracing_intersection) <br> Adds thousands of implicit primitives and uses an intersection shader to render spheres and cubes. Explains what is needed to get procedural hit group working. Intersection Shaders. Sphere intersection. Axis aligned bounding box intersection.
|
||||
 | [Callable Shader](ray_tracing_callable) <br> Replacing if/else by callable shaders. The code to execute the lighting is done in separate callable shaders instead of being part of the main code. Adding multiple callable shaders. Calling ExecuteCallableEXT from the closest hit shader.
|
||||
 | [Ray Query](ray_tracing_rayquery) <br> Invokes ray intersection queries directly from the fragment shader to cast shadow rays. Ray tracing directly from the fragment shader.
|
||||
 | [glTF Scene](ray_tracing_gltf) <br> Instead of loading separate OBJ objects, the example was modified to load glTF scene files containing multiple objects. This example is not about shading, but using more complex data than OBJ. However, it also shows a basic path tracer implementation.
|
||||
 | [Advance](ray_tracing__advance) <br> An example combining most of the above samples in a single application.
|
||||
 | [Trace Rays Indirect](ray_tracing_indirect_scissor) <br> Teaches the use of `vkCmdTraceRaysIndirectKHR`, which sources width/height/depth from a buffer. As a use case, we add lanterns to the scene and use a compute shader to calculate scissor rectangles for each of them.
|
||||
 | [AO Raytracing](ray_tracing_ao) <br> This extension to the tutorial is showing how G-Buffers from the fragment shader, can be used in a compute shader to cast ambient occlusion rays using ray queries ([GLSL_EXT_ray_query](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_ray_query.txt)).
|
||||
 | [Specialization Constants](ray_tracing_specialization) <br> Showing how to use specialization constant and using interactively different specialization.
|
||||
 | [Advanced Compilation](ray_tracing_advanced_compilation) <br> Shows how to create reusable pipeline libraries and compile pipelines on multiple threads.
|
||||
 | [Motion Blur](ray_tracing_motionblur) <br> Using vertex motion and instance motion: matrix and SRT.
|
||||
122
raytracer/common/obj_loader.cpp
Normal file
122
raytracer/common/obj_loader.cpp
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// This file exist only to do the implementation of tiny obj loader
|
||||
#define TINYOBJLOADER_IMPLEMENTATION
|
||||
#include "obj_loader.h"
|
||||
#include "nvh/nvprint.hpp"
|
||||
|
||||
|
||||
void ObjLoader::loadModel(const std::string& filename)
|
||||
{
|
||||
tinyobj::ObjReader reader;
|
||||
reader.ParseFromFile(filename);
|
||||
if(!reader.Valid())
|
||||
{
|
||||
LOGE("Cannot load %s: %s", filename.c_str(), reader.Error().c_str());
|
||||
assert(reader.Valid());
|
||||
}
|
||||
|
||||
// Collecting the material in the scene
|
||||
for(const auto& material : reader.GetMaterials())
|
||||
{
|
||||
MaterialObj m;
|
||||
m.ambient = glm::vec3(material.ambient[0], material.ambient[1], material.ambient[2]);
|
||||
m.diffuse = glm::vec3(material.diffuse[0], material.diffuse[1], material.diffuse[2]);
|
||||
m.specular = glm::vec3(material.specular[0], material.specular[1], material.specular[2]);
|
||||
m.emission = glm::vec3(material.emission[0], material.emission[1], material.emission[2]);
|
||||
m.transmittance = glm::vec3(material.transmittance[0], material.transmittance[1], material.transmittance[2]);
|
||||
m.dissolve = material.dissolve;
|
||||
m.ior = material.ior;
|
||||
m.shininess = material.shininess;
|
||||
m.illum = material.illum;
|
||||
if(!material.diffuse_texname.empty())
|
||||
{
|
||||
m_textures.push_back(material.diffuse_texname);
|
||||
m.textureID = static_cast<int>(m_textures.size()) - 1;
|
||||
}
|
||||
|
||||
m_materials.emplace_back(m);
|
||||
}
|
||||
|
||||
// If there were none, add a default
|
||||
if(m_materials.empty())
|
||||
m_materials.emplace_back(MaterialObj());
|
||||
|
||||
const tinyobj::attrib_t& attrib = reader.GetAttrib();
|
||||
|
||||
for(const auto& shape : reader.GetShapes())
|
||||
{
|
||||
m_vertices.reserve(shape.mesh.indices.size() + m_vertices.size());
|
||||
m_indices.reserve(shape.mesh.indices.size() + m_indices.size());
|
||||
m_matIndx.insert(m_matIndx.end(), shape.mesh.material_ids.begin(), shape.mesh.material_ids.end());
|
||||
|
||||
for(const auto& index : shape.mesh.indices)
|
||||
{
|
||||
VertexObj vertex = {};
|
||||
const float* vp = &attrib.vertices[3 * index.vertex_index];
|
||||
vertex.pos = {*(vp + 0), *(vp + 1), *(vp + 2)};
|
||||
|
||||
if(!attrib.normals.empty() && index.normal_index >= 0)
|
||||
{
|
||||
const float* np = &attrib.normals[3 * index.normal_index];
|
||||
vertex.nrm = {*(np + 0), *(np + 1), *(np + 2)};
|
||||
}
|
||||
|
||||
if(!attrib.texcoords.empty() && index.texcoord_index >= 0)
|
||||
{
|
||||
const float* tp = &attrib.texcoords[2 * index.texcoord_index + 0];
|
||||
vertex.texCoord = {*tp, 1.0f - *(tp + 1)};
|
||||
}
|
||||
|
||||
if(!attrib.colors.empty())
|
||||
{
|
||||
const float* vc = &attrib.colors[3 * index.vertex_index];
|
||||
vertex.color = {*(vc + 0), *(vc + 1), *(vc + 2)};
|
||||
}
|
||||
|
||||
m_vertices.push_back(vertex);
|
||||
m_indices.push_back(static_cast<int>(m_indices.size()));
|
||||
}
|
||||
}
|
||||
|
||||
// Fixing material indices
|
||||
for(auto& mi : m_matIndx)
|
||||
{
|
||||
if(mi < 0 || mi > m_materials.size())
|
||||
mi = 0;
|
||||
}
|
||||
|
||||
|
||||
// Compute normal when no normal were provided.
|
||||
if(attrib.normals.empty())
|
||||
{
|
||||
for(size_t i = 0; i < m_indices.size(); i += 3)
|
||||
{
|
||||
VertexObj& v0 = m_vertices[m_indices[i + 0]];
|
||||
VertexObj& v1 = m_vertices[m_indices[i + 1]];
|
||||
VertexObj& v2 = m_vertices[m_indices[i + 2]];
|
||||
|
||||
glm::vec3 n = glm::normalize(glm::cross((v1.pos - v0.pos), (v2.pos - v0.pos)));
|
||||
v0.nrm = n;
|
||||
v1.nrm = n;
|
||||
v2.nrm = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
72
raytracer/common/obj_loader.h
Normal file
72
raytracer/common/obj_loader.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <glm/glm.hpp>
|
||||
#include "tiny_obj_loader.h"
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
// Structure holding the material
|
||||
struct MaterialObj
|
||||
{
|
||||
glm::vec3 ambient = glm::vec3(0.1f, 0.1f, 0.1f);
|
||||
glm::vec3 diffuse = glm::vec3(0.7f, 0.7f, 0.7f);
|
||||
glm::vec3 specular = glm::vec3(1.0f, 1.0f, 1.0f);
|
||||
glm::vec3 transmittance = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
glm::vec3 emission = glm::vec3(0.0f, 0.0f, 0.10);
|
||||
float shininess = 0.f;
|
||||
float ior = 1.0f; // index of refraction
|
||||
float dissolve = 1.f; // 1 == opaque; 0 == fully transparent
|
||||
// illumination model (see http://www.fileformat.info/format/material/)
|
||||
int illum = 0;
|
||||
int textureID = -1;
|
||||
};
|
||||
// OBJ representation of a vertex
|
||||
// NOTE: BLAS builder depends on pos being the first member
|
||||
struct VertexObj
|
||||
{
|
||||
glm::vec3 pos;
|
||||
glm::vec3 nrm;
|
||||
glm::vec3 color;
|
||||
glm::vec2 texCoord;
|
||||
};
|
||||
|
||||
|
||||
struct shapeObj
|
||||
{
|
||||
uint32_t offset;
|
||||
uint32_t nbIndex;
|
||||
uint32_t matIndex;
|
||||
};
|
||||
|
||||
class ObjLoader
|
||||
{
|
||||
public:
|
||||
void loadModel(const std::string& filename);
|
||||
|
||||
std::vector<VertexObj> m_vertices;
|
||||
std::vector<uint32_t> m_indices;
|
||||
std::vector<MaterialObj> m_materials;
|
||||
std::vector<std::string> m_textures;
|
||||
std::vector<int32_t> m_matIndx;
|
||||
};
|
||||
BIN
raytracer/media/scenes/cornellBox.bin
Normal file
BIN
raytracer/media/scenes/cornellBox.bin
Normal file
Binary file not shown.
1570
raytracer/media/scenes/cornellBox.gltf
Normal file
1570
raytracer/media/scenes/cornellBox.gltf
Normal file
File diff suppressed because it is too large
Load diff
BIN
raytracer/media/scenes/grid.bin
Normal file
BIN
raytracer/media/scenes/grid.bin
Normal file
Binary file not shown.
335
raytracer/media/scenes/grid.gltf
Normal file
335
raytracer/media/scenes/grid.gltf
Normal file
|
|
@ -0,0 +1,335 @@
|
|||
{
|
||||
"asset":{
|
||||
"generator":"Khronos glTF Blender I/O v4.1.63",
|
||||
"version":"2.0"
|
||||
},
|
||||
"extensionsUsed":[
|
||||
"KHR_materials_emissive_strength"
|
||||
],
|
||||
"scene":0,
|
||||
"scenes":[
|
||||
{
|
||||
"name":"Scene",
|
||||
"nodes":[
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes":[
|
||||
{
|
||||
"mesh":0,
|
||||
"name":"Base",
|
||||
"scale":[
|
||||
300,
|
||||
1,
|
||||
300
|
||||
]
|
||||
},
|
||||
{
|
||||
"camera":0,
|
||||
"name":"Camera",
|
||||
"rotation":[
|
||||
-0.4850793778896332,
|
||||
0.011384948156774044,
|
||||
0.006316010374575853,
|
||||
0.874373197555542
|
||||
],
|
||||
"translation":[
|
||||
22.192241668701172,
|
||||
739.938720703125,
|
||||
580.302978515625
|
||||
]
|
||||
},
|
||||
{
|
||||
"mesh":1,
|
||||
"name":"Plane",
|
||||
"scale":[
|
||||
424.1018981933594,
|
||||
424.1018981933594,
|
||||
424.1018981933594
|
||||
],
|
||||
"translation":[
|
||||
0,
|
||||
684.2815551757812,
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"cameras":[
|
||||
{
|
||||
"name":"Camera",
|
||||
"perspective":{
|
||||
"aspectRatio":1,
|
||||
"yfov":0.6911112070083618,
|
||||
"zfar":2000,
|
||||
"znear":0.10000000149011612
|
||||
},
|
||||
"type":"perspective"
|
||||
}
|
||||
],
|
||||
"materials":[
|
||||
{
|
||||
"doubleSided":true,
|
||||
"name":"Material",
|
||||
"pbrMetallicRoughness":{
|
||||
"baseColorFactor":[
|
||||
0.8003232479095459,
|
||||
0.052682049572467804,
|
||||
0.03800351545214653,
|
||||
1
|
||||
],
|
||||
"metallicFactor":0,
|
||||
"roughnessFactor":0.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"doubleSided":true,
|
||||
"emissiveFactor":[
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"extensions":{
|
||||
"KHR_materials_emissive_strength":{
|
||||
"emissiveStrength":2
|
||||
}
|
||||
},
|
||||
"name":"Material.001",
|
||||
"pbrMetallicRoughness":{
|
||||
"baseColorFactor":[
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
1
|
||||
],
|
||||
"metallicFactor":0,
|
||||
"roughnessFactor":0.5
|
||||
}
|
||||
}
|
||||
],
|
||||
"meshes":[
|
||||
{
|
||||
"name":"Cube",
|
||||
"primitives":[
|
||||
{
|
||||
"attributes":{
|
||||
"POSITION":0,
|
||||
"NORMAL":1,
|
||||
"TEXCOORD_0":2
|
||||
},
|
||||
"indices":3,
|
||||
"material":0
|
||||
},
|
||||
{
|
||||
"attributes":{
|
||||
"POSITION":4,
|
||||
"NORMAL":5,
|
||||
"TEXCOORD_0":6
|
||||
},
|
||||
"indices":7,
|
||||
"material":0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"Plane",
|
||||
"primitives":[
|
||||
{
|
||||
"attributes":{
|
||||
"POSITION":8,
|
||||
"NORMAL":9,
|
||||
"TEXCOORD_0":10
|
||||
},
|
||||
"indices":11,
|
||||
"material":1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"accessors":[
|
||||
{
|
||||
"bufferView":0,
|
||||
"componentType":5126,
|
||||
"count":180024,
|
||||
"max":[
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"min":[
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
],
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":1,
|
||||
"componentType":5126,
|
||||
"count":180024,
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":2,
|
||||
"componentType":5126,
|
||||
"count":180024,
|
||||
"type":"VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView":3,
|
||||
"componentType":5125,
|
||||
"count":810036,
|
||||
"type":"SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView":4,
|
||||
"componentType":5126,
|
||||
"count":360000,
|
||||
"max":[
|
||||
0.996666669845581,
|
||||
1,
|
||||
0.996666669845581
|
||||
],
|
||||
"min":[
|
||||
-0.996666669845581,
|
||||
-1,
|
||||
-0.996666669845581
|
||||
],
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":5,
|
||||
"componentType":5126,
|
||||
"count":360000,
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":6,
|
||||
"componentType":5126,
|
||||
"count":360000,
|
||||
"type":"VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView":7,
|
||||
"componentType":5125,
|
||||
"count":540000,
|
||||
"type":"SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView":8,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"max":[
|
||||
1,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"min":[
|
||||
-1,
|
||||
0,
|
||||
-1
|
||||
],
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":9,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":10,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"type":"VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView":11,
|
||||
"componentType":5123,
|
||||
"count":6,
|
||||
"type":"SCALAR"
|
||||
}
|
||||
],
|
||||
"bufferViews":[
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":2160288,
|
||||
"byteOffset":0,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":2160288,
|
||||
"byteOffset":2160288,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":1440192,
|
||||
"byteOffset":4320576,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":3240144,
|
||||
"byteOffset":5760768,
|
||||
"target":34963
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":4320000,
|
||||
"byteOffset":9000912,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":4320000,
|
||||
"byteOffset":13320912,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":2880000,
|
||||
"byteOffset":17640912,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":2160000,
|
||||
"byteOffset":20520912,
|
||||
"target":34963
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":48,
|
||||
"byteOffset":22680912,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":48,
|
||||
"byteOffset":22680960,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":32,
|
||||
"byteOffset":22681008,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":12,
|
||||
"byteOffset":22681040,
|
||||
"target":34963
|
||||
}
|
||||
],
|
||||
"buffers":[
|
||||
{
|
||||
"byteLength":22681052,
|
||||
"uri":"grid.bin"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
raytracer/media/scenes/sportscar.bin
Normal file
BIN
raytracer/media/scenes/sportscar.bin
Normal file
Binary file not shown.
BIN
raytracer/media/scenes/sportscar.glb
Normal file
BIN
raytracer/media/scenes/sportscar.glb
Normal file
Binary file not shown.
113
raytracer/media/scenes/sportscar.gltf
Normal file
113
raytracer/media/scenes/sportscar.gltf
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"asset":{
|
||||
"generator":"Khronos glTF Blender I/O v4.1.63",
|
||||
"version":"2.0"
|
||||
},
|
||||
"scene":0,
|
||||
"scenes":[
|
||||
{
|
||||
"name":"Scene",
|
||||
"nodes":[
|
||||
0,
|
||||
1
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes":[
|
||||
{
|
||||
"name":"sportsCar"
|
||||
},
|
||||
{
|
||||
"mesh":0,
|
||||
"name":"Plane",
|
||||
"scale":[
|
||||
-4.532076835632324,
|
||||
-4.532076835632324,
|
||||
-4.532076835632324
|
||||
]
|
||||
}
|
||||
],
|
||||
"meshes":[
|
||||
{
|
||||
"name":"Plane",
|
||||
"primitives":[
|
||||
{
|
||||
"attributes":{
|
||||
"POSITION":0,
|
||||
"NORMAL":1,
|
||||
"TEXCOORD_0":2
|
||||
},
|
||||
"indices":3
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"accessors":[
|
||||
{
|
||||
"bufferView":0,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"max":[
|
||||
1,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"min":[
|
||||
-1,
|
||||
0,
|
||||
-1
|
||||
],
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":1,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"type":"VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView":2,
|
||||
"componentType":5126,
|
||||
"count":4,
|
||||
"type":"VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView":3,
|
||||
"componentType":5123,
|
||||
"count":6,
|
||||
"type":"SCALAR"
|
||||
}
|
||||
],
|
||||
"bufferViews":[
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":48,
|
||||
"byteOffset":0,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":48,
|
||||
"byteOffset":48,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":32,
|
||||
"byteOffset":96,
|
||||
"target":34962
|
||||
},
|
||||
{
|
||||
"buffer":0,
|
||||
"byteLength":12,
|
||||
"byteOffset":128,
|
||||
"target":34963
|
||||
}
|
||||
],
|
||||
"buffers":[
|
||||
{
|
||||
"byteLength":140,
|
||||
"uri":"sportscar.bin"
|
||||
}
|
||||
]
|
||||
}
|
||||
67
raytracer/nvpro_core/.clang-format
Normal file
67
raytracer/nvpro_core/.clang-format
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: '-2'
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: 'true'
|
||||
AlignConsecutiveDeclarations: 'true'
|
||||
AlignOperands: 'true'
|
||||
AlignTrailingComments: 'true'
|
||||
AllowAllParametersOfDeclarationOnNextLine: 'false'
|
||||
AllowShortBlocksOnASingleLine: 'false'
|
||||
AllowShortCaseLabelsOnASingleLine: 'false'
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: 'false'
|
||||
AllowShortLoopsOnASingleLine: 'false'
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: 'true'
|
||||
AlwaysBreakTemplateDeclarations: 'true'
|
||||
BinPackArguments: 'true'
|
||||
BinPackParameters: 'false'
|
||||
ExperimentalAutoDetectBinPacking: 'false'
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: 'false'
|
||||
BreakConstructorInitializersBeforeComma: 'true'
|
||||
ColumnLimit: '120'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
|
||||
Cpp11BracedListStyle: 'true'
|
||||
IndentCaseLabels: 'true'
|
||||
IndentWidth: '2'
|
||||
KeepEmptyLinesAtTheStartOfBlocks: 'true'
|
||||
Language: Cpp
|
||||
MaxEmptyLinesToKeep: '2'
|
||||
NamespaceIndentation: None
|
||||
ObjCSpaceBeforeProtocolList: 'true'
|
||||
PointerAlignment: Left
|
||||
SpaceAfterCStyleCast: 'false'
|
||||
SpaceBeforeAssignmentOperators: 'true'
|
||||
SpaceBeforeParens: Never
|
||||
SpaceInEmptyParentheses: 'false'
|
||||
SpacesBeforeTrailingComments: '2'
|
||||
SpacesInAngles: 'false'
|
||||
SpacesInCStyleCastParentheses: 'false'
|
||||
SpacesInParentheses: 'false'
|
||||
SpacesInSquareBrackets: 'false'
|
||||
Standard: Cpp11
|
||||
TabWidth: '2'
|
||||
UseTab: Never
|
||||
SortIncludes: 'false'
|
||||
ReflowComments: 'false'
|
||||
BraceWrapping: {
|
||||
AfterClass: 'true'
|
||||
AfterControlStatement: 'true'
|
||||
AfterEnum: 'true'
|
||||
AfterFunction: 'true'
|
||||
AfterNamespace: 'false'
|
||||
AfterStruct: 'true'
|
||||
AfterUnion: 'true'
|
||||
BeforeCatch: 'true'
|
||||
BeforeElse: 'true'
|
||||
IndentBraces: 'false'
|
||||
}
|
||||
PenaltyExcessCharacter: 1
|
||||
PenaltyBreakBeforeFirstCallParameter: 40
|
||||
PenaltyBreakFirstLessLess: 1
|
||||
PenaltyBreakComment: 30
|
||||
PenaltyBreakString: 30
|
||||
PenaltyReturnTypeOnItsOwnLine: 9999
|
||||
BreakStringLiterals: false
|
||||
7
raytracer/nvpro_core/.editorconfig
Normal file
7
raytracer/nvpro_core/.editorconfig
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# This is the top-most editor config file
|
||||
root = true
|
||||
|
||||
# Default to 2 space indentation for C/C++ files
|
||||
[*.{c,cpp,h,hpp,inl}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
187
raytracer/nvpro_core/.gitignore
vendored
Normal file
187
raytracer/nvpro_core/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
doxygen/html
|
||||
doxygen/log.txt
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.vcxproj
|
||||
*.filters
|
||||
*.sln
|
||||
*.user
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish
|
||||
|
||||
# Others
|
||||
[Bb]in
|
||||
[Oo]bj
|
||||
sql
|
||||
TestResults
|
||||
*.Cache
|
||||
ClientBin
|
||||
stylecop.*
|
||||
~$*
|
||||
*.dbmdl
|
||||
Generated_Code #added for RIA/Silverlight projects
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
|
||||
|
||||
############
|
||||
## Windows
|
||||
############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
|
||||
############
|
||||
## Linux
|
||||
############
|
||||
|
||||
# Backup Files
|
||||
*~
|
||||
|
||||
# Lock Files
|
||||
\#*\#
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist
|
||||
build
|
||||
# Don't ignore Zstd's build folder, since that's where it includes its CMake files
|
||||
!third_party/zstd/build
|
||||
eggs
|
||||
parts
|
||||
bin
|
||||
var
|
||||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
#specific to the project
|
||||
cmake_built
|
||||
|
||||
#Omniverse
|
||||
OV/downloaded
|
||||
|
||||
|
||||
_autogen/
|
||||
262
raytracer/nvpro_core/CMakeLists.txt
Normal file
262
raytracer/nvpro_core/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
#####################################################################################
|
||||
# offer the choice of having nvpro_core as a sub-folder... good for packaging a sample
|
||||
#
|
||||
# if BASE_DIRECTORY not defined, it means this cmake file was called as the first entry point and not included
|
||||
if(NOT BASE_DIRECTORY) # if not defined, it means this cmake file was called as the first entry point and not included
|
||||
message(FATAL_ERROR "cannot be directly invoked")
|
||||
else()
|
||||
Message(STATUS "-------------------------------")
|
||||
Message(STATUS "Processing nvpro_core files")
|
||||
endif()
|
||||
|
||||
|
||||
set(NVPWINDOW_SOURCE
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpwindow.cpp
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpwindow.hpp
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpsystem.cpp
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpsystem.hpp
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpfilesystem.cpp
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/nvpfilesystem.hpp
|
||||
# Do not add project_name.cpp here as it contains per-project dependent data.
|
||||
# perproject_globals.cpp will be automatically added to the per-project builds via
|
||||
# COMMON_SOURCE_FILES
|
||||
${BASE_DIRECTORY}/nvpro_core/nvp/perproject_globals.hpp
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
LIST(APPEND NVPWINDOW_SOURCE ${BASE_DIRECTORY}/nvpro_core/nvp/nvpsystem_linux.cpp )
|
||||
else()
|
||||
LIST(APPEND NVPWINDOW_SOURCE ${BASE_DIRECTORY}/nvpro_core/nvp/nvpsystem_win32.cpp )
|
||||
endif()
|
||||
|
||||
if(NOT (CMAKE_SIZEOF_VOID_P EQUAL 8))
|
||||
message( FATAL_ERROR "64-bit builds are mandatory for this framework" )
|
||||
endif()
|
||||
|
||||
|
||||
# Add third party libraries. This sets THIRDPARTY_LIBRARIES to list of added libraries
|
||||
add_subdirectory(third_party)
|
||||
|
||||
|
||||
# add packages that may be needed by some of the samples
|
||||
_optional_package_VulkanSDK()
|
||||
_optional_package_ShaderC()
|
||||
_optional_package_OpenGL()
|
||||
_optional_package_DirectX12()
|
||||
_optional_package_Optix()
|
||||
_optional_package_Cuda()
|
||||
_optional_package_NVML()
|
||||
_optional_package_NVToolsExt()
|
||||
|
||||
# process the rest of some cmake code that needs to be done after the packages
|
||||
_process_shared_cmake_code()
|
||||
|
||||
file(GLOB FILEFORMATS_SOURCE fileformats/*.cpp fileformats/*.hpp fileformats/*.inl fileformats/*.h)
|
||||
file(GLOB NVMATH_SOURCE nvmath/*.cpp nvmath/*.hpp nvmath/*.inl nvmath/*.h)
|
||||
file(GLOB NVHELPERS_SOURCE nvh/*.cpp nvh/*.hpp nvh/*.inl nvh/*.h)
|
||||
|
||||
if (NOT TARGET tinygltf)
|
||||
list(REMOVE_ITEM NVHELPERS_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvh/gltfscene.cpp)
|
||||
list(REMOVE_ITEM NVHELPERS_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvh/gltfscene.hpp)
|
||||
endif()
|
||||
|
||||
set(library_name "nvpro_core")
|
||||
|
||||
if(USING_OPENGL)
|
||||
file(GLOB NVHELPERSGL_SOURCE nvgl/*.cpp nvgl/*.hpp nvgl/*.inl nvgl/*.h)
|
||||
source_group("nvgl" FILES ${NVHELPERSGL_SOURCE})
|
||||
|
||||
string(CONCAT library_name ${library_name} "_gl")
|
||||
endif()
|
||||
|
||||
if(USING_VULKANSDK)
|
||||
file(GLOB NVHELPERSVK_SOURCE nvvk/*.cpp nvvk/*.hpp nvvk/*.inl nvvk/*.h)
|
||||
|
||||
# the implementation depends on SUPPORTS_AFTERMATH and thus can only be provided
|
||||
# as part of the individual sample projects. Check setup.cmake where we insert
|
||||
# nsight_aftermath_vk.cpp into the projects automatically
|
||||
list(REMOVE_ITEM NVHELPERSVK_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvvk/nsight_aftermath_vk.cpp)
|
||||
|
||||
# Adding compile_glsl
|
||||
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
endif()
|
||||
|
||||
# Vulkan-high-level helpers
|
||||
file(GLOB NVVKHL_SOURCE nvvkhl/*.cpp nvvkhl/*.hpp nvvkl/*.inl nvvkh;/*.h)
|
||||
set(SHD_DIR nvvkhl/shaders)
|
||||
file(GLOB SHD_HDR ${SHD_DIR}/*.glsl ${SHD_DIR}/*.h)
|
||||
file(GLOB SHD_SRC ${SHD_DIR}/*.vert ${SHD_DIR}/*.frag ${SHD_DIR}/*.comp ${SHD_DIR}/*.rgen ${SHD_DIR}/*.rchit ${SHD_DIR}/*.rmiss)
|
||||
# Compiling shaders to SPIR-V header
|
||||
compile_glsl(
|
||||
SOURCE_FILES ${SHD_SRC}
|
||||
HEADER_FILES ${SHD_HDR}
|
||||
DST "${CMAKE_CURRENT_SOURCE_DIR}/_autogen"
|
||||
VULKAN_TARGET "vulkan1.3"
|
||||
HEADER ON
|
||||
DEPENDENCY ${VULKAN_BUILD_DEPENDENCIES}
|
||||
FLAGS "-I${SHD_DIR}" "-I${CMAKE_CURRENT_SOURCE_DIR}" -g
|
||||
)
|
||||
|
||||
if (NOT TARGET vma)
|
||||
list(REMOVE_ITEM NVHELPERSVK_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvvk/memallocator_vma_vk.hpp)
|
||||
list(REMOVE_ITEM NVHELPERSVK_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvvk/memallocator_vma_vk.inl)
|
||||
list(REMOVE_ITEM NVVKHL_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/nvvkhl/alloc_vma.hpp)
|
||||
endif()
|
||||
|
||||
source_group("nvvk" FILES ${NVHELPERSVK_SOURCE})
|
||||
source_group("nvvkhl" FILES ${NVVKHL_SOURCE})
|
||||
source_group("nvvkhl/shaders" FILES ${GLSL_SOURCES} ${GLSL_HEADERS})
|
||||
set(NVVKHL_SHADERS ${GLSL_SOURCES} ${GLSL_HEADERS})
|
||||
|
||||
string(CONCAT library_name ${library_name} "_vk")
|
||||
|
||||
if(WIN32)
|
||||
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
|
||||
endif(WIN32)
|
||||
if(UNIX)
|
||||
add_definitions(-DVK_USE_PLATFORM_XCB_KHR)
|
||||
add_definitions(-DVK_USE_PLATFORM_XLIB_KHR)
|
||||
endif(UNIX)
|
||||
endif()
|
||||
|
||||
if(USING_IMGUI)
|
||||
set(IMGUI_SOURCE
|
||||
imgui/imgui_axis.cpp
|
||||
imgui/imgui_axis.hpp
|
||||
imgui/imgui_camera_widget.cpp
|
||||
imgui/imgui_camera_widget.h
|
||||
imgui/imgui_helper.cpp
|
||||
imgui/imgui_helper.h
|
||||
imgui/imgui_icon.cpp
|
||||
imgui/imgui_icon.h
|
||||
imgui/imgui_orient.cpp
|
||||
imgui/imgui_orient.h
|
||||
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_glfw.h
|
||||
)
|
||||
if (NOT TARGET tinygltf)
|
||||
# depends on json.hpp from tinygltf
|
||||
list(REMOVE_ITEM IMGUI_SOURCE imgui/imgui_camera_widget.h)
|
||||
list(REMOVE_ITEM IMGUI_SOURCE imgui/imgui_camera_widget.cpp)
|
||||
endif()
|
||||
|
||||
if(USING_OPENGL)
|
||||
# replaced with our own copy
|
||||
list(APPEND IMGUI_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgui/backends/imgui_impl_gl.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgui/backends/imgui_impl_gl.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USING_VULKANSDK)
|
||||
list(APPEND IMGUI_SOURCE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgui/backends/imgui_vk_extra.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/imgui/backends/imgui_vk_extra.h
|
||||
${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_vulkan.h)
|
||||
endif()
|
||||
|
||||
if(USING_DIRECTX12)
|
||||
list(APPEND IMGUI_SOURCE
|
||||
${IMGUI_DIR}/backends/imgui_impl_dx12.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_dx12.h)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if (USING_DIRECTX12)
|
||||
file(GLOB NVHELPERSDX12_SOURCE nvdx12/*.cpp nvdx12/*.hpp nvdx12/*.inl nvdx12/*.h)
|
||||
source_group("nvdx12" FILES ${NVHELPERSDX12_SOURCE})
|
||||
|
||||
string(CONCAT library_name ${library_name} "_dx12")
|
||||
endif()
|
||||
|
||||
|
||||
if (USING_OPTIX)
|
||||
Message(STATUS "Note: adding Optix utility files")
|
||||
file(GLOB NVHELPERSOPTIX_FILES nvoptix/*.cpp nvoptix/*.h)
|
||||
source_group("nvoptix" FILES ${NVHELPERSOPTIX_FILES})
|
||||
|
||||
string(CONCAT library_name ${library_name} "_optix")
|
||||
endif()
|
||||
|
||||
if (USING_SHADERC)
|
||||
string(CONCAT library_name ${library_name} "_shaderc")
|
||||
endif()
|
||||
|
||||
source_group("fileformats" FILES ${FILEFORMATS_SOURCE})
|
||||
source_group("noise" FILES ${NOISE_SOURCE})
|
||||
source_group("nvmath" FILES ${NVMATH_SOURCE})
|
||||
source_group("nvh" FILES ${NVHELPERS_SOURCE})
|
||||
source_group("nvp" FILES ${NVPWINDOW_SOURCE})
|
||||
source_group("imgui" FILES ${IMGUI_SOURCE})
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
if(USING_OPENGL)
|
||||
set(OPENGL_FILES
|
||||
${has_GL_FILES}
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(nvpro_core STATIC
|
||||
${NVHELPERS_SOURCE}
|
||||
${NVMATH_SOURCE}
|
||||
${IMGUI_SOURCE}
|
||||
${FILEFORMATS_SOURCE}
|
||||
${NVPWINDOW_SOURCE}
|
||||
${OPENGL_FILES}
|
||||
${NVHELPERSVK_SOURCE}
|
||||
${NVVKHL_SOURCE}
|
||||
${NVVKHL_SHADERS}
|
||||
${NVHELPERSGL_SOURCE}
|
||||
${NVHELPERSDX12_SOURCE}
|
||||
${PACKAGE_SOURCE_FILES}
|
||||
${NVHELPERSOPTIX_FILES}
|
||||
)
|
||||
|
||||
# Create precompiled header (added in CMake 3.16)
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||
set(_PCH_FILES
|
||||
"<algorithm>"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nvh/nvprint.hpp
|
||||
)
|
||||
target_precompile_headers(nvpro_core PRIVATE ${_PCH_FILES})
|
||||
endif()
|
||||
|
||||
# Add X11 for screenshot support on linux
|
||||
if(UNIX)
|
||||
find_package(X11 REQUIRED)
|
||||
LIST(APPEND PLATFORM_LIBRARIES ${X11_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# Make Windows compilation somewhat faster
|
||||
if(WIN32)
|
||||
target_compile_definitions(nvpro_core PRIVATE WIN32_LEAN_AND_MEAN)
|
||||
endif()
|
||||
|
||||
if(USING_IMGUI)
|
||||
# Enable ImVec* operators for all nvpro_core. See imgui.h.
|
||||
target_compile_definitions(nvpro_core PRIVATE IMGUI_DEFINE_MATH_OPERATORS)
|
||||
endif()
|
||||
|
||||
target_link_libraries(nvpro_core
|
||||
${PLATFORM_LIBRARIES}
|
||||
glfw
|
||||
imgui
|
||||
implot
|
||||
fmt
|
||||
glm
|
||||
${THIRDPARTY_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(nvpro_core PROPERTIES OUTPUT_NAME ${library_name})
|
||||
_set_target_output(nvpro_core)
|
||||
|
||||
message(STATUS "nvpro_core library name: ${library_name}")
|
||||
|
||||
36
raytracer/nvpro_core/CONTRIBUTING
Normal file
36
raytracer/nvpro_core/CONTRIBUTING
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
https://developercertificate.org/
|
||||
|
||||
Developer Certificate of Origin
|
||||
Version 1.1
|
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
||||
7163
raytracer/nvpro_core/GL/glcustom.h
Normal file
7163
raytracer/nvpro_core/GL/glcustom.h
Normal file
File diff suppressed because it is too large
Load diff
5344
raytracer/nvpro_core/GL/glsubset.h
Normal file
5344
raytracer/nvpro_core/GL/glsubset.h
Normal file
File diff suppressed because it is too large
Load diff
943
raytracer/nvpro_core/GL/wgl.h
Normal file
943
raytracer/nvpro_core/GL/wgl.h
Normal file
|
|
@ -0,0 +1,943 @@
|
|||
#ifndef __wgl_wgl_h_
|
||||
#define __wgl_wgl_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are 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 Materials.
|
||||
**
|
||||
** THE MATERIALS ARE 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** This header is generated from the Khronos OpenGL / OpenGL ES XML
|
||||
** API Registry. The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
/// @DOC_SKIP (keyword to exclude this file from automatic README.md generation)
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* Generated on date 20180905 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: wgl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef WGL_VERSION_1_0
|
||||
#define WGL_VERSION_1_0 1
|
||||
#define WGL_FONT_LINES 0
|
||||
#define WGL_FONT_POLYGONS 1
|
||||
#define WGL_SWAP_MAIN_PLANE 0x00000001
|
||||
#define WGL_SWAP_OVERLAY1 0x00000002
|
||||
#define WGL_SWAP_OVERLAY2 0x00000004
|
||||
#define WGL_SWAP_OVERLAY3 0x00000008
|
||||
#define WGL_SWAP_OVERLAY4 0x00000010
|
||||
#define WGL_SWAP_OVERLAY5 0x00000020
|
||||
#define WGL_SWAP_OVERLAY6 0x00000040
|
||||
#define WGL_SWAP_OVERLAY7 0x00000080
|
||||
#define WGL_SWAP_OVERLAY8 0x00000100
|
||||
#define WGL_SWAP_OVERLAY9 0x00000200
|
||||
#define WGL_SWAP_OVERLAY10 0x00000400
|
||||
#define WGL_SWAP_OVERLAY11 0x00000800
|
||||
#define WGL_SWAP_OVERLAY12 0x00001000
|
||||
#define WGL_SWAP_OVERLAY13 0x00002000
|
||||
#define WGL_SWAP_OVERLAY14 0x00004000
|
||||
#define WGL_SWAP_OVERLAY15 0x00008000
|
||||
#define WGL_SWAP_UNDERLAY1 0x00010000
|
||||
#define WGL_SWAP_UNDERLAY2 0x00020000
|
||||
#define WGL_SWAP_UNDERLAY3 0x00040000
|
||||
#define WGL_SWAP_UNDERLAY4 0x00080000
|
||||
#define WGL_SWAP_UNDERLAY5 0x00100000
|
||||
#define WGL_SWAP_UNDERLAY6 0x00200000
|
||||
#define WGL_SWAP_UNDERLAY7 0x00400000
|
||||
#define WGL_SWAP_UNDERLAY8 0x00800000
|
||||
#define WGL_SWAP_UNDERLAY9 0x01000000
|
||||
#define WGL_SWAP_UNDERLAY10 0x02000000
|
||||
#define WGL_SWAP_UNDERLAY11 0x04000000
|
||||
#define WGL_SWAP_UNDERLAY12 0x08000000
|
||||
#define WGL_SWAP_UNDERLAY13 0x10000000
|
||||
#define WGL_SWAP_UNDERLAY14 0x20000000
|
||||
#define WGL_SWAP_UNDERLAY15 0x40000000
|
||||
typedef int (WINAPI * PFNCHOOSEPIXELFORMATPROC) (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd);
|
||||
typedef int (WINAPI * PFNDESCRIBEPIXELFORMATPROC) (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
typedef UINT (WINAPI * PFNGETENHMETAFILEPIXELFORMATPROC) (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
typedef int (WINAPI * PFNGETPIXELFORMATPROC) (HDC hdc);
|
||||
typedef BOOL (WINAPI * PFNSETPIXELFORMATPROC) (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
typedef BOOL (WINAPI * PFNSWAPBUFFERSPROC) (HDC hdc);
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYCONTEXTPROC) (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTPROC) (HDC hDc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATELAYERCONTEXTPROC) (HDC hDc, int level);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETECONTEXTPROC) (HGLRC oldContext);
|
||||
typedef BOOL (WINAPI * PFNWGLDESCRIBELAYERPLANEPROC) (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTCONTEXTPROC) (void);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTDCPROC) (void);
|
||||
typedef int (WINAPI * PFNWGLGETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
|
||||
typedef PROC (WINAPI * PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECURRENTPROC) (HDC hDc, HGLRC newContext);
|
||||
typedef BOOL (WINAPI * PFNWGLREALIZELAYERPALETTEPROC) (HDC hdc, int iLayerPlane, BOOL bRealize);
|
||||
typedef int (WINAPI * PFNWGLSETLAYERPALETTEENTRIESPROC) (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
|
||||
typedef BOOL (WINAPI * PFNWGLSHARELISTSPROC) (HGLRC hrcSrvShare, HGLRC hrcSrvSource);
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPLAYERBUFFERSPROC) (HDC hdc, UINT fuFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTBITMAPSWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESAPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
typedef BOOL (WINAPI * PFNWGLUSEFONTOUTLINESWPROC) (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
int WINAPI ChoosePixelFormat (HDC hDc, const PIXELFORMATDESCRIPTOR *pPfd);
|
||||
int WINAPI DescribePixelFormat (HDC hdc, int ipfd, UINT cjpfd, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
UINT WINAPI GetEnhMetaFilePixelFormat (HENHMETAFILE hemf, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
int WINAPI GetPixelFormat (HDC hdc);
|
||||
BOOL WINAPI SetPixelFormat (HDC hdc, int ipfd, const PIXELFORMATDESCRIPTOR *ppfd);
|
||||
BOOL WINAPI SwapBuffers (HDC hdc);
|
||||
BOOL WINAPI wglCopyContext (HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
|
||||
HGLRC WINAPI wglCreateContext (HDC hDc);
|
||||
HGLRC WINAPI wglCreateLayerContext (HDC hDc, int level);
|
||||
BOOL WINAPI wglDeleteContext (HGLRC oldContext);
|
||||
BOOL WINAPI wglDescribeLayerPlane (HDC hDc, int pixelFormat, int layerPlane, UINT nBytes, const LAYERPLANEDESCRIPTOR *plpd);
|
||||
HGLRC WINAPI wglGetCurrentContext (void);
|
||||
HDC WINAPI wglGetCurrentDC (void);
|
||||
int WINAPI wglGetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
|
||||
PROC WINAPI wglGetProcAddress (LPCSTR lpszProc);
|
||||
BOOL WINAPI wglMakeCurrent (HDC hDc, HGLRC newContext);
|
||||
BOOL WINAPI wglRealizeLayerPalette (HDC hdc, int iLayerPlane, BOOL bRealize);
|
||||
int WINAPI wglSetLayerPaletteEntries (HDC hdc, int iLayerPlane, int iStart, int cEntries, const COLORREF *pcr);
|
||||
BOOL WINAPI wglShareLists (HGLRC hrcSrvShare, HGLRC hrcSrvSource);
|
||||
BOOL WINAPI wglSwapLayerBuffers (HDC hdc, UINT fuFlags);
|
||||
BOOL WINAPI wglUseFontBitmaps (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
BOOL WINAPI wglUseFontBitmapsA (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
BOOL WINAPI wglUseFontBitmapsW (HDC hDC, DWORD first, DWORD count, DWORD listBase);
|
||||
BOOL WINAPI wglUseFontOutlines (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
BOOL WINAPI wglUseFontOutlinesA (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
BOOL WINAPI wglUseFontOutlinesW (HDC hDC, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf);
|
||||
#endif
|
||||
#endif /* WGL_VERSION_1_0 */
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
|
||||
VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
|
||||
BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
|
||||
BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_buffer_region */
|
||||
|
||||
#ifndef WGL_ARB_context_flush_control
|
||||
#define WGL_ARB_context_flush_control 1
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
|
||||
#endif /* WGL_ARB_context_flush_control */
|
||||
|
||||
#ifndef WGL_ARB_create_context
|
||||
#define WGL_ARB_create_context 1
|
||||
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
|
||||
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
||||
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
|
||||
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
|
||||
#define WGL_CONTEXT_FLAGS_ARB 0x2094
|
||||
#define ERROR_INVALID_VERSION_ARB 0x2095
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_create_context */
|
||||
|
||||
#ifndef WGL_ARB_create_context_no_error
|
||||
#define WGL_ARB_create_context_no_error 1
|
||||
#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
|
||||
#endif /* WGL_ARB_create_context_no_error */
|
||||
|
||||
#ifndef WGL_ARB_create_context_profile
|
||||
#define WGL_ARB_create_context_profile 1
|
||||
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
|
||||
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
|
||||
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
|
||||
#define ERROR_INVALID_PROFILE_ARB 0x2096
|
||||
#endif /* WGL_ARB_create_context_profile */
|
||||
|
||||
#ifndef WGL_ARB_create_context_robustness
|
||||
#define WGL_ARB_create_context_robustness 1
|
||||
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
|
||||
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
|
||||
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
|
||||
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
|
||||
#endif /* WGL_ARB_create_context_robustness */
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_ARB_extensions_string */
|
||||
|
||||
#ifndef WGL_ARB_framebuffer_sRGB
|
||||
#define WGL_ARB_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif /* WGL_ARB_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif
|
||||
#endif /* WGL_ARB_make_current_read */
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif /* WGL_ARB_multisample */
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pbuffer */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_ARB_pixel_format */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif /* WGL_ARB_pixel_format_float */
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
#endif /* WGL_ARB_render_texture */
|
||||
|
||||
#ifndef WGL_ARB_robustness_application_isolation
|
||||
#define WGL_ARB_robustness_application_isolation 1
|
||||
#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
|
||||
#endif /* WGL_ARB_robustness_application_isolation */
|
||||
|
||||
#ifndef WGL_ARB_robustness_share_group_isolation
|
||||
#define WGL_ARB_robustness_share_group_isolation 1
|
||||
#endif /* WGL_ARB_robustness_share_group_isolation */
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif /* WGL_3DFX_multisample */
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
|
||||
#endif
|
||||
#endif /* WGL_3DL_stereo_control */
|
||||
|
||||
#ifndef WGL_AMD_gpu_association
|
||||
#define WGL_AMD_gpu_association 1
|
||||
#define WGL_GPU_VENDOR_AMD 0x1F00
|
||||
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
|
||||
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
|
||||
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
|
||||
#define WGL_GPU_RAM_AMD 0x21A3
|
||||
#define WGL_GPU_CLOCK_AMD 0x21A4
|
||||
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
|
||||
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
|
||||
#define WGL_GPU_NUM_RB_AMD 0x21A7
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
|
||||
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
|
||||
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
|
||||
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
|
||||
INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
|
||||
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
|
||||
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
|
||||
BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
|
||||
BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
|
||||
HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
|
||||
VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
#endif /* WGL_AMD_gpu_association */
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#endif /* WGL_ATI_pixel_format_float */
|
||||
|
||||
#ifndef WGL_EXT_colorspace
|
||||
#define WGL_EXT_colorspace 1
|
||||
#define WGL_COLORSPACE_EXT 0x309D
|
||||
#define WGL_COLORSPACE_SRGB_EXT 0x3089
|
||||
#define WGL_COLORSPACE_LINEAR_EXT 0x308A
|
||||
#endif /* WGL_EXT_colorspace */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es2_profile
|
||||
#define WGL_EXT_create_context_es2_profile 1
|
||||
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es2_profile */
|
||||
|
||||
#ifndef WGL_EXT_create_context_es_profile
|
||||
#define WGL_EXT_create_context_es_profile 1
|
||||
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
|
||||
#endif /* WGL_EXT_create_context_es_profile */
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif /* WGL_EXT_depth_float */
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
|
||||
GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
|
||||
GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
|
||||
VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
|
||||
#endif
|
||||
#endif /* WGL_EXT_display_color_table */
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
const char *WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_extensions_string */
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
#endif /* WGL_EXT_framebuffer_sRGB */
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_make_current_read */
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif /* WGL_EXT_multisample */
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
|
||||
int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
|
||||
BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pbuffer */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
#endif /* WGL_EXT_pixel_format */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
#endif /* WGL_EXT_pixel_format_packed_float */
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglSwapIntervalEXT (int interval);
|
||||
int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif
|
||||
#endif /* WGL_EXT_swap_control */
|
||||
|
||||
#ifndef WGL_EXT_swap_control_tear
|
||||
#define WGL_EXT_swap_control_tear 1
|
||||
#endif /* WGL_EXT_swap_control_tear */
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_digital_video_control */
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
|
||||
BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
#endif /* WGL_I3D_gamma */
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
|
||||
BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
|
||||
BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
|
||||
BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
|
||||
BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
|
||||
BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
|
||||
BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
|
||||
BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
|
||||
BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
|
||||
BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
|
||||
BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
#endif /* WGL_I3D_genlock */
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
|
||||
BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
#endif /* WGL_I3D_image_buffer */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
|
||||
BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_lock */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
|
||||
BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
#endif /* WGL_I3D_swap_frame_usage */
|
||||
|
||||
#ifndef WGL_NV_DX_interop
|
||||
#define WGL_NV_DX_interop 1
|
||||
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
|
||||
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
|
||||
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
|
||||
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
|
||||
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
|
||||
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
|
||||
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
|
||||
HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
|
||||
BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
|
||||
HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||
BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
|
||||
BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
|
||||
BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||
#endif
|
||||
#endif /* WGL_NV_DX_interop */
|
||||
|
||||
#ifndef WGL_NV_DX_interop2
|
||||
#define WGL_NV_DX_interop2 1
|
||||
#endif /* WGL_NV_DX_interop2 */
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
#endif /* WGL_NV_copy_image */
|
||||
|
||||
#ifndef WGL_NV_delay_before_swap
|
||||
#define WGL_NV_delay_before_swap 1
|
||||
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
|
||||
#endif
|
||||
#endif /* WGL_NV_delay_before_swap */
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif /* WGL_NV_float_buffer */
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
};
|
||||
typedef struct _GPU_DEVICE *PGPU_DEVICE;
|
||||
#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
|
||||
BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
BOOL WINAPI wglDeleteDCNV (HDC hdc);
|
||||
#endif
|
||||
#endif /* WGL_NV_gpu_affinity */
|
||||
|
||||
#ifndef WGL_NV_multisample_coverage
|
||||
#define WGL_NV_multisample_coverage 1
|
||||
#define WGL_COVERAGE_SAMPLES_NV 0x2042
|
||||
#define WGL_COLOR_SAMPLES_NV 0x20B9
|
||||
#endif /* WGL_NV_multisample_coverage */
|
||||
|
||||
#ifndef WGL_NV_present_video
|
||||
#define WGL_NV_present_video 1
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
|
||||
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
|
||||
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
|
||||
#endif
|
||||
#endif /* WGL_NV_present_video */
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_NV_render_depth_texture 1
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif /* WGL_NV_render_depth_texture */
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_NV_render_texture_rectangle 1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif /* WGL_NV_render_texture_rectangle */
|
||||
|
||||
#ifndef WGL_NV_swap_group
|
||||
#define WGL_NV_swap_group 1
|
||||
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
|
||||
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
|
||||
BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
|
||||
BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
|
||||
BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
|
||||
BOOL WINAPI wglResetFrameCountNV (HDC hDC);
|
||||
#endif
|
||||
#endif /* WGL_NV_swap_group */
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
void WINAPI wglFreeMemoryNV (void *pointer);
|
||||
#endif
|
||||
#endif /* WGL_NV_vertex_array_range */
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_capture */
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
|
||||
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
|
||||
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
|
||||
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
|
||||
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
|
||||
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
|
||||
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
|
||||
#define WGL_VIDEO_OUT_FRAME 0x20C8
|
||||
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
|
||||
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
|
||||
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
|
||||
BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
|
||||
BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
|
||||
BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
|
||||
BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif
|
||||
#endif /* WGL_NV_video_output */
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
#endif /* WGL_OML_sync_control */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
282
raytracer/nvpro_core/KHR/khrplatform.h
Normal file
282
raytracer/nvpro_core/KHR/khrplatform.h
Normal file
|
|
@ -0,0 +1,282 @@
|
|||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are 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 Materials.
|
||||
**
|
||||
** THE MATERIALS ARE 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
||||
177
raytracer/nvpro_core/LICENSE
Normal file
177
raytracer/nvpro_core/LICENSE
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
21
raytracer/nvpro_core/PACKAGE-LICENSES/AntTweakBar-LICENSE.md
Normal file
21
raytracer/nvpro_core/PACKAGE-LICENSES/AntTweakBar-LICENSE.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
--- AntTweakBar license ---
|
||||
|
||||
Copyright (C) 2005-2013 Philippe Decaudin
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the
|
||||
use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including
|
||||
commercial applications, and to alter it and redistribute it freely, subject to
|
||||
the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim
|
||||
that you wrote the original software. If you use this software in a product,
|
||||
an acknowledgment in the product documentation would be appreciated but is not
|
||||
required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
MIT License
|
||||
|
||||
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.
|
||||
202
raytracer/nvpro_core/PACKAGE-LICENSES/OpenCL-Headers-LICENSE.md
Normal file
202
raytracer/nvpro_core/PACKAGE-LICENSES/OpenCL-Headers-LICENSE.md
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
11
raytracer/nvpro_core/PACKAGE-LICENSES/OpenEXR-LICENSE.md
Normal file
11
raytracer/nvpro_core/PACKAGE-LICENSES/OpenEXR-LICENSE.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Copyright (c) Contributors to the OpenEXR Project. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Copyright (c) 2004, 2005 Tristan Grimmer
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
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.
|
||||
201
raytracer/nvpro_core/PACKAGE-LICENSES/basis_universal-LICENSE.md
Normal file
201
raytracer/nvpro_core/PACKAGE-LICENSES/basis_universal-LICENSE.md
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
23
raytracer/nvpro_core/PACKAGE-LICENSES/boost-LICENSE.md
Normal file
23
raytracer/nvpro_core/PACKAGE-LICENSES/boost-LICENSE.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
23
raytracer/nvpro_core/PACKAGE-LICENSES/catch-LICENSE.md
Normal file
23
raytracer/nvpro_core/PACKAGE-LICENSES/catch-LICENSE.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
7
raytracer/nvpro_core/PACKAGE-LICENSES/cgltf-LICENSE.md
Normal file
7
raytracer/nvpro_core/PACKAGE-LICENSES/cgltf-LICENSE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Copyright (c) 2018-2021 Johannes Kuhlmann
|
||||
|
||||
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.
|
||||
23
raytracer/nvpro_core/PACKAGE-LICENSES/dlib-LICENSE.md
Normal file
23
raytracer/nvpro_core/PACKAGE-LICENSES/dlib-LICENSE.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
18
raytracer/nvpro_core/PACKAGE-LICENSES/doxygen-LICENSE.md
Normal file
18
raytracer/nvpro_core/PACKAGE-LICENSES/doxygen-LICENSE.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (C) 1997-2020 by Dimitri van Heesch
|
||||
|
||||
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.
|
||||
71
raytracer/nvpro_core/PACKAGE-LICENSES/dxc-LICENSE.md
Normal file
71
raytracer/nvpro_core/PACKAGE-LICENSES/dxc-LICENSE.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
==============================================================================
|
||||
LLVM Release License
|
||||
==============================================================================
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLVM Team
|
||||
|
||||
University of Illinois at Urbana-Champaign
|
||||
|
||||
http://llvm.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
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:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLVM Team, University of Illinois at
|
||||
Urbana-Champaign, nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this Software without specific
|
||||
prior written permission.
|
||||
|
||||
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
|
||||
CONTRIBUTORS 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 WITH THE
|
||||
SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
Copyrights and Licenses for Third Party Software Distributed with LLVM:
|
||||
==============================================================================
|
||||
The LLVM software contains code written by third parties. Such software will
|
||||
have its own individual LICENSE.TXT file in the directory in which it appears.
|
||||
This file will describe the copyrights, license, and restrictions which apply
|
||||
to that code.
|
||||
|
||||
The disclaimer of warranty in the University of Illinois Open Source License
|
||||
applies to all code in the LLVM Distribution, and nothing in any of the
|
||||
other licenses gives permission to use the names of the LLVM Team or the
|
||||
University of Illinois to endorse or promote products derived from this
|
||||
Software.
|
||||
|
||||
The following pieces of software have additional or alternate copyrights,
|
||||
licenses, and/or restrictions:
|
||||
|
||||
Program Directory
|
||||
------- ---------
|
||||
Autoconf llvm/autoconf
|
||||
llvm/projects/ModuleMaker/autoconf
|
||||
Google Test llvm/utils/unittest/googletest
|
||||
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
|
||||
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
|
||||
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
|
||||
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
|
||||
miniz llvm/lib/Miniz/miniz.c llvm/include/miniz/miniz.h llvm/lib/Miniz/LICENSE.txt
|
||||
27
raytracer/nvpro_core/PACKAGE-LICENSES/fmt-LICENSE.rst
Normal file
27
raytracer/nvpro_core/PACKAGE-LICENSES/fmt-LICENSE.rst
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors
|
||||
|
||||
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.
|
||||
|
||||
--- Optional exception to the license ---
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
22
raytracer/nvpro_core/PACKAGE-LICENSES/gl3w-LICENSE.md
Normal file
22
raytracer/nvpro_core/PACKAGE-LICENSES/gl3w-LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
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 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.
|
||||
22
raytracer/nvpro_core/PACKAGE-LICENSES/glfw-LICENSE.md
Normal file
22
raytracer/nvpro_core/PACKAGE-LICENSES/glfw-LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
|
||||
Copyright (c) 2006-2019 Camilla Löwy
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would
|
||||
be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
54
raytracer/nvpro_core/PACKAGE-LICENSES/glm-LICENSE.md
Normal file
54
raytracer/nvpro_core/PACKAGE-LICENSES/glm-LICENSE.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
================================================================================
|
||||
OpenGL Mathematics (GLM)
|
||||
--------------------------------------------------------------------------------
|
||||
GLM is licensed under The Happy Bunny License or MIT License
|
||||
|
||||
================================================================================
|
||||
The Happy Bunny License (Modified MIT License)
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - G-Truc Creation
|
||||
|
||||
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.
|
||||
|
||||
Restrictions:
|
||||
By making use of the Software for military purposes, you choose to make a
|
||||
Bunny unhappy.
|
||||
|
||||
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.
|
||||
|
||||
================================================================================
|
||||
The MIT License
|
||||
--------------------------------------------------------------------------------
|
||||
Copyright (c) 2005 - G-Truc Creation
|
||||
|
||||
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.
|
||||
111
raytracer/nvpro_core/PACKAGE-LICENSES/iconic-LICENSE.md
Normal file
111
raytracer/nvpro_core/PACKAGE-LICENSES/iconic-LICENSE.md
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
SIL OPEN FONT LICENSE Version 1.1
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
||||
|
||||
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Waybury
|
||||
|
||||
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.
|
||||
21
raytracer/nvpro_core/PACKAGE-LICENSES/imgui-LICENSE.md
Normal file
21
raytracer/nvpro_core/PACKAGE-LICENSES/imgui-LICENSE.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2022 Omar Cornut
|
||||
|
||||
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.
|
||||
5
raytracer/nvpro_core/PACKAGE-LICENSES/makeid-LICENSE.md
Normal file
5
raytracer/nvpro_core/PACKAGE-LICENSES/makeid-LICENSE.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Public Domain
|
||||
|
||||
This file is released in the hopes that it will be useful. Use in whatever way you like, but no guarantees that it
|
||||
actually works or fits any particular purpose. It has been unit-tested and benchmarked though, and seems to do
|
||||
what it was designed to do, and seems pretty quick at it too.
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
ISC License
|
||||
|
||||
Copyright (c) 2015, Mapbox
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
22
raytracer/nvpro_core/PACKAGE-LICENSES/miniz-LICENSE.md
Normal file
22
raytracer/nvpro_core/PACKAGE-LICENSES/miniz-LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright 2013-2014 RAD Game Tools and Valve Software
|
||||
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
|
||||
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2013-2022 Niels Lohmann
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright (C) 2004 Sam Hocevar
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
37
raytracer/nvpro_core/PACKAGE-LICENSES/stb-LICENSE.md
Normal file
37
raytracer/nvpro_core/PACKAGE-LICENSES/stb-LICENSE.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
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.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
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 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.
|
||||
22
raytracer/nvpro_core/PACKAGE-LICENSES/tinyexr-LICENSE.md
Normal file
22
raytracer/nvpro_core/PACKAGE-LICENSES/tinyexr-LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2014 - 2021, Syoyo Fujita and many contributors.
|
||||
All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the Syoyo Fujita nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
21
raytracer/nvpro_core/PACKAGE-LICENSES/tinygltf-LICENSE.md
Normal file
21
raytracer/nvpro_core/PACKAGE-LICENSES/tinygltf-LICENSE.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2017 Syoyo Fujita, Aurélien Chatelain and many contributors
|
||||
|
||||
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.
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2012-2019 Syoyo Fujita and many contributors.
|
||||
|
||||
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.
|
||||
22
raytracer/nvpro_core/PACKAGE-LICENSES/zlib-LICENSE.md
Normal file
22
raytracer/nvpro_core/PACKAGE-LICENSES/zlib-LICENSE.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright notice:
|
||||
|
||||
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jean-loup Gailly Mark Adler
|
||||
jloup@gzip.org madler@alumni.caltech.edu
|
||||
30
raytracer/nvpro_core/PACKAGE-LICENSES/zstd-LICENSE.md
Normal file
30
raytracer/nvpro_core/PACKAGE-LICENSES/zstd-LICENSE.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
BSD License
|
||||
|
||||
For Zstandard software
|
||||
|
||||
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name Facebook nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
48
raytracer/nvpro_core/README.md
Normal file
48
raytracer/nvpro_core/README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# nvpro_core
|
||||
|
||||
## Repository
|
||||
This folder is a repository of *shared source code* : most other samples use it as library or directly reference code from it.
|
||||
|
||||
It means that you must clone this repository (with submodules) prior to trying those samples that refer to this repository as a dependency.
|
||||
|
||||
## Folders
|
||||
* **cmake**: 'find' files to search for cmake packages
|
||||
* **doxygen**: folder for doxygen doc generation
|
||||
* **fileformats**: various helpers to load some files
|
||||
* **nvh**: API agnostic helpers to simplify the code of samples.
|
||||
* **nvgl**: helpers for OpenGL
|
||||
* **nvvk**: helpers for Vulkan (to aid extension use and simplify initialization of Vulkan structs, some files were generated from scripting)
|
||||
* **nvvkhl**: helpers for Vulkan High-Level for creating samples; applications, loading scenes, HDR-environment, G-Buffers, etc.
|
||||
* **nvvkhl/shaders**: commonly use functions for shading, tonemaper, etc.
|
||||
* **nvoptix**: helpers for Optix
|
||||
* **nvdx12**: helpers for DirectX 12
|
||||
* **nvmath**: math library used by most samples
|
||||
* **imgui**: a version of [imgui](https://github.com/ocornut/imgui) and some implementations to render it (derived from its examples).
|
||||
* **GL/KHR**: include files for OpenGL (we use a subset of extensions that is generated and defined by `nvgl/extensions_gl.lua`)
|
||||
* resources: icons etc.
|
||||
|
||||
## Files
|
||||
* **nvpsystem\[_linux|win32\].hpp/cpp**: defines the base class NVPSystem
|
||||
* **nvpwindow.hpp/cpp**: defines the main class NVPWindow
|
||||
* **docgen.py**: python script that generates README.md files from comments gathered in various headers
|
||||
* **CMakeLists.txt**: project definition for the nvpro_core library
|
||||
* **resources...**: win32 resources
|
||||
* **include_gl.h**: shortcut for including the file that contains the GL extension definitions
|
||||
* **platform.h / NvFoundation.h**: platform specific `NV_...` macros that aid cross platform coding
|
||||
|
||||
## Dependencies
|
||||
Some samples may rely on few additional libraries in order to compile (mostly for win32). You can find them in [third_party/binaries](https://github.com/nvpro-samples/third_party_binaries). The use of Vulkan or DirectX APIs requires that the appropriate SDKs are installed.
|
||||
|
||||
The minimum Vulkan SDK version is currently: 1.3.261.0
|
||||
|
||||
## License
|
||||
nvpro_core is licensed under the [Apache License 2.0](LICENSE).
|
||||
|
||||
## Third-Party Libraries
|
||||
This project embeds or includes (as submodules) several open-source libraries
|
||||
and/or code derived from them. All such libraries' licenses are included in the
|
||||
[PACKAGE-LICENSES](PACKAGE-LICENSES) folder.
|
||||
|
||||
The include file mechanism inside `nvh/shaderfilemanager.cpp` is derived from
|
||||
the [OpenGL Samples Pack](https://github.com/g-truc/ogl-samples). Only the hash
|
||||
combine logic was derived from Boost (https://www.boost.org/doc/libs/1_35_0/doc/html/boost/hash_combine_id241013.html).
|
||||
19
raytracer/nvpro_core/cmake/find/FindGLM.cmake
Normal file
19
raytracer/nvpro_core/cmake/find/FindGLM.cmake
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_path( GLM_INCLUDE_DIR glm/glm.hpp HINTS ${GLM_LOCATION}
|
||||
$ENV{GLM_LOCATION}
|
||||
${BASE_DIRECTORY}/nvpro_core/third_party/glm
|
||||
$ENV{VK_SDK_PATH}/include
|
||||
${VULKAN_HEADERS_OVERRIDE_INCLUDE_DIR}
|
||||
${Vulkan_INCLUDE_DIR} )
|
||||
|
||||
# Handle REQUIRD argument, define *_FOUND variable
|
||||
find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR)
|
||||
|
||||
# Define GLM_INCLUDE_DIRS
|
||||
if (GLM_FOUND)
|
||||
set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# Hide some variables
|
||||
mark_as_advanced(GLM_INCLUDE_DIR)
|
||||
71
raytracer/nvpro_core/cmake/find/FindKitSDK.cmake
Normal file
71
raytracer/nvpro_core/cmake/find/FindKitSDK.cmake
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# Try to find KIT_SDK project so and include file
|
||||
#
|
||||
unset(KIT_SDK_LIBRARIES CACHE)
|
||||
unset(KIT_SDK_INCLUDE_DIR CACHE)
|
||||
unset(KIT_SDK_LIBRARY_DIR CACHE)
|
||||
unset(KIT_SDK_FOUND CACHE)
|
||||
unset(KIT_SDK_ALL_DEPS_FILE CACHE)
|
||||
|
||||
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
endif()
|
||||
|
||||
if(USE_PACKMAN)
|
||||
message(STATUS "attempting to using packman to source kit-sdk")
|
||||
|
||||
pull_dependencies(DEPENDENCY_FILE "kit-sdk-deps.packman.xml")
|
||||
|
||||
set(KitSDK_DIR "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/kit")
|
||||
|
||||
find_file(KIT_SDK_ALL_DEPS_FILE
|
||||
NAMES all-deps.packman.xml
|
||||
PATHS ${KitSDK_DIR}/dev
|
||||
)
|
||||
if (NOT KIT_SDK_ALL_DEPS_FILE)
|
||||
message(WARNING "Kit all-deps.packman.xml not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
find_file(KIT_SDK_LAUNCH_SCRIPT
|
||||
NAMES omni.app.full.bat
|
||||
PATHS ${KitSDK_DIR}
|
||||
)
|
||||
find_file(KIT_APP
|
||||
NAMES kit.exe
|
||||
PATHS ${KitSDK_DIR}
|
||||
)
|
||||
elseif(UNIX)
|
||||
find_file(KIT_SDK_LAUNCH_SCRIPT
|
||||
NAMES omni.app.full.sh
|
||||
PATHS ${KitSDK_DIR}
|
||||
)
|
||||
find_file(KIT_APP
|
||||
NAMES kit
|
||||
PATHS ${KitSDK_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(KIT_SDK_LAUNCH_SCRIPT)
|
||||
message(STATUS " Kit launch script found at ${KIT_SDK_LAUNCH_SCRIPT}")
|
||||
else(KIT_SDK_LAUNCH_SCRIPT)
|
||||
message(WARNING "
|
||||
Kit launch script not found.")
|
||||
endif(KIT_SDK_LAUNCH_SCRIPT)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(KitSDK DEFAULT_MSG
|
||||
KIT_SDK_LAUNCH_SCRIPT
|
||||
KIT_APP
|
||||
KitSDK_DIR
|
||||
KIT_SDK_ALL_DEPS_FILE
|
||||
)
|
||||
|
||||
# Do we have to rewrite the variable here...
|
||||
set(KIT_SDK_LAUNCH_SCRIPT ${KIT_SDK_LAUNCH_SCRIPT} CACHE FILEPATH "filepath")
|
||||
set(KIT_APP ${KIT_APP} CACHE FILEPATH "filepath")
|
||||
set(KitSDK_DIR ${KitSDK_DIR} CACHE PATH "path")
|
||||
|
||||
mark_as_advanced( KIT_SDK_FOUND )
|
||||
114
raytracer/nvpro_core/cmake/find/FindNVML.cmake
Normal file
114
raytracer/nvpro_core/cmake/find/FindNVML.cmake
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Try to find NVML.
|
||||
# Once done this will define
|
||||
#
|
||||
# NVML_FOUND - whether all of the components of NVML were found
|
||||
# NVML_INCLUDE_DIRS - same as the CUDA include dir
|
||||
# NVML_LIBRARIES - the linker library for NVML
|
||||
#
|
||||
# The NVML headers and linker library are distributed as part of the CUDA SDK.
|
||||
# We use the variables set by finding CUDA
|
||||
# (see https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html and
|
||||
# https://cmake.org/cmake/help/v3.3/module/FindCUDA.html)
|
||||
# However, the shared library (DLL on Windows) should be found at runtime.
|
||||
#
|
||||
# Please note that on Windows, NVML is only available for 64-bit systems.
|
||||
set(NVML_FOUND OFF)
|
||||
|
||||
# FindCUDAToolkit is the new module to use here, but it's only available in
|
||||
# CMake 3.17+.
|
||||
# FindCUDA is available until 3.27. So we switch between the two
|
||||
# depending on the CMake version:
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.17.0)
|
||||
find_package(CUDA)
|
||||
if(WIN32) # Windows
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_ARCH "x64")
|
||||
else()
|
||||
message(FATAL_ERROR "FindNVML.cmake was called with a 32-bit platform on \
|
||||
Windows, but NVML and nvpro_core are not available for 32-bit systems on \
|
||||
Windows. Did you mean to use a 64-bit platform?")
|
||||
endif()
|
||||
endif()
|
||||
set(_CUDA_LIB_DIR ${CUDA_TOOLKIT_ROOT_DIR}/lib/${_ARCH})
|
||||
set(_CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_ROOT_DIR}/include)
|
||||
else() # CMake >= 3.17.0
|
||||
find_package(CUDAToolkit)
|
||||
set(_CUDA_LIB_DIR ${CUDAToolkit_LIBRARY_DIR})
|
||||
set(_CUDA_INCLUDE_DIRS ${CUDAToolkit_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Finding CUDA doesn't guarantee that NVML was installed with CUDA, since
|
||||
# one can turn that off during installation. Search for NVML in a number of
|
||||
# locations:
|
||||
|
||||
find_library(NVML_LIBRARIES NAMES nvml nvidia-ml PATHS ${_CUDA_LIB_DIR})
|
||||
|
||||
if(NOT NVML_LIBRARIES)
|
||||
if(WIN32)
|
||||
message(WARNING "CMake couldn't locate the NVML library, so compilation \
|
||||
will likely fail. You may need to install the CUDA toolkit.")
|
||||
else()
|
||||
message(WARNING "CMake couldn't locate the nvidia-ml library, so \
|
||||
compilation will likely fail. You may need to install NVML using your OS' \
|
||||
package manager; for instance, by running `sudo apt install libnvidia-ml-dev`.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(NVML_INCLUDE_DIRS nvml.h
|
||||
${NVML_LOCATION}
|
||||
$ENV{NVML_LOCATION}
|
||||
${_CUDA_INCLUDE_DIRS}
|
||||
# if no CUDA, let's try to find nvml locally in our third_party supplement.
|
||||
# FindNVML.cmake is located in nvpro_core/cmake/find.
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../third_party/binaries/nvml
|
||||
)
|
||||
|
||||
if(NOT NVML_INCLUDE_DIRS)
|
||||
message(WARNING "
|
||||
NVML headers not found. To explicitly locate it, set NVML_LOCATION,
|
||||
which should be a folder containing nvml.h."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NVML_LIBRARIES AND NVML_INCLUDE_DIRS)
|
||||
set(NVML_FOUND ON)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(NVML DEFAULT_MSG
|
||||
NVML_INCLUDE_DIRS
|
||||
NVML_LIBRARIES
|
||||
)
|
||||
|
||||
mark_as_advanced(
|
||||
NVML_INCLUDE_DIRS
|
||||
NVML_LIBRARIES
|
||||
)
|
||||
99
raytracer/nvpro_core/cmake/find/FindNsightAftermath.cmake
Normal file
99
raytracer/nvpro_core/cmake/find/FindNsightAftermath.cmake
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
#
|
||||
# Copyright (c) 2021 NVIDIA Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
#.rst:
|
||||
# FindNsightAftermath
|
||||
# ----------
|
||||
#
|
||||
# Try to find the NVIDIA Nsight Aftermath SDK based on the NSIGHT_AFTERMATH_SDK environment variable
|
||||
#
|
||||
# IMPORTED Targets
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines :prop_tgt:`IMPORTED` target ``NsightAftermath::NsightAftermath``, if
|
||||
# the NVIDIA Nsight Aftermath SDK has been found.
|
||||
#
|
||||
# Result Variables
|
||||
# ^^^^^^^^^^^^^^^^
|
||||
#
|
||||
# This module defines the following variables::
|
||||
#
|
||||
# NsightAftermath_FOUND - True if the NVIDIA Nsight Aftermath SDK was found
|
||||
# NsightAftermath_INCLUDE_DIRS - include directories for the NVIDIA Nsight Aftermath SDK
|
||||
# NsightAftermath_LIBRARIES - link against this library to use the NVIDIA Nsight Aftermath SDK
|
||||
# NsightAftermath_DLLS - .dll or .so files needed for distribution
|
||||
#
|
||||
# The module will also define two cache variables::
|
||||
#
|
||||
# NsightAftermath_INCLUDE_DIR - the NVIDIA Nsight Aftermath SDK include directory
|
||||
# NsightAftermath_LIBRARY - the path to the NVIDIA Nsight Aftermath SDK library
|
||||
#
|
||||
|
||||
if(WIN32 OR UNIX)
|
||||
find_path(NsightAftermath_INCLUDE_DIR
|
||||
NAMES GFSDK_Aftermath.h
|
||||
PATHS
|
||||
"${NSIGHT_AFTERMATH_SDK}/include"
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
find_library(NsightAftermath_LIBRARY
|
||||
NAMES GFSDK_Aftermath_Lib.x64
|
||||
PATHS
|
||||
"${NSIGHT_AFTERMATH_SDK}/lib/x64"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
find_library(NsightAftermath_LIBRARY
|
||||
NAMES GFSDK_Aftermath_Lib.x86
|
||||
PATHS
|
||||
"${NSIGHT_AFTERMATH_SDK}/lib/x86"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
find_path(NsightAftermath_INCLUDE_DIR
|
||||
NAMES GFSDK_Aftermath.h
|
||||
PATHS
|
||||
"${NSIGHT_AFTERMATH_SDK}/include")
|
||||
find_library(NsightAftermath_LIBRARY
|
||||
NAMES GFSDK_Aftermath_Lib
|
||||
PATHS
|
||||
"${NSIGHT_AFTERMATH_SDK}/lib")
|
||||
endif()
|
||||
|
||||
string(REPLACE ".lib" ".dll" NsightAftermath_DLLS ${NsightAftermath_LIBRARY})
|
||||
|
||||
set(NsightAftermath_LIBRARIES ${NsightAftermath_LIBRARY})
|
||||
set(NsightAftermath_INCLUDE_DIRS ${NsightAftermath_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(NsightAftermath
|
||||
DEFAULT_MSG
|
||||
NsightAftermath_LIBRARY NsightAftermath_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(NsightAftermath_INCLUDE_DIR NsightAftermath_LIBRARY)
|
||||
|
||||
if(NsightAftermath_FOUND AND NOT TARGET NsightAftermath::NsightAftermath)
|
||||
add_library(NsightAftermath::NsightAftermath UNKNOWN IMPORTED)
|
||||
set_target_properties(NsightAftermath::NsightAftermath PROPERTIES
|
||||
IMPORTED_LOCATION "${NsightAftermath_LIBRARIES}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${NsightAftermath_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if(NOT NsightAftermath_FOUND)
|
||||
message("NSIGHT_AFTERMATH_SDK environment variable not set to a valid location (value: ${NSIGHT_AFTERMATH_SDK})")
|
||||
endif()
|
||||
|
||||
53
raytracer/nvpro_core/cmake/find/FindOmniUsdResolver.cmake
Normal file
53
raytracer/nvpro_core/cmake/find/FindOmniUsdResolver.cmake
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Try to find OMNI_USD_RESOLVER project so and include file
|
||||
#
|
||||
unset(OMNI_USD_RESOLVER_LIBRARIES CACHE)
|
||||
unset(OMNI_USD_RESOLVER_INCLUDE_DIR CACHE)
|
||||
unset(OMNI_USD_RESOLVER_LIBRARY_DIR CACHE)
|
||||
unset(OMNI_USD_RESOLVER_FOUND CACHE)
|
||||
|
||||
if ("nopy" IN_LIST OmniUsdResolver_FIND_COMPONENTS OR (DEFINED PYTHON_VERSION AND PYTHON_VERSION EQUAL "nopy"))
|
||||
set(INCLUDE_PYTHON 0)
|
||||
set(PYTHON_VERSION "nopy")
|
||||
elseif()
|
||||
set(INCLUDE_PYTHON 1)
|
||||
if (NOT DEFINED PYTHON_VERSION)
|
||||
message(STATUS "PYTHON_VERSION must be set to compatible python version string ['py37, 'py310', or 'nopy']")
|
||||
message(STATUS "Defaulting PYTHON_VERSION to 'py37'")
|
||||
set(PYTHON_VERSION "py37")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
endif()
|
||||
|
||||
if(USE_PACKMAN)
|
||||
message(STATUS "attempting to using packman to source omni usd resolver")
|
||||
|
||||
pull_dependencies(DEPENDENCY_FILE "omniusdresolver-deps.packman.xml")
|
||||
|
||||
set(OMNI_USD_RESOLVER_DIR "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/omni_usd_resolver")
|
||||
endif()
|
||||
|
||||
#message("OMNI_USD_RESOLVER_DIR: " ${OMNI_USD_RESOLVER_DIR})
|
||||
|
||||
if(OMNI_USD_RESOLVER_DIR)
|
||||
set(OMNI_USD_RESOLVER_PLUGINS_DIR "${OMNI_USD_RESOLVER_DIR}/$<IF:$<CONFIG:Debug>,debug,release>")
|
||||
set(OMNI_USD_RESOLVER_RESOURCES_DIR "${OMNI_USD_RESOLVER_DIR}/$<IF:$<CONFIG:Debug>,debug,release>/usd/omniverse/resources")
|
||||
else(OMNI_USD_RESOLVER_DIR)
|
||||
message(WARNING "Omni usd resolver plugin not found.")
|
||||
endif(OMNI_USD_RESOLVER_DIR)
|
||||
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(OmniUsdResolver DEFAULT_MSG
|
||||
OMNI_USD_RESOLVER_PLUGINS_DIR
|
||||
OMNI_USD_RESOLVER_RESOURCES_DIR
|
||||
)
|
||||
|
||||
# Do we have to rewrite the variable here...
|
||||
set(OMNI_USD_RESOLVER_PLUGINS_DIR ${OMNI_USD_RESOLVER_PLUGINS_DIR} CACHE PATH "path")
|
||||
set(OMNI_USD_RESOLVER_RESOURCES_DIR ${OMNI_USD_RESOLVER_RESOURCES_DIR} CACHE PATH "path")
|
||||
|
||||
mark_as_advanced( OMNI_USD_RESOLVER_FOUND )
|
||||
171
raytracer/nvpro_core/cmake/find/FindOptix.cmake
Normal file
171
raytracer/nvpro_core/cmake/find/FindOptix.cmake
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
# Try to find OptiX project dll/so and headers
|
||||
#
|
||||
|
||||
# outputs
|
||||
unset(OPTIX_DLL CACHE)
|
||||
unset(OPTIX_LIB CACHE)
|
||||
unset(OPTIX_FOUND CACHE)
|
||||
unset(OPTIX_INCLUDE_DIR CACHE)
|
||||
|
||||
# OPTIX_LOCATION can be setup to search versions somewhere else
|
||||
|
||||
macro ( folder_list result curdir substring )
|
||||
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*${substring}*)
|
||||
SET(dirlist "")
|
||||
foreach ( child ${children})
|
||||
IF(IS_DIRECTORY ${curdir}/${child})
|
||||
LIST(APPEND dirlist ${child})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
SET(${result} ${dirlist})
|
||||
ENDMACRO()
|
||||
|
||||
macro(_find_version_path targetVersion targetPath rootName searchList )
|
||||
unset ( targetVersion )
|
||||
unset ( targetPath )
|
||||
SET ( bestver "0.0.0" )
|
||||
SET ( bestpath "" )
|
||||
foreach ( basedir ${searchList} )
|
||||
folder_list ( dirList ${basedir} ${rootName} )
|
||||
foreach ( checkdir ${dirList} )
|
||||
string ( REGEX MATCH "${rootName}(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" result "${checkdir}" )
|
||||
if ( "${result}" STREQUAL "${checkdir}" )
|
||||
# found a path with versioning
|
||||
SET ( ver "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${CMAKE_MATCH_4}" )
|
||||
if ( ver VERSION_GREATER bestver )
|
||||
SET ( bestver ${ver} )
|
||||
SET ( bestmajorver ${CMAKE_MATCH_2})
|
||||
SET ( bestminorver ${CMAKE_MATCH_3})
|
||||
SET ( bestpath "${basedir}/${checkdir}" )
|
||||
endif ()
|
||||
endif()
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
SET ( ${targetVersion} "${bestver}" )
|
||||
SET ( ${targetPath} "${bestpath}" )
|
||||
endmacro()
|
||||
|
||||
macro(_find_files targetVar incDir dllName dllName64 folder)
|
||||
unset ( fileList )
|
||||
if(ARCH STREQUAL "x86")
|
||||
file(GLOB fileList "${${incDir}}/../${folder}${dllName}")
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
file(GLOB fileList "${${incDir}}/${folder}${dllName}")
|
||||
endif()
|
||||
else()
|
||||
file(GLOB fileList "${${incDir}}/../${folder}${dllName64}")
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
file(GLOB fileList "${${incDir}}/${folder}${dllName64}")
|
||||
endif()
|
||||
endif()
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
message(STATUS "MISSING: unable to find ${targetVar} files (${folder}${dllName}, ${folder}${dllName64})" )
|
||||
set (${targetVar} "NOTFOUND")
|
||||
endif()
|
||||
list(APPEND ${targetVar} ${fileList} )
|
||||
|
||||
# message ( "File list: ${${targetVar}}" ) #-- debugging
|
||||
endmacro()
|
||||
|
||||
if (DEFINED OPTIX_LOCATION OR DEFINED ENV{OPTIX_LOCATION} )
|
||||
Message(STATUS "using OPTIX_LOCATION (${OPTIX_LOCATION})...")
|
||||
if(NOT DEFINED OPTIX_LOCATION)
|
||||
if(DEFINED ENV{OPTIX_LOCATION})
|
||||
set(OPTIX_LOCATION $ENV{OPTIX_LOCATION})
|
||||
endif()
|
||||
endif()
|
||||
# Locate by version failed. Handle user override for OPTIX_LOCATION.
|
||||
string ( REGEX MATCH ".*([0-9]+).([0-9]+).([0-9]+)(.*)$" result "${OPTIX_LOCATION}" )
|
||||
if ( "${result}" STREQUAL "${OPTIX_LOCATION}" )
|
||||
SET ( bestver "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" )
|
||||
SET ( bestmajorver ${CMAKE_MATCH_1})
|
||||
SET ( bestminorver ${CMAKE_MATCH_2})
|
||||
Message(STATUS "found version ${bestver}")
|
||||
else()
|
||||
Message(WARNING "Could NOT extract the version from OptiX folder : ${result}")
|
||||
endif()
|
||||
find_path( OPTIX_INCLUDE_DIR optix.h ${OPTIX_LOCATION}/include )
|
||||
if ( OPTIX_INCLUDE_DIR )
|
||||
set (OPTIX_ROOT_DIR ${OPTIX_INCLUDE_DIR}/../ )
|
||||
endif()
|
||||
endif()
|
||||
if(NOT DEFINED OPTIX_ROOT_DIR)
|
||||
# Locate OptiX by version
|
||||
set ( SEARCH_PATHS
|
||||
$ENV{OPTIX_LOCATION}
|
||||
${OPTIX_LOCATION}
|
||||
${PROJECT_SOURCE_DIR}/../LocalPackages/Optix
|
||||
${PROJECT_SOURCE_DIR}/../../LocalPackages/Optix
|
||||
${PROJECT_SOURCE_DIR}/../../../LocalPackages/Optix
|
||||
C:/ProgramData/NVIDIA\ Corporation
|
||||
|
||||
)
|
||||
|
||||
_find_version_path ( OPTIX_VERSION OPTIX_ROOT_DIR "OptiX" "${SEARCH_PATHS}" )
|
||||
|
||||
message ( STATUS "OptiX version: ${OPTIX_VERSION}")
|
||||
endif()
|
||||
|
||||
if (OPTIX_ROOT_DIR)
|
||||
|
||||
if (WIN32)
|
||||
#-------- Locate DLLS
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optix.${bestmajorver}.${bestminorver}.0.dll" "bin64/optix.${bestmajorver}.${bestminorver}.0.dll" "")
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optixu.${bestmajorver}.${bestminorver}.0.dll" "bin64/optixu.${bestmajorver}.${bestminorver}.0.dll" "")
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/optix_prime.${bestmajorver}.${bestminorver}.0.dll" "bin64/optix_prime.${bestmajorver}.${bestminorver}.0.dll" "")
|
||||
|
||||
#-------- Locate LIBS
|
||||
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optix.${bestmajorver}.${bestminorver}.0.lib" "lib64/optix.${bestmajorver}.${bestminorver}.0.lib" "")
|
||||
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optixu.${bestmajorver}.${bestminorver}.0.lib" "lib64/optixu.${bestmajorver}.${bestminorver}.0.lib" "")
|
||||
_find_files( OPTIX_LIB OPTIX_ROOT_DIR "lib/optix_prime.${bestmajorver}.${bestminorver}.0.lib" "lib64/optix_prime.${bestmajorver}.${bestminorver}.0.lib" "")
|
||||
if(NOT OPTIX_LIB)
|
||||
message(STATUS "setting OPTIX_LIB to ${OPTIX_LIB}" )
|
||||
endif()
|
||||
endif(WIN32)
|
||||
|
||||
if (UNIX)
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptix.so" "lib64/liboptix.so" "" )
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptixu.so" "lib64/liboptixu.so" "" )
|
||||
_find_files( OPTIX_DLL OPTIX_ROOT_DIR "lib/liboptix_prime.so" "lib64/liboptix_prime.so" "" )
|
||||
|
||||
set(OPTIX_LIB ${OPTIX_DLL})
|
||||
|
||||
endif(UNIX)
|
||||
|
||||
#-------- Locate HEADERS
|
||||
_find_files( OPTIX_HEADERS OPTIX_ROOT_DIR "optix.h" "optix.h" "include/" )
|
||||
|
||||
|
||||
if(OPTIX_DLL)
|
||||
set( OPTIX_FOUND "YES" )
|
||||
else()
|
||||
message(STATUS "setting OPTIX_DLL to ${OPTIX_DLL}" )
|
||||
endif(OPTIX_DLL)
|
||||
else(OPTIX_ROOT_DIR)
|
||||
|
||||
message(WARNING "
|
||||
OPTIX not found.
|
||||
The OPTIX folder you would specify with OPTIX_LOCATION should contain:
|
||||
- lib[64] folder: containing the Optix[64_]*.dll or *.so
|
||||
- include folder: containing the include files"
|
||||
)
|
||||
endif(OPTIX_ROOT_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
SET(OPTIX_DLL ${OPTIX_DLL} CACHE PATH "path")
|
||||
SET(OPTIX_LIB ${OPTIX_LIB} CACHE PATH "path")
|
||||
SET(OPTIX_INCLUDE_DIR "${OPTIX_ROOT_DIR}/include" CACHE PATH "path")
|
||||
add_definitions("-DOPTIX_PATH=R\"(${OPTIX_ROOT_DIR})\"")
|
||||
add_definitions("-DOPTIX_VERSION_STR=\"${OPTIX_VERSION}\"")
|
||||
|
||||
find_package_handle_standard_args(OPTIX DEFAULT_MSG
|
||||
OPTIX_INCLUDE_DIR
|
||||
OPTIX_DLL
|
||||
)
|
||||
|
||||
mark_as_advanced( OPTIX_FOUND )
|
||||
|
||||
134
raytracer/nvpro_core/cmake/find/FindOptix7.cmake
Normal file
134
raytracer/nvpro_core/cmake/find/FindOptix7.cmake
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
# Try to find OptiX project dll/so and headers
|
||||
#
|
||||
|
||||
# outputs
|
||||
unset(OPTIX7_DLL CACHE)
|
||||
unset(OPTIX7_LIB CACHE)
|
||||
unset(OPTIX7_FOUND CACHE)
|
||||
unset(OPTIX7_INCLUDE_DIR CACHE)
|
||||
|
||||
# OPTIX7_LOCATION can be setup to search versions somewhere else
|
||||
|
||||
macro ( folder_list result curdir substring )
|
||||
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*${substring}*)
|
||||
SET(dirlist "")
|
||||
foreach ( child ${children})
|
||||
IF(IS_DIRECTORY ${curdir}/${child})
|
||||
LIST(APPEND dirlist ${child})
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
SET(${result} ${dirlist})
|
||||
ENDMACRO()
|
||||
|
||||
macro(_find_version_path targetVersion targetPath rootName searchList )
|
||||
unset ( targetVersion )
|
||||
unset ( targetPath )
|
||||
SET ( bestver "0.0.0" )
|
||||
SET ( bestpath "" )
|
||||
foreach ( basedir ${searchList} )
|
||||
folder_list ( dirList ${basedir} ${rootName} )
|
||||
foreach ( checkdir ${dirList} )
|
||||
string ( REGEX MATCH "${rootName}(.*)([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$" result "${checkdir}" )
|
||||
if ( "${result}" STREQUAL "${checkdir}" )
|
||||
# found a path with versioning
|
||||
SET ( ver "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}.${CMAKE_MATCH_4}" )
|
||||
if ( ver VERSION_GREATER bestver )
|
||||
SET ( bestver ${ver} )
|
||||
SET ( bestmajorver ${CMAKE_MATCH_2})
|
||||
SET ( bestminorver ${CMAKE_MATCH_3})
|
||||
SET ( bestpath "${basedir}/${checkdir}" )
|
||||
endif ()
|
||||
endif()
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
SET ( ${targetVersion} "${bestver}" )
|
||||
SET ( ${targetPath} "${bestpath}" )
|
||||
endmacro()
|
||||
|
||||
macro(_find_files targetVar incDir dllName dllName64 folder)
|
||||
unset ( fileList )
|
||||
if(ARCH STREQUAL "x86")
|
||||
file(GLOB fileList "${${incDir}}/../${folder}${dllName}")
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
file(GLOB fileList "${${incDir}}/${folder}${dllName}")
|
||||
endif()
|
||||
else()
|
||||
file(GLOB fileList "${${incDir}}/../${folder}${dllName64}")
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
file(GLOB fileList "${${incDir}}/${folder}${dllName64}")
|
||||
endif()
|
||||
endif()
|
||||
list(LENGTH fileList NUMLIST)
|
||||
if(NUMLIST EQUAL 0)
|
||||
message(STATUS "MISSING: unable to find ${targetVar} files (${folder}${dllName}, ${folder}${dllName64})" )
|
||||
set (${targetVar} "NOTFOUND")
|
||||
endif()
|
||||
list(APPEND ${targetVar} ${fileList} )
|
||||
|
||||
# message ( "File list: ${${targetVar}}" ) #-- debugging
|
||||
endmacro()
|
||||
|
||||
if (DEFINED OPTIX7_LOCATION OR DEFINED ENV{OPTIX7_LOCATION} )
|
||||
Message(STATUS "using OPTIX7_LOCATION (${OPTIX7_LOCATION})...")
|
||||
if(NOT DEFINED OPTIX7_LOCATION)
|
||||
if(DEFINED ENV{OPTIX7_LOCATION})
|
||||
set(OPTIX7_LOCATION $ENV{OPTIX7_LOCATION})
|
||||
endif()
|
||||
endif()
|
||||
# Locate by version failed. Handle user override for OPTIX7_LOCATION.
|
||||
string ( REGEX MATCH ".*([7]+).([0-9]+).([0-9]+)(.*)$" result "${OPTIX7_LOCATION}" )
|
||||
if ( "${result}" STREQUAL "${OPTIX7_LOCATION}" )
|
||||
SET ( bestver "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" )
|
||||
SET ( bestmajorver ${CMAKE_MATCH_1})
|
||||
SET ( bestminorver ${CMAKE_MATCH_2})
|
||||
Message(STATUS "found version ${bestver}")
|
||||
else()
|
||||
Message(WARNING "Could NOT extract the version from OptiX7 folder : ${result}")
|
||||
endif()
|
||||
find_path( OPTIX7_INCLUDE_DIR optix.h ${OPTIX7_LOCATION}/include )
|
||||
if ( OPTIX7_INCLUDE_DIR )
|
||||
set (OPTIX7_ROOT_DIR ${OPTIX7_INCLUDE_DIR}/../ )
|
||||
endif()
|
||||
endif()
|
||||
if(NOT DEFINED OPTIX7_ROOT_DIR)
|
||||
# Locate OptiX by version
|
||||
set ( SEARCH_PATHS
|
||||
$ENV{OPTIX7_LOCATION}
|
||||
${OPTIX7_LOCATION}
|
||||
${PROJECT_SOURCE_DIR}/../LocalPackages/Optix
|
||||
${PROJECT_SOURCE_DIR}/../../LocalPackages/Optix
|
||||
${PROJECT_SOURCE_DIR}/../../../LocalPackages/Optix
|
||||
C:/ProgramData/NVIDIA\ Corporation
|
||||
|
||||
)
|
||||
|
||||
_find_version_path ( OPTIX7_VERSION OPTIX7_ROOT_DIR "OptiX" "${SEARCH_PATHS}" )
|
||||
|
||||
message ( STATUS "OptiX version: ${OPTIX7_VERSION}")
|
||||
endif()
|
||||
|
||||
if (OPTIX7_ROOT_DIR)
|
||||
#-------- Locate HEADERS
|
||||
_find_files( OPTIX7_HEADERS OPTIX7_ROOT_DIR "optix.h" "optix.h" "include/" )
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
SET(OPTIX7_INCLUDE_DIR "${OPTIX7_ROOT_DIR}/include" CACHE PATH "path")
|
||||
add_definitions("-DOPTIX7_PATH=R\"(${OPTIX7_ROOT_DIR})\"")
|
||||
add_definitions("-DOPTIX7_VERSION_STR=\"${OPTIX7_VERSION}\"")
|
||||
|
||||
else(OPTIX7_ROOT_DIR)
|
||||
|
||||
message(WARNING "
|
||||
OPTIX not found.
|
||||
The OPTIX folder you would specify with OPTIX7_LOCATION should contain:
|
||||
- lib[64] folder: containing the Optix[64_]*.dll or *.so
|
||||
- include folder: containing the include files"
|
||||
)
|
||||
endif(OPTIX7_ROOT_DIR)
|
||||
|
||||
find_package_handle_standard_args(Optix7 DEFAULT_MSG OPTIX7_ROOT_DIR)
|
||||
mark_as_advanced( OPTIX7_FOUND )
|
||||
|
||||
48
raytracer/nvpro_core/cmake/find/FindPybind11.cmake
Normal file
48
raytracer/nvpro_core/cmake/find/FindPybind11.cmake
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Try to find PYBIND11 project so and include file
|
||||
#
|
||||
set(PYBIND11_LOCATION "" CACHE STRING "Set to location of pybind11 library/headers")
|
||||
unset(PYBIND11_INCLUDE_DIR CACHE)
|
||||
unset(PYBIND11_FOUND CACHE)
|
||||
|
||||
if(EXISTS ${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
include(${BASE_DIRECTORY}/nvpro_core/cmake/utilities.cmake)
|
||||
endif()
|
||||
|
||||
if(USE_PACKMAN)
|
||||
message(STATUS "attempting to using packman to source pybind11")
|
||||
|
||||
pull_dependencies(DEPENDENCY_FILE "pybind11-deps.packman.xml")
|
||||
|
||||
set(PYBIND11_LOCATION "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/pybind11")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PYBIND11_LOCATION)
|
||||
message(WARNING "PYBIND11_LOCATION is not defined")
|
||||
elseif(NOT EXISTS ${PYBIND11_LOCATION})
|
||||
message(WARNING "PYBIND11_LOCATION doesn't exist")
|
||||
endif()
|
||||
|
||||
find_path(PYBIND11_INCLUDE_DIR
|
||||
NAMES pybind11/pybind11.h
|
||||
PATHS ${PYBIND11_LOCATION}
|
||||
)
|
||||
|
||||
if(PYBIND11_INCLUDE_DIR)
|
||||
message(STATUS " pybind11.h found in ${PYBIND11_INCLUDE_DIR}")
|
||||
|
||||
set( PYBIND11_FOUND "YES" )
|
||||
|
||||
else(PYBIND11_INCLUDE_DIR)
|
||||
message(WARNING "
|
||||
pybind11 not found.")
|
||||
endif(PYBIND11_INCLUDE_DIR)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(Pybind11 DEFAULT_MSG
|
||||
PYBIND11_INCLUDE_DIR
|
||||
)
|
||||
|
||||
set(PYBIND11_INCLUDE_DIR ${PYBIND11_INCLUDE_DIR} CACHE PATH "path")
|
||||
|
||||
mark_as_advanced( PYBIND11_FOUND )
|
||||
98
raytracer/nvpro_core/cmake/packman.cmake
Normal file
98
raytracer/nvpro_core/cmake/packman.cmake
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
#*****************************************************************************
|
||||
# Copyright 2023 NVIDIA Corporation. All rights reserved.
|
||||
#*****************************************************************************
|
||||
include_guard(GLOBAL)
|
||||
|
||||
unset(PYTHON_VERSION)
|
||||
|
||||
|
||||
if (EXISTS "${BASE_DIRECTORY}/nvpro_core/OV")
|
||||
message(STATUS "Packman is available, toggle off USE_PACKMAN to disable")
|
||||
option(USE_PACKMAN "Enable to use packman dependencies where possible" ON)
|
||||
else()
|
||||
option(USE_PACKMAN "Enable to use packman dependencies where possible" OFF)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
set(PACKMAN_PLATFORM "windows-x86_64" CACHE INTERNAL "")
|
||||
set(PACKMAN_COMMAND "packman.cmd" CACHE INTERNAL "")
|
||||
elseif (UNIX)
|
||||
set(PACKMAN_PLATFORM "linux-${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
|
||||
set(PACKMAN_COMMAND "packman" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
if (DEBUG)
|
||||
set(PACKMAN_CONFIG "debug" CACHE INTERNAL "")
|
||||
else()
|
||||
set(PACKMAN_CONFIG "release" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# Configure all-deps file
|
||||
function(configure_all_deps_file)
|
||||
set(oneValueArgs ALL_DEPS_FILEPATH PYTHON_VERSION_STRING)
|
||||
cmake_parse_arguments(PACKMAN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT DEFINED PACKMAN_ALL_DEPS_FILEPATH)
|
||||
set(PACKMAN_ALL_DEPS_FILEPATH "${BASE_DIRECTORY}/nvpro_core/OV/all-deps.packman.xml")
|
||||
message(STATUS "Using default packman all-deps ${PACKMAN_ALL_DEPS_FILEPATH}")
|
||||
else()
|
||||
message(STATUS "Using custom packman all-deps ${PACKMAN_ALL_DEPS_FILEPATH}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PACKMAN_PYTHON_VERSION_STRING)
|
||||
set(PACKMAN_PYTHON_VERSION_STRING "py37")
|
||||
message(WARNING "PYTHON_VERSION_STRING not defined, defaulting to py37 (none, py37, py310)")
|
||||
endif()
|
||||
|
||||
message(STATUS "PACKMAN_PYTHON_VERSION_STRING ${PACKMAN_PYTHON_VERSION_STRING}")
|
||||
message(STATUS "PACKMAN_ALL_DEPS_FILEPATH ${PACKMAN_ALL_DEPS_FILEPATH}")
|
||||
|
||||
set(PYTHON_VERSION ${PACKMAN_PYTHON_VERSION_STRING} CACHE INTERNAL "")
|
||||
|
||||
file(MAKE_DIRECTORY "${BASE_DIRECTORY}/nvpro_core/OV/downloaded")
|
||||
configure_file(
|
||||
"${PACKMAN_ALL_DEPS_FILEPATH}"
|
||||
"${BASE_DIRECTORY}/nvpro_core/OV/downloaded/all-deps.packman.xml"
|
||||
@ONLY
|
||||
)
|
||||
endfunction()
|
||||
|
||||
# Use packman to pull dependencies from ${BASE_DIRECTORY}/nvpro_core/OV/${PACKMAN_DEPENDENCY_FILE} where DEPENDENCY_FILE is an arg
|
||||
function(pull_dependencies)
|
||||
set(oneValueArgs DEPENDENCY_FILE COMMAND)
|
||||
cmake_parse_arguments(PACKMAN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT EXISTS ${BASE_DIRECTORY}/nvpro_core/OV/packman/${PACKMAN_COMMAND})
|
||||
message(FATAL_ERROR "PACKMAN_COMMAND \"${BASE_DIRECTORY}/nvpro_core/OV/packman/${PACKMAN_COMMAND}\" does not exist!")
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${BASE_DIRECTORY}/nvpro_core/OV/${PACKMAN_DEPENDENCY_FILE})
|
||||
message(FATAL_ERROR "PACKMAN_DEPENDENCY_FILE \"${BASE_DIRECTORY}/nvpro_core/OV/${PACKMAN_DEPENDENCY_FILE}\" does not exist!")
|
||||
endif()
|
||||
|
||||
message(STATUS "Pulling dependencies from ${PACKMAN_DEPENDENCY_FILE}...")
|
||||
message(STATUS " Platform: ${PACKMAN_PLATFORM}")
|
||||
message(STATUS " Config: ${PACKMAN_CONFIG}")
|
||||
message(STATUS " Python: ${PYTHON_VERSION}")
|
||||
|
||||
file(MAKE_DIRECTORY "${BASE_DIRECTORY}/nvpro_core/OV/downloaded")
|
||||
configure_file(
|
||||
"${BASE_DIRECTORY}/nvpro_core/OV/${PACKMAN_DEPENDENCY_FILE}"
|
||||
"${BASE_DIRECTORY}/nvpro_core/OV/downloaded/${PACKMAN_DEPENDENCY_FILE}"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
message(STATUS "execute_process(COMMAND ${BASE_DIRECTORY}/nvpro_core/OV/packman/${PACKMAN_COMMAND} pull ${BASE_DIRECTORY}/nvpro_core/OV/downloaded/${PACKMAN_DEPENDENCY_FILE} -p \"${PACKMAN_PLATFORM}\" -t config=${PACKMAN_CONFIG}
|
||||
WORKING_DIRECTORY ${BASE_DIRECTORY}/nvpro_core/OV/downloaded
|
||||
RESULT_VARIABLE PACKMAN_RESULT)")
|
||||
|
||||
execute_process(COMMAND "${BASE_DIRECTORY}/nvpro_core/OV/packman/${PACKMAN_COMMAND}" pull "${BASE_DIRECTORY}/nvpro_core/OV/downloaded/${PACKMAN_DEPENDENCY_FILE}" -p "${PACKMAN_PLATFORM}" -t config=${PACKMAN_CONFIG}
|
||||
WORKING_DIRECTORY "${BASE_DIRECTORY}/nvpro_core/OV/downloaded"
|
||||
RESULT_VARIABLE PACKMAN_RESULT)
|
||||
|
||||
if (${PACKMAN_RESULT} EQUAL 0)
|
||||
message(STATUS "Packman result: success")
|
||||
else()
|
||||
message(FATAL_ERROR "Packman result: ${PACKMAN_RESULT}")
|
||||
endif()
|
||||
endfunction()
|
||||
1151
raytracer/nvpro_core/cmake/setup.cmake
Normal file
1151
raytracer/nvpro_core/cmake/setup.cmake
Normal file
File diff suppressed because it is too large
Load diff
355
raytracer/nvpro_core/cmake/utilities.cmake
Normal file
355
raytracer/nvpro_core/cmake/utilities.cmake
Normal file
|
|
@ -0,0 +1,355 @@
|
|||
#*****************************************************************************
|
||||
# Copyright 2020-2023 NVIDIA Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
#*****************************************************************************
|
||||
include_guard(GLOBAL)
|
||||
|
||||
# -------------------------------------------------------------------------------------------------
|
||||
# function that copies a list of files into the target directory
|
||||
#
|
||||
# target_copy_to_output_dir(TARGET foo
|
||||
# [RELATIVE <path_prefix>] # allows to keep the folder structure starting from this level
|
||||
# FILES <absolute_file_path> [<absolute_file_path>]
|
||||
# )
|
||||
#
|
||||
function(target_copy_to_output_dir)
|
||||
set(options)
|
||||
set(oneValueArgs TARGET RELATIVE DEST_SUBFOLDER)
|
||||
set(multiValueArgs FILES)
|
||||
cmake_parse_arguments(TARGET_COPY_TO_OUTPUT_DIR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
foreach(_ELEMENT ${TARGET_COPY_TO_OUTPUT_DIR_FILES} )
|
||||
|
||||
# handle absolute and relative paths
|
||||
if(TARGET_COPY_TO_OUTPUT_DIR_RELATIVE)
|
||||
set(_SOURCE_FILE ${TARGET_COPY_TO_OUTPUT_DIR_RELATIVE}/${_ELEMENT})
|
||||
set(_FOLDER_PATH ${_ELEMENT})
|
||||
else()
|
||||
set(_SOURCE_FILE ${_ELEMENT})
|
||||
get_filename_component(_FOLDER_PATH ${_ELEMENT} NAME)
|
||||
set (_ELEMENT "")
|
||||
endif()
|
||||
|
||||
# handle directories and files slightly different
|
||||
if(IS_DIRECTORY ${_SOURCE_FILE})
|
||||
if(MDL_LOG_FILE_DEPENDENCIES)
|
||||
MESSAGE(STATUS "- folder to copy: ${_SOURCE_FILE}")
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_COPY_TO_OUTPUT_DIR_TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${_SOURCE_FILE} $<TARGET_FILE_DIR:${TARGET_COPY_TO_OUTPUT_DIR_TARGET}>/${TARGET_COPY_TO_OUTPUT_DIR_DEST_SUBFOLDER}${_FOLDER_PATH}
|
||||
)
|
||||
else()
|
||||
if(MDL_LOG_FILE_DEPENDENCIES)
|
||||
MESSAGE(STATUS "- file to copy: ${_SOURCE_FILE}")
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_COPY_TO_OUTPUT_DIR_TARGET} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_SOURCE_FILE} $<TARGET_FILE_DIR:${TARGET_COPY_TO_OUTPUT_DIR_TARGET}>/${TARGET_COPY_TO_OUTPUT_DIR_DEST_SUBFOLDER}${_ELEMENT}
|
||||
)
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
# Downloading the URL to FILENAME and extract its content if EXTRACT option is present
|
||||
# ZIP files should have a folder of the name of the archive
|
||||
# - ex. foo.zip -> foo/<data>
|
||||
# Arguements
|
||||
# FILENAMES : all filenames to download
|
||||
# EXTRACT : if present, will extract the content of the file
|
||||
# NOINSTALL : if present, will not make files part of install
|
||||
# INSTALL_DIR : folder for the 'install' build, default is 'media' next to the executable
|
||||
# TARGET_DIR : folder where to download to, default is {DOWNLOAD_TARGET_DIR}
|
||||
# SOURCE_DIR : folder on server, if not present 'scenes'
|
||||
#
|
||||
# Examples:
|
||||
# download_files(FILENAMES sample1.zip EXTRACT)
|
||||
# download_files(FILENAMES env.hdr)
|
||||
# download_files(FILENAMES zlib.zip EXTRACT TARGET_DIR ${BASE_DIRECTORY}/blah SOURCE_DIR libraries NOINSTALL)
|
||||
#
|
||||
function(download_files)
|
||||
set(options EXTRACT NOINSTALL)
|
||||
set(oneValueArgs INSTALL_DIR SOURCE_DIR TARGET_DIR)
|
||||
set(multiValueArgs FILENAMES)
|
||||
cmake_parse_arguments(DOWNLOAD_FILES "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
if(NOT DEFINED DOWNLOAD_FILES_INSTALL_DIR)
|
||||
set(DOWNLOAD_FILES_INSTALL_DIR "media")
|
||||
endif()
|
||||
if(NOT DEFINED DOWNLOAD_FILES_SOURCE_DIR)
|
||||
set(DOWNLOAD_FILES_SOURCE_DIR "")
|
||||
endif()
|
||||
if(NOT DEFINED DOWNLOAD_FILES_TARGET_DIR)
|
||||
set(DOWNLOAD_FILES_TARGET_DIR ${DOWNLOAD_TARGET_DIR})
|
||||
endif()
|
||||
|
||||
# Check each file to download
|
||||
foreach(FILENAME ${DOWNLOAD_FILES_FILENAMES})
|
||||
|
||||
set(TARGET_FILENAME ${DOWNLOAD_FILES_TARGET_DIR}/${FILENAME})
|
||||
if(NOT EXISTS ${TARGET_FILENAME})
|
||||
message(STATUS "Downloading ${DOWNLOAD_SITE}/${FILENAME} to ${TARGET_FILENAME}")
|
||||
file(DOWNLOAD ${DOWNLOAD_SITE}${DOWNLOAD_FILES_SOURCE_DIR}/${FILENAME} ${TARGET_FILENAME}
|
||||
SHOW_PROGRESS
|
||||
STATUS _DOWNLOAD_STATUS)
|
||||
|
||||
# Check whether the download succeeded. _DOWNLOAD_STATUS is a list of
|
||||
# length 2; element 0 is the return value (0 == no error), element 1 is
|
||||
# a string value for the error.
|
||||
list(GET _DOWNLOAD_STATUS 0 _DOWNLOAD_STATUS_CODE)
|
||||
if(NOT (${_DOWNLOAD_STATUS_CODE} EQUAL 0))
|
||||
list(GET _DOWNLOAD_STATUS 1 _DOWNLOAD_STATUS_MESSAGE)
|
||||
message(FATAL_ERROR "Download of ${DOWNLOAD_SITE}/${FILENAME} to ${TARGET_FILENAME} failed with code ${_DOWNLOAD_STATUS_CODE}: ${_DOWNLOAD_STATUS_MESSAGE}")
|
||||
endif()
|
||||
|
||||
# Extracting the ZIP file
|
||||
if(DOWNLOAD_FILES_EXTRACT)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xf ${TARGET_FILENAME}
|
||||
WORKING_DIRECTORY ${DOWNLOAD_FILES_TARGET_DIR})
|
||||
# ARCHIVE_EXTRACT needs CMake 3.18+
|
||||
# file(ARCHIVE_EXTRACT INPUT ${TARGET_FILENAME}
|
||||
# DESTINATION ${DOWNLOAD_FILES_TARGET_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Installing the files or directory
|
||||
if (NOT DOWNLOAD_FILES_NOINSTALL)
|
||||
if(DOWNLOAD_FILES_EXTRACT)
|
||||
get_filename_component(FILE_DIR ${FILENAME} NAME_WE)
|
||||
install(DIRECTORY ${DOWNLOAD_FILES_TARGET_DIR}/${FILE_DIR} CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${DOWNLOAD_FILES_INSTALL_DIR}")
|
||||
install(DIRECTORY ${DOWNLOAD_FILES_TARGET_DIR}/${FILE_DIR} CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${DOWNLOAD_FILES_INSTALL_DIR}")
|
||||
else()
|
||||
install(FILES ${TARGET_FILENAME} CONFIGURATIONS Release DESTINATION "bin_${ARCH}/${DOWNLOAD_FILES_INSTALL_DIR}")
|
||||
install(FILES ${TARGET_FILENAME} CONFIGURATIONS Debug DESTINATION "bin_${ARCH}_debug/${DOWNLOAD_FILES_INSTALL_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
# Find dependencies for GLSL files (#include ...)
|
||||
# Call 'glslc -M' to find all dependencies of the file and return the list
|
||||
# in GLSL_DEPENDENCY
|
||||
#
|
||||
function(get_glsl_dependencies )
|
||||
cmake_parse_arguments(GGD "" "SRC" "FLAGS" ${ARGN} )
|
||||
get_filename_component(FILE_NAME ${GGD_SRC} NAME)
|
||||
get_filename_component(DIR_NAME ${GGD_SRC} DIRECTORY)
|
||||
|
||||
# glslc has a bug where it won't quote paths with spaces
|
||||
# As a workaround, assume all paths are absolute and separate based on matching the root path
|
||||
# Include any added include paths in case they are on different windows drives
|
||||
set(INCLUDE_PATHS ${GGD_FLAGS})
|
||||
list(FILTER INCLUDE_PATHS INCLUDE REGEX "-I.*")
|
||||
list(TRANSFORM INCLUDE_PATHS REPLACE "-I" "")
|
||||
list(APPEND INCLUDE_PATHS ${DIR_NAME})
|
||||
set(INCLUDE_ROOTS)
|
||||
foreach(INCLUDE_PATH ${INCLUDE_PATHS})
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.20.0")
|
||||
string(REGEX MATCH "^([A-Za-z]:)?/" INCLUDE_ROOT ${INCLUDE_PATH})
|
||||
else()
|
||||
cmake_path(GET INCLUDE_PATH ROOT_PATH INCLUDE_ROOT)
|
||||
endif()
|
||||
list(APPEND INCLUDE_ROOTS ${INCLUDE_ROOT})
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES INCLUDE_ROOTS)
|
||||
|
||||
message(STATUS " - Find dependencies for ${FILE_NAME}")
|
||||
#message(STATUS "calling : ${Vulkan_GLSLC_EXECUTABLE} ${GGD_FLAGS} -M ${GGD_SRC} OUTPUT_VARIABLE DEP RESULT_VARIABLE RES")
|
||||
execute_process(COMMAND ${Vulkan_GLSLC_EXECUTABLE} ${GGD_FLAGS} -M ${GGD_SRC} OUTPUT_VARIABLE DEP RESULT_VARIABLE RES )
|
||||
if(RES EQUAL 0)
|
||||
# Removing "name.spv: "
|
||||
string(REGEX REPLACE "[^:]*: " "" DEP ${DEP})
|
||||
# The command line may end with newlines. This breaks the Ninja generator on
|
||||
# CMake 3.16.2 (fixed as of 3.24.1). As a workaround, remove trailing newlines.
|
||||
string(REGEX REPLACE "[\r\n]+$" "" DEP ${DEP})
|
||||
# Splitting each root with a ';'. On linux this is just ' /' -> ';/'.
|
||||
foreach(ROOT ${INCLUDE_ROOTS})
|
||||
string(REPLACE " ${ROOT}" ";${ROOT}" DEP ${DEP})
|
||||
endforeach()
|
||||
set(GLSL_DEPENDENCY ${DEP} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
# Function to compile all GLSL source files to Spir-V
|
||||
#
|
||||
# SOURCE_FILES : List of sources to compile
|
||||
# HEADER_FILES : List of dependency header files
|
||||
# DST : The destination directory (need to be absolute)
|
||||
# VULKAN_TARGET : to define the vulkan target i.e vulkan1.2 (default vulkan1.1)
|
||||
# HEADER ON: if ON, will generate headers instead of binary Spir-V files
|
||||
# DEPENDENCY : ON|OFF will create the list of dependencies for the GLSL source file
|
||||
# FLAGS: List of compile flags
|
||||
#
|
||||
# compile_glsl(
|
||||
# SOURCE_FILES foo.vert foo.frag
|
||||
# DST ${CMAKE_CURRENT_SOURCE_DIR}/shaders
|
||||
# FLAGS -g0
|
||||
# )
|
||||
|
||||
function(compile_glsl)
|
||||
set(oneValueArgs DST VULKAN_TARGET HEADER DEPENDENCY)
|
||||
set(multiValueArgs SOURCE_FILES HEADER_FILES FLAGS)
|
||||
cmake_parse_arguments(COMPILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
# Check if the GLSL compiler is present
|
||||
if(NOT Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
|
||||
message(ERROR "Could not find Vulkan_GLSLANG_VALIDATOR_EXECUTABLE to compile shaders")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# By default use Vulkan 1.1
|
||||
if(NOT DEFINED COMPILE_VULKAN_TARGET)
|
||||
set(COMPILE_VULKAN_TARGET vulkan1.1)
|
||||
endif()
|
||||
|
||||
# If destination is not present, same as source
|
||||
if(NOT DEFINED COMPILE_DST)
|
||||
message(ERROR " --- DST not defined")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Make the output directory if needed
|
||||
file(MAKE_DIRECTORY ${COMPILE_DST})
|
||||
|
||||
# If no flag set -g (debug)
|
||||
if(NOT DEFINED COMPILE_FLAGS)
|
||||
set(COMPILE_FLAGS -g)
|
||||
endif()
|
||||
|
||||
# Compiling all GLSL sources
|
||||
foreach(GLSL_SRC ${COMPILE_SOURCE_FILES})
|
||||
|
||||
# Find the dependency files for the GLSL source
|
||||
# or use all headers as dependencies.
|
||||
if(COMPILE_DEPENDENCY)
|
||||
get_glsl_dependencies(SRC ${GLSL_SRC} FLAGS ${COMPILE_FLAGS})
|
||||
else()
|
||||
set(GLSL_DEPENDENCY ${HEADER_FILES})
|
||||
endif()
|
||||
|
||||
# Default compiler command, always adding debug information (Add and option to opt-out?)
|
||||
set(COMPILE_CMD ${COMPILE_FLAGS} --target-env ${COMPILE_VULKAN_TARGET})
|
||||
|
||||
# Compilation to headers need a variable name, the output will be a .h
|
||||
get_filename_component(FILE_NAME ${GLSL_SRC} NAME)
|
||||
if(COMPILE_HEADER)
|
||||
STRING(REPLACE "." "_" VAR_NAME ${FILE_NAME}) # Name of the variable in the header
|
||||
list(APPEND COMPILE_CMD --vn ${VAR_NAME})
|
||||
set(GLSL_OUT "${COMPILE_DST}/${FILE_NAME}.h")
|
||||
else()
|
||||
set(GLSL_OUT "${COMPILE_DST}/${FILE_NAME}.spv")
|
||||
list(APPEND _SPVS ${GLSL_OUT})
|
||||
endif()
|
||||
|
||||
|
||||
# Appending the output name and the file source
|
||||
list(APPEND COMPILE_CMD -o ${GLSL_OUT} ${GLSL_SRC} )
|
||||
# The custom command is added to the build system, check for the presence of the output
|
||||
# but also for changes done in GLSL headers
|
||||
add_custom_command(
|
||||
PRE_BUILD
|
||||
OUTPUT ${GLSL_OUT}
|
||||
COMMAND echo ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} ${COMPILE_CMD}
|
||||
COMMAND ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE} ${COMPILE_CMD}
|
||||
MAIN_DEPENDENCY ${GLSL_SRC}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
DEPENDS ${GLSL_DEPENDENCY}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
# Setting OUT variables
|
||||
set(GLSL_SOURCES ${COMPILE_SOURCE_FILES} PARENT_SCOPE)
|
||||
set(GLSL_HEADERS ${COMPILE_HEADER_FILES} PARENT_SCOPE)
|
||||
set(SPV_OUTPUT ${_SPVS} PARENT_SCOPE)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
# Function to compile all GLSL files from a source to Spir-V
|
||||
# The sources are all .vert, .frag, .r* and the headers for the source are .glsl and .h
|
||||
# This allows to modify one of the header and getting the sources recompiled.
|
||||
#
|
||||
# SRC : The directory source of the shaders
|
||||
# DST : The destination directory (need to be absolute)
|
||||
# VULKAN_TARGET : to define the vulkan target i.e vulkan1.2 (default vulkan1.1)
|
||||
# HEADER ON: if present, will generate headers instead of binary Spir-V files
|
||||
# DEPENDENCY : ON|OFF will create the list of dependencies for the GLSL source file
|
||||
# FLAGS : other glslValidator flags
|
||||
#
|
||||
# compile_glsl_directory(
|
||||
# SRC "${CMAKE_CURRENT_SOURCE_DIR}/shaders"
|
||||
# DST "${CMAKE_CURRENT_SOURCE_DIR}/autogen"
|
||||
# VULKAN_TARGET "vulkan1.2"
|
||||
# HEADER ON
|
||||
# )
|
||||
#
|
||||
function(compile_glsl_directory)
|
||||
set(oneValueArgs SRC DST VULKAN_TARGET HEADER DEPENDENCY FLAGS)
|
||||
set(multiValueArgs)
|
||||
cmake_parse_arguments(COMPILE "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
# Collecting all source files
|
||||
file(GLOB GLSL_SOURCE_FILES
|
||||
"${COMPILE_SRC}/*.comp" # Compute
|
||||
"${COMPILE_SRC}/*.frag" # Fragment
|
||||
"${COMPILE_SRC}/*.geom" # Geometry
|
||||
"${COMPILE_SRC}/*.mesh" # Mesh
|
||||
"${COMPILE_SRC}/*.rahit" # Ray any hit
|
||||
"${COMPILE_SRC}/*.rcall" # Ray callable
|
||||
"${COMPILE_SRC}/*.rchit" # Ray closest hit
|
||||
"${COMPILE_SRC}/*.rgen" # Ray generation
|
||||
"${COMPILE_SRC}/*.rint" # Ray intersection
|
||||
"${COMPILE_SRC}/*.rmiss" # Ray miss
|
||||
"${COMPILE_SRC}/*.task" # Task
|
||||
"${COMPILE_SRC}/*.tesc" # Tessellation control
|
||||
"${COMPILE_SRC}/*.tese" # Tessellation evaluation
|
||||
"${COMPILE_SRC}/*.vert" # Vertex
|
||||
)
|
||||
|
||||
# Collecting headers for dependencies
|
||||
file(GLOB GLSL_HEADER_FILES
|
||||
"${COMPILE_SRC}/*.glsl" # Auto detect - used for header
|
||||
"${COMPILE_SRC}/*.h"
|
||||
)
|
||||
|
||||
# By default use Vulkan 1.1
|
||||
if(NOT DEFINED COMPILE_VULKAN_TARGET)
|
||||
set(COMPILE_VULKAN_TARGET vulkan1.1)
|
||||
endif()
|
||||
|
||||
# If destination is not present, same as source
|
||||
if(NOT DEFINED COMPILE_DST)
|
||||
set(COMPILE_DST ${COMPILE_SRC})
|
||||
endif()
|
||||
|
||||
# If no flag set -g (debug)
|
||||
if(NOT DEFINED COMPILE_FLAGS)
|
||||
set(COMPILE_FLAGS -g)
|
||||
endif()
|
||||
|
||||
# Compiling all GLSL
|
||||
compile_glsl(SOURCE_FILES ${GLSL_SOURCE_FILES}
|
||||
HEADER_FILES ${GLSL_HEADER_FILES}
|
||||
DST ${COMPILE_DST}
|
||||
VULKAN_TARGET ${COMPILE_VULKAN_TARGET}
|
||||
HEADER ${COMPILE_HEADER}
|
||||
DEPENDENCY ${COMPILE_DEPENDENCY}
|
||||
FLAGS ${COMPILE_FLAGS}
|
||||
)
|
||||
|
||||
# Setting OUT variables
|
||||
set(GLSL_SOURCES ${GLSL_SOURCE_FILES} PARENT_SCOPE)
|
||||
set(GLSL_HEADERS ${GLSL_HEADER_FILES} PARENT_SCOPE)
|
||||
set(SPV_OUTPUT ${SPV_OUTPUT} PARENT_SCOPE) # propagate value set in compile_glsl
|
||||
endfunction()
|
||||
|
||||
95
raytracer/nvpro_core/docgen.py
Normal file
95
raytracer/nvpro_core/docgen.py
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# This script generates a README.md file for each folder containing header files,
|
||||
# with a table of contents and documentation extracted from the header files.
|
||||
|
||||
# How to use:
|
||||
# 1. Customize the excluded_folders list as per your project's needs.
|
||||
# 2. Run the script in the root directory of your project.
|
||||
|
||||
# Note: To include documentation in the README.md file, enclose the documentation
|
||||
# within the "@DOC_START" and "@DOC_END" tags in the header files. Anything inside
|
||||
# will be threated as Markdown documentation.
|
||||
# If the header contains @DOC_SKIP, the header will not try to generate documentation
|
||||
|
||||
# Note: Any title (`#`) will be demoted by two level to fit the documentation.
|
||||
# Level-1 (title): reserve, level-2 (sub-title): filename
|
||||
# Ex. "# MyClass" -> "### MyClass"
|
||||
|
||||
import os
|
||||
|
||||
# Define excluded folders
|
||||
excluded_folders = [
|
||||
".git",
|
||||
".vscode",
|
||||
"cmake",
|
||||
"doxygen",
|
||||
"resources",
|
||||
"third_party",
|
||||
"KHR",
|
||||
"GL",
|
||||
"OV",
|
||||
"PACKAGE-LICENSES",
|
||||
"_autogen"
|
||||
]
|
||||
|
||||
# Function to generate table of contents
|
||||
def generate_table_of_contents(header_files):
|
||||
return "## Table of Contents\n" + "\n".join(f"- [{file}](#{file.replace('.', '')})" for file in header_files)
|
||||
|
||||
# Function to extract documentation from header files
|
||||
def extract_documentation(file_path):
|
||||
documentation = ""
|
||||
with open(file_path, 'r', encoding="utf-8") as file:
|
||||
in_doc_block = False
|
||||
for line in file:
|
||||
if "@DOC_START" in line.strip():
|
||||
in_doc_block = True
|
||||
elif "@DOC_END" in line.strip():
|
||||
in_doc_block = False
|
||||
elif in_doc_block:
|
||||
if line.lstrip().startswith("# "):
|
||||
documentation += "##" + line.lstrip() + "\n"
|
||||
else:
|
||||
documentation += line.strip() + "\n"
|
||||
if not documentation:
|
||||
documentation = "\n> Todo: Add documentation\n"
|
||||
return documentation
|
||||
|
||||
|
||||
# Traverse through folders
|
||||
for root, dirs, files in os.walk("."):
|
||||
print("Parsing sub-folder:", root) # Print the sub-folder being parsed
|
||||
|
||||
# Exclude specified folders
|
||||
dirs[:] = [d for d in dirs if d not in excluded_folders]
|
||||
|
||||
# Filter header files
|
||||
header_files = []
|
||||
for file in files:
|
||||
if file.endswith((".h", ".hpp")):
|
||||
with open(os.path.join(root, file), encoding="utf-8") as f:
|
||||
# Check for "@DOC_SKIP" only if file extension matches
|
||||
if not any("@DOC_SKIP" in line for line in f):
|
||||
header_files.append(file)
|
||||
else:
|
||||
# Optional: Inform about skipping files (for clarity)
|
||||
print(f" - Skipping file: {file}") # Informative, optional
|
||||
|
||||
# Proceed if there are header files
|
||||
if header_files:
|
||||
# Generate table of contents
|
||||
table_of_contents = generate_table_of_contents(header_files)
|
||||
|
||||
# Create or append to README.md
|
||||
with open(os.path.join(root, "README.md"), "w") as readme:
|
||||
readme.write(table_of_contents + "\n")
|
||||
|
||||
# Process each header file
|
||||
for header_file in header_files:
|
||||
readme.write(f"\n## {header_file}\n")
|
||||
header_path = os.path.join(root, header_file)
|
||||
|
||||
# Extract documentation from header file
|
||||
documentation = extract_documentation(header_path)
|
||||
|
||||
# Append documentation to README.md
|
||||
readme.write(documentation)
|
||||
2
raytracer/nvpro_core/doxygen/CompileDox.bat
Normal file
2
raytracer/nvpro_core/doxygen/CompileDox.bat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Doxygen Doxyfile.dox >log.txt 2>&1
|
||||
html\index.html
|
||||
2644
raytracer/nvpro_core/doxygen/doxyfile.dox
Normal file
2644
raytracer/nvpro_core/doxygen/doxyfile.dox
Normal file
File diff suppressed because it is too large
Load diff
297
raytracer/nvpro_core/doxygen/extra.css
Normal file
297
raytracer/nvpro_core/doxygen/extra.css
Normal file
|
|
@ -0,0 +1,297 @@
|
|||
.sm-dox,.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted,.sm-dox ul a:hover{
|
||||
background:none;
|
||||
text-shadow:none
|
||||
}
|
||||
.sm-dox a span.sub-arrow{
|
||||
border-color:#f2f2f2 transparent transparent transparent
|
||||
}
|
||||
.sm-dox a span.sub-arrow:active,.sm-dox a span.sub-arrow:focus,.sm-dox a span.sub-arrow:hover,.sm-dox a:hover span.sub-arrow{
|
||||
border-color:#f60 transparent transparent transparent
|
||||
}
|
||||
.sm-dox ul a span.sub-arrow:active,.sm-dox ul a span.sub-arrow:focus,.sm-dox ul a span.sub-arrow:hover,.sm-dox ul a:hover span.sub-arrow{
|
||||
border-color:transparent transparent transparent #f60
|
||||
}
|
||||
.sm-dox ul a:hover{
|
||||
background:#666;
|
||||
text-shadow:none
|
||||
}
|
||||
.sm-dox ul.sm-nowrap a{
|
||||
color:#4d4d4d;
|
||||
text-shadow:none
|
||||
}
|
||||
#main-nav,#main-menu,#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.memdoc,dl.reflist dd,div.toc li,.ah,span.lineno,span.lineno a,span.lineno a:hover,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,.doxtable code,.markdownTable code{
|
||||
background:none
|
||||
}
|
||||
#titlearea,.footer,.contents,div.header,.memdoc,table.doxtable td,table.doxtable th,table.markdownTable td,table.markdownTable th,hr,.memSeparator{
|
||||
border:none
|
||||
}
|
||||
#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li,.reflist dt a.el,.levels span,.directory .levels span{
|
||||
text-shadow:none
|
||||
}
|
||||
.memdoc,dl.reflist dd{
|
||||
box-shadow:none
|
||||
}
|
||||
div.headertitle,.note code,.pre code,.post code,.invariant code,.warning code,.attention code,.deprecated code,.bug code,.todo code,.test code,table.doxtable code,table.markdownTable code{
|
||||
padding:0
|
||||
}
|
||||
#nav-path,.directory .levels,span.lineno{
|
||||
display:none
|
||||
}
|
||||
html,#titlearea,.footer,tr.even,.directory tr.even,.doxtable tr:nth-child(even),tr.markdownTableBody:nth-child(even),.mdescLeft,.mdescRight,.memItemLeft,.memItemRight,code,.markdownTableRowEven{
|
||||
background:#f2f2f2
|
||||
}
|
||||
body{
|
||||
color:#4d4d4d
|
||||
}
|
||||
h1,h2,h2.groupheader,h3,div.toc h3,h4,h5,h6,strong,em{
|
||||
color:#1a1a1a;
|
||||
border-bottom:none
|
||||
}
|
||||
h1{
|
||||
padding-top:.5em;
|
||||
font-size:180%
|
||||
}
|
||||
h2{
|
||||
padding-top:.5em;
|
||||
margin-bottom:0;
|
||||
font-size:140%
|
||||
}
|
||||
h3{
|
||||
padding-top:.5em;
|
||||
margin-bottom:0;
|
||||
font-size:110%
|
||||
}
|
||||
.nvproheader{
|
||||
font-size:16px;
|
||||
min-height:64px;
|
||||
max-width:920px;
|
||||
padding:0 32px;
|
||||
margin:0 auto;
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
flex-wrap:wrap;
|
||||
justify-content:flex-start;
|
||||
align-items:center;
|
||||
align-content:stretch
|
||||
}
|
||||
#nvprohome{
|
||||
line-height:64px;
|
||||
padding-right:48px;
|
||||
color:#666;
|
||||
font-size:2.5em;
|
||||
}
|
||||
.nvpronavbar{
|
||||
list-style-type:none;
|
||||
margin:0 0 0 auto;
|
||||
float:right
|
||||
}
|
||||
#nvprohome,.nvpronavbar li{
|
||||
float:left
|
||||
}
|
||||
.nvpronavbar a,.nvpronavbar a:visited{
|
||||
line-height:64px;
|
||||
margin-left:2em;
|
||||
display:block;
|
||||
color:#666
|
||||
}
|
||||
.nvpronavbar{
|
||||
padding-left:0
|
||||
}
|
||||
#nvprohome,.nvpronavbar a,.nvpronavbar a:visited{
|
||||
transition:.35s ease
|
||||
}
|
||||
#titlearea,.footer{
|
||||
color:rgb(102, 102, 102)
|
||||
}
|
||||
address.footer{
|
||||
text-align:center;
|
||||
padding:2em;
|
||||
margin-top:3em
|
||||
}
|
||||
#top{
|
||||
background:rgb(61, 110, 61)
|
||||
}
|
||||
#main-nav{
|
||||
max-width:960px;
|
||||
margin:0 auto;
|
||||
font-size:13px
|
||||
}
|
||||
#main-menu{
|
||||
max-width:920px;
|
||||
margin:0 auto;
|
||||
font-size:13px
|
||||
}
|
||||
.memtitle{
|
||||
display:none
|
||||
}
|
||||
.memproto,.memname{
|
||||
font-weight:bold;
|
||||
text-shadow:none
|
||||
}
|
||||
#main-menu{
|
||||
min-height:36px;
|
||||
display:flex;
|
||||
flex-direction:row;
|
||||
flex-wrap:wrap;
|
||||
justify-content:flex-start;
|
||||
align-items:center;
|
||||
align-content:stretch
|
||||
}
|
||||
#main-menu a,#main-menu a:visited,#main-menu a:hover,#main-menu li{
|
||||
color:#f2f2f2
|
||||
}
|
||||
#main-menu li ul.sm-nowrap li a{
|
||||
color:#4d4d4d
|
||||
}
|
||||
#main-menu li ul.sm-nowrap li a:hover{
|
||||
color:#f60
|
||||
}
|
||||
#main-menu>li:last-child{
|
||||
margin:0 0 0 auto
|
||||
}
|
||||
.contents{
|
||||
min-height:590px
|
||||
}
|
||||
div.contents,div.header{
|
||||
max-width:920px;
|
||||
margin:0 auto;
|
||||
padding:0 32px;
|
||||
background:#fff none
|
||||
}
|
||||
table.doxtable th,table.markdownTable th,dl.reflist dt{
|
||||
background:linear-gradient(to bottom, #ffa733 0%, #ff6600 100%);
|
||||
box-shadow:inset 0 0 32px #f60;
|
||||
text-shadow:0 -1px 1px #b34700;
|
||||
text-align:left;
|
||||
color:#fff
|
||||
}
|
||||
dl.reflist dt a.el{
|
||||
color:#f60;
|
||||
padding:.2em;
|
||||
border-radius:4px;
|
||||
background-color:#ffe0cc
|
||||
}
|
||||
div.toc{
|
||||
float:none;
|
||||
width:auto
|
||||
}
|
||||
div.toc h3{
|
||||
font-size:1.17em
|
||||
}
|
||||
div.toc ul{
|
||||
padding-left:1.5em
|
||||
}
|
||||
div.toc li{
|
||||
font-size:1em;
|
||||
padding-left:0;
|
||||
list-style-type:disc
|
||||
}
|
||||
div.toc,.memproto,div.qindex,div.ah{
|
||||
background:linear-gradient(to bottom, #f2f2f2 0%, #e6e6e6 100%);
|
||||
box-shadow:inset 0 0 32px #e6e6e6;
|
||||
text-shadow:0 1px 1px #fff;
|
||||
color:#1a1a1a;
|
||||
border:2px solid #e6e6e6;
|
||||
border-radius:4px
|
||||
}
|
||||
.paramname{
|
||||
color:#803300
|
||||
}
|
||||
dl.reflist dt{
|
||||
border:2px solid #f60;
|
||||
border-top-left-radius:4px;
|
||||
border-top-right-radius:4px;
|
||||
border-bottom:none
|
||||
}
|
||||
dl.reflist dd{
|
||||
border:2px solid #f60;
|
||||
border-bottom-right-radius:4px;
|
||||
border-bottom-left-radius:4px;
|
||||
border-top:none
|
||||
}
|
||||
table.doxtable,table.markdownTable{
|
||||
border-collapse:inherit;
|
||||
border-spacing:0;
|
||||
border:2px solid #f60;
|
||||
border-radius:4px
|
||||
}
|
||||
a,a:hover,a:visited,a:visited:hover,.contents a:visited,.el,a.el:visited,#nvprohome:hover,#main-menu a:hover,span.lineno a:hover{
|
||||
color:#f60;
|
||||
text-decoration:none
|
||||
}
|
||||
div.directory{
|
||||
border-collapse:inherit;
|
||||
border-spacing:0;
|
||||
border:2px solid #f60;
|
||||
border-radius:4px
|
||||
}
|
||||
hr,.memSeparator{
|
||||
height:2px;
|
||||
background:linear-gradient(to right, #f2f2f2 0%, #d9d9d9 50%, #f2f2f2 100%)
|
||||
}
|
||||
dl.note,dl.pre,dl.post,dl.invariant{
|
||||
background:linear-gradient(to bottom, #ddfad1 0%, #cbf7ba 100%);
|
||||
box-shadow:inset 0 0 32px #baf5a3;
|
||||
color:#1e5309;
|
||||
border:2px solid #afe699
|
||||
}
|
||||
dl.warning,dl.attention{
|
||||
background:linear-gradient(to bottom, #fae8d1 0%, #f7ddba 100%);
|
||||
box-shadow:inset 0 0 32px #f5d1a3;
|
||||
color:#533309;
|
||||
border:2px solid #e6c499
|
||||
}
|
||||
dl.deprecated,dl.bug{
|
||||
background:linear-gradient(to bottom, #fad1e3 0%, #f7bad6 100%);
|
||||
box-shadow:inset 0 0 32px #f5a3c8;
|
||||
color:#53092a;
|
||||
border:2px solid #e699bb
|
||||
}
|
||||
dl.todo,dl.test{
|
||||
background:linear-gradient(to bottom, #d1ecfa 0%, #bae3f7 100%);
|
||||
box-shadow:inset 0 0 32px #a3daf5;
|
||||
color:#093a53;
|
||||
border:2px solid #99cce6
|
||||
}
|
||||
dl.note,dl.pre,dl.post,dl.invariant,dl.warning,dl.attention,dl.deprecated,dl.bug,dl.todo,dl.test{
|
||||
border-radius:4px;
|
||||
padding:1em;
|
||||
text-shadow:0 1px 1px #fff;
|
||||
margin:1em 0
|
||||
}
|
||||
.note a,.pre a,.post a,.invariant a,.warning a,.attention a,.deprecated a,.bug a,.todo a,.test a,.note a:visited,.pre a:visited,.post a:visited,.invariant a:visited,.warning a:visited,.attention a:visited,.deprecated a:visited,.bug a:visited,.todo a:visited,.test a:visited{
|
||||
color:inherit
|
||||
}
|
||||
div.line{
|
||||
line-height:inherit
|
||||
}
|
||||
div.fragment,pre.fragment{
|
||||
background:#f2f2f2;
|
||||
border-radius:4px;
|
||||
border:none;
|
||||
padding:1em;
|
||||
overflow:auto;
|
||||
border-left:4px solid #ccc;
|
||||
margin:1em 0
|
||||
}
|
||||
.lineno a,.lineno a:visited,.line,pre.fragment{
|
||||
color:#4d4d4d
|
||||
}
|
||||
span.preprocessor,span.comment{
|
||||
color:#007899
|
||||
}
|
||||
a.code,a.code:visited{
|
||||
color:#e64500
|
||||
}
|
||||
span.keyword,span.keywordtype,span.keywordflow{
|
||||
color:#404040;
|
||||
font-weight:bold
|
||||
}
|
||||
span.stringliteral{
|
||||
color:#360099
|
||||
}
|
||||
code{
|
||||
padding:.1em;
|
||||
border-radius:4px
|
||||
}
|
||||
/*# sourceMappingURL=extra.css.map */
|
||||
53
raytracer/nvpro_core/fileformats/README.md
Normal file
53
raytracer/nvpro_core/fileformats/README.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
## Table of Contents
|
||||
- [khr_df.h](#khr_dfh)
|
||||
- [nv_ktx.h](#nv_ktxh)
|
||||
- [tiny_converter.hpp](#tiny_converterhpp)
|
||||
|
||||
## khr_df.h
|
||||
|
||||
This header defines a structure that can describe the layout of image
|
||||
formats in memory. This means that the data format is transparent to
|
||||
the application, and the expectation is that this should be used when
|
||||
the layout is defined external to the API. Many Khronos APIs deliberately
|
||||
keep the internal layout of images opaque, to allow proprietary layouts
|
||||
and optimizations. This structure is not appropriate for describing
|
||||
opaque layouts.
|
||||
|
||||
|
||||
## nv_ktx.h
|
||||
|
||||
A mostly self-contained reader and writer for KTX2 files and reader for KTX1
|
||||
files. Relies on Vulkan (for KTX2), GL (for KTX1), and the
|
||||
Khronos Data Format.
|
||||
|
||||
Sample usage for reading files:
|
||||
|
||||
```cpp
|
||||
KTXImage image;
|
||||
ErrorWithText maybe_error = image.readFromFile("data/image.ktx2");
|
||||
if(maybe_error.has_value())
|
||||
{
|
||||
// Do something with the error message, maybe_error.value()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Access subresources using image.subresource(...), and upload them
|
||||
// to the GPU using your graphics API of choice.
|
||||
}
|
||||
```
|
||||
|
||||
Define NVP_SUPPORTS_ZSTD, NVP_SUPPORTS_GZLIB, and NVP_SUPPORTS_BASISU to
|
||||
include the Zstd, Zlib, and Basis Universal headers respectively, and to
|
||||
enable reading these formats. This will also enable writing Zstd and
|
||||
Basis Universal-compressed formats.
|
||||
If you're using this inside the nvpro-samples framework, you can add all
|
||||
three quickly by adding _add_package_KTX() to your dependencies
|
||||
in CMakeLists.txt.
|
||||
|
||||
|
||||
## tiny_converter.hpp
|
||||
|
||||
Class TinyConverter
|
||||
|
||||
> This class is used to convert a tinyobj::ObjReader to a tinygltf::Model.
|
||||
|
||||
73
raytracer/nvpro_core/fileformats/bmp.hpp
Normal file
73
raytracer/nvpro_core/fileformats/bmp.hpp
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/// @DOC_SKIP (keyword to exclude this file from automatic README.md generation)
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
inline void saveBMP(const char* bmpfilename, int width, int height, const unsigned char* bgra)
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
struct
|
||||
{
|
||||
unsigned short bfType;
|
||||
unsigned int bfSize;
|
||||
unsigned int bfReserved;
|
||||
unsigned int bfOffBits;
|
||||
|
||||
unsigned int biSize;
|
||||
signed int biWidth;
|
||||
signed int biHeight;
|
||||
unsigned short biPlanes;
|
||||
unsigned short biBitCount;
|
||||
unsigned int biCompression;
|
||||
unsigned int biSizeImage;
|
||||
signed int biXPelsPerMeter;
|
||||
signed int biYPelsPerMeter;
|
||||
unsigned int biClrUsed;
|
||||
unsigned int biClrImportant;
|
||||
} bmpinfo;
|
||||
#pragma pack(pop)
|
||||
|
||||
const unsigned int imageDataSize = width * height * 4 * static_cast<unsigned int>(sizeof(unsigned char));
|
||||
|
||||
bmpinfo.bfType = 19778;
|
||||
bmpinfo.bfSize = static_cast<unsigned int>(sizeof(bmpinfo)) + imageDataSize;
|
||||
bmpinfo.bfReserved = 0;
|
||||
bmpinfo.bfOffBits = 54;
|
||||
|
||||
bmpinfo.biSize = 40;
|
||||
bmpinfo.biWidth = width;
|
||||
bmpinfo.biHeight = height;
|
||||
bmpinfo.biPlanes = 1;
|
||||
bmpinfo.biBitCount = 32;
|
||||
bmpinfo.biCompression = 0;
|
||||
bmpinfo.biSizeImage = 0;
|
||||
bmpinfo.biXPelsPerMeter = 0;
|
||||
bmpinfo.biYPelsPerMeter = 0;
|
||||
bmpinfo.biClrUsed = 0;
|
||||
bmpinfo.biClrImportant = 0;
|
||||
|
||||
FILE* bmpfile = fopen(bmpfilename, "wb");
|
||||
fwrite(&bmpinfo, sizeof(bmpinfo), 1, bmpfile);
|
||||
fwrite(bgra, sizeof(char), imageDataSize, bmpfile);
|
||||
fclose(bmpfile);
|
||||
}
|
||||
1042
raytracer/nvpro_core/fileformats/cadscenefile.h
Normal file
1042
raytracer/nvpro_core/fileformats/cadscenefile.h
Normal file
File diff suppressed because it is too large
Load diff
3637
raytracer/nvpro_core/fileformats/cadscenefile.inl
Normal file
3637
raytracer/nvpro_core/fileformats/cadscenefile.inl
Normal file
File diff suppressed because it is too large
Load diff
633
raytracer/nvpro_core/fileformats/khr_df.h
Normal file
633
raytracer/nvpro_core/fileformats/khr_df.h
Normal file
|
|
@ -0,0 +1,633 @@
|
|||
/* The Khronos Data Format Specification (version 1.3) */
|
||||
/*
|
||||
** Copyright (c) 2015-19 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are 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 Materials.
|
||||
**
|
||||
** THE MATERIALS ARE 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
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
|
||||
/** @DOC_START
|
||||
|
||||
This header defines a structure that can describe the layout of image
|
||||
formats in memory. This means that the data format is transparent to
|
||||
the application, and the expectation is that this should be used when
|
||||
the layout is defined external to the API. Many Khronos APIs deliberately
|
||||
keep the internal layout of images opaque, to allow proprietary layouts
|
||||
and optimizations. This structure is not appropriate for describing
|
||||
opaque layouts.
|
||||
|
||||
@DOC_END */
|
||||
|
||||
/* We stick to standard C89 constructs for simplicity and portability. */
|
||||
|
||||
#ifndef _KHR_DATA_FORMAT_H_
|
||||
#define _KHR_DATA_FORMAT_H_
|
||||
|
||||
/* Accessors */
|
||||
typedef enum _khr_word_e
|
||||
{
|
||||
KHR_DF_WORD_VENDORID = 0U,
|
||||
KHR_DF_WORD_DESCRIPTORTYPE = 0U,
|
||||
KHR_DF_WORD_VERSIONNUMBER = 1U,
|
||||
KHR_DF_WORD_DESCRIPTORBLOCKSIZE = 1U,
|
||||
KHR_DF_WORD_MODEL = 2U,
|
||||
KHR_DF_WORD_PRIMARIES = 2U,
|
||||
KHR_DF_WORD_TRANSFER = 2U,
|
||||
KHR_DF_WORD_FLAGS = 2U,
|
||||
KHR_DF_WORD_TEXELBLOCKDIMENSION0 = 3U,
|
||||
KHR_DF_WORD_TEXELBLOCKDIMENSION1 = 3U,
|
||||
KHR_DF_WORD_TEXELBLOCKDIMENSION2 = 3U,
|
||||
KHR_DF_WORD_TEXELBLOCKDIMENSION3 = 3U,
|
||||
KHR_DF_WORD_BYTESPLANE0 = 4U,
|
||||
KHR_DF_WORD_BYTESPLANE1 = 4U,
|
||||
KHR_DF_WORD_BYTESPLANE2 = 4U,
|
||||
KHR_DF_WORD_BYTESPLANE3 = 4U,
|
||||
KHR_DF_WORD_BYTESPLANE4 = 5U,
|
||||
KHR_DF_WORD_BYTESPLANE5 = 5U,
|
||||
KHR_DF_WORD_BYTESPLANE6 = 5U,
|
||||
KHR_DF_WORD_BYTESPLANE7 = 5U,
|
||||
KHR_DF_WORD_SAMPLESTART = 6U,
|
||||
KHR_DF_WORD_SAMPLEWORDS = 4U
|
||||
} khr_df_word_e;
|
||||
|
||||
typedef enum _khr_df_shift_e
|
||||
{
|
||||
KHR_DF_SHIFT_VENDORID = 0U,
|
||||
KHR_DF_SHIFT_DESCRIPTORTYPE = 17U,
|
||||
KHR_DF_SHIFT_VERSIONNUMBER = 0U,
|
||||
KHR_DF_SHIFT_DESCRIPTORBLOCKSIZE = 16U,
|
||||
KHR_DF_SHIFT_MODEL = 0U,
|
||||
KHR_DF_SHIFT_PRIMARIES = 8U,
|
||||
KHR_DF_SHIFT_TRANSFER = 16U,
|
||||
KHR_DF_SHIFT_FLAGS = 24U,
|
||||
KHR_DF_SHIFT_TEXELBLOCKDIMENSION0 = 0U,
|
||||
KHR_DF_SHIFT_TEXELBLOCKDIMENSION1 = 8U,
|
||||
KHR_DF_SHIFT_TEXELBLOCKDIMENSION2 = 16U,
|
||||
KHR_DF_SHIFT_TEXELBLOCKDIMENSION3 = 24U,
|
||||
KHR_DF_SHIFT_BYTESPLANE0 = 0U,
|
||||
KHR_DF_SHIFT_BYTESPLANE1 = 8U,
|
||||
KHR_DF_SHIFT_BYTESPLANE2 = 16U,
|
||||
KHR_DF_SHIFT_BYTESPLANE3 = 24U,
|
||||
KHR_DF_SHIFT_BYTESPLANE4 = 0U,
|
||||
KHR_DF_SHIFT_BYTESPLANE5 = 8U,
|
||||
KHR_DF_SHIFT_BYTESPLANE6 = 16U,
|
||||
KHR_DF_SHIFT_BYTESPLANE7 = 24U
|
||||
} khr_df_shift_e;
|
||||
|
||||
typedef enum _khr_df_mask_e
|
||||
{
|
||||
KHR_DF_MASK_VENDORID = 0x1FFFFU,
|
||||
KHR_DF_MASK_DESCRIPTORTYPE = 0x7FFFU,
|
||||
KHR_DF_MASK_VERSIONNUMBER = 0xFFFFU,
|
||||
KHR_DF_MASK_DESCRIPTORBLOCKSIZE = 0xFFFFU,
|
||||
KHR_DF_MASK_MODEL = 0xFFU,
|
||||
KHR_DF_MASK_PRIMARIES = 0xFFU,
|
||||
KHR_DF_MASK_TRANSFER = 0xFFU,
|
||||
KHR_DF_MASK_FLAGS = 0xFFU,
|
||||
KHR_DF_MASK_TEXELBLOCKDIMENSION0 = 0xFFU,
|
||||
KHR_DF_MASK_TEXELBLOCKDIMENSION1 = 0xFFU,
|
||||
KHR_DF_MASK_TEXELBLOCKDIMENSION2 = 0xFFU,
|
||||
KHR_DF_MASK_TEXELBLOCKDIMENSION3 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE0 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE1 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE2 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE3 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE4 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE5 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE6 = 0xFFU,
|
||||
KHR_DF_MASK_BYTESPLANE7 = 0xFFU
|
||||
} khr_df_mask_e;
|
||||
|
||||
/* Helper macro:
|
||||
Extract field X from basic descriptor block BDB */
|
||||
#define KHR_DFDVAL(BDB, X) (((BDB)[KHR_DF_WORD_##X] >> (KHR_DF_SHIFT_##X)) & (KHR_DF_MASK_##X))
|
||||
|
||||
/* Helper macro:
|
||||
Set field X of basic descriptor block BDB */
|
||||
#define KHR_DFDSETVAL(BDB, X, val) \
|
||||
((BDB)[KHR_DF_WORD_##X] = ((BDB)[KHR_DF_WORD_##X] & ~((KHR_DF_MASK_##X) << (KHR_DF_SHIFT_##X))) \
|
||||
| (((val) & (KHR_DF_MASK_##X)) << (KHR_DF_SHIFT_##X)))
|
||||
|
||||
/* Offsets relative to the start of a sample */
|
||||
typedef enum _khr_df_sampleword_e
|
||||
{
|
||||
KHR_DF_SAMPLEWORD_BITOFFSET = 0U,
|
||||
KHR_DF_SAMPLEWORD_BITLENGTH = 0U,
|
||||
KHR_DF_SAMPLEWORD_CHANNELID = 0U,
|
||||
KHR_DF_SAMPLEWORD_QUALIFIERS = 0U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEPOSITION0 = 1U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEPOSITION1 = 1U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEPOSITION2 = 1U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEPOSITION3 = 1U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEPOSITION_ALL = 1U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLELOWER = 2U,
|
||||
KHR_DF_SAMPLEWORD_SAMPLEUPPER = 3U
|
||||
} khr_df_sampleword_e;
|
||||
|
||||
typedef enum _khr_df_sampleshift_e
|
||||
{
|
||||
KHR_DF_SAMPLESHIFT_BITOFFSET = 0U,
|
||||
KHR_DF_SAMPLESHIFT_BITLENGTH = 16U,
|
||||
KHR_DF_SAMPLESHIFT_CHANNELID = 24U,
|
||||
/* N.B. Qualifiers are defined as an offset into a byte */
|
||||
KHR_DF_SAMPLESHIFT_QUALIFIERS = 24U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEPOSITION0 = 0U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEPOSITION1 = 8U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEPOSITION2 = 16U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEPOSITION3 = 24U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEPOSITION_ALL = 0U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLELOWER = 0U,
|
||||
KHR_DF_SAMPLESHIFT_SAMPLEUPPER = 0U
|
||||
} khr_df_sampleshift_e;
|
||||
|
||||
typedef enum _khr_df_samplemask_e
|
||||
{
|
||||
KHR_DF_SAMPLEMASK_BITOFFSET = 0xFFFFU,
|
||||
KHR_DF_SAMPLEMASK_BITLENGTH = 0xFF,
|
||||
KHR_DF_SAMPLEMASK_CHANNELID = 0xF,
|
||||
/* N.B. Qualifiers are defined as an offset into a byte */
|
||||
KHR_DF_SAMPLEMASK_QUALIFIERS = 0xF0,
|
||||
KHR_DF_SAMPLEMASK_SAMPLEPOSITION0 = 0xFF,
|
||||
KHR_DF_SAMPLEMASK_SAMPLEPOSITION1 = 0xFF,
|
||||
KHR_DF_SAMPLEMASK_SAMPLEPOSITION2 = 0xFF,
|
||||
KHR_DF_SAMPLEMASK_SAMPLEPOSITION3 = 0xFF,
|
||||
/* ISO C restricts enum values to range of int hence the
|
||||
cast. We do it verbosely instead of using -1 to ensure
|
||||
it is a 32-bit value even if int is 64 bits. */
|
||||
KHR_DF_SAMPLEMASK_SAMPLEPOSITION_ALL = (int)0xFFFFFFFFU,
|
||||
KHR_DF_SAMPLEMASK_SAMPLELOWER = (int)0xFFFFFFFFU,
|
||||
KHR_DF_SAMPLEMASK_SAMPLEUPPER = (int)0xFFFFFFFFU
|
||||
} khr_df_samplemask_e;
|
||||
|
||||
/* Helper macro:
|
||||
Extract field X of sample S from basic descriptor block BDB */
|
||||
#define KHR_DFDSVAL(BDB, S, X) \
|
||||
(((BDB)[KHR_DF_WORD_SAMPLESTART + ((S) * KHR_DF_WORD_SAMPLEWORDS) + KHR_DF_SAMPLEWORD_##X] >> (KHR_DF_SAMPLESHIFT_##X)) \
|
||||
& (KHR_DF_SAMPLEMASK_##X))
|
||||
|
||||
/* Helper macro:
|
||||
Set field X of sample S of basic descriptor block BDB */
|
||||
#define KHR_DFDSETSVAL(BDB, S, X, val) \
|
||||
((BDB)[KHR_DF_WORD_SAMPLESTART + ((S) * KHR_DF_WORD_SAMPLEWORDS) + KHR_DF_SAMPLEWORD_##X] = \
|
||||
((BDB)[KHR_DF_WORD_SAMPLESTART + ((S) * KHR_DF_WORD_SAMPLEWORDS) + KHR_DF_SAMPLEWORD_##X] \
|
||||
& ~((uint32_t)(KHR_DF_SAMPLEMASK_##X) << (KHR_DF_SAMPLESHIFT_##X))) \
|
||||
| (((val) & (uint32_t)(KHR_DF_SAMPLEMASK_##X)) << (KHR_DF_SAMPLESHIFT_##X)))
|
||||
|
||||
/* Helper macro:
|
||||
Number of samples in basic descriptor block BDB */
|
||||
#define KHR_DFDSAMPLECOUNT(BDB) \
|
||||
(((KHR_DFDVAL(BDB, DESCRIPTORBLOCKSIZE) >> 2) - KHR_DF_WORD_SAMPLESTART) / KHR_DF_WORD_SAMPLEWORDS)
|
||||
|
||||
/* Helper macro:
|
||||
Size in words of basic descriptor block for S samples */
|
||||
#define KHR_DFDSIZEWORDS(S) (KHR_DF_WORD_SAMPLESTART + (S) * KHR_DF_WORD_SAMPLEWORDS)
|
||||
|
||||
/* Vendor ids */
|
||||
typedef enum _khr_df_vendorid_e
|
||||
{
|
||||
/* Standard Khronos descriptor */
|
||||
KHR_DF_VENDORID_KHRONOS = 0U,
|
||||
KHR_DF_VENDORID_MAX = 0x1FFFFU
|
||||
} khr_df_vendorid_e;
|
||||
|
||||
/* Descriptor types */
|
||||
typedef enum _khr_df_khr_descriptortype_e
|
||||
{
|
||||
/* Default Khronos basic descriptor block */
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0U,
|
||||
/* Extension descriptor block for additional planes */
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_PLANES = 0x6001U,
|
||||
/* Extension descriptor block for additional dimensions */
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_DIMENSIONS = 0x6002U,
|
||||
/* Bit indicates modifying requires understanding this extension */
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_NEEDED_FOR_WRITE_BIT = 0x2000U,
|
||||
/* Bit indicates processing requires understanding this extension */
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_NEEDED_FOR_DECODE_BIT = 0x4000U,
|
||||
KHR_DF_KHR_DESCRIPTORTYPE_MAX = 0x7FFFU
|
||||
} khr_df_khr_descriptortype_e;
|
||||
|
||||
/* Descriptor block version */
|
||||
typedef enum _khr_df_versionnumber_e
|
||||
{
|
||||
/* Standard Khronos descriptor */
|
||||
KHR_DF_VERSIONNUMBER_1_0 = 0U, /* Version 1.0 of the specification */
|
||||
KHR_DF_VERSIONNUMBER_1_1 = 0U, /* Version 1.1 did not bump the version number */
|
||||
KHR_DF_VERSIONNUMBER_1_2 = 1U, /* Version 1.2 increased the version number */
|
||||
KHR_DF_VERSIONNUMBER_1_3 = 2U, /* Version 1.3 increased the version number */
|
||||
KHR_DF_VERSIONNUMBER_LATEST = KHR_DF_VERSIONNUMBER_1_3,
|
||||
KHR_DF_VERSIONNUMBER_MAX = 0xFFFFU
|
||||
} khr_df_versionnumber_e;
|
||||
|
||||
/* Model in which the color coordinate space is defined.
|
||||
There is no requirement that a color format use all the
|
||||
channel types that are defined in the color model. */
|
||||
typedef enum _khr_df_model_e
|
||||
{
|
||||
/* No interpretation of color channels defined */
|
||||
KHR_DF_MODEL_UNSPECIFIED = 0U,
|
||||
/* Color primaries (red, green, blue) + alpha, depth and stencil */
|
||||
KHR_DF_MODEL_RGBSDA = 1U,
|
||||
/* Color differences (Y', Cb, Cr) + alpha, depth and stencil */
|
||||
KHR_DF_MODEL_YUVSDA = 2U,
|
||||
/* Color differences (Y', I, Q) + alpha, depth and stencil */
|
||||
KHR_DF_MODEL_YIQSDA = 3U,
|
||||
/* Perceptual color (CIE L*a*b*) + alpha, depth and stencil */
|
||||
KHR_DF_MODEL_LABSDA = 4U,
|
||||
/* Subtractive colors (cyan, magenta, yellow, black) + alpha */
|
||||
KHR_DF_MODEL_CMYKA = 5U,
|
||||
/* Non-color coordinate data (X, Y, Z, W) */
|
||||
KHR_DF_MODEL_XYZW = 6U,
|
||||
/* Hue, saturation, value, hue angle on color circle, plus alpha */
|
||||
KHR_DF_MODEL_HSVA_ANG = 7U,
|
||||
/* Hue, saturation, lightness, hue angle on color circle, plus alpha */
|
||||
KHR_DF_MODEL_HSLA_ANG = 8U,
|
||||
/* Hue, saturation, value, hue on color hexagon, plus alpha */
|
||||
KHR_DF_MODEL_HSVA_HEX = 9U,
|
||||
/* Hue, saturation, lightness, hue on color hexagon, plus alpha */
|
||||
KHR_DF_MODEL_HSLA_HEX = 10U,
|
||||
/* Lightweight approximate color difference (luma, orange, green) */
|
||||
KHR_DF_MODEL_YCGCOA = 11U,
|
||||
/* ITU BT.2020 constant luminance YcCbcCrc */
|
||||
KHR_DF_MODEL_YCCBCCRC = 12U,
|
||||
/* ITU BT.2100 constant intensity ICtCp */
|
||||
KHR_DF_MODEL_ICTCP = 13U,
|
||||
/* CIE 1931 XYZ color coordinates (X, Y, Z) */
|
||||
KHR_DF_MODEL_CIEXYZ = 14U,
|
||||
/* CIE 1931 xyY color coordinates (X, Y, Y) */
|
||||
KHR_DF_MODEL_CIEXYY = 15U,
|
||||
|
||||
/* Compressed formats start at 128. */
|
||||
/* These compressed formats should generally have a single sample,
|
||||
sited at the 0,0 position of the texel block. Where multiple
|
||||
channels are used to distinguish formats, these should be cosited. */
|
||||
/* Direct3D (and S3) compressed formats */
|
||||
/* Note that premultiplied status is recorded separately */
|
||||
/* DXT1 "channels" are RGB (0), Alpha (1) */
|
||||
/* DXT1/BC1 with one channel is opaque */
|
||||
/* DXT1/BC1 with a cosited alpha sample is transparent */
|
||||
KHR_DF_MODEL_DXT1A = 128U,
|
||||
KHR_DF_MODEL_BC1A = 128U,
|
||||
/* DXT2/DXT3/BC2, with explicit 4-bit alpha */
|
||||
KHR_DF_MODEL_DXT2 = 129U,
|
||||
KHR_DF_MODEL_DXT3 = 129U,
|
||||
KHR_DF_MODEL_BC2 = 129U,
|
||||
/* DXT4/DXT5/BC3, with interpolated alpha */
|
||||
KHR_DF_MODEL_DXT4 = 130U,
|
||||
KHR_DF_MODEL_DXT5 = 130U,
|
||||
KHR_DF_MODEL_BC3 = 130U,
|
||||
/* BC4 - single channel interpolated 8-bit data */
|
||||
/* (The UNORM/SNORM variation is recorded in the channel data) */
|
||||
KHR_DF_MODEL_BC4 = 131U,
|
||||
/* BC5 - two channel interpolated 8-bit data */
|
||||
/* (The UNORM/SNORM variation is recorded in the channel data) */
|
||||
KHR_DF_MODEL_BC5 = 132U,
|
||||
/* BC6H - DX11 format for 16-bit float channels */
|
||||
KHR_DF_MODEL_BC6H = 133U,
|
||||
/* BC7 - DX11 format */
|
||||
KHR_DF_MODEL_BC7 = 134U,
|
||||
/* Gap left for future desktop expansion */
|
||||
|
||||
/* Mobile compressed formats follow */
|
||||
/* A format of ETC1 indicates that the format shall be decodable
|
||||
by an ETC1-compliant decoder and not rely on ETC2 features */
|
||||
KHR_DF_MODEL_ETC1 = 160U,
|
||||
/* A format of ETC2 is permitted to use ETC2 encodings on top of
|
||||
the baseline ETC1 specification */
|
||||
/* The ETC2 format has channels "red", "green", "RGB" and "alpha",
|
||||
which should be cosited samples */
|
||||
/* Punch-through alpha can be distinguished from full alpha by
|
||||
the plane size in bytes required for the texel block */
|
||||
KHR_DF_MODEL_ETC2 = 161U,
|
||||
/* Adaptive Scalable Texture Compression */
|
||||
/* ASTC HDR vs LDR is determined by the float flag in the channel */
|
||||
/* ASTC block size can be distinguished by texel block size */
|
||||
KHR_DF_MODEL_ASTC = 162U,
|
||||
/* ETC1S is a simplified subset of ETC1 */
|
||||
KHR_DF_MODEL_ETC1S = 163U,
|
||||
/* PowerVR Texture Compression */
|
||||
KHR_DF_MODEL_PVRTC = 164U,
|
||||
KHR_DF_MODEL_PVRTC2 = 165U,
|
||||
/* Proprietary formats (ATITC, etc.) should follow */
|
||||
KHR_DF_MODEL_MAX = 0xFFU
|
||||
} khr_df_model_e;
|
||||
|
||||
/* Definition of channel names for each color model */
|
||||
typedef enum _khr_df_model_channels_e
|
||||
{
|
||||
/* Unspecified format with nominal channel numbering */
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_0 = 0U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_1 = 1U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_2 = 2U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_3 = 3U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_4 = 4U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_5 = 5U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_6 = 6U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_7 = 7U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_8 = 8U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_9 = 9U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_10 = 10U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_11 = 11U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_12 = 12U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_13 = 13U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_14 = 14U,
|
||||
KHR_DF_CHANNEL_UNSPECIFIED_15 = 15U,
|
||||
/* MODEL_RGBSDA - red, green, blue, stencil, depth, alpha */
|
||||
KHR_DF_CHANNEL_RGBSDA_RED = 0U,
|
||||
KHR_DF_CHANNEL_RGBSDA_R = 0U,
|
||||
KHR_DF_CHANNEL_RGBSDA_GREEN = 1U,
|
||||
KHR_DF_CHANNEL_RGBSDA_G = 1U,
|
||||
KHR_DF_CHANNEL_RGBSDA_BLUE = 2U,
|
||||
KHR_DF_CHANNEL_RGBSDA_B = 2U,
|
||||
KHR_DF_CHANNEL_RGBSDA_STENCIL = 13U,
|
||||
KHR_DF_CHANNEL_RGBSDA_S = 13U,
|
||||
KHR_DF_CHANNEL_RGBSDA_DEPTH = 14U,
|
||||
KHR_DF_CHANNEL_RGBSDA_D = 14U,
|
||||
KHR_DF_CHANNEL_RGBSDA_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_RGBSDA_A = 15U,
|
||||
/* MODEL_YUVSDA - luma, Cb, Cr, stencil, depth, alpha */
|
||||
KHR_DF_CHANNEL_YUVSDA_Y = 0U,
|
||||
KHR_DF_CHANNEL_YUVSDA_CB = 1U,
|
||||
KHR_DF_CHANNEL_YUVSDA_U = 1U,
|
||||
KHR_DF_CHANNEL_YUVSDA_CR = 2U,
|
||||
KHR_DF_CHANNEL_YUVSDA_V = 2U,
|
||||
KHR_DF_CHANNEL_YUVSDA_STENCIL = 13U,
|
||||
KHR_DF_CHANNEL_YUVSDA_S = 13U,
|
||||
KHR_DF_CHANNEL_YUVSDA_DEPTH = 14U,
|
||||
KHR_DF_CHANNEL_YUVSDA_D = 14U,
|
||||
KHR_DF_CHANNEL_YUVSDA_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_YUVSDA_A = 15U,
|
||||
/* MODEL_YIQSDA - luma, in-phase, quadrature, stencil, depth, alpha */
|
||||
KHR_DF_CHANNEL_YIQSDA_Y = 0U,
|
||||
KHR_DF_CHANNEL_YIQSDA_I = 1U,
|
||||
KHR_DF_CHANNEL_YIQSDA_Q = 2U,
|
||||
KHR_DF_CHANNEL_YIQSDA_STENCIL = 13U,
|
||||
KHR_DF_CHANNEL_YIQSDA_S = 13U,
|
||||
KHR_DF_CHANNEL_YIQSDA_DEPTH = 14U,
|
||||
KHR_DF_CHANNEL_YIQSDA_D = 14U,
|
||||
KHR_DF_CHANNEL_YIQSDA_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_YIQSDA_A = 15U,
|
||||
/* MODEL_LABSDA - CIELAB/L*a*b* luma, red-green, blue-yellow, stencil, depth, alpha */
|
||||
KHR_DF_CHANNEL_LABSDA_L = 0U,
|
||||
KHR_DF_CHANNEL_LABSDA_A = 1U,
|
||||
KHR_DF_CHANNEL_LABSDA_B = 2U,
|
||||
KHR_DF_CHANNEL_LABSDA_STENCIL = 13U,
|
||||
KHR_DF_CHANNEL_LABSDA_S = 13U,
|
||||
KHR_DF_CHANNEL_LABSDA_DEPTH = 14U,
|
||||
KHR_DF_CHANNEL_LABSDA_D = 14U,
|
||||
KHR_DF_CHANNEL_LABSDA_ALPHA = 15U,
|
||||
/* NOTE: KHR_DF_CHANNEL_LABSDA_A is not a synonym for alpha! */
|
||||
/* MODEL_CMYKA - cyan, magenta, yellow, key/blacK, alpha */
|
||||
KHR_DF_CHANNEL_CMYKSDA_CYAN = 0U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_C = 0U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_MAGENTA = 1U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_M = 1U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_YELLOW = 2U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_Y = 2U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_KEY = 3U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_BLACK = 3U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_K = 3U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_CMYKSDA_A = 15U,
|
||||
/* MODEL_XYZW - coordinates x, y, z, w */
|
||||
KHR_DF_CHANNEL_XYZW_X = 0U,
|
||||
KHR_DF_CHANNEL_XYZW_Y = 1U,
|
||||
KHR_DF_CHANNEL_XYZW_Z = 2U,
|
||||
KHR_DF_CHANNEL_XYZW_W = 3U,
|
||||
/* MODEL_HSVA_ANG - value (luma), saturation, hue, alpha, angular projection, conical space */
|
||||
KHR_DF_CHANNEL_HSVA_ANG_VALUE = 0U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_V = 0U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_SATURATION = 1U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_S = 1U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_HUE = 2U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_H = 2U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_HSVA_ANG_A = 15U,
|
||||
/* MODEL_HSLA_ANG - lightness (luma), saturation, hue, alpha, angular projection, double conical space */
|
||||
KHR_DF_CHANNEL_HSLA_ANG_LIGHTNESS = 0U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_L = 0U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_SATURATION = 1U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_S = 1U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_HUE = 2U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_H = 2U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_HSLA_ANG_A = 15U,
|
||||
/* MODEL_HSVA_HEX - value (luma), saturation, hue, alpha, hexagonal projection, conical space */
|
||||
KHR_DF_CHANNEL_HSVA_HEX_VALUE = 0U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_V = 0U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_SATURATION = 1U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_S = 1U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_HUE = 2U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_H = 2U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_HSVA_HEX_A = 15U,
|
||||
/* MODEL_HSLA_HEX - lightness (luma), saturation, hue, alpha, hexagonal projection, double conical space */
|
||||
KHR_DF_CHANNEL_HSLA_HEX_LIGHTNESS = 0U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_L = 0U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_SATURATION = 1U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_S = 1U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_HUE = 2U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_H = 2U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_HSLA_HEX_A = 15U,
|
||||
/* MODEL_YCGCOA - luma, green delta, orange delta, alpha */
|
||||
KHR_DF_CHANNEL_YCGCOA_Y = 0U,
|
||||
KHR_DF_CHANNEL_YCGCOA_CG = 1U,
|
||||
KHR_DF_CHANNEL_YCGCOA_CO = 2U,
|
||||
KHR_DF_CHANNEL_YCGCOA_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_YCGCOA_A = 15U,
|
||||
/* MODEL_CIEXYZ - CIE 1931 X, Y, Z */
|
||||
KHR_DF_CHANNEL_CIEXYZ_X = 0U,
|
||||
KHR_DF_CHANNEL_CIEXYZ_Y = 1U,
|
||||
KHR_DF_CHANNEL_CIEXYZ_Z = 2U,
|
||||
/* MODEL_CIEXYY - CIE 1931 x, y, Y */
|
||||
KHR_DF_CHANNEL_CIEXYY_X = 0U,
|
||||
KHR_DF_CHANNEL_CIEXYY_YCHROMA = 1U,
|
||||
KHR_DF_CHANNEL_CIEXYY_YLUMA = 2U,
|
||||
|
||||
/* Compressed formats */
|
||||
/* MODEL_DXT1A/MODEL_BC1A */
|
||||
KHR_DF_CHANNEL_DXT1A_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_BC1A_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_DXT1A_ALPHAPRESENT = 1U,
|
||||
KHR_DF_CHANNEL_DXT1A_ALPHA = 1U,
|
||||
KHR_DF_CHANNEL_BC1A_ALPHAPRESENT = 1U,
|
||||
KHR_DF_CHANNEL_BC1A_ALPHA = 1U,
|
||||
/* MODEL_DXT2/3/MODEL_BC2 */
|
||||
KHR_DF_CHANNEL_DXT2_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_DXT3_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_BC2_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_DXT2_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_DXT3_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_BC2_ALPHA = 15U,
|
||||
/* MODEL_DXT4/5/MODEL_BC3 */
|
||||
KHR_DF_CHANNEL_DXT4_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_DXT5_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_BC3_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_DXT4_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_DXT5_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_BC3_ALPHA = 15U,
|
||||
/* MODEL_BC4 */
|
||||
KHR_DF_CHANNEL_BC4_DATA = 0U,
|
||||
/* MODEL_BC5 */
|
||||
KHR_DF_CHANNEL_BC5_RED = 0U,
|
||||
KHR_DF_CHANNEL_BC5_R = 0U,
|
||||
KHR_DF_CHANNEL_BC5_GREEN = 1U,
|
||||
KHR_DF_CHANNEL_BC5_G = 1U,
|
||||
/* MODEL_BC6H */
|
||||
KHR_DF_CHANNEL_BC6H_COLOR = 0U,
|
||||
KHR_DF_CHANNEL_BC6H_DATA = 0U,
|
||||
/* MODEL_BC7 */
|
||||
KHR_DF_CHANNEL_BC7_DATA = 0U,
|
||||
KHR_DF_CHANNEL_BC7_COLOR = 0U,
|
||||
/* MODEL_ETC1 */
|
||||
KHR_DF_CHANNEL_ETC1_DATA = 0U,
|
||||
KHR_DF_CHANNEL_ETC1_COLOR = 0U,
|
||||
/* MODEL_ETC2 */
|
||||
KHR_DF_CHANNEL_ETC2_RED = 0U,
|
||||
KHR_DF_CHANNEL_ETC2_R = 0U,
|
||||
KHR_DF_CHANNEL_ETC2_GREEN = 1U,
|
||||
KHR_DF_CHANNEL_ETC2_G = 1U,
|
||||
KHR_DF_CHANNEL_ETC2_COLOR = 2U,
|
||||
KHR_DF_CHANNEL_ETC2_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_ETC2_A = 15U,
|
||||
/* MODEL_ASTC */
|
||||
KHR_DF_CHANNEL_ASTC_DATA = 0U,
|
||||
/* MODEL_ETC1S */
|
||||
KHR_DF_CHANNEL_ETC1S_DATA = 0U,
|
||||
KHR_DF_CHANNEL_ETC1S_COLOR = 0U,
|
||||
/* MODEL_PVRTC */
|
||||
KHR_DF_CHANNEL_PVRTC_DATA = 0U,
|
||||
KHR_DF_CHANNEL_PVRTC_COLOR = 0U,
|
||||
/* MODEL_PVRTC2 */
|
||||
KHR_DF_CHANNEL_PVRTC2_DATA = 0U,
|
||||
KHR_DF_CHANNEL_PVRTC2_COLOR = 0U,
|
||||
|
||||
/* Common channel names shared by multiple formats */
|
||||
KHR_DF_CHANNEL_COMMON_LUMA = 0U,
|
||||
KHR_DF_CHANNEL_COMMON_L = 0U,
|
||||
KHR_DF_CHANNEL_COMMON_STENCIL = 13U,
|
||||
KHR_DF_CHANNEL_COMMON_S = 13U,
|
||||
KHR_DF_CHANNEL_COMMON_DEPTH = 14U,
|
||||
KHR_DF_CHANNEL_COMMON_D = 14U,
|
||||
KHR_DF_CHANNEL_COMMON_ALPHA = 15U,
|
||||
KHR_DF_CHANNEL_COMMON_A = 15U
|
||||
} khr_df_model_channels_e;
|
||||
|
||||
/* Definition of the primary colors in color coordinates.
|
||||
This is implicitly responsible for defining the conversion
|
||||
between RGB an YUV color spaces.
|
||||
LAB and related absolute color models should use
|
||||
KHR_DF_PRIMARIES_CIEXYZ. */
|
||||
typedef enum _khr_df_primaries_e
|
||||
{
|
||||
/* No color primaries defined */
|
||||
KHR_DF_PRIMARIES_UNSPECIFIED = 0U,
|
||||
/* Color primaries of ITU-R BT.709 and sRGB */
|
||||
KHR_DF_PRIMARIES_BT709 = 1U,
|
||||
/* Synonym for KHR_DF_PRIMARIES_BT709 */
|
||||
KHR_DF_PRIMARIES_SRGB = 1U,
|
||||
/* Color primaries of ITU-R BT.601 (625-line EBU variant) */
|
||||
KHR_DF_PRIMARIES_BT601_EBU = 2U,
|
||||
/* Color primaries of ITU-R BT.601 (525-line SMPTE C variant) */
|
||||
KHR_DF_PRIMARIES_BT601_SMPTE = 3U,
|
||||
/* Color primaries of ITU-R BT.2020 */
|
||||
KHR_DF_PRIMARIES_BT2020 = 4U,
|
||||
/* CIE theoretical color coordinate space */
|
||||
KHR_DF_PRIMARIES_CIEXYZ = 5U,
|
||||
/* Academy Color Encoding System primaries */
|
||||
KHR_DF_PRIMARIES_ACES = 6U,
|
||||
/* Color primaries of ACEScc */
|
||||
KHR_DF_PRIMARIES_ACESCC = 7U,
|
||||
/* Legacy NTSC 1953 primaries */
|
||||
KHR_DF_PRIMARIES_NTSC1953 = 8U,
|
||||
/* Legacy PAL 525-line primaries */
|
||||
KHR_DF_PRIMARIES_PAL525 = 9U,
|
||||
/* Color primaries of Display P3 */
|
||||
KHR_DF_PRIMARIES_DISPLAYP3 = 10U,
|
||||
/* Color primaries of Adobe RGB (1998) */
|
||||
KHR_DF_PRIMARIES_ADOBERGB = 11U,
|
||||
KHR_DF_PRIMARIES_MAX = 0xFFU
|
||||
} khr_df_primaries_e;
|
||||
|
||||
/* Definition of the optical to digital transfer function
|
||||
("gamma correction"). Most transfer functions are not a pure
|
||||
power function and also include a linear element.
|
||||
LAB and related absolute color representations should use
|
||||
KHR_DF_TRANSFER_UNSPECIFIED. */
|
||||
typedef enum _khr_df_transfer_e
|
||||
{
|
||||
/* No transfer function defined */
|
||||
KHR_DF_TRANSFER_UNSPECIFIED = 0U,
|
||||
/* Linear transfer function (value proportional to intensity) */
|
||||
KHR_DF_TRANSFER_LINEAR = 1U,
|
||||
/* Perceptually-linear transfer function of sRGH (~2.4) */
|
||||
KHR_DF_TRANSFER_SRGB = 2U,
|
||||
/* Perceptually-linear transfer function of ITU non-HDR specifications (~1/.45) */
|
||||
KHR_DF_TRANSFER_ITU = 3U,
|
||||
/* SMTPE170M (digital NTSC) defines an alias for the ITU transfer function (~1/.45) */
|
||||
KHR_DF_TRANSFER_SMTPE170M = 3U,
|
||||
/* Perceptually-linear gamma function of original NTSC (simple 2.2 gamma) */
|
||||
KHR_DF_TRANSFER_NTSC = 4U,
|
||||
/* Sony S-log used by Sony video cameras */
|
||||
KHR_DF_TRANSFER_SLOG = 5U,
|
||||
/* Sony S-log 2 used by Sony video cameras */
|
||||
KHR_DF_TRANSFER_SLOG2 = 6U,
|
||||
/* ITU BT.1886 EOTF */
|
||||
KHR_DF_TRANSFER_BT1886 = 7U,
|
||||
/* ITU BT.2100 HLG OETF */
|
||||
KHR_DF_TRANSFER_HLG_OETF = 8U,
|
||||
/* ITU BT.2100 HLG EOTF */
|
||||
KHR_DF_TRANSFER_HLG_EOTF = 9U,
|
||||
/* ITU BT.2100 PQ EOTF */
|
||||
KHR_DF_TRANSFER_PQ_EOTF = 10U,
|
||||
/* ITU BT.2100 PQ OETF */
|
||||
KHR_DF_TRANSFER_PQ_OETF = 11U,
|
||||
/* DCI P3 transfer function */
|
||||
KHR_DF_TRANSFER_DCIP3 = 12U,
|
||||
/* Legacy PAL OETF */
|
||||
KHR_DF_TRANSFER_PAL_OETF = 13U,
|
||||
/* Legacy PAL 625-line EOTF */
|
||||
KHR_DF_TRANSFER_PAL625_EOTF = 14U,
|
||||
/* Legacy ST240 transfer function */
|
||||
KHR_DF_TRANSFER_ST240 = 15U,
|
||||
/* ACEScc transfer function */
|
||||
KHR_DF_TRANSFER_ACESCC = 16U,
|
||||
/* ACEScct transfer function */
|
||||
KHR_DF_TRANSFER_ACESCCT = 17U,
|
||||
/* Adobe RGB (1998) transfer function */
|
||||
KHR_DF_TRANSFER_ADOBERGB = 18U,
|
||||
KHR_DF_TRANSFER_MAX = 0xFFU
|
||||
} khr_df_transfer_e;
|
||||
|
||||
typedef enum _khr_df_flags_e
|
||||
{
|
||||
KHR_DF_FLAG_ALPHA_STRAIGHT = 0U,
|
||||
KHR_DF_FLAG_ALPHA_PREMULTIPLIED = 1U
|
||||
} khr_df_flags_e;
|
||||
|
||||
typedef enum _khr_df_sample_datatype_qualifiers_e
|
||||
{
|
||||
KHR_DF_SAMPLE_DATATYPE_LINEAR = 1U << 4U,
|
||||
KHR_DF_SAMPLE_DATATYPE_EXPONENT = 1U << 5U,
|
||||
KHR_DF_SAMPLE_DATATYPE_SIGNED = 1U << 6U,
|
||||
KHR_DF_SAMPLE_DATATYPE_FLOAT = 1U << 7U
|
||||
} khr_df_sample_datatype_qualifiers_e;
|
||||
|
||||
#endif
|
||||
1009
raytracer/nvpro_core/fileformats/nv_dds.cpp
Normal file
1009
raytracer/nvpro_core/fileformats/nv_dds.cpp
Normal file
File diff suppressed because it is too large
Load diff
357
raytracer/nvpro_core/fileformats/nv_dds.h
Normal file
357
raytracer/nvpro_core/fileformats/nv_dds.h
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2016-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
//--------------------------------------------------------------------
|
||||
/// @DOC_SKIP (keyword to exclude this file from automatic README.md generation)
|
||||
#ifndef __DDS_H__
|
||||
#define __DDS_H__
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <deque>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#define COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
|
||||
#define RED 0x1903
|
||||
#define RG8 0x822B
|
||||
#define RGB8 0x8051
|
||||
#define RGBA8 0x8058
|
||||
#define BGR_EXT 0x80E0
|
||||
#define BGRA_EXT 0x80E1
|
||||
#define LUMINANCE 0x1909
|
||||
|
||||
namespace nv_dds {
|
||||
// surface description flags
|
||||
const uint32_t DDSF_CAPS = 0x00000001l;
|
||||
const uint32_t DDSF_HEIGHT = 0x00000002l;
|
||||
const uint32_t DDSF_WIDTH = 0x00000004l;
|
||||
const uint32_t DDSF_PITCH = 0x00000008l;
|
||||
const uint32_t DDSF_PIXELFORMAT = 0x00001000l;
|
||||
const uint32_t DDSF_MIPMAPCOUNT = 0x00020000l;
|
||||
const uint32_t DDSF_LINEARSIZE = 0x00080000l;
|
||||
const uint32_t DDSF_DEPTH = 0x00800000l;
|
||||
|
||||
// pixel format flags
|
||||
const uint32_t DDSF_ALPHAPIXELS = 0x00000001l;
|
||||
const uint32_t DDSF_FOURCC = 0x00000004l;
|
||||
const uint32_t DDSF_RGB = 0x00000040l;
|
||||
const uint32_t DDSF_RGBA = 0x00000041l;
|
||||
|
||||
// dwCaps1 flags
|
||||
const uint32_t DDSF_COMPLEX = 0x00000008l;
|
||||
const uint32_t DDSF_TEXTURE = 0x00001000l;
|
||||
const uint32_t DDSF_MIPMAP = 0x00400000l;
|
||||
|
||||
// dwCaps2 flags
|
||||
const uint32_t DDSF_CUBEMAP = 0x00000200l;
|
||||
const uint32_t DDSF_CUBEMAP_POSITIVEX = 0x00000400l;
|
||||
const uint32_t DDSF_CUBEMAP_NEGATIVEX = 0x00000800l;
|
||||
const uint32_t DDSF_CUBEMAP_POSITIVEY = 0x00001000l;
|
||||
const uint32_t DDSF_CUBEMAP_NEGATIVEY = 0x00002000l;
|
||||
const uint32_t DDSF_CUBEMAP_POSITIVEZ = 0x00004000l;
|
||||
const uint32_t DDSF_CUBEMAP_NEGATIVEZ = 0x00008000l;
|
||||
const uint32_t DDSF_CUBEMAP_ALL_FACES = 0x0000FC00l;
|
||||
const uint32_t DDSF_VOLUME = 0x00200000l;
|
||||
|
||||
// compressed texture types
|
||||
const uint32_t FOURCC_DXT1 = 0x31545844l; //(MAKEFOURCC('D','X','T','1'))
|
||||
const uint32_t FOURCC_DXT3 = 0x33545844l; //(MAKEFOURCC('D','X','T','3'))
|
||||
const uint32_t FOURCC_DXT5 = 0x35545844l; //(MAKEFOURCC('D','X','T','5'))
|
||||
|
||||
struct DXTColBlock
|
||||
{
|
||||
unsigned short col0;
|
||||
unsigned short col1;
|
||||
|
||||
unsigned char row[4];
|
||||
};
|
||||
|
||||
struct DXT3AlphaBlock
|
||||
{
|
||||
unsigned short row[4];
|
||||
};
|
||||
|
||||
struct DXT5AlphaBlock
|
||||
{
|
||||
unsigned char alpha0;
|
||||
unsigned char alpha1;
|
||||
|
||||
unsigned char row[6];
|
||||
};
|
||||
|
||||
struct DDS_PIXELFORMAT
|
||||
{
|
||||
uint32_t dwSize;
|
||||
uint32_t dwFlags;
|
||||
uint32_t dwFourCC;
|
||||
uint32_t dwRGBBitCount;
|
||||
uint32_t dwRBitMask;
|
||||
uint32_t dwGBitMask;
|
||||
uint32_t dwBBitMask;
|
||||
uint32_t dwABitMask;
|
||||
};
|
||||
|
||||
struct DDS_HEADER
|
||||
{
|
||||
uint32_t dwSize;
|
||||
uint32_t dwFlags;
|
||||
uint32_t dwHeight;
|
||||
uint32_t dwWidth;
|
||||
uint32_t dwPitchOrLinearSize;
|
||||
uint32_t dwDepth;
|
||||
uint32_t dwMipMapCount;
|
||||
uint32_t dwReserved1[11];
|
||||
DDS_PIXELFORMAT ddspf;
|
||||
uint32_t dwCaps1;
|
||||
uint32_t dwCaps2;
|
||||
uint32_t dwReserved2[3];
|
||||
};
|
||||
|
||||
enum TextureType
|
||||
{
|
||||
TextureNone,
|
||||
TextureFlat, // 1D, 2D, and rectangle textures
|
||||
Texture3D,
|
||||
TextureCubemap
|
||||
};
|
||||
|
||||
class CSurface
|
||||
{
|
||||
public:
|
||||
CSurface();
|
||||
CSurface(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char* pixels);
|
||||
CSurface(const CSurface& copy);
|
||||
CSurface& operator=(const CSurface& rhs);
|
||||
virtual ~CSurface();
|
||||
|
||||
operator unsigned char*() const;
|
||||
|
||||
virtual void create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char* pixels);
|
||||
virtual void clear();
|
||||
|
||||
inline unsigned int get_width() const { return m_width; }
|
||||
inline unsigned int get_height() const { return m_height; }
|
||||
inline unsigned int get_depth() const { return m_depth; }
|
||||
inline unsigned int get_size() const { return m_size; }
|
||||
|
||||
private:
|
||||
unsigned int m_width;
|
||||
unsigned int m_height;
|
||||
unsigned int m_depth;
|
||||
unsigned int m_size;
|
||||
|
||||
unsigned char* m_pixels;
|
||||
};
|
||||
|
||||
class CTexture : public CSurface
|
||||
{
|
||||
friend class CDDSImage;
|
||||
|
||||
public:
|
||||
CTexture();
|
||||
CTexture(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char* pixels);
|
||||
CTexture(const CTexture& copy);
|
||||
CTexture& operator=(const CTexture& rhs);
|
||||
~CTexture();
|
||||
|
||||
void create(unsigned int w, unsigned int h, unsigned int d, unsigned int imgsize, const unsigned char* pixels);
|
||||
void clear();
|
||||
|
||||
inline const CSurface& get_mipmap(unsigned int index) const
|
||||
{
|
||||
assert(!m_mipmaps.empty());
|
||||
assert(index < m_mipmaps.size());
|
||||
|
||||
return m_mipmaps[index];
|
||||
}
|
||||
|
||||
inline void add_mipmap(const CSurface& mipmap) { m_mipmaps.push_back(mipmap); }
|
||||
|
||||
inline unsigned int get_num_mipmaps() const { return (unsigned int)m_mipmaps.size(); }
|
||||
|
||||
protected:
|
||||
inline CSurface& get_mipmap(unsigned int index)
|
||||
{
|
||||
assert(!m_mipmaps.empty());
|
||||
assert(index < m_mipmaps.size());
|
||||
|
||||
return m_mipmaps[index];
|
||||
}
|
||||
|
||||
private:
|
||||
std::deque<CSurface> m_mipmaps;
|
||||
};
|
||||
|
||||
class CDDSImage
|
||||
{
|
||||
public:
|
||||
CDDSImage();
|
||||
virtual ~CDDSImage();
|
||||
|
||||
void create_textureFlat(unsigned int format, unsigned int components, const CTexture& baseImage);
|
||||
void create_texture3D(unsigned int format, unsigned int components, const CTexture& baseImage);
|
||||
void create_textureCubemap(unsigned int format,
|
||||
unsigned int components,
|
||||
const CTexture& positiveX,
|
||||
const CTexture& negativeX,
|
||||
const CTexture& positiveY,
|
||||
const CTexture& negativeY,
|
||||
const CTexture& positiveZ,
|
||||
const CTexture& negativeZ);
|
||||
|
||||
void clear();
|
||||
virtual bool load(std::string filename, bool flipImage = true, bool RGB2RGBA = true);
|
||||
bool save(std::string filename, bool flipImage = true);
|
||||
|
||||
inline operator unsigned char*()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0];
|
||||
}
|
||||
|
||||
inline unsigned int get_width()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0].get_width();
|
||||
}
|
||||
|
||||
inline unsigned int get_height()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0].get_height();
|
||||
}
|
||||
|
||||
inline unsigned int get_depth()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0].get_depth();
|
||||
}
|
||||
|
||||
inline unsigned int get_size()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0].get_size();
|
||||
}
|
||||
|
||||
inline unsigned int get_num_mipmaps()
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
|
||||
return m_images[0].get_num_mipmaps();
|
||||
}
|
||||
|
||||
inline const CSurface& get_mipmap(unsigned int index) const
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
if(index < m_images[0].get_num_mipmaps())
|
||||
return m_images[0].get_mipmap(index);
|
||||
else
|
||||
return m_images[0];
|
||||
}
|
||||
|
||||
inline const CTexture& get_cubemap_face(unsigned int face) const
|
||||
{
|
||||
assert(m_valid);
|
||||
assert(!m_images.empty());
|
||||
assert(m_images.size() == 6);
|
||||
assert(m_type == TextureCubemap);
|
||||
assert(face < 6);
|
||||
|
||||
return m_images[face];
|
||||
}
|
||||
|
||||
inline unsigned int get_components() { return m_components; }
|
||||
inline unsigned int get_format() { return m_format; }
|
||||
inline unsigned int get_internal_format() { return m_internal_format; }
|
||||
inline TextureType get_type() { return m_type; }
|
||||
|
||||
inline bool is_compressed()
|
||||
{
|
||||
if((m_format == COMPRESSED_RGBA_S3TC_DXT1_EXT) || (m_format == COMPRESSED_RGBA_S3TC_DXT3_EXT)
|
||||
|| (m_format == COMPRESSED_RGBA_S3TC_DXT5_EXT))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool is_cubemap() { return (m_type == TextureCubemap); }
|
||||
inline bool is_volume() { return (m_type == Texture3D); }
|
||||
inline bool is_valid() { return m_valid; }
|
||||
|
||||
inline bool is_dword_aligned()
|
||||
{
|
||||
assert(m_valid);
|
||||
|
||||
int dwordLineSize = get_dword_aligned_linesize(get_width(), m_components * 8);
|
||||
int curLineSize = get_width() * m_components;
|
||||
|
||||
return (dwordLineSize == curLineSize);
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned int clamp_size(unsigned int size);
|
||||
unsigned int size_dxtc(unsigned int width, unsigned int height);
|
||||
unsigned int size_rgb(unsigned int width, unsigned int height);
|
||||
inline void swap_endian(void* val);
|
||||
|
||||
// calculates 4-byte aligned width of image
|
||||
inline unsigned int get_dword_aligned_linesize(unsigned int width, unsigned int bpp)
|
||||
{
|
||||
return ((width * bpp + 31) & -32) >> 3;
|
||||
}
|
||||
|
||||
void flip(CSurface& surface);
|
||||
void flip_texture(CTexture& texture);
|
||||
|
||||
void swap(void* byte1, void* byte2, unsigned int size);
|
||||
void flip_blocks_dxtc1(DXTColBlock* line, unsigned int numBlocks);
|
||||
void flip_blocks_dxtc3(DXTColBlock* line, unsigned int numBlocks);
|
||||
void flip_blocks_dxtc5(DXTColBlock* line, unsigned int numBlocks);
|
||||
void flip_dxt5_alpha(DXT5AlphaBlock* block);
|
||||
|
||||
void write_texture(const CTexture& texture, FILE* fp);
|
||||
|
||||
unsigned int m_format, m_internal_format;
|
||||
unsigned int m_components;
|
||||
TextureType m_type;
|
||||
bool m_valid;
|
||||
|
||||
std::deque<CTexture> m_images;
|
||||
};
|
||||
} // namespace nv_dds
|
||||
#endif
|
||||
322
raytracer/nvpro_core/fileformats/nv_ktx.h
Normal file
322
raytracer/nvpro_core/fileformats/nv_ktx.h
Normal file
|
|
@ -0,0 +1,322 @@
|
|||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/** @DOC_START
|
||||
|
||||
A mostly self-contained reader and writer for KTX2 files and reader for KTX1
|
||||
files. Relies on Vulkan (for KTX2), GL (for KTX1), and the
|
||||
Khronos Data Format.
|
||||
|
||||
Sample usage for reading files:
|
||||
|
||||
```cpp
|
||||
KTXImage image;
|
||||
ErrorWithText maybe_error = image.readFromFile("data/image.ktx2");
|
||||
if(maybe_error.has_value())
|
||||
{
|
||||
// Do something with the error message, maybe_error.value()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Access subresources using image.subresource(...), and upload them
|
||||
// to the GPU using your graphics API of choice.
|
||||
}
|
||||
```
|
||||
|
||||
Define NVP_SUPPORTS_ZSTD, NVP_SUPPORTS_GZLIB, and NVP_SUPPORTS_BASISU to
|
||||
include the Zstd, Zlib, and Basis Universal headers respectively, and to
|
||||
enable reading these formats. This will also enable writing Zstd and
|
||||
Basis Universal-compressed formats.
|
||||
If you're using this inside the nvpro-samples framework, you can add all
|
||||
three quickly by adding _add_package_KTX() to your dependencies
|
||||
in CMakeLists.txt.
|
||||
|
||||
-- @DOC_END */
|
||||
|
||||
#ifndef __NV_KTX_H__
|
||||
#define __NV_KTX_H__
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
namespace nv_ktx {
|
||||
// These functions return an empty std::optional if they succeeded, and a
|
||||
// value with text describing the error if they failed.
|
||||
using ErrorWithText = std::optional<std::string>;
|
||||
|
||||
// KTX files can store key/value pairs, where the key is a UTF-8
|
||||
// null-terminated string and the value is an arbitrary byte array
|
||||
// (but often a null-terminated ASCII string).
|
||||
using KeyValueData = std::map<std::string, std::vector<char>>;
|
||||
|
||||
// Apps can define custom functions that return the size in bytes of new
|
||||
// VkFormats. Functions of this type should take in the width, height, and
|
||||
// depth of a format in the first 3 parameters, the VkFormat in the 4th, and
|
||||
// return the size in bytes of an image with those dimensions in the last
|
||||
// parameter. Passing in an image size of (1, 1, 1) should give the size of
|
||||
// the smallest possible nonzero image. If the format is unknown, it should
|
||||
// return a string; if it succeeds, it should return {}.
|
||||
using CustomExportSizeFuncPtr = ErrorWithText (*)(size_t, size_t, size_t, VkFormat, size_t&);
|
||||
|
||||
// Configurable settings for reading files. This is a struct so that it can
|
||||
// be extended in the future.
|
||||
struct ReadSettings
|
||||
{
|
||||
// Whether to read all mips (true), or only the base mip (false).
|
||||
bool mips = true;
|
||||
// See docs for CustomExportSizeFuncPtr
|
||||
CustomExportSizeFuncPtr custom_size_callback = nullptr;
|
||||
// If true, the reader will validate that the KTX file contains at least 1
|
||||
// byte per subresource. This will involve seeking to the end of the stream
|
||||
// to determine the length of the stream or file.
|
||||
bool validate_input_size = true;
|
||||
// Limits the maximum uncompressed image size size per mip and
|
||||
// supercompression global data size in bytes; produces errors for any files
|
||||
// with a larger size. This allows certain types of issues with
|
||||
// supercompression to be caught before the rest of the file is loaded. If
|
||||
// one wants to allow larger images, they should set this to a larger value
|
||||
// (such as UINT64_MAX).
|
||||
uint64_t max_resource_size_in_bytes = 1ULL << 30;
|
||||
// By default, UASTC is transcoded to BC7 instead of ASTC. Setting this to
|
||||
// true will transcode UASTC to ASTC.
|
||||
bool device_supports_astc = false;
|
||||
};
|
||||
|
||||
enum class WriteSupercompressionType
|
||||
{
|
||||
NONE, // Apply no supercompression, or use the supercompression included with ETC1S.
|
||||
ZSTD, // ZStandard
|
||||
};
|
||||
|
||||
enum class EncodeRGBA8ToFormat
|
||||
{
|
||||
NO, // Don't encode the data to a Basis Universal format.
|
||||
// For the following modes, the image format must be VK_FORMAT_B8G8R8A8_SRGB
|
||||
// or VK_FORMAT_B8G8R8A8_UNORM. Basis Universal will then be called to encode
|
||||
// the data and write the KTX2 file.
|
||||
UASTC, // Highest-quality format; RGBA data, usually decodes to ASTC or BC7.
|
||||
ETC1S_RGBA, // RGBA data; usually decodes to BC7 (8bpp).
|
||||
ETC1S_RGB // RGB channels only; usually decodes to BC7 (8bpp).
|
||||
};
|
||||
|
||||
enum class UASTCEncodingQuality
|
||||
{
|
||||
FASTEST = 0,
|
||||
FASTER = 1,
|
||||
DEFAULT = 2,
|
||||
SLOWER = 3,
|
||||
VERYSLOW = 4
|
||||
};
|
||||
|
||||
// Configurable settings for writing files. This is a struct so that it can
|
||||
// be extended in the future.
|
||||
struct WriteSettings
|
||||
{
|
||||
// Type of supercompression to apply if any
|
||||
WriteSupercompressionType supercompression = WriteSupercompressionType::NONE;
|
||||
// Supercompression quality level for Zstandard, which is supported by all
|
||||
// formats other than ETC1s. This ranges from ZSTD_minCLevel() to
|
||||
// ZSTD_maxCLevel().
|
||||
// Higher levels are slower.
|
||||
int supercompression_level = 0;
|
||||
// See docs for CustomExportSizeFuncPtr
|
||||
CustomExportSizeFuncPtr custom_size_callback = nullptr;
|
||||
// Whether to encode the data to a Basis format. If not NO, the image format
|
||||
// must be VK_FORMAT_B8G8R8A8_SRGB or VK_FORMAT_B8G8R8A8_UNORM.
|
||||
EncodeRGBA8ToFormat encode_rgba8_to_format = EncodeRGBA8ToFormat::NO;
|
||||
// Applies when encoding RGBA8 to UASTC. Corresponds to cPackUASTCLevel in Basis.
|
||||
UASTCEncodingQuality uastc_encoding_quality = UASTCEncodingQuality::DEFAULT;
|
||||
// Applies when encoding RGBA8 to ETC1S. Ranges from 0 to BASISU_MAX_COMPRESSION_LEVEL.
|
||||
// Higher levels are slower.
|
||||
int etc1s_encoding_level = 3;
|
||||
// Lambda for UASTC Rate-Distortion Optimization, from 0 to 50. Higher numbers
|
||||
// compress more at lower quality.
|
||||
float rdo_lambda = 10.0f;
|
||||
// Enables Rate-Distortion Optimization for ETC1S.
|
||||
bool rdo_etc1s = true;
|
||||
};
|
||||
|
||||
// An enum for each of the possible elements in a ktxSwizzle value.
|
||||
enum class KTX_SWIZZLE
|
||||
{
|
||||
ZERO = 0,
|
||||
ONE,
|
||||
R,
|
||||
G,
|
||||
B,
|
||||
A
|
||||
};
|
||||
|
||||
// Represents the inflated contents of a KTX or KTX2 file. This includes:
|
||||
// - the VkFormat of the image data,
|
||||
// - the formatted (i.e. encoded/compressed) image data for
|
||||
// each element, mip level, and face,
|
||||
// - and the table of key/value pairs.
|
||||
// The stored data is not supercompressed, as we supercompress and inflate when
|
||||
// writing and reading to and from KTX files.
|
||||
struct KTXImage
|
||||
{
|
||||
public:
|
||||
// Clears, then sets up storage for an image with the given dimensions. These
|
||||
// can be set to 0 instead of 1 along each dimension to indicate different
|
||||
// texture types, such as 1D or 2D. See table 4.1 in the KTX 2.0
|
||||
// specification, or the comments on these variables below.
|
||||
//
|
||||
// Width, height, depth, and VkFormat should be set manually using the
|
||||
// member variables. This does not allocate the encoded subresources.
|
||||
// This can fail e.g. if the parameters are so large that the app runs out of
|
||||
// memory when allocating space.
|
||||
ErrorWithText allocate(
|
||||
// The number of mips (levels) in the image, including the base mip.
|
||||
uint32_t _num_mips = 1,
|
||||
// The number of array elements (layers) in the image. 0 for a non-array
|
||||
// texture (this has meaning in OpenGL, but not in Vulkan).
|
||||
// If representing an incomplete cube map (i.e. a cube map where not all
|
||||
// faces are stored), this is
|
||||
// (faces per cube map) * (number of cube maps)
|
||||
// and _num_faces is 1.
|
||||
uint32_t _num_layers = 0,
|
||||
// The number of faces in the image (1 for a 2D texture, 6 for a cube map)
|
||||
uint32_t _num_faces = 1);
|
||||
|
||||
// Clears all stored image and table data.
|
||||
void clear();
|
||||
|
||||
// Determines the VkImageType corresponding to this KTXImage based on the
|
||||
// dimensions, according to Table 4.1 of the KTX 2.0 specification.
|
||||
// In the invalid case where mip_0_width == 0, returns VK_IMAGE_TYPE_1D.
|
||||
VkImageType getImageType() const;
|
||||
|
||||
// Returns whether the loaded file was a KTX1 (1) or KTX2 (2) file.
|
||||
uint32_t getKTXVersion() const;
|
||||
|
||||
// Mutably accesses the subresource at the given mip, layer, and face. If the
|
||||
// given indices are out of range, throws an std::out_of_range exception.
|
||||
std::vector<char>& subresource(uint32_t mip = 0, uint32_t layer = 0, uint32_t face = 0);
|
||||
|
||||
// Reads this structure from a KTX stream, advancing the stream as well.
|
||||
// Returns an optional error message if the read failed.
|
||||
ErrorWithText readFromStream(std::istream& input, // The input stream, at the start of the KTX data
|
||||
const ReadSettings& readSettings); // Settings for the reader
|
||||
|
||||
// Wrapper for readFromStream for a filename.
|
||||
ErrorWithText readFromFile(const char* filename, // The .ktx or .ktx2 file to read from.
|
||||
const ReadSettings& readSettings); // Settings for the reader
|
||||
|
||||
// Writes this structure in KTX2 format to a stream.
|
||||
ErrorWithText writeKTX2Stream(std::ostream& output, // The output stream, at the point to start writing
|
||||
const WriteSettings& writeSettings); // Settings for the writer
|
||||
|
||||
// Wrapper for writeKTX2Stream for a filename. Customarily, the filename ends
|
||||
// in .ktx2.
|
||||
ErrorWithText writeKTX2File(const char* filename, // The output stream, at the point to start writing
|
||||
const WriteSettings& writeSettings); // Settings for the writer
|
||||
|
||||
public:
|
||||
// These members can be freely modified.
|
||||
|
||||
// The format of the data in this image. When reading a KTX1 file (which
|
||||
// specifies a GL format), we automatically convert to a VkFormat.
|
||||
VkFormat format = VK_FORMAT_UNDEFINED;
|
||||
// The width in pixels of the largest mip. Must be > 0.
|
||||
uint32_t mip_0_width = 1;
|
||||
// The height in pixels of the largest mip. 0 for a 1D texture.
|
||||
uint32_t mip_0_height = 0;
|
||||
// The depth in pixels of the largest mip. 0 for a 1D or 2D texture.
|
||||
uint32_t mip_0_depth = 0;
|
||||
// The number of mips (levels) in the image, including the base mip. Always
|
||||
// greater than or equal to 1.
|
||||
uint32_t num_mips = 1;
|
||||
// The number of array elements (layers) in the image. 0 for a non-array
|
||||
// texture (this has meaning in OpenGL, but not in Vulkan).
|
||||
// If representing an incomplete cube map (i.e. a cube map where not all
|
||||
// faces are stored), this is
|
||||
// (faces per cube map) * (number of cube maps)
|
||||
// and _num_faces is 1.
|
||||
uint32_t num_layers_possibly_0 = 0;
|
||||
// The number of faces in the image (1 for a 2D texture, 6 for a cube map)
|
||||
uint32_t num_faces = 0;
|
||||
// This file's key/value table. Note that for the ktxSwizzle key, one should
|
||||
// use the swizzle element instead!
|
||||
KeyValueData key_value_data{};
|
||||
|
||||
// KTX files can set the number of mips to 0 to indicate that
|
||||
// the application should generate a full mip chain.
|
||||
bool app_should_generate_mips = false;
|
||||
|
||||
// Whether this data represents an image with premultiplied alpha
|
||||
// (generally, storing (r*a, g*a, b*a, a) instead of (r, g, b, a)).
|
||||
// This is used when writing the Data Format Descriptor in KTX2.
|
||||
bool is_premultiplied = false;
|
||||
|
||||
// Whether the Data Format Descriptor transferFunction for this data is
|
||||
// KHR_DF_TRANSFER_SRGB. (Otherwise, it is KHR_DF_TRANSFER_LINEAR.)
|
||||
// More informally, says "when a GPU accesses this texture, should it perform
|
||||
// sRGB-to-linear conversion". For instance, this is usually true for color
|
||||
// textures, and false for normal maps and depth maps. Validation requires
|
||||
// this to match the VkFormat - except in special cases such as Basis UASTC
|
||||
// and Universal.
|
||||
bool is_srgb = true;
|
||||
|
||||
// Specifies how the red, green, blue, and alpha channels should be sampled
|
||||
// from the source data. For instance, {R, G, ZERO, ONE} means the red and
|
||||
// green channels should be sampled from the red and green texture components
|
||||
// respectively, the blue channel is sampled as 0, and the alpha channel is
|
||||
// sampled as 1.
|
||||
// Note that values here should be read in lieu of the key_value_data's
|
||||
// ktxSwizzle key! This is to make Basis Universal usage easier in the future.
|
||||
std::array<KTX_SWIZZLE, 4> swizzle = {KTX_SWIZZLE::R, KTX_SWIZZLE::G, KTX_SWIZZLE::B, KTX_SWIZZLE::A};
|
||||
|
||||
// The loader will transcode supercompressed files to an appropriate format
|
||||
// when supercompression libraries are available, so a loaded supercompressed
|
||||
// file typically looks like a regular BC4, BC7 or ASTC file. One can read
|
||||
// this field to determine what the original supercompressed format was.
|
||||
enum class InputSupercompression
|
||||
{
|
||||
eNone,
|
||||
eBasisUASTC,
|
||||
eBasisETC1S
|
||||
} input_supercompression = InputSupercompression::eNone;
|
||||
|
||||
private:
|
||||
// Private functions used by readFromStream after it determines whether the
|
||||
// stream is a KTX1 or KTX2 stream.
|
||||
ErrorWithText readFromKTX1Stream(std::istream& input, const ReadSettings& readSettings);
|
||||
ErrorWithText readFromKTX2Stream(std::istream& input, const ReadSettings& readSettings);
|
||||
|
||||
// Whether the loaded file was a KTX1 (1) or KTX2 (2) file.
|
||||
uint32_t read_ktx_version = 1;
|
||||
|
||||
private:
|
||||
// A structure containing all the image's encoded, non-supercompressed
|
||||
// image data. We store this in a buffer with an entry per subresource, and
|
||||
// provide accessors to it.
|
||||
std::vector<std::vector<char>> data;
|
||||
};
|
||||
|
||||
} // namespace nv_ktx
|
||||
|
||||
#include "nv_ktx.inl"
|
||||
|
||||
#endif
|
||||
3585
raytracer/nvpro_core/fileformats/nv_ktx.inl
Normal file
3585
raytracer/nvpro_core/fileformats/nv_ktx.inl
Normal file
File diff suppressed because it is too large
Load diff
371
raytracer/nvpro_core/fileformats/tiny_converter.cpp
Normal file
371
raytracer/nvpro_core/fileformats/tiny_converter.cpp
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "tiny_converter.hpp"
|
||||
|
||||
|
||||
void TinyConverter::convert(tinygltf::Model& gltf, const tinyobj::ObjReader& reader)
|
||||
{
|
||||
// Default assets
|
||||
gltf.asset.copyright = "NVIDIA Corporation";
|
||||
gltf.asset.generator = "OBJ converter";
|
||||
gltf.asset.version = "2.0"; // glTF version 2.0
|
||||
|
||||
// Adding one buffer
|
||||
gltf.buffers.emplace_back();
|
||||
auto& tBuffer = gltf.buffers.back();
|
||||
|
||||
// Materials
|
||||
for(const auto& mat : reader.GetMaterials())
|
||||
convertMaterial(gltf, mat);
|
||||
|
||||
if(gltf.materials.empty())
|
||||
gltf.materials.emplace_back(); // Default material
|
||||
|
||||
// Unordered map of unique Vertex
|
||||
auto hash = [&](const Vertex& v) { return makeHash(v); };
|
||||
auto equal = [&](const Vertex& l, const Vertex& r) { return l == r; };
|
||||
std::unordered_map<Vertex, size_t, decltype(hash), decltype(equal)> vertexToIdx(0, hash, equal);
|
||||
|
||||
// Building unique vertices
|
||||
auto& attrib = reader.GetAttrib();
|
||||
std::vector<glm::vec3> vertices;
|
||||
std::vector<glm::vec3> normals;
|
||||
std::vector<glm::vec2> texcoords;
|
||||
vertices.reserve((int)(attrib.vertices.size()) / 3);
|
||||
normals.reserve((int)(attrib.normals.size()) / 3);
|
||||
texcoords.reserve((int)(attrib.texcoords.size()) / 2);
|
||||
|
||||
Bbox bb;
|
||||
for(const auto& shape : reader.GetShapes())
|
||||
{
|
||||
for(const auto& index : shape.mesh.indices)
|
||||
{
|
||||
const auto v = getVertex(attrib, index);
|
||||
if(vertexToIdx.find(v) == vertexToIdx.end())
|
||||
{
|
||||
vertexToIdx[v] = vertexToIdx.size();
|
||||
vertices.push_back(v.pos);
|
||||
bb.insert(v.pos);
|
||||
if(!attrib.normals.empty())
|
||||
normals.push_back(v.nrm);
|
||||
if(!attrib.texcoords.empty())
|
||||
texcoords.push_back(v.tex);
|
||||
}
|
||||
}
|
||||
}
|
||||
vertices.shrink_to_fit();
|
||||
normals.shrink_to_fit();
|
||||
texcoords.shrink_to_fit();
|
||||
|
||||
// Number of unique vertices
|
||||
uint32_t nbVertices = (uint32_t)vertexToIdx.size();
|
||||
|
||||
// Estimate size of buffer before appending data
|
||||
uint32_t nbIndices{0};
|
||||
for(const auto& shape : reader.GetShapes())
|
||||
nbIndices += (uint32_t)shape.mesh.indices.size();
|
||||
size_t bufferEstimateSize{0};
|
||||
bufferEstimateSize += nbVertices * sizeof(glm::vec3);
|
||||
bufferEstimateSize += normals.empty() ? 0 : nbVertices * sizeof(glm::vec3);
|
||||
bufferEstimateSize += texcoords.empty() ? 0 : nbVertices * sizeof(glm::vec2);
|
||||
bufferEstimateSize += nbIndices * sizeof(uint32_t);
|
||||
tBuffer.data.reserve(bufferEstimateSize); // Reserving to make the allocations faster
|
||||
|
||||
|
||||
// Storing the information in the glTF buffer
|
||||
{
|
||||
struct OffsetLen
|
||||
{
|
||||
uint32_t offset{0};
|
||||
uint32_t len{0};
|
||||
};
|
||||
|
||||
// Make buffer of attribs
|
||||
OffsetLen olIdx, olPos, olNrm, olTex;
|
||||
auto& tBuffer = gltf.buffers.back();
|
||||
olPos.offset = static_cast<uint32_t>(tBuffer.data.size());
|
||||
olPos.len = appendData(tBuffer, vertices);
|
||||
olNrm.offset = static_cast<uint32_t>(tBuffer.data.size());
|
||||
olNrm.len = appendData(tBuffer, normals);
|
||||
olTex.offset = static_cast<uint32_t>(tBuffer.data.size());
|
||||
olTex.len = appendData(tBuffer, texcoords);
|
||||
|
||||
// Same buffer views for all shapes
|
||||
int posBufferView{-1};
|
||||
int nrmBufferView{-1};
|
||||
int texBufferView{-1};
|
||||
|
||||
// Buffer View (POSITION)
|
||||
{
|
||||
gltf.bufferViews.emplace_back();
|
||||
auto& tBufferView = gltf.bufferViews.back();
|
||||
tBufferView.buffer = 0;
|
||||
tBufferView.byteOffset = olPos.offset;
|
||||
tBufferView.byteStride = 3 * sizeof(float);
|
||||
tBufferView.byteLength = nbVertices * tBufferView.byteStride;
|
||||
|
||||
// Accessor (POSITION)
|
||||
gltf.accessors.emplace_back();
|
||||
auto& tAccessor = gltf.accessors.back();
|
||||
tAccessor.bufferView = static_cast<int>(gltf.bufferViews.size() - 1);
|
||||
tAccessor.byteOffset = 0;
|
||||
tAccessor.componentType = TINYGLTF_COMPONENT_TYPE_FLOAT;
|
||||
tAccessor.count = nbVertices;
|
||||
tAccessor.type = TINYGLTF_TYPE_VEC3;
|
||||
tAccessor.minValues = {bb.min()[0], bb.min()[1], bb.min()[2]};
|
||||
tAccessor.maxValues = {bb.max()[0], bb.max()[1], bb.max()[2]};
|
||||
assert(tAccessor.count > 0);
|
||||
posBufferView = (int)gltf.accessors.size() - 1;
|
||||
}
|
||||
|
||||
// Buffer View (NORMAL)
|
||||
if(!attrib.normals.empty())
|
||||
{
|
||||
gltf.bufferViews.emplace_back();
|
||||
auto& tBufferView = gltf.bufferViews.back();
|
||||
tBufferView.buffer = 0;
|
||||
tBufferView.byteOffset = olNrm.offset;
|
||||
tBufferView.byteStride = 3 * sizeof(float);
|
||||
tBufferView.byteLength = nbVertices * tBufferView.byteStride;
|
||||
|
||||
// Accessor (NORMAL)
|
||||
gltf.accessors.emplace_back();
|
||||
auto& tAccessor = gltf.accessors.back();
|
||||
tAccessor.bufferView = static_cast<int>(gltf.bufferViews.size() - 1);
|
||||
tAccessor.byteOffset = 0;
|
||||
tAccessor.componentType = TINYGLTF_COMPONENT_TYPE_FLOAT;
|
||||
tAccessor.count = nbVertices;
|
||||
tAccessor.type = TINYGLTF_TYPE_VEC3;
|
||||
nrmBufferView = (int)gltf.accessors.size() - 1;
|
||||
}
|
||||
|
||||
// Buffer View (TEXCOORD_0)
|
||||
if(!attrib.texcoords.empty())
|
||||
{
|
||||
gltf.bufferViews.emplace_back();
|
||||
auto& tBufferView = gltf.bufferViews.back();
|
||||
tBufferView.buffer = 0;
|
||||
tBufferView.byteOffset = olTex.offset;
|
||||
tBufferView.byteStride = 2 * sizeof(float);
|
||||
tBufferView.byteLength = nbVertices * tBufferView.byteStride;
|
||||
|
||||
// Accessor (TEXCOORD_0)
|
||||
gltf.accessors.emplace_back();
|
||||
auto& tAccessor = gltf.accessors.back();
|
||||
tAccessor.bufferView = static_cast<int>(gltf.bufferViews.size() - 1);
|
||||
tAccessor.byteOffset = 0;
|
||||
tAccessor.componentType = TINYGLTF_COMPONENT_TYPE_FLOAT;
|
||||
tAccessor.count = nbVertices;
|
||||
tAccessor.type = TINYGLTF_TYPE_VEC2;
|
||||
texBufferView = (int)gltf.accessors.size() - 1;
|
||||
}
|
||||
|
||||
// Create one node/mesh/primitive per shape
|
||||
for(const auto& shape : reader.GetShapes())
|
||||
{
|
||||
uint32_t idxBufferView{0};
|
||||
// Finding the unique vertex index for the shape
|
||||
std::vector<uint32_t> indices;
|
||||
indices.reserve(shape.mesh.indices.size());
|
||||
for(const auto& index : shape.mesh.indices)
|
||||
{
|
||||
const auto v = getVertex(attrib, index);
|
||||
size_t idx = vertexToIdx[v];
|
||||
indices.push_back((uint32_t)idx);
|
||||
}
|
||||
|
||||
// Appending the index data to the glTF buffer
|
||||
auto& tBuffer = gltf.buffers.back();
|
||||
olIdx.offset = static_cast<uint32_t>(tBuffer.data.size());
|
||||
olIdx.len = appendData(tBuffer, indices);
|
||||
|
||||
// Adding a Buffer View (INDICES)
|
||||
{
|
||||
gltf.bufferViews.emplace_back();
|
||||
auto& tBufferView = gltf.bufferViews.back();
|
||||
tBufferView.buffer = 0;
|
||||
tBufferView.byteOffset = olIdx.offset;
|
||||
tBufferView.byteStride = 0; // "bufferView.byteStride must not be defined for indices accessor." ;
|
||||
tBufferView.byteLength = sizeof(uint32_t) * indices.size();
|
||||
|
||||
// Accessor (INDICES)
|
||||
gltf.accessors.emplace_back();
|
||||
auto& tAccessor = gltf.accessors.back();
|
||||
tAccessor.bufferView = static_cast<int>(gltf.bufferViews.size() - 1);
|
||||
tAccessor.byteOffset = 0;
|
||||
tAccessor.componentType = TINYGLTF_COMPONENT_TYPE_UNSIGNED_INT;
|
||||
tAccessor.count = indices.size();
|
||||
tAccessor.type = TINYGLTF_TYPE_SCALAR;
|
||||
idxBufferView = static_cast<int>(gltf.accessors.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
// Adding a glTF mesh
|
||||
tinygltf::Mesh mesh;
|
||||
mesh.name = shape.name;
|
||||
|
||||
// One primitive under the mesh
|
||||
mesh.primitives.emplace_back();
|
||||
auto& tPrim = mesh.primitives.back();
|
||||
tPrim.mode = TINYGLTF_MODE_TRIANGLES;
|
||||
|
||||
// Material reference
|
||||
// #TODO - We assume all primitives have the same material
|
||||
tPrim.material = shape.mesh.material_ids.empty() ? 0 : shape.mesh.material_ids[0];
|
||||
tPrim.material = std::max(0, tPrim.material);
|
||||
|
||||
// Setting all buffer views
|
||||
tPrim.indices = idxBufferView;
|
||||
tPrim.attributes["POSITION"] = posBufferView;
|
||||
if(nrmBufferView > 0)
|
||||
tPrim.attributes["NORMAL"] = nrmBufferView;
|
||||
if(texBufferView > 0)
|
||||
tPrim.attributes["TEXCOORD_0"] = texBufferView;
|
||||
|
||||
// Adding the mesh
|
||||
gltf.meshes.emplace_back(mesh);
|
||||
|
||||
// Adding the node referencing the mesh we just have created
|
||||
tinygltf::Node node;
|
||||
node.name = mesh.name;
|
||||
node.mesh = static_cast<int>(gltf.meshes.size() - 1);
|
||||
gltf.nodes.emplace_back(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Scene
|
||||
gltf.defaultScene = 0;
|
||||
tinygltf::Scene scene;
|
||||
for(int n = 0; n < (int)gltf.nodes.size(); n++)
|
||||
scene.nodes.push_back(n);
|
||||
gltf.scenes.emplace_back(scene);
|
||||
|
||||
// Shrink back
|
||||
tBuffer.data.shrink_to_fit();
|
||||
}
|
||||
|
||||
TinyConverter::Vertex TinyConverter::getVertex(const tinyobj::attrib_t& attrib, const tinyobj::index_t& index)
|
||||
{
|
||||
Vertex v;
|
||||
const float* vp = &attrib.vertices[3ULL * index.vertex_index];
|
||||
v.pos = {*(vp + 0), *(vp + 1), *(vp + 2)};
|
||||
if(!attrib.normals.empty() && index.normal_index >= 0)
|
||||
{
|
||||
const float* np = &attrib.normals[3ULL * index.normal_index];
|
||||
v.nrm = {*(np + 0), *(np + 1), *(np + 2)};
|
||||
}
|
||||
if(!attrib.texcoords.empty() && index.texcoord_index >= 0)
|
||||
{
|
||||
const float* tp = &attrib.texcoords[2ULL * index.texcoord_index + 0];
|
||||
v.tex = {*tp, 1.0f - *(tp + 1)};
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
void TinyConverter::convertMaterial(tinygltf::Model& gltf, const tinyobj::material_t& mat)
|
||||
{
|
||||
tinygltf::TextureInfo baseColorTexture;
|
||||
tinygltf::TextureInfo emissiveTexture;
|
||||
tinygltf::NormalTextureInfo normalTexture;
|
||||
tinygltf::OcclusionTextureInfo occlusionTexture;
|
||||
tinygltf::TextureInfo metallicRoughnessTexture = createMetallicRoughnessTexture(mat.metallic_texname, mat.roughness_texname);
|
||||
|
||||
baseColorTexture.index = convertTexture(gltf, mat.diffuse_texname);
|
||||
emissiveTexture.index = convertTexture(gltf, mat.emissive_texname);
|
||||
normalTexture.index = convertTexture(gltf, mat.normal_texname);
|
||||
occlusionTexture.index = convertTexture(gltf, mat.ambient_texname);
|
||||
|
||||
|
||||
tinygltf::Material gMat;
|
||||
gMat.name = mat.name;
|
||||
gMat.emissiveFactor = {mat.emission[0], mat.emission[1], mat.emission[2]};
|
||||
gMat.pbrMetallicRoughness.baseColorFactor = {mat.diffuse[0], mat.diffuse[1], mat.diffuse[2], 1};
|
||||
gMat.pbrMetallicRoughness.metallicFactor = (mat.specular[0] + mat.specular[1] + mat.specular[2]) / 3.0f;
|
||||
gMat.pbrMetallicRoughness.roughnessFactor = mat.shininess;
|
||||
|
||||
gMat.doubleSided = false;
|
||||
gMat.normalTexture = normalTexture;
|
||||
gMat.occlusionTexture = occlusionTexture;
|
||||
gMat.emissiveTexture = emissiveTexture;
|
||||
gMat.pbrMetallicRoughness.baseColorTexture = baseColorTexture;
|
||||
gMat.pbrMetallicRoughness.metallicRoughnessTexture = metallicRoughnessTexture;
|
||||
|
||||
|
||||
gltf.materials.emplace_back(gMat);
|
||||
}
|
||||
|
||||
int TinyConverter::convertTexture(tinygltf::Model& gltf, const std::string& diffuse_texname)
|
||||
{
|
||||
if(diffuse_texname.empty())
|
||||
return -1;
|
||||
|
||||
int sourceImg = findImage(gltf, diffuse_texname);
|
||||
if(sourceImg < 0)
|
||||
{
|
||||
tinygltf::Image img;
|
||||
img.uri = diffuse_texname;
|
||||
gltf.images.emplace_back(img);
|
||||
sourceImg = (int)gltf.images.size() - 1;
|
||||
}
|
||||
|
||||
int sourceTex = findTexture(gltf, sourceImg);
|
||||
if(sourceTex < 0)
|
||||
{
|
||||
tinygltf::Texture tex;
|
||||
tex.source = sourceImg;
|
||||
gltf.textures.emplace_back(tex);
|
||||
sourceTex = (int)gltf.textures.size() - 1;
|
||||
}
|
||||
return sourceTex;
|
||||
}
|
||||
|
||||
|
||||
int TinyConverter::findImage(tinygltf::Model& gltf, const std::string& texname)
|
||||
{
|
||||
int idx{-1};
|
||||
for(const auto& i : gltf.images)
|
||||
{
|
||||
++idx;
|
||||
if(i.uri == texname)
|
||||
return idx;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TinyConverter::findTexture(tinygltf::Model& gltf, int source)
|
||||
{
|
||||
int idx{-1};
|
||||
for(const auto& t : gltf.textures)
|
||||
{
|
||||
++idx;
|
||||
if(t.source == source)
|
||||
return idx;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
tinygltf::TextureInfo TinyConverter::createMetallicRoughnessTexture(std::string metallic_texname, std::string roughness_texname)
|
||||
{
|
||||
tinygltf::TextureInfo tex;
|
||||
return tex;
|
||||
|
||||
// #TODO Mix metallic and roughness in one channel and add inline image or save to disk?
|
||||
}
|
||||
122
raytracer/nvpro_core/fileformats/tiny_converter.hpp
Normal file
122
raytracer/nvpro_core/fileformats/tiny_converter.hpp
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "tiny_gltf.h"
|
||||
#include "tiny_obj_loader.h"
|
||||
|
||||
/** @DOC_START
|
||||
|
||||
Class TinyConverter
|
||||
|
||||
> This class is used to convert a tinyobj::ObjReader to a tinygltf::Model.
|
||||
|
||||
@DOC_END */
|
||||
|
||||
|
||||
class TinyConverter
|
||||
{
|
||||
public:
|
||||
void convert(tinygltf::Model& gltf, const tinyobj::ObjReader& reader);
|
||||
|
||||
|
||||
private:
|
||||
//---- Hash Combination ----
|
||||
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3876.pdf
|
||||
template <typename T>
|
||||
void hashCombine(std::size_t& seed, const T& val)
|
||||
{
|
||||
seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
|
||||
}
|
||||
// Auxiliary generic functions to create a hash value using a seed
|
||||
template <typename T, typename... Types>
|
||||
void hashCombine(std::size_t& seed, const T& val, const Types&... args)
|
||||
{
|
||||
hashCombine(seed, val);
|
||||
hashCombine(seed, args...);
|
||||
}
|
||||
// Optional auxiliary generic functions to support hash_val() without arguments
|
||||
void hashCombine(std::size_t& seed) {}
|
||||
// Generic function to create a hash value out of a heterogeneous list of arguments
|
||||
template <typename... Types>
|
||||
std::size_t hashVal(const Types&... args)
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
hashCombine(seed, args...);
|
||||
return seed;
|
||||
}
|
||||
//--------------
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
glm::vec3 pos;
|
||||
glm::vec3 nrm;
|
||||
glm::vec2 tex;
|
||||
|
||||
bool operator==(const Vertex& l) const { return this->pos == l.pos && this->nrm == l.nrm && this->tex == l.tex; }
|
||||
};
|
||||
|
||||
|
||||
Vertex getVertex(const tinyobj::attrib_t& attrib, const tinyobj::index_t& index);
|
||||
void convertMaterial(tinygltf::Model& gltf, const tinyobj::material_t& mat);
|
||||
int convertTexture(tinygltf::Model& gltf, const std::string& diffuse_texname);
|
||||
|
||||
int findImage(tinygltf::Model& gltf, const std::string& texname);
|
||||
int findTexture(tinygltf::Model& gltf, int source);
|
||||
|
||||
tinygltf::TextureInfo createMetallicRoughnessTexture(std::string metallic_texname, std::string roughness_texname);
|
||||
|
||||
// This is appending the incoming data to the binary buffer and return the amount in byte of data that was added.
|
||||
template <class T>
|
||||
uint32_t appendData(tinygltf::Buffer& buffer, const T& inData)
|
||||
{
|
||||
auto* pData = reinterpret_cast<const char*>(inData.data());
|
||||
uint32_t len = static_cast<uint32_t>(sizeof(inData[0]) * inData.size());
|
||||
buffer.data.insert(buffer.data.end(), pData, pData + len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
struct Bbox
|
||||
{
|
||||
Bbox() = default;
|
||||
|
||||
void insert(const glm::vec3& v)
|
||||
{
|
||||
m_min = {std::min(m_min[0], v[0]), std::min(m_min[1], v[1]), std::min(m_min[2], v[2])};
|
||||
m_max = {std::max(m_max[0], v[0]), std::max(m_max[1], v[1]), std::max(m_max[2], v[2])};
|
||||
}
|
||||
inline glm::vec3 min() { return m_min; }
|
||||
inline glm::vec3 max() { return m_max; }
|
||||
|
||||
private:
|
||||
glm::vec3 m_min{std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), std::numeric_limits<float>::max()};
|
||||
glm::vec3 m_max{-std::numeric_limits<float>::max(), -std::numeric_limits<float>::max(), -std::numeric_limits<float>::max()};
|
||||
};
|
||||
|
||||
std::size_t makeHash(const Vertex& v)
|
||||
{
|
||||
return hashVal(v.pos.x, v.pos.y, v.pos.z, v.nrm.x, v.nrm.y, v.nrm.z, v.tex.x, v.tex.y);
|
||||
}
|
||||
};
|
||||
43
raytracer/nvpro_core/imgui/README.md
Normal file
43
raytracer/nvpro_core/imgui/README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
## Table of Contents
|
||||
- [imgui_axis.hpp](#imgui_axishpp)
|
||||
- [imgui_camera_widget.h](#imgui_camera_widgeth)
|
||||
- [imgui_orient.h](#imgui_orienth)
|
||||
|
||||
## imgui_axis.hpp
|
||||
|
||||
Function `Axis(ImVec2 pos, const glm::mat4& modelView, float size = 20.f)`
|
||||
which display right-handed axis in a ImGui window.
|
||||
|
||||
Example
|
||||
|
||||
```cpp
|
||||
{ // Display orientation axis at the bottom left corner of the window
|
||||
float axisSize = 25.F;
|
||||
ImVec2 pos = ImGui::GetWindowPos();
|
||||
pos.y += ImGui::GetWindowSize().y;
|
||||
pos += ImVec2(axisSize * 1.1F, -axisSize * 1.1F) * ImGui::GetWindowDpiScale(); // Offset
|
||||
ImGuiH::Axis(pos, CameraManip.getMatrix(), axisSize);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## imgui_camera_widget.h
|
||||
|
||||
### functions in ImGuiH
|
||||
|
||||
|
||||
- CameraWidget : CameraWidget is a Camera widget for the the Camera Manipulator
|
||||
- SetCameraJsonFile : set the name (without .json) of the setting file. It will load and replace all camera and settings
|
||||
- SetHomeCamera : set the home camera - replace the one on load
|
||||
- AddCamera : adding a camera to the list of cameras
|
||||
|
||||
|
||||
## imgui_orient.h
|
||||
|
||||
### struct ImOrient
|
||||
|
||||
> brief This is a really nice implementation of an orientation widget; all due respect to the original author ;)
|
||||
|
||||
This is a port of the AntTweakBar orientation widget, which is a 3D orientation widget that allows the user to specify a
|
||||
3D orientation using a quaternion, axis-angle, or direction vector. It is a very useful widget for 3D applications.
|
||||
|
||||
11
raytracer/nvpro_core/imgui/backends/README.md
Normal file
11
raytracer/nvpro_core/imgui/backends/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
## Table of Contents
|
||||
- [imgui_impl_gl.h](#imgui_impl_glh)
|
||||
- [imgui_vk_extra.h](#imgui_vk_extrah)
|
||||
|
||||
## imgui_impl_gl.h
|
||||
|
||||
> Todo: Add documentation
|
||||
|
||||
## imgui_vk_extra.h
|
||||
|
||||
> Todo: Add documentation
|
||||
289
raytracer/nvpro_core/imgui/backends/imgui_impl_gl.cpp
Normal file
289
raytracer/nvpro_core/imgui/backends/imgui_impl_gl.cpp
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
#include "imgui/backends/imgui_impl_gl.h"
|
||||
#include "imgui.h"
|
||||
#include <include_gl.h>
|
||||
|
||||
// ImGui GLFW binding with OpenGL3 + shaders
|
||||
// More or less copy-pasted from https://raw.githubusercontent.com/ocornut/imgui/master/examples/opengl3_example/imgui_impl_glfw_gl3.cpp
|
||||
|
||||
namespace {
|
||||
const char* g_GlslVersion = "#version 450\n";
|
||||
GLuint g_FontTexture = 0;
|
||||
int g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
|
||||
int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0;
|
||||
int g_AttribLocationPosition = 0, g_AttribLocationUV = 0, g_AttribLocationColor = 0;
|
||||
unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
|
||||
} // namespace
|
||||
|
||||
void ImGui::InitGL()
|
||||
{
|
||||
// Backup GL state
|
||||
GLint last_texture, last_array_buffer, last_vertex_array;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||
|
||||
const GLchar* vertex_shader =
|
||||
"layout(location=0) uniform mat4 ProjMtx;\n"
|
||||
"layout(location=0) in vec2 Position;\n"
|
||||
"layout(location=1) in vec2 UV;\n"
|
||||
"layout(location=2) in vec4 Color;\n"
|
||||
"out vec2 Frag_UV;\n"
|
||||
"out vec4 Frag_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Frag_UV = UV;\n"
|
||||
" Frag_Color = Color;\n"
|
||||
" gl_Position = ProjMtx * vec4(Position.xy,0,1);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* fragment_shader =
|
||||
"layout(location=1, binding=0) uniform sampler2D Texture;\n"
|
||||
"in vec2 Frag_UV;\n"
|
||||
"in vec4 Frag_Color;\n"
|
||||
"layout(location=0, index=0) out vec4 Out_Color;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" Out_Color = Frag_Color * texture( Texture, Frag_UV.st);\n"
|
||||
"}\n";
|
||||
|
||||
const GLchar* vertex_shader_with_version[2] = {g_GlslVersion, vertex_shader};
|
||||
const GLchar* fragment_shader_with_version[2] = {g_GlslVersion, fragment_shader};
|
||||
|
||||
g_ShaderHandle = glCreateProgram();
|
||||
g_VertHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||
g_FragHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(g_VertHandle, 2, vertex_shader_with_version, NULL);
|
||||
glShaderSource(g_FragHandle, 2, fragment_shader_with_version, NULL);
|
||||
glCompileShader(g_VertHandle);
|
||||
glCompileShader(g_FragHandle);
|
||||
glAttachShader(g_ShaderHandle, g_VertHandle);
|
||||
glAttachShader(g_ShaderHandle, g_FragHandle);
|
||||
glLinkProgram(g_ShaderHandle);
|
||||
|
||||
// check if program linked
|
||||
GLint success = 0;
|
||||
glGetProgramiv(g_ShaderHandle, GL_LINK_STATUS, &success);
|
||||
if(!success)
|
||||
{
|
||||
char temp[1024];
|
||||
glGetProgramInfoLog(g_ShaderHandle, 1024, 0, temp);
|
||||
success = success;
|
||||
}
|
||||
|
||||
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
|
||||
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
|
||||
g_AttribLocationPosition = glGetAttribLocation(g_ShaderHandle, "Position");
|
||||
g_AttribLocationUV = glGetAttribLocation(g_ShaderHandle, "UV");
|
||||
g_AttribLocationColor = glGetAttribLocation(g_ShaderHandle, "Color");
|
||||
|
||||
glGenBuffers(1, &g_VboHandle);
|
||||
glGenBuffers(1, &g_ElementsHandle);
|
||||
|
||||
// Build texture atlas
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
unsigned char* pixels;
|
||||
int width, height;
|
||||
// Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||
|
||||
// Upload texture to graphics system
|
||||
glGenTextures(1, &g_FontTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
// Store our identifier
|
||||
io.Fonts->TexID = (void*)(intptr_t)g_FontTexture;
|
||||
|
||||
// Restore state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
|
||||
// Restore modified GL state
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
glBindVertexArray(last_vertex_array);
|
||||
}
|
||||
void ImGui::ShutdownGL()
|
||||
{
|
||||
if(g_VboHandle)
|
||||
glDeleteBuffers(1, &g_VboHandle);
|
||||
if(g_ElementsHandle)
|
||||
glDeleteBuffers(1, &g_ElementsHandle);
|
||||
g_VboHandle = g_ElementsHandle = 0;
|
||||
|
||||
if(g_ShaderHandle && g_VertHandle)
|
||||
glDetachShader(g_ShaderHandle, g_VertHandle);
|
||||
if(g_VertHandle)
|
||||
glDeleteShader(g_VertHandle);
|
||||
g_VertHandle = 0;
|
||||
|
||||
if(g_ShaderHandle && g_FragHandle)
|
||||
glDetachShader(g_ShaderHandle, g_FragHandle);
|
||||
if(g_FragHandle)
|
||||
glDeleteShader(g_FragHandle);
|
||||
g_FragHandle = 0;
|
||||
|
||||
if(g_ShaderHandle)
|
||||
glDeleteProgram(g_ShaderHandle);
|
||||
g_ShaderHandle = 0;
|
||||
|
||||
if(g_FontTexture)
|
||||
{
|
||||
glDeleteTextures(1, &g_FontTexture);
|
||||
ImGui::GetIO().Fonts->TexID = 0;
|
||||
g_FontTexture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::RenderDrawDataGL(const ImDrawData* drawData)
|
||||
{
|
||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
int fb_width = (int)(io.DisplaySize.x * io.DisplayFramebufferScale.x);
|
||||
int fb_height = (int)(io.DisplaySize.y * io.DisplayFramebufferScale.y);
|
||||
if(fb_width == 0 || fb_height == 0)
|
||||
return;
|
||||
// evil
|
||||
((ImDrawData*)drawData)->ScaleClipRects(io.DisplayFramebufferScale);
|
||||
|
||||
// Backup GL state
|
||||
GLenum last_active_texture;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
GLint last_program;
|
||||
glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
|
||||
GLint last_texture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||
GLint last_sampler;
|
||||
glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
|
||||
GLint last_array_buffer;
|
||||
glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
|
||||
GLint last_element_array_buffer;
|
||||
glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, &last_element_array_buffer);
|
||||
GLint last_vertex_array;
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array);
|
||||
GLint last_polygon_mode[2];
|
||||
glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
|
||||
GLint last_viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||
GLint last_scissor_box[4];
|
||||
glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||
GLenum last_blend_src_rgb;
|
||||
glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*)&last_blend_src_rgb);
|
||||
GLenum last_blend_dst_rgb;
|
||||
glGetIntegerv(GL_BLEND_DST_RGB, (GLint*)&last_blend_dst_rgb);
|
||||
GLenum last_blend_src_alpha;
|
||||
glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*)&last_blend_src_alpha);
|
||||
GLenum last_blend_dst_alpha;
|
||||
glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*)&last_blend_dst_alpha);
|
||||
GLenum last_blend_equation_rgb;
|
||||
glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*)&last_blend_equation_rgb);
|
||||
GLenum last_blend_equation_alpha;
|
||||
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*)&last_blend_equation_alpha);
|
||||
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||
GLboolean last_enable_scissor_test = glIsEnabled(GL_SCISSOR_TEST);
|
||||
|
||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, polygon fill
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
|
||||
// Setup viewport, orthographic projection matrix
|
||||
glViewport(0, 0, (GLsizei)fb_width, (GLsizei)fb_height);
|
||||
const float ortho_projection[4][4] = {
|
||||
{2.0f / io.DisplaySize.x, 0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 2.0f / -io.DisplaySize.y, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, -1.0f, 0.0f},
|
||||
{-1.0f, 1.0f, 0.0f, 1.0f},
|
||||
};
|
||||
glUseProgram(g_ShaderHandle);
|
||||
glUniform1i(g_AttribLocationTex, 0);
|
||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
||||
|
||||
// Recreate the VAO every time
|
||||
// (This is to easily allow multiple GL contexts. VAO are not shared among GL contexts, and we don't track creation/deletion of windows so we don't have an obvious key to use to cache them.)
|
||||
GLuint vao_handle = 0;
|
||||
glGenVertexArrays(1, &vao_handle);
|
||||
glBindVertexArray(vao_handle);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||
glEnableVertexAttribArray(g_AttribLocationPosition);
|
||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert),
|
||||
(GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||
|
||||
// Draw
|
||||
for(int n = 0; n < drawData->CmdListsCount; n++)
|
||||
{
|
||||
const ImDrawList* cmd_list = drawData->CmdLists[n];
|
||||
const ImDrawIdx* idx_buffer_offset = 0;
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert),
|
||||
(const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx),
|
||||
(const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||
|
||||
for(int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||
{
|
||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||
if(pcmd->UserCallback)
|
||||
{
|
||||
pcmd->UserCallback(cmd_list, pcmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
|
||||
glScissor((int)pcmd->ClipRect.x, (int)(fb_height - pcmd->ClipRect.w),
|
||||
(int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y));
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount,
|
||||
sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
|
||||
}
|
||||
idx_buffer_offset += pcmd->ElemCount;
|
||||
}
|
||||
}
|
||||
glDeleteVertexArrays(1, &vao_handle);
|
||||
|
||||
// Restore modified GL state
|
||||
glUseProgram(last_program);
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindSampler(0, last_sampler);
|
||||
glActiveTexture(last_active_texture);
|
||||
glBindVertexArray(last_vertex_array);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, last_element_array_buffer);
|
||||
glBlendEquationSeparate(last_blend_equation_rgb, last_blend_equation_alpha);
|
||||
glBlendFuncSeparate(last_blend_src_rgb, last_blend_dst_rgb, last_blend_src_alpha, last_blend_dst_alpha);
|
||||
if(last_enable_blend)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
if(last_enable_cull_face)
|
||||
glEnable(GL_CULL_FACE);
|
||||
else
|
||||
glDisable(GL_CULL_FACE);
|
||||
if(last_enable_depth_test)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
else
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
if(last_enable_scissor_test)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
else
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, (GLenum)last_polygon_mode[0]);
|
||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||
}
|
||||
12
raytracer/nvpro_core/imgui/backends/imgui_impl_gl.h
Normal file
12
raytracer/nvpro_core/imgui/backends/imgui_impl_gl.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
/// @DOC_SKIP (keyword to exclude this file from automatic README.md generation)
|
||||
|
||||
struct ImDrawData;
|
||||
|
||||
namespace ImGui {
|
||||
void InitGL();
|
||||
void ShutdownGL();
|
||||
|
||||
void RenderDrawDataGL(const ImDrawData* drawData);
|
||||
} // namespace ImGui
|
||||
105
raytracer/nvpro_core/imgui/backends/imgui_vk_extra.cpp
Normal file
105
raytracer/nvpro_core/imgui/backends/imgui_vk_extra.cpp
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "imgui/backends/imgui_vk_extra.h"
|
||||
#include "imgui/imgui_helper.h"
|
||||
#include <backends/imgui_impl_vulkan.h>
|
||||
|
||||
static ImGui_ImplVulkan_InitInfo g_VulkanInitInfo = {};
|
||||
|
||||
static void check_vk_result(VkResult err)
|
||||
{
|
||||
assert(err == VK_SUCCESS);
|
||||
}
|
||||
|
||||
void ImGui::InitVK(VkDevice device, VkPhysicalDevice physicalDevice, VkQueue queue, uint32_t queueFamilyIndex, VkRenderPass pass, int subPassIndex)
|
||||
{
|
||||
VkResult err = VK_RESULT_MAX_ENUM;
|
||||
|
||||
std::vector<VkDescriptorPoolSize> poolSize{{VK_DESCRIPTOR_TYPE_SAMPLER, 1}, {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1}};
|
||||
VkDescriptorPoolCreateInfo poolInfo{VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO};
|
||||
poolInfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||
poolInfo.maxSets = 2;
|
||||
poolInfo.poolSizeCount = static_cast<uint32_t>(poolSize.size());
|
||||
poolInfo.pPoolSizes = poolSize.data();
|
||||
vkCreateDescriptorPool(device, &poolInfo, nullptr, &g_VulkanInitInfo.DescriptorPool);
|
||||
|
||||
// Setup Platform/Renderer backends
|
||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||
init_info.Instance = VkInstance(666); // <--- WRONG need argument
|
||||
init_info.PhysicalDevice = physicalDevice;
|
||||
init_info.Device = device;
|
||||
init_info.QueueFamily = queueFamilyIndex;
|
||||
init_info.Queue = queue;
|
||||
init_info.PipelineCache = VK_NULL_HANDLE;
|
||||
init_info.DescriptorPool = g_VulkanInitInfo.DescriptorPool;
|
||||
init_info.RenderPass = pass;
|
||||
init_info.Subpass = subPassIndex;
|
||||
init_info.MinImageCount = 2;
|
||||
init_info.ImageCount = 3; // <--- WRONG need argument
|
||||
init_info.MSAASamples = VK_SAMPLE_COUNT_1_BIT; // <--- need argument?
|
||||
init_info.Allocator = nullptr;
|
||||
init_info.CheckVkResultFn = nullptr;
|
||||
ImGui_ImplVulkan_Init(&init_info);
|
||||
g_VulkanInitInfo = init_info;
|
||||
|
||||
// Upload Fonts
|
||||
VkCommandPool pool = VK_NULL_HANDLE;
|
||||
VkCommandPoolCreateInfo createInfo{VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO};
|
||||
createInfo.queueFamilyIndex = queueFamilyIndex;
|
||||
err = vkCreateCommandPool(device, &createInfo, nullptr, &pool);
|
||||
check_vk_result(err);
|
||||
|
||||
VkCommandBuffer cmd = VK_NULL_HANDLE;
|
||||
VkCommandBufferAllocateInfo allocInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO};
|
||||
allocInfo.commandPool = pool;
|
||||
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
|
||||
allocInfo.commandBufferCount = 1;
|
||||
err = vkAllocateCommandBuffers(device, &allocInfo, &cmd);
|
||||
check_vk_result(err);
|
||||
|
||||
VkCommandBufferBeginInfo beginInfo{VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO};
|
||||
beginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
err = vkBeginCommandBuffer(cmd, &beginInfo);
|
||||
check_vk_result(err);
|
||||
|
||||
ImGui_ImplVulkan_CreateFontsTexture();
|
||||
|
||||
err = vkEndCommandBuffer(cmd);
|
||||
check_vk_result(err);
|
||||
|
||||
VkSubmitInfo submit{VK_STRUCTURE_TYPE_SUBMIT_INFO};
|
||||
submit.commandBufferCount = 1;
|
||||
submit.pCommandBuffers = &cmd;
|
||||
err = vkQueueSubmit(queue, 1, &submit, VK_NULL_HANDLE);
|
||||
check_vk_result(err);
|
||||
|
||||
err = vkDeviceWaitIdle(device);
|
||||
check_vk_result(err);
|
||||
vkFreeCommandBuffers(device, pool, 1, &cmd);
|
||||
vkDestroyCommandPool(device, pool, nullptr);
|
||||
}
|
||||
|
||||
|
||||
void ImGui::ShutdownVK()
|
||||
{
|
||||
ImGui_ImplVulkan_InitInfo* v = &g_VulkanInitInfo;
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
vkDestroyDescriptorPool(v->Device, v->DescriptorPool, v->Allocator);
|
||||
}
|
||||
26
raytracer/nvpro_core/imgui/backends/imgui_vk_extra.h
Normal file
26
raytracer/nvpro_core/imgui/backends/imgui_vk_extra.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/// @DOC_SKIP (keyword to exclude this file from automatic README.md generation)
|
||||
|
||||
#include <backends/imgui_impl_vulkan.h>
|
||||
namespace ImGui {
|
||||
void InitVK(VkDevice device, VkPhysicalDevice physicalDevice, VkQueue queue, uint32_t queueFamilyIndex, VkRenderPass pass, int subPassIndex = 0);
|
||||
void ShutdownVK();
|
||||
} // namespace ImGui
|
||||
189
raytracer/nvpro_core/imgui/imgui_axis.cpp
Normal file
189
raytracer/nvpro_core/imgui/imgui_axis.cpp
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2022 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
#include "imgui_axis.hpp"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// This IMGUI widget draw axis in red, green and blue at the position
|
||||
// defined.
|
||||
//
|
||||
|
||||
struct AxisGeom
|
||||
{
|
||||
AxisGeom()
|
||||
{
|
||||
const float asize = 1.0f; // length of arrow
|
||||
const float aradius = 0.11f; // width of arrow tip
|
||||
const float abase = 0.66f; // 1/3 of arrow length
|
||||
const int asubdiv = 8;
|
||||
|
||||
// Cone
|
||||
red.push_back({asize, 0, 0}); // 0 Tip
|
||||
for(int i = 0; i <= asubdiv; ++i)
|
||||
{
|
||||
float a0 = 2.0F * float(M_PI) * (float(i)) / asubdiv; // Counter-clockwise
|
||||
float y0 = cosf(a0) * aradius;
|
||||
float z0 = sinf(a0) * aradius;
|
||||
red.push_back({abase, y0, z0});
|
||||
}
|
||||
for(int i = 0; i <= asubdiv - 1; ++i) // Triangle fan
|
||||
{
|
||||
indices.push_back(0);
|
||||
indices.push_back(i + 1);
|
||||
indices.push_back(i + 2);
|
||||
}
|
||||
|
||||
// Under Cap
|
||||
int center = static_cast<int>(red.size());
|
||||
red.push_back({abase, 0, 0}); // Center of cap
|
||||
for(int i = 0; i <= asubdiv; ++i)
|
||||
{
|
||||
float a0 = -2.0F * float(M_PI) * (float(i)) / asubdiv; // Clockwise
|
||||
float y0 = cosf(a0) * aradius;
|
||||
float z0 = sinf(a0) * aradius;
|
||||
red.push_back({abase, y0, z0});
|
||||
}
|
||||
for(int i = 0; i <= asubdiv - 1; ++i)
|
||||
{
|
||||
indices.push_back(center);
|
||||
indices.push_back(center + i + 1);
|
||||
indices.push_back(center + i + 2);
|
||||
}
|
||||
|
||||
// Start of arrow
|
||||
red.push_back({0, 0, 0});
|
||||
|
||||
// Other arrows are permutations of the Red arrow
|
||||
for(const auto& v : red)
|
||||
{
|
||||
green.push_back({v.z, v.x, v.y});
|
||||
blue.push_back({v.y, v.z, v.x});
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<glm::vec3> red;
|
||||
std::vector<glm::vec3> green;
|
||||
std::vector<glm::vec3> blue;
|
||||
std::vector<int> indices;
|
||||
|
||||
// Return the transformed arrow
|
||||
std::vector<glm::vec3> transform(const std::vector<glm::vec3>& in_vec, const ImVec2& pos, const glm::mat4& modelView, float size)
|
||||
{
|
||||
std::vector<glm::vec3> temp(in_vec.size());
|
||||
|
||||
for(size_t i = 0; i < in_vec.size(); ++i)
|
||||
{
|
||||
temp[i] = glm::vec3(modelView * glm::vec4(in_vec[i], 0.F)); // Rotate
|
||||
temp[i].x *= size; // Scale
|
||||
temp[i].y *= -size; // - invert Y
|
||||
temp[i].x += pos.x; // Translate
|
||||
temp[i].y += pos.y;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
void drawTriangle(ImVec2 v0, ImVec2 v1, ImVec2 v2, const ImVec2& uv, ImU32 col)
|
||||
{
|
||||
auto draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
ImVec2 d0 = ImVec2(v1.x - v0.x, v1.y - v0.y);
|
||||
ImVec2 d1 = ImVec2(v2.x - v0.x, v2.y - v0.y);
|
||||
float c = (d0.x * d1.y) - (d0.y * d1.x); // Cross
|
||||
|
||||
if(c > 0.0f) // Culling to avoid z-fighting
|
||||
{
|
||||
v1 = v0; // Culled triangles are degenerated to
|
||||
v2 = v0; // avoid displaying them
|
||||
}
|
||||
|
||||
draw_list->PrimVtx(v0, uv, col);
|
||||
draw_list->PrimVtx(v1, uv, col);
|
||||
draw_list->PrimVtx(v2, uv, col);
|
||||
}
|
||||
|
||||
// Draw the arrow
|
||||
void draw(const std::vector<glm::vec3>& vertex, ImU32 col)
|
||||
{
|
||||
auto draw_list = ImGui::GetWindowDrawList();
|
||||
const ImVec2 uv = ImGui::GetFontTexUvWhitePixel();
|
||||
|
||||
int num_indices = static_cast<int>(indices.size());
|
||||
draw_list->PrimReserve(num_indices, num_indices); // num vert/indices
|
||||
|
||||
// Draw all triangles
|
||||
for(int i = 0; i < num_indices; i += 3)
|
||||
{
|
||||
int i0 = indices[i];
|
||||
int i1 = indices[i + 1];
|
||||
int i2 = indices[i + 2];
|
||||
ImVec2 v0 = {vertex[i0].x, vertex[i0].y};
|
||||
ImVec2 v1 = {vertex[i1].x, vertex[i1].y};
|
||||
ImVec2 v2 = {vertex[i2].x, vertex[i2].y};
|
||||
drawTriangle(v0, v1, v2, uv, col);
|
||||
}
|
||||
|
||||
// Draw the line
|
||||
draw_list->AddLine(ImVec2(vertex[0].x, vertex[0].y), ImVec2(vertex.back().x, vertex.back().y), col,
|
||||
1.0F * ImGui::GetWindowDpiScale());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void ImGuiH::Axis(ImVec2 pos, const glm::mat4& modelView, float size /*= 20.f*/)
|
||||
{
|
||||
static AxisGeom a;
|
||||
|
||||
struct Arrow
|
||||
{
|
||||
std::vector<glm::vec3> v;
|
||||
ImU32 c{0};
|
||||
};
|
||||
|
||||
size *= ImGui::GetWindowDpiScale();
|
||||
|
||||
std::array<Arrow, 3> arrow;
|
||||
arrow[0].v = a.transform(a.red, pos, modelView, size);
|
||||
arrow[0].c = IM_COL32(200, 0, 0, 255);
|
||||
arrow[1].v = a.transform(a.green, pos, modelView, size);
|
||||
arrow[1].c = IM_COL32(0, 200, 0, 255);
|
||||
arrow[2].v = a.transform(a.blue, pos, modelView, size);
|
||||
arrow[2].c = IM_COL32(0, 0, 200, 255);
|
||||
|
||||
// Sort from smallest Z to nearest (Painter algorithm)
|
||||
if(arrow[1].v[0].z < arrow[0].v[0].z)
|
||||
std::swap(arrow[0], arrow[1]);
|
||||
if(arrow[2].v[0].z < arrow[1].v[0].z)
|
||||
{
|
||||
std::swap(arrow[1], arrow[2]);
|
||||
if(arrow[1].v[0].z < arrow[0].v[0].z)
|
||||
std::swap(arrow[1], arrow[0]);
|
||||
}
|
||||
|
||||
// Draw all axis
|
||||
a.draw(arrow[0].v, arrow[0].c);
|
||||
a.draw(arrow[1].v, arrow[1].c);
|
||||
a.draw(arrow[2].v, arrow[2].c);
|
||||
}
|
||||
48
raytracer/nvpro_core/imgui/imgui_axis.hpp
Normal file
48
raytracer/nvpro_core/imgui/imgui_axis.hpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2022 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "imgui.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
/* @DOC_START -------------------------------------------------------
|
||||
|
||||
Function `Axis(ImVec2 pos, const glm::mat4& modelView, float size = 20.f)`
|
||||
which display right-handed axis in a ImGui window.
|
||||
|
||||
Example
|
||||
|
||||
```cpp
|
||||
{ // Display orientation axis at the bottom left corner of the window
|
||||
float axisSize = 25.F;
|
||||
ImVec2 pos = ImGui::GetWindowPos();
|
||||
pos.y += ImGui::GetWindowSize().y;
|
||||
pos += ImVec2(axisSize * 1.1F, -axisSize * 1.1F) * ImGui::GetWindowDpiScale(); // Offset
|
||||
ImGuiH::Axis(pos, CameraManip.getMatrix(), axisSize);
|
||||
}
|
||||
```
|
||||
|
||||
--- @DOC_END ------------------------------------------------------- */
|
||||
|
||||
// The API
|
||||
namespace ImGuiH {
|
||||
|
||||
// This utility is adding the 3D axis at `pos`, using the matrix `modelView`
|
||||
IMGUI_API void Axis(ImVec2 pos, const glm::mat4& modelView, float size = 20.f);
|
||||
|
||||
}; // namespace ImGuiH
|
||||
511
raytracer/nvpro_core/imgui/imgui_camera_widget.cpp
Normal file
511
raytracer/nvpro_core/imgui/imgui_camera_widget.cpp
Normal file
|
|
@ -0,0 +1,511 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
||||
* and proprietary rights in and to this software, related documentation
|
||||
* and any modifications thereto. Any use, reproduction, disclosure or
|
||||
* distribution of this software and related documentation without an express
|
||||
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
||||
*/
|
||||
|
||||
|
||||
#include "json.hpp"
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui/imgui_camera_widget.h"
|
||||
#include "imgui_helper.h"
|
||||
#include "nvh/cameramanipulator.hpp"
|
||||
#include "nvh/misc.hpp"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
namespace ImGuiH {
|
||||
|
||||
using nlohmann::json;
|
||||
using Gui = ImGuiH::Control;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Holds all saved cameras in a vector of Cameras
|
||||
// - The first camera in the list is the HOME camera, the one that was set before this is called.
|
||||
// - The update function will check if something has changed and will save the JSON to disk, only
|
||||
// once in a while.
|
||||
// - Adding a camera will be added only if it is different from all other saved cameras
|
||||
// - load/save Setting will load next to the executable, the "jsonFilename" + ".json"
|
||||
//
|
||||
struct CameraManager
|
||||
{
|
||||
CameraManager() = default;
|
||||
~CameraManager()
|
||||
{
|
||||
if(m_settingsDirtyTimer > 0.0f)
|
||||
saveSetting(nvh::CameraManipulator::Singleton());
|
||||
};
|
||||
|
||||
|
||||
// update setting, load or save
|
||||
void update(nvh::CameraManipulator& cameraM)
|
||||
{
|
||||
// Push the HOME camera and load default setting
|
||||
if(m_cameras.empty())
|
||||
{
|
||||
m_cameras.emplace_back(cameraM.getCamera());
|
||||
}
|
||||
if(m_doLoadSetting)
|
||||
loadSetting(cameraM);
|
||||
|
||||
// Save settings (with a delay after the last modification, so we don't spam disk too much)
|
||||
auto& IO = ImGui::GetIO();
|
||||
if(m_settingsDirtyTimer > 0.0f)
|
||||
{
|
||||
m_settingsDirtyTimer -= IO.DeltaTime;
|
||||
if(m_settingsDirtyTimer <= 0.0f)
|
||||
{
|
||||
saveSetting(cameraM);
|
||||
m_settingsDirtyTimer = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear all cameras except the HOME
|
||||
void removedSavedCameras()
|
||||
{
|
||||
if(m_cameras.size() > 1)
|
||||
m_cameras.erase(m_cameras.begin() + 1, m_cameras.end());
|
||||
}
|
||||
|
||||
void setCameraJsonFile(const std::string& filename)
|
||||
{
|
||||
m_jsonFilename = NVPSystem::exePath() + filename + ".json";
|
||||
m_doLoadSetting = true;
|
||||
removedSavedCameras();
|
||||
}
|
||||
|
||||
|
||||
void setHomeCamera(const nvh::CameraManipulator::Camera& camera)
|
||||
{
|
||||
if(m_cameras.empty())
|
||||
m_cameras.resize(1);
|
||||
m_cameras[0] = camera;
|
||||
}
|
||||
|
||||
// Adding a camera only if it different from all the saved ones
|
||||
void addCamera(const nvh::CameraManipulator::Camera& camera)
|
||||
{
|
||||
bool unique = true;
|
||||
for(const auto& c : m_cameras)
|
||||
{
|
||||
if(c == camera)
|
||||
{
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(unique)
|
||||
{
|
||||
m_cameras.emplace_back(camera);
|
||||
markIniSettingsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
// Removing a camera
|
||||
void removeCamera(int delete_item)
|
||||
{
|
||||
m_cameras.erase(m_cameras.begin() + delete_item);
|
||||
markIniSettingsDirty();
|
||||
}
|
||||
|
||||
void markIniSettingsDirty()
|
||||
{
|
||||
if(m_settingsDirtyTimer <= 0.0f)
|
||||
m_settingsDirtyTimer = 0.1f;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool getJsonValue(const json& j, const std::string& name, T& value)
|
||||
{
|
||||
auto fieldIt = j.find(name);
|
||||
if(fieldIt != j.end())
|
||||
{
|
||||
value = (*fieldIt);
|
||||
return true;
|
||||
}
|
||||
LOGE("Could not find JSON field %s", name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool getJsonArray(const json& j, const std::string& name, T& value)
|
||||
{
|
||||
auto fieldIt = j.find(name);
|
||||
if(fieldIt != j.end())
|
||||
{
|
||||
value = T((*fieldIt).begin(), (*fieldIt).end());
|
||||
return true;
|
||||
}
|
||||
LOGE("Could not find JSON field %s", name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void loadSetting(nvh::CameraManipulator& cameraM)
|
||||
{
|
||||
if(m_jsonFilename.empty() || m_cameras.empty() || m_doLoadSetting == false)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
m_doLoadSetting = false;
|
||||
|
||||
// Clear all cameras except the HOME
|
||||
removedSavedCameras();
|
||||
|
||||
std::ifstream i(m_jsonFilename);
|
||||
if(!i.is_open())
|
||||
return;
|
||||
|
||||
// Parsing the file
|
||||
json j;
|
||||
i >> j;
|
||||
|
||||
// Temp
|
||||
int iVal;
|
||||
float fVal;
|
||||
std::vector<float> vfVal;
|
||||
|
||||
// Settings
|
||||
if(getJsonValue(j, "mode", iVal))
|
||||
cameraM.setMode(static_cast<nvh::CameraManipulator::Modes>(iVal));
|
||||
if(getJsonValue(j, "speed", fVal))
|
||||
cameraM.setSpeed(fVal);
|
||||
if(getJsonValue(j, "anim_duration", fVal))
|
||||
cameraM.setAnimationDuration(fVal);
|
||||
|
||||
// All cameras
|
||||
std::vector<json> cc;
|
||||
getJsonArray(j, "cameras", cc);
|
||||
for(auto& c : cc)
|
||||
{
|
||||
nvh::CameraManipulator::Camera camera;
|
||||
if(getJsonArray(c, "eye", vfVal))
|
||||
camera.eye = {vfVal[0], vfVal[1], vfVal[2]};
|
||||
if(getJsonArray(c, "ctr", vfVal))
|
||||
camera.ctr = {vfVal[0], vfVal[1], vfVal[2]};
|
||||
if(getJsonArray(c, "up", vfVal))
|
||||
camera.up = {vfVal[0], vfVal[1], vfVal[2]};
|
||||
if(getJsonValue(c, "fov", fVal))
|
||||
camera.fov = fVal;
|
||||
m_cameras.emplace_back(camera);
|
||||
}
|
||||
i.close();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void saveSetting(nvh::CameraManipulator& cameraM) noexcept
|
||||
{
|
||||
if(m_jsonFilename.empty())
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
json j;
|
||||
j["mode"] = cameraM.getMode();
|
||||
j["speed"] = cameraM.getSpeed();
|
||||
j["anim_duration"] = cameraM.getAnimationDuration();
|
||||
|
||||
// Save all extra cameras
|
||||
json cc = json::array();
|
||||
for(size_t n = 1; n < m_cameras.size(); n++)
|
||||
{
|
||||
auto& c = m_cameras[n];
|
||||
json jo = json::object();
|
||||
jo["eye"] = std::vector<float>{c.eye.x, c.eye.y, c.eye.z};
|
||||
jo["up"] = std::vector<float>{c.up.x, c.up.y, c.up.z};
|
||||
jo["ctr"] = std::vector<float>{c.ctr.x, c.ctr.y, c.ctr.z};
|
||||
jo["fov"] = c.fov;
|
||||
cc.push_back(jo);
|
||||
}
|
||||
j["cameras"] = cc;
|
||||
|
||||
std::ofstream o(m_jsonFilename);
|
||||
if(o.is_open())
|
||||
{
|
||||
o << j.dump(2) << std::endl;
|
||||
o.close();
|
||||
}
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
LOGE("Could not save camera settings to %s: %s\n", m_jsonFilename.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
// Holds all cameras. [0] == HOME
|
||||
std::vector<nvh::CameraManipulator::Camera> m_cameras;
|
||||
float m_settingsDirtyTimer{0};
|
||||
std::string m_jsonFilename;
|
||||
bool m_doLoadSetting{true};
|
||||
};
|
||||
|
||||
static std::unique_ptr<CameraManager> sCamMgr;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Display the values of the current camera: position, center, up and FOV
|
||||
//
|
||||
void CurrentCameraTab(nvh::CameraManipulator& cameraM, nvh::CameraManipulator::Camera& camera, bool& changed, bool& instantSet)
|
||||
{
|
||||
|
||||
bool y_is_up = camera.up.y == 1;
|
||||
|
||||
PropertyEditor::begin();
|
||||
PropertyEditor::entry(
|
||||
"Eye", [&] { return ImGui::InputFloat3("##Eye", &camera.eye.x, "%.5f"); }, "Position of the Camera");
|
||||
changed |= ImGui::IsItemDeactivatedAfterEdit();
|
||||
PropertyEditor::entry(
|
||||
"Center", [&] { return ImGui::InputFloat3("##Ctr", &camera.ctr.x, "%.5f"); }, "Center of camera interest");
|
||||
changed |= ImGui::IsItemDeactivatedAfterEdit();
|
||||
changed |= PropertyEditor::entry(
|
||||
"Y is UP", [&] { return ImGui::Checkbox("##Y", &y_is_up); }, "Is Y pointing up or Z?");
|
||||
if(PropertyEditor::entry(
|
||||
"FOV",
|
||||
[&] { return ImGui::SliderFloat("##Y", &camera.fov, 1.F, 179.F, "%.1f deg", ImGuiSliderFlags_Logarithmic); },
|
||||
"Field of view in degrees"))
|
||||
{
|
||||
instantSet = true;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(PropertyEditor::treeNode("Clip planes"))
|
||||
{
|
||||
glm::vec2 clip = cameraM.getClipPlanes();
|
||||
PropertyEditor::entry("Near", [&] { return ImGui::InputFloat("##CN", &clip.x); });
|
||||
changed |= ImGui::IsItemDeactivatedAfterEdit();
|
||||
PropertyEditor::entry("Far", [&] { return ImGui::InputFloat("##CF", &clip.y); });
|
||||
changed |= ImGui::IsItemDeactivatedAfterEdit();
|
||||
PropertyEditor::treePop();
|
||||
cameraM.setClipPlanes(clip);
|
||||
}
|
||||
|
||||
camera.up = y_is_up ? glm::vec3(0, 1, 0) : glm::vec3(0, 0, 1);
|
||||
|
||||
if(cameraM.isAnimated())
|
||||
{
|
||||
// Ignoring any changes while the camera is moving to the goal.
|
||||
// The camera has to be in the new position before setting a new value.
|
||||
changed = false;
|
||||
}
|
||||
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
ImGui::TextDisabled("(?)");
|
||||
ImGuiH::tooltip(cameraM.getHelp().c_str(), false, 0.0f);
|
||||
ImGui::TableNextColumn();
|
||||
if(ImGui::SmallButton("Copy"))
|
||||
{
|
||||
std::string text = nvh::stringFormat("{%.5f, %.5f, %.5f}, {%.5f, %.5f, %.5f}, {%.5f, %.5f, %.5f}", //
|
||||
camera.eye.x, camera.eye.y, camera.eye.z, //
|
||||
camera.ctr.x, camera.ctr.y, camera.ctr.z, //
|
||||
camera.up.x, camera.up.y, camera.up.z);
|
||||
ImGui::SetClipboardText(text.c_str());
|
||||
}
|
||||
ImGuiH::tooltip("Copy to the clipboard the current camera: {eye}, {ctr}, {up}");
|
||||
ImGui::SameLine();
|
||||
const char* pPastedString;
|
||||
if(ImGui::SmallButton("Paste") && (pPastedString = ImGui::GetClipboardText()))
|
||||
{
|
||||
float val[9]{};
|
||||
int result = sscanf(pPastedString, "{%f, %f, %f}, {%f, %f, %f}, {%f, %f, %f}", &val[0], &val[1], &val[2], &val[3],
|
||||
&val[4], &val[5], &val[6], &val[7], &val[8]);
|
||||
if(result == 9) // 9 value properly scanned
|
||||
{
|
||||
camera.eye = glm::vec3{val[0], val[1], val[2]};
|
||||
camera.ctr = glm::vec3{val[3], val[4], val[5]};
|
||||
camera.up = glm::vec3{val[6], val[7], val[8]};
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
ImGuiH::tooltip("Paste from the clipboard the current camera: {eye}, {ctr}, {up}");
|
||||
PropertyEditor::end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Display buttons for all saved cameras. Allow to create and delete saved cameras
|
||||
//
|
||||
void SavedCameraTab(nvh::CameraManipulator& cameraM, nvh::CameraManipulator::Camera& camera, bool& changed)
|
||||
{
|
||||
// Dummy
|
||||
ImVec2 button_sz(50, 30);
|
||||
char label[128];
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
int buttons_count = (int)sCamMgr->m_cameras.size();
|
||||
float window_visible_x2 = ImGui::GetWindowPos().x + ImGui::GetWindowContentRegionMax().x;
|
||||
|
||||
// The HOME camera button, different from the other ones
|
||||
if(ImGui::Button("Home", ImVec2(ImGui::GetWindowContentRegionMax().x, 50)))
|
||||
{
|
||||
camera = sCamMgr->m_cameras[0];
|
||||
changed = true;
|
||||
}
|
||||
ImGuiH::tooltip("Reset the camera to its origin");
|
||||
|
||||
// Display all the saved camera in an array of buttons
|
||||
int delete_item = -1;
|
||||
for(int n = 1; n < buttons_count; n++)
|
||||
{
|
||||
ImGui::PushID(n);
|
||||
sprintf(label, "# %d", n);
|
||||
if(ImGui::Button(label, button_sz))
|
||||
{
|
||||
camera = sCamMgr->m_cameras[n];
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Middle click to delete a camera
|
||||
if(ImGui::IsItemHovered() && ImGui::GetIO().MouseClicked[NVPWindow::MOUSE_BUTTON_MIDDLE])
|
||||
delete_item = n;
|
||||
|
||||
// Displaying the position of the camera when hovering the button
|
||||
sprintf(label, "Pos: %3.5f, %3.5f, %3.5f", sCamMgr->m_cameras[n].eye.x, sCamMgr->m_cameras[n].eye.y,
|
||||
sCamMgr->m_cameras[n].eye.z);
|
||||
ImGuiH::tooltip(label);
|
||||
|
||||
// Wrapping all buttons (see ImGUI Demo)
|
||||
float last_button_x2 = ImGui::GetItemRectMax().x;
|
||||
float next_button_x2 = last_button_x2 + style.ItemSpacing.x + button_sz.x; // Expected position if next button was on same line
|
||||
if(n + 1 < buttons_count && next_button_x2 < window_visible_x2)
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
// Adding a camera button
|
||||
if(ImGui::Button("+"))
|
||||
{
|
||||
sCamMgr->addCamera(cameraM.getCamera());
|
||||
}
|
||||
ImGuiH::tooltip("Add a new saved camera");
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("(?)");
|
||||
ImGuiH::tooltip("Middle-click a camera to delete it", false, 0.0f);
|
||||
|
||||
// Remove element
|
||||
if(delete_item > 0)
|
||||
{
|
||||
sCamMgr->removeCamera(delete_item);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// This holds all camera setting, like the speed, the movement mode, transition duration
|
||||
//
|
||||
void CameraExtraTab(nvh::CameraManipulator& cameraM, bool& changed)
|
||||
{
|
||||
// Navigation Mode
|
||||
PropertyEditor::begin();
|
||||
auto mode = cameraM.getMode();
|
||||
auto speed = cameraM.getSpeed();
|
||||
auto duration = static_cast<float>(cameraM.getAnimationDuration());
|
||||
|
||||
changed |= PropertyEditor::entry(
|
||||
"Navigation",
|
||||
[&] {
|
||||
int rmode = static_cast<int>(mode);
|
||||
changed |= ImGui::RadioButton("Examine", &rmode, nvh::CameraManipulator::Examine);
|
||||
ImGuiH::tooltip("The camera orbit around a point of interest");
|
||||
changed |= ImGui::RadioButton("Fly", &rmode, nvh::CameraManipulator::Fly);
|
||||
ImGuiH::tooltip("The camera is free and move toward the looking direction");
|
||||
changed |= ImGui::RadioButton("Walk", &rmode, nvh::CameraManipulator::Walk);
|
||||
ImGuiH::tooltip("The camera is free but stay on a plane");
|
||||
cameraM.setMode(static_cast<nvh::CameraManipulator::Modes>(rmode));
|
||||
return changed;
|
||||
},
|
||||
"Camera Navigation Mode");
|
||||
|
||||
changed |= PropertyEditor::entry(
|
||||
"Speed", [&] { return ImGui::SliderFloat("##S", &speed, 0.01F, 10.0F); }, "Changing the default speed movement");
|
||||
changed |= PropertyEditor::entry(
|
||||
"Transition", [&] { return ImGui::SliderFloat("##S", &duration, 0.0F, 2.0F); }, "Nb seconds to move to new position");
|
||||
|
||||
cameraM.setSpeed(speed);
|
||||
cameraM.setAnimationDuration(duration);
|
||||
|
||||
PropertyEditor::end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Display the camera eye and center of interest position of the camera (nvh::CameraManipulator)
|
||||
// Allow also to modify the field-of-view (FOV)
|
||||
// And basic control information is displayed
|
||||
bool CameraWidget(nvh::CameraManipulator& cameraM /*= nvh::CameraManipulator::Singleton()*/)
|
||||
{
|
||||
if(!sCamMgr)
|
||||
sCamMgr = std::make_unique<CameraManager>();
|
||||
|
||||
bool changed{false};
|
||||
bool instantSet{false};
|
||||
auto camera = cameraM.getCamera();
|
||||
|
||||
// Updating the camera manager
|
||||
sCamMgr->update(cameraM);
|
||||
|
||||
// Starting UI
|
||||
if(ImGui::BeginTabBar("Hello"))
|
||||
{
|
||||
if(ImGui::BeginTabItem("Current"))
|
||||
{
|
||||
CurrentCameraTab(cameraM, camera, changed, instantSet);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if(ImGui::BeginTabItem("Cameras"))
|
||||
{
|
||||
SavedCameraTab(cameraM, camera, changed);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
|
||||
if(ImGui::BeginTabItem("Extra"))
|
||||
{
|
||||
CameraExtraTab(cameraM, changed);
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
|
||||
// Apply the change back to the camera
|
||||
if(changed)
|
||||
{
|
||||
cameraM.setCamera(camera, instantSet);
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void SetCameraJsonFile(const std::string& filename)
|
||||
{
|
||||
if(!sCamMgr)
|
||||
sCamMgr = std::make_unique<CameraManager>();
|
||||
sCamMgr->setCameraJsonFile(filename);
|
||||
}
|
||||
|
||||
void SetHomeCamera(const nvh::CameraManipulator::Camera& camera)
|
||||
{
|
||||
if(!sCamMgr)
|
||||
sCamMgr = std::make_unique<CameraManager>();
|
||||
sCamMgr->setHomeCamera(camera);
|
||||
}
|
||||
|
||||
void AddCamera(const nvh::CameraManipulator::Camera& camera)
|
||||
{
|
||||
if(!sCamMgr)
|
||||
sCamMgr = std::make_unique<CameraManager>();
|
||||
sCamMgr->addCamera(camera);
|
||||
}
|
||||
|
||||
} // namespace ImGuiH
|
||||
36
raytracer/nvpro_core/imgui/imgui_camera_widget.h
Normal file
36
raytracer/nvpro_core/imgui/imgui_camera_widget.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
||||
* and proprietary rights in and to this software, related documentation
|
||||
* and any modifications thereto. Any use, reproduction, disclosure or
|
||||
* distribution of this software and related documentation without an express
|
||||
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "nvh/cameramanipulator.hpp"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace ImGuiH {
|
||||
|
||||
/* @DOC_START -------------------------------------------------------
|
||||
|
||||
# functions in ImGuiH
|
||||
|
||||
- CameraWidget : CameraWidget is a Camera widget for the the Camera Manipulator
|
||||
- SetCameraJsonFile : set the name (without .json) of the setting file. It will load and replace all camera and settings
|
||||
- SetHomeCamera : set the home camera - replace the one on load
|
||||
- AddCamera : adding a camera to the list of cameras
|
||||
|
||||
--- @DOC_END ------------------------------------------------------- */
|
||||
|
||||
bool CameraWidget(nvh::CameraManipulator& cameraM = nvh::CameraManipulator::Singleton());
|
||||
|
||||
void SetCameraJsonFile(const std::string& filename);
|
||||
|
||||
void SetHomeCamera(const nvh::CameraManipulator::Camera& camera);
|
||||
|
||||
void AddCamera(const nvh::CameraManipulator::Camera& camera);
|
||||
|
||||
} // namespace ImGuiH
|
||||
690
raytracer/nvpro_core/imgui/imgui_helper.cpp
Normal file
690
raytracer/nvpro_core/imgui/imgui_helper.cpp
Normal file
|
|
@ -0,0 +1,690 @@
|
|||
/*
|
||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2018 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include "imgui/imgui_helper.h"
|
||||
#include <backends/imgui_impl_glfw.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace ImGuiH {
|
||||
|
||||
void Init(int width, int height, void* userData, FontMode fontmode)
|
||||
{
|
||||
ImGui::CreateContext();
|
||||
setFonts(fontmode);
|
||||
auto& imgui_io = ImGui::GetIO();
|
||||
imgui_io.IniFilename = nullptr;
|
||||
imgui_io.UserData = userData;
|
||||
imgui_io.DisplaySize = ImVec2(float(width), float(height));
|
||||
imgui_io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable keyboard controls (tab, space, arrow keys)
|
||||
|
||||
// Scale style sizes for high-DPI monitors
|
||||
ImGuiStyle& imgui_style = ImGui::GetStyle();
|
||||
imgui_style.ScaleAllSizes(getDPIScale());
|
||||
}
|
||||
|
||||
void Deinit()
|
||||
{
|
||||
ImGui::DestroyContext(nullptr);
|
||||
}
|
||||
|
||||
|
||||
bool Combo(const char* label, size_t numEnums, const Enum* enums, void* valuePtr, ImGuiComboFlags flags, ValueType valueType, bool* valueChanged)
|
||||
{
|
||||
int* ivalue = (int*)valuePtr;
|
||||
float* fvalue = (float*)valuePtr;
|
||||
|
||||
size_t idx = 0;
|
||||
bool found = false;
|
||||
bool changed = false;
|
||||
for(size_t i = 0; i < numEnums; i++)
|
||||
{
|
||||
switch(valueType)
|
||||
{
|
||||
case TYPE_INT:
|
||||
if(enums[i].ivalue == *ivalue)
|
||||
{
|
||||
idx = i;
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
case TYPE_FLOAT:
|
||||
if(enums[i].fvalue == *fvalue)
|
||||
{
|
||||
idx = i;
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
{
|
||||
assert(!"No such value in combo!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ImGui::BeginCombo(label, enums[idx].name.c_str(), flags)) // The second parameter is the label previewed before opening the combo.
|
||||
{
|
||||
for(size_t i = 0; i < numEnums; i++)
|
||||
{
|
||||
ImGui::BeginDisabled(enums[i].disabled);
|
||||
bool is_selected = i == idx;
|
||||
if(ImGui::Selectable(enums[i].name.c_str(), is_selected))
|
||||
{
|
||||
switch(valueType)
|
||||
{
|
||||
case TYPE_INT:
|
||||
*ivalue = enums[i].ivalue;
|
||||
break;
|
||||
case TYPE_FLOAT:
|
||||
*fvalue = enums[i].fvalue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
if(is_selected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch)
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if(valueChanged)
|
||||
*valueChanged = changed;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// If GLFW has been initialized, returns the DPI scale of the primary monitor. Otherwise, returns 1.
|
||||
//
|
||||
float getDPIScale()
|
||||
{
|
||||
// Cached DPI scale, so that this doesn't change after the first time code calls getDPIScale.
|
||||
// A negative value indicates that the value hasn't been computed yet.
|
||||
static float cached_dpi_scale = -1.0f;
|
||||
|
||||
if(cached_dpi_scale < 0.0f)
|
||||
{
|
||||
// Compute the product of the monitor DPI scale and any DPI scale
|
||||
// set in the NVPRO_DPI_SCALE variable.
|
||||
cached_dpi_scale = 1.0f;
|
||||
|
||||
GLFWmonitor* monitor = glfwGetPrimaryMonitor();
|
||||
assert(monitor);
|
||||
if(monitor != nullptr)
|
||||
{
|
||||
float y_scale;
|
||||
glfwGetMonitorContentScale(monitor, &cached_dpi_scale, &y_scale);
|
||||
}
|
||||
// Otherwise, GLFW isn't initialized yet, but might be in the future.
|
||||
// (Note that this code assumes all samples use GLFW.)
|
||||
|
||||
// Multiply by the value of the NVPRO_DPI_SCALE environment variable.
|
||||
const char* dpi_env = getenv("NVPRO_DPI_SCALE");
|
||||
if(dpi_env)
|
||||
{
|
||||
const float parsed_dpi_env = strtof(dpi_env, nullptr);
|
||||
if(parsed_dpi_env != 0.0f)
|
||||
{
|
||||
cached_dpi_scale *= parsed_dpi_env;
|
||||
}
|
||||
}
|
||||
|
||||
cached_dpi_scale = (cached_dpi_scale > 0.0f ? cached_dpi_scale : 1.0f);
|
||||
}
|
||||
|
||||
return cached_dpi_scale;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Setting a dark style for the GUI
|
||||
// The colors were coded in sRGB color space, set the useLinearColor
|
||||
// flag to convert to linear color space.
|
||||
void setStyle(bool useLinearColor)
|
||||
{
|
||||
typedef ImVec4 (*srgbFunction)(float, float, float, float);
|
||||
srgbFunction passthrough = [](float r, float g, float b, float a) -> ImVec4 { return ImVec4(r, g, b, a); };
|
||||
srgbFunction toLinear = [](float r, float g, float b, float a) -> ImVec4 {
|
||||
auto toLinearScalar = [](float u) -> float {
|
||||
return u <= 0.04045 ? 25 * u / 323.f : powf((200 * u + 11) / 211.f, 2.4f);
|
||||
};
|
||||
return ImVec4(toLinearScalar(r), toLinearScalar(g), toLinearScalar(b), a);
|
||||
};
|
||||
srgbFunction srgb = useLinearColor ? toLinear : passthrough;
|
||||
|
||||
ImGui::StyleColorsDark();
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.WindowRounding = 0.0f;
|
||||
style.WindowBorderSize = 0.0f;
|
||||
style.ColorButtonPosition = ImGuiDir_Right;
|
||||
style.FrameRounding = 2.0f;
|
||||
style.FrameBorderSize = 1.0f;
|
||||
style.GrabRounding = 4.0f;
|
||||
style.IndentSpacing = 12.0f;
|
||||
style.Colors[ImGuiCol_WindowBg] = srgb(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
style.Colors[ImGuiCol_MenuBarBg] = srgb(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
style.Colors[ImGuiCol_ScrollbarBg] = srgb(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
style.Colors[ImGuiCol_PopupBg] = srgb(0.135f, 0.135f, 0.135f, 1.0f);
|
||||
style.Colors[ImGuiCol_Border] = srgb(0.4f, 0.4f, 0.4f, 0.5f);
|
||||
style.Colors[ImGuiCol_FrameBg] = srgb(0.05f, 0.05f, 0.05f, 0.5f);
|
||||
|
||||
// Normal
|
||||
ImVec4 normal_color = srgb(0.465f, 0.465f, 0.525f, 1.0f);
|
||||
std::vector<ImGuiCol> to_change_nrm;
|
||||
to_change_nrm.push_back(ImGuiCol_Header);
|
||||
to_change_nrm.push_back(ImGuiCol_SliderGrab);
|
||||
to_change_nrm.push_back(ImGuiCol_Button);
|
||||
to_change_nrm.push_back(ImGuiCol_CheckMark);
|
||||
to_change_nrm.push_back(ImGuiCol_ResizeGrip);
|
||||
to_change_nrm.push_back(ImGuiCol_TextSelectedBg);
|
||||
to_change_nrm.push_back(ImGuiCol_Separator);
|
||||
to_change_nrm.push_back(ImGuiCol_FrameBgActive);
|
||||
for(auto c : to_change_nrm)
|
||||
{
|
||||
style.Colors[c] = normal_color;
|
||||
}
|
||||
|
||||
// Active
|
||||
ImVec4 active_color = srgb(0.365f, 0.365f, 0.425f, 1.0f);
|
||||
std::vector<ImGuiCol> to_change_act;
|
||||
to_change_act.push_back(ImGuiCol_HeaderActive);
|
||||
to_change_act.push_back(ImGuiCol_SliderGrabActive);
|
||||
to_change_act.push_back(ImGuiCol_ButtonActive);
|
||||
to_change_act.push_back(ImGuiCol_ResizeGripActive);
|
||||
to_change_act.push_back(ImGuiCol_SeparatorActive);
|
||||
for(auto c : to_change_act)
|
||||
{
|
||||
style.Colors[c] = active_color;
|
||||
}
|
||||
|
||||
// Hovered
|
||||
ImVec4 hovered_color = srgb(0.565f, 0.565f, 0.625f, 1.0f);
|
||||
std::vector<ImGuiCol> to_change_hover;
|
||||
to_change_hover.push_back(ImGuiCol_HeaderHovered);
|
||||
to_change_hover.push_back(ImGuiCol_ButtonHovered);
|
||||
to_change_hover.push_back(ImGuiCol_FrameBgHovered);
|
||||
to_change_hover.push_back(ImGuiCol_ResizeGripHovered);
|
||||
to_change_hover.push_back(ImGuiCol_SeparatorHovered);
|
||||
for(auto c : to_change_hover)
|
||||
{
|
||||
style.Colors[c] = hovered_color;
|
||||
}
|
||||
|
||||
|
||||
style.Colors[ImGuiCol_TitleBgActive] = srgb(0.465f, 0.465f, 0.465f, 1.0f);
|
||||
style.Colors[ImGuiCol_TitleBg] = srgb(0.125f, 0.125f, 0.125f, 1.0f);
|
||||
style.Colors[ImGuiCol_Tab] = srgb(0.05f, 0.05f, 0.05f, 0.5f);
|
||||
style.Colors[ImGuiCol_TabHovered] = srgb(0.465f, 0.495f, 0.525f, 1.0f);
|
||||
style.Colors[ImGuiCol_TabActive] = srgb(0.282f, 0.290f, 0.302f, 1.0f);
|
||||
style.Colors[ImGuiCol_ModalWindowDimBg] = srgb(0.465f, 0.465f, 0.465f, 0.350f);
|
||||
|
||||
//Colors_ext[ImGuiColExt_Warning] = srgb (1.0f, 0.43f, 0.35f, 1.0f);
|
||||
|
||||
ImGui::SetColorEditOptions(ImGuiColorEditFlags_Float | ImGuiColorEditFlags_PickerHueWheel);
|
||||
}
|
||||
|
||||
//
|
||||
// Local, return true if the filename exist
|
||||
//
|
||||
static bool fileExists(const char* filename)
|
||||
{
|
||||
std::ifstream stream;
|
||||
stream.open(filename);
|
||||
return stream.is_open();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Looking for TTF fonts, first on the VULKAN SDK, then Windows default fonts
|
||||
//
|
||||
void setFonts(FontMode fontmode)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
const float high_dpi_scale = getDPIScale();
|
||||
|
||||
|
||||
// Nicer fonts
|
||||
ImFont* font = nullptr;
|
||||
if(fontmode == FONT_MONOSPACED_SCALED)
|
||||
{
|
||||
if(font == nullptr)
|
||||
{
|
||||
const std::string p = R"(C:/Windows/Fonts/consola.ttf)";
|
||||
if(fileExists(p.c_str()))
|
||||
font = io.Fonts->AddFontFromFileTTF(p.c_str(), 12.0f * high_dpi_scale);
|
||||
}
|
||||
if(font == nullptr)
|
||||
{
|
||||
const std::string p = "/usr/share/fonts/truetype/ubuntu/UbuntuMono-R.ttf";
|
||||
if(fileExists(p.c_str()))
|
||||
font = io.Fonts->AddFontFromFileTTF(p.c_str(), 12.0f * high_dpi_scale);
|
||||
}
|
||||
}
|
||||
else if(fontmode == FONT_PROPORTIONAL_SCALED)
|
||||
{
|
||||
const char* vk_path = getenv("VK_SDK_PATH");
|
||||
if(vk_path)
|
||||
{
|
||||
const std::string p = std::string(vk_path) + R"(/Samples/Layer-Samples/data/FreeSans.ttf)";
|
||||
if(fileExists(p.c_str()))
|
||||
font = io.Fonts->AddFontFromFileTTF(p.c_str(), 16.0f * high_dpi_scale);
|
||||
}
|
||||
if(font == nullptr)
|
||||
{
|
||||
const std::string p = R"(C:/Windows/Fonts/segoeui.ttf)";
|
||||
if(fileExists(p.c_str()))
|
||||
font = io.Fonts->AddFontFromFileTTF(p.c_str(), 16.0f * high_dpi_scale);
|
||||
}
|
||||
if(font == nullptr)
|
||||
{
|
||||
const std::string p = "/usr/share/fonts/truetype/ubuntu/Ubuntu-R.ttf";
|
||||
if(fileExists(p.c_str()))
|
||||
font = io.Fonts->AddFontFromFileTTF(p.c_str(), 16.0f * high_dpi_scale);
|
||||
}
|
||||
}
|
||||
|
||||
if(font == nullptr)
|
||||
{
|
||||
ImFontConfig font_config = ImFontConfig();
|
||||
font_config.SizePixels = 13.0f * high_dpi_scale; // 13 is the default font size
|
||||
io.Fonts->AddFontDefault(&font_config);
|
||||
}
|
||||
}
|
||||
|
||||
void tooltip(const char* description, bool questionMark /*= false*/, float timerThreshold /*= 0.5f*/)
|
||||
{
|
||||
bool passTimer = GImGui->HoveredIdTimer >= timerThreshold && GImGui->ActiveIdTimer == 0.0f;
|
||||
if(questionMark)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("(?)");
|
||||
passTimer = true;
|
||||
}
|
||||
|
||||
if(ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && passTimer)
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
ImGui::TextUnformatted(description);
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename TScalar, ImGuiDataType type, uint8_t dim>
|
||||
bool show_slider_control_scalar(TScalar* value, TScalar* min, TScalar* max, const char* format)
|
||||
{
|
||||
static const char* visible_labels[] = {"x:", "y:", "z:", "w:"};
|
||||
|
||||
if(dim == 1)
|
||||
return ImGui::SliderScalar("##hidden", type, &value[0], &min[0], &max[0], format);
|
||||
|
||||
float indent = ImGui::GetCursorPos().x;
|
||||
bool changed = false;
|
||||
for(uint8_t c = 0; c < dim; ++c)
|
||||
{
|
||||
ImGui::PushID(c);
|
||||
if(c > 0)
|
||||
{
|
||||
ImGui::NewLine();
|
||||
ImGui::SameLine(indent);
|
||||
}
|
||||
ImGui::Text("%s", visible_labels[c]);
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
changed |= ImGui::SliderScalar("##hidden", type, &value[c], &min[c], &max[c], format);
|
||||
ImGui::PopID();
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<float>(float* value, float& min, float& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<float, ImGuiDataType_Float, 1>(value, &min, &max, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::vec2>(glm::vec2* value, glm::vec2& min, glm::vec2& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<float, ImGuiDataType_Float, 2>(&value->x, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::vec3>(glm::vec3* value, glm::vec3& min, glm::vec3& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<float, ImGuiDataType_Float, 3>(&value->x, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::vec4>(glm::vec4* value, glm::vec4& min, glm::vec4& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<float, ImGuiDataType_Float, 4>(&value->x, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<float>(float* value, float speed, float& min, float& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<float, ImGuiDataType_Float, 1>(value, speed, &min, &max, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::vec2>(glm::vec2* value, float speed, glm::vec2& min, glm::vec2& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<float, ImGuiDataType_Float, 2>(&value->x, speed, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::vec3>(glm::vec3* value, float speed, glm::vec3& min, glm::vec3& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<float, ImGuiDataType_Float, 3>(&value->x, speed, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::vec4>(glm::vec4* value, float speed, glm::vec4& min, glm::vec4& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<float, ImGuiDataType_Float, 4>(&value->x, speed, &min.x, &max.x, format ? format : "%.3f");
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<int>(int* value, int& min, int& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<int, ImGuiDataType_S32, 1>(value, &min, &max, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::ivec2>(glm::ivec2* value, glm::ivec2& min, glm::ivec2& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<int, ImGuiDataType_S32, 2>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::ivec3>(glm::ivec3* value, glm::ivec3& min, glm::ivec3& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<int, ImGuiDataType_S32, 3>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<glm::ivec4>(glm::ivec4* value, glm::ivec4& min, glm::ivec4& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<int, ImGuiDataType_S32, 4>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<int>(int* value, float speed, int& min, int& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<int, ImGuiDataType_S32, 1>(value, speed, &min, &max, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::ivec2>(glm::ivec2* value, float speed, glm::ivec2& min, glm::ivec2& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<int, ImGuiDataType_S32, 2>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::ivec3>(glm::ivec3* value, float speed, glm::ivec3& min, glm::ivec3& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<int, ImGuiDataType_S32, 3>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<glm::ivec4>(glm::ivec4* value, float speed, glm::ivec4& min, glm::ivec4& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<int, ImGuiDataType_S32, 4>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<uint32_t>(uint32_t* value, uint32_t& min, uint32_t& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<uint32_t, ImGuiDataType_U32, 1>(value, &min, &max, format ? format : "%d");
|
||||
}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_slider_control<uint32_t_2>(uint32_t_2* value, uint32_t_2& min, uint32_t_2& max, const char* format)
|
||||
//{
|
||||
// return show_slider_control_scalar<uint32_t, ImGuiDataType_U32, 2>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_slider_control<uint32_t_3>(uint32_t_3* value, uint32_t_3& min, uint32_t_3& max, const char* format)
|
||||
//{
|
||||
// return show_slider_control_scalar<uint32_t, ImGuiDataType_U32, 3>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_slider_control<uint32_t_4>(uint32_t_4* value, uint32_t_4& min, uint32_t_4& max, const char* format)
|
||||
//{
|
||||
// return show_slider_control_scalar<uint32_t, ImGuiDataType_U32, 4>(&value->x, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_drag_control<uint32_t>(uint32_t* value, float speed, uint32_t& min, uint32_t& max, const char* format)
|
||||
//{
|
||||
// return show_drag_control_scalar<uint32_t, ImGuiDataType_U32, 1>(value, speed, &min, &max, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_drag_control<uint32_t_2>(uint32_t_2* value, float speed, uint32_t_2& min, uint32_t_2& max, const char* format)
|
||||
//{
|
||||
// return show_drag_control_scalar<uint32_t, ImGuiDataType_U32, 2>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_drag_control<uint32_t_3>(uint32_t_3* value, float speed, uint32_t_3& min, uint32_t_3& max, const char* format)
|
||||
//{
|
||||
// return show_drag_control_scalar<uint32_t, ImGuiDataType_U32, 3>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
//
|
||||
//template <>
|
||||
//bool Control::show_drag_control<uint32_t_4>(uint32_t_4* value, float speed, uint32_t_4& min, uint32_t_4& max, const char* format)
|
||||
//{
|
||||
// return show_drag_control_scalar<uint32_t, ImGuiDataType_U32, 4>(&value->x, speed, &min.x, &max.x, format ? format : "%d");
|
||||
//}
|
||||
|
||||
|
||||
template <>
|
||||
bool Control::show_slider_control<size_t>(size_t* value, size_t& min, size_t& max, const char* format)
|
||||
{
|
||||
return show_slider_control_scalar<size_t, ImGuiDataType_U64, 1>(value, &min, &max, format ? format : "%d");
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Control::show_drag_control<size_t>(size_t* value, float speed, size_t& min, size_t& max, const char* format)
|
||||
{
|
||||
return show_drag_control_scalar<size_t, ImGuiDataType_U64, 1>(value, speed, &min, &max, format ? format : "%d");
|
||||
}
|
||||
|
||||
// Static member declaration
|
||||
ImGuiID Panel::dockspaceID{0};
|
||||
|
||||
void Panel::Begin(Side side /*= Side::Right*/, float alpha /*= 0.5f*/, char* name /*= nullptr*/)
|
||||
{
|
||||
// Keeping the unique ID of the dock space
|
||||
dockspaceID = ImGui::GetID("DockSpace");
|
||||
|
||||
// The dock need a dummy window covering the entire viewport.
|
||||
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(viewport->WorkPos);
|
||||
ImGui::SetNextWindowSize(viewport->WorkSize);
|
||||
ImGui::SetNextWindowViewport(viewport->ID);
|
||||
|
||||
// All flags to dummy window
|
||||
ImGuiWindowFlags host_window_flags = 0;
|
||||
host_window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize;
|
||||
host_window_flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDocking;
|
||||
host_window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
||||
host_window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
|
||||
// Starting dummy window
|
||||
char label[32];
|
||||
ImFormatString(label, IM_ARRAYSIZE(label), "DockSpaceViewport_%08X", viewport->ID);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::Begin(label, nullptr, host_window_flags);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
// The central node is transparent, so that when UI is draw after, the image is visible
|
||||
// Auto Hide Bar, no title of the panel
|
||||
// Center is not dockable, that is for the scene
|
||||
ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_AutoHideTabBar
|
||||
| ImGuiDockNodeFlags_NoDockingOverCentralNode;
|
||||
|
||||
// Default panel/window is name setting
|
||||
std::string dock_name("Settings");
|
||||
if(name != nullptr)
|
||||
dock_name = name;
|
||||
|
||||
// Building the splitting of the dock space is done only once
|
||||
if(!ImGui::DockBuilderGetNode(dockspaceID))
|
||||
{
|
||||
ImGui::DockBuilderRemoveNode(dockspaceID);
|
||||
ImGui::DockBuilderAddNode(dockspaceID, dockspaceFlags | ImGuiDockNodeFlags_DockSpace);
|
||||
ImGui::DockBuilderSetNodeSize(dockspaceID, viewport->Size);
|
||||
|
||||
ImGuiID dock_main_id = dockspaceID;
|
||||
|
||||
// Slitting all 4 directions, targetting (320 pixel * DPI) panel width, (180 pixel * DPI) panel height.
|
||||
const float xRatio = glm::clamp<float>(320.0f * getDPIScale() / viewport->WorkSize[0], 0.01f, 0.499f);
|
||||
const float yRatio = glm::clamp<float>(180.0f * getDPIScale() / viewport->WorkSize[1], 0.01f, 0.499f);
|
||||
ImGuiID id_left, id_right, id_up, id_down;
|
||||
|
||||
// Note, for right, down panels, we use the n / (1 - n) formula to correctly split the space remaining from the left, up panels.
|
||||
id_left = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Left, xRatio, nullptr, &dock_main_id);
|
||||
id_right = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Right, xRatio / (1 - xRatio), nullptr, &dock_main_id);
|
||||
id_up = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Up, yRatio, nullptr, &dock_main_id);
|
||||
id_down = ImGui::DockBuilderSplitNode(dock_main_id, ImGuiDir_Down, yRatio / (1 - yRatio), nullptr, &dock_main_id);
|
||||
|
||||
ImGui::DockBuilderDockWindow(side == Side::Left ? dock_name.c_str() : "Dock_left", id_left);
|
||||
ImGui::DockBuilderDockWindow(side == Side::Right ? dock_name.c_str() : "Dock_right", id_right);
|
||||
ImGui::DockBuilderDockWindow("Dock_up", id_up);
|
||||
ImGui::DockBuilderDockWindow("Dock_down", id_down);
|
||||
ImGui::DockBuilderDockWindow("Scene", dock_main_id); // Center
|
||||
|
||||
ImGui::DockBuilderFinish(dock_main_id);
|
||||
}
|
||||
|
||||
// Setting the panel to blend with alpha
|
||||
ImVec4 col = ImGui::GetStyleColorVec4(ImGuiCol_WindowBg);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(col.x, col.y, col.z, alpha));
|
||||
|
||||
ImGui::DockSpace(dockspaceID, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::End();
|
||||
|
||||
// The panel
|
||||
if(alpha < 1)
|
||||
ImGui::SetNextWindowBgAlpha(alpha); // For when the panel becomes a floating window
|
||||
ImGui::Begin(dock_name.c_str());
|
||||
}
|
||||
|
||||
Control::Style Control::style{};
|
||||
|
||||
} // namespace ImGuiH
|
||||
|
||||
|
||||
bool ImGuiH::azimuthElevationSliders(glm::vec3& direction, bool negative, bool yIsUp /*=true*/)
|
||||
{
|
||||
glm::vec3 normalized_dir = normalize(direction);
|
||||
if(negative)
|
||||
{
|
||||
normalized_dir = -normalized_dir;
|
||||
}
|
||||
|
||||
double azimuth;
|
||||
double elevation;
|
||||
const double min_azimuth = -180.0;
|
||||
const double max_azimuth = 180.0;
|
||||
const double min_elevation = -90.0;
|
||||
const double max_elevation = 90.0;
|
||||
|
||||
if(yIsUp)
|
||||
{
|
||||
azimuth = glm::degrees(atan2(normalized_dir.z, normalized_dir.x));
|
||||
elevation = glm::degrees(asin(normalized_dir.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
azimuth = glm::degrees(atan2(normalized_dir.y, normalized_dir.x));
|
||||
elevation = glm::degrees(asin(normalized_dir.z));
|
||||
}
|
||||
|
||||
|
||||
bool changed = false;
|
||||
changed |= PropertyEditor::entry("Azimuth", [&]() {
|
||||
return ImGui::SliderScalar("Azimuth", ImGuiDataType_Double, &azimuth, &min_azimuth, &max_azimuth, "%.1f deg",
|
||||
ImGuiSliderFlags_NoRoundToFormat);
|
||||
});
|
||||
changed |= PropertyEditor::entry("Elevation", [&]() {
|
||||
return ImGui::SliderScalar("Elevation", ImGuiDataType_Double, &elevation, &min_elevation, &max_elevation,
|
||||
"%.1f deg", ImGuiSliderFlags_NoRoundToFormat);
|
||||
});
|
||||
|
||||
if(changed)
|
||||
{
|
||||
azimuth = glm::radians(azimuth);
|
||||
elevation = glm::radians(elevation);
|
||||
double cos_elevation = cos(elevation);
|
||||
|
||||
if(yIsUp)
|
||||
{
|
||||
direction.y = static_cast<float>(sin(elevation));
|
||||
direction.x = static_cast<float>(cos(azimuth) * cos_elevation);
|
||||
direction.z = static_cast<float>(sin(azimuth) * cos_elevation);
|
||||
}
|
||||
else
|
||||
{
|
||||
direction.z = static_cast<float>(sin(elevation));
|
||||
direction.x = static_cast<float>(cos(azimuth) * cos_elevation);
|
||||
direction.y = static_cast<float>(sin(azimuth) * cos_elevation);
|
||||
}
|
||||
|
||||
if(negative)
|
||||
{
|
||||
direction = -direction;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
1302
raytracer/nvpro_core/imgui/imgui_helper.h
Normal file
1302
raytracer/nvpro_core/imgui/imgui_helper.h
Normal file
File diff suppressed because it is too large
Load diff
326
raytracer/nvpro_core/imgui/imgui_icon.cpp
Normal file
326
raytracer/nvpro_core/imgui/imgui_icon.cpp
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
/*
|
||||
* Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <imgui.h>
|
||||
#include "imgui_icon.h"
|
||||
|
||||
namespace ImGuiH {
|
||||
ImFont* g_iconicFont = nullptr;
|
||||
}
|
||||
|
||||
// Forward declaration
|
||||
const char* getOpenIconicFontCompressedBase85TTF();
|
||||
|
||||
|
||||
void ImGuiH::addIconicFont(float fontSize)
|
||||
{
|
||||
if(g_iconicFont == nullptr)
|
||||
{
|
||||
ImFontConfig fontConfig;
|
||||
static uint16_t const range[] = {0xE000, 0xE0DF, 0};
|
||||
char const* glyphsData = getOpenIconicFontCompressedBase85TTF();
|
||||
g_iconicFont =
|
||||
ImGui::GetIO().Fonts->AddFontFromMemoryCompressedBase85TTF(glyphsData, fontSize, &fontConfig, (const ImWchar*)range);
|
||||
}
|
||||
}
|
||||
|
||||
ImFont* ImGuiH::getIconicFont()
|
||||
{
|
||||
return g_iconicFont;
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
const char* getOpenIconicFontCompressedBase85TTF()
|
||||
{
|
||||
// TTF font data for OpenIconic font TTF
|
||||
|
||||
// SIL OPEN FONT LICENSE Version 1.1
|
||||
// https://github.com/iconic/open-iconic/blob/master/FONT-LICENSE
|
||||
|
||||
// The MIT License(MIT)
|
||||
// https://github.com/iconic/open-iconic/blob/master/ICON-LICENSE
|
||||
//
|
||||
// Copyright(c) 2014 Waybury
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this softwareand 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 noticeand 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.
|
||||
|
||||
// File: 'open-iconic.ttf' (28028 bytes)
|
||||
// Exported using binary_to_compressed_c.cpp
|
||||
static const char openIconic_compressed_data_base85[25385 + 1] =
|
||||
"7])#######cl1xJ'/###W),##2(V$#Q6>##u@;*>#ovW#&6)=-'OE/1gZn426mL&=1->>#JqEn/aNV=B28=<m_)m<-EZlS._0XGH`$vhL0IbjN=pb:&$jg0Fr9eV5oQQ^RE6WaE%J%/G"
|
||||
"BgO2(UC72LFAuY%,5LsCDEw5[7)1G`8@Ei*b';9Co/(F9LFS7hr1dD4Eo3R/f@h>#/;pu&V3dW.;h^`IwBAA+k%HL2WF')No6Q<BUs$&94b(8_mQf^c0iR/GMxKghV8C5M9ANDF;),eP"
|
||||
"s=L%Mv6QwLYcv/GiF#>pfe->#G:%&#P$;-GItJ1kmO31#r$pBABLTsL:+:%/-p5m6#aJ_&FZ;#jL-gF%N55YueXZV$l`+W%G'7*.p+AGM%rs.Lx0KfLwF6##_OB`N1^*bNYU$##.,<6C"
|
||||
"pYw:#[MW;-$_C2:01XMCH]/F%@oj>-Wmf*%%q8.$F`7@'.B.;6_Du'&hF;;$63Mk+MS:;$l9r&lW+>>#YvEuu=m*.-H####Y4+GMQrus-Su[fLK=6##'DbA#bFw8'tB6##Lhdk%Nb#d)"
|
||||
"-l68%<a60%*8YY#ksnO(meGH3D@dOgq#Sk#<@KZ+^2bY#t=58.Z42G`R5pP'R#k8&1p^w0%2tM(TDl-$nq@8%uP&<6FMsFrkg%;Qk:MEd]'CJ#q4cQumLuFroPu>C&8FB-#@'$.8mwiL"
|
||||
"KO2EOR.tB-1N5</<PQ?SQlRfL^5fQMK4X$#8e`##9Q@k(xsFA#cFGH3*/rv-@0steAL@&Mt98'RE:6G`(q1@doX]'R>$hiPchu,MLY5;-]Xo34camA#@YqlLLxQ2MIMh1MB2tuLjV;;$"
|
||||
"PE)B4-Mc##=(V$#3JRN'GRes$-M:;$eN;hLGSrhL)kL)Nv$Q;-h8Ee#OYLxL/qPW-+l*hcw3Tt:K=/g)&QD.$s@o6<40)V;=6axT1F<U;2OWq;.]BxTR2###;:U;-<3]V$]V@^FJR@%#"
|
||||
"8l#U7uUO.)Y9kT%1YUV$Yp()3GU1E4m3[5/sgw,*wqq8.5&7C#)#xP'hT%;Q<a&buYwaVaJjAZ#/7:*j>[x@A1P&,;nl8IW*Yn36=b/(G*8FW.KkqrUgt]_uR0.g>Z>,%&$),##50ED#"
|
||||
";EFEaP]UkIJ1P*nO(@nBD3gp/Ys%*c,/Wp`IhM]^'/B67gL0mM<%9@RS%EE.<$(iNn0&DJ1(*O13(0&Ws%C8I6oF'XMon(BW#Ej5/1#iK#$V@pgL5W=huZXAwR'qAZPH(<?#%G3]-"
|
||||
"R4B>QW<Q]uIvg_-5Or`S*J);;RmwiL*BauPcOB_-66lKYg,3^#r+TV-jO@mk5ImO($FKx9R:xIQTCfd4XcE,#8EaP]VkIJ1W9m9MqiRdF#jaIhUm9DC)Pb3Fq';dMJ:>GMU'MHME]sFr"
|
||||
"$#bIh$ErFrtE)Xu*S.GMsFZY#xx'&(-hBD3O4g]uc_.08/tf2`_^7I-PK7I-dn6]-TYwTM9en9M3*-&4%lQDO]H1[MO@YoPM8,,MU#<?#0q3L#r&_B#Gk5`-+XV$^wAI&#MgwGMe/=fM"
|
||||
"%2rAMwM,i87d0^#(tAh8IG1B#8E_#$uLbA#=2vg)<j8>CoeY9C3[-CuBu[*$#xYr#2w@P#3(CJ#G*2GMlH^v-KV;;?BT_c)lH*20%'%<&DI$,*DiY##=Z[0)jiWI)qV6C#2-#Q/8bCE4"
|
||||
"d.fZ$aSIWABTgk0;-LD?7L1a#d:+d4.:L^u@Ft%,O27>>$/Ib%@s@8:JrksLPQuP=Wj&2XY'f*.W>%H?Jo*50D@N'6@:&&6Mj;5:[G>',%/5##sIkA#?V)2/9(V$#rA+KWNVB.*0Zc8/"
|
||||
"_YWF3p;:R/g;2.I07b2CAZAb4hLY['IR(<)[8UCCx5B58Xatm'Dn35&+^L-M&J_P8H79v-P>/B#9]SfLYWY95F5kWo[iJdo7PFa[Nk9:<bmp2<`1g2$^kYhLMbQb[P)^F#&fAguE8*C&"
|
||||
".'wwB_B(7#1Yu##;PF$/GRes$c^HwBH$nO(gv8s7EPdO(jW4G`Lq#Gr3RgIht28G`]n&=(Vu_?###b9#`KGf%;T<A+&Zu(3%'%<&_T/a+bhV?#+crB#;0l]#P#G:.rkh8.mNv)4kDsI3"
|
||||
"5;`:%q2Qv$lf/+*u?lD#g48`&/0*>P^-R`E7+R<C0F91p*AM9LpLL=Q3H?.q]PMP0*+_HM3bQ;-`78JL$R]duA'OI)ZFX:CxH#OKvCnf)Gd(APJCZY#)J/-2IdS2^M4v##;Z[0)?sGA#"
|
||||
"vx:g)Z4jd%lUFb3(ctM(7'$,&H$^>u=NxH#6J8I&tS?.&(w?w%M&CJ#nxkT9HoMs%Ri,#:fs0c7fGA_#kSuIUZ42G`#?#,2'ti21;ix+MG3gF4`cJ,3)_Aj0cI9F*jpB:%cn4[$UJ,G4"
|
||||
"[uUv-?]d8/hJL:%+SN/2X,n.)1Yl>#4a&m%;Bjo*G6'j0DTnr6>vl[P^Su>#D5UlSjXT)5er^)%7R2=-kL)APv<qa4<IK60tY#c4<q@?PW;e+WLuuEm05Vm&fK(,)nM5N(f%JfL`Lu(3"
|
||||
"9UsNOj/@tLh]8f3.m(u$Uxor6]]DC8ukm/N3vOG=Mo&vHc2Ii4iJ<cFuP@+`E'flLbcK`$v)$$$PrC$#e28]%/5:$)V'+X$)lNn0vpf8%B:Y)4ZE>V/isSi)XSf_4Kj+5A3/mCW-nm<S"
|
||||
"`Tr6C?9%0$lKTATZ(N=(=BPEd++wH?Ukx/1U'+&#`,Gj^8%L+**<m`-0]kHZ(LOA#vkh8.7/TF4o=]:/Z(OF3kl-F%3F6eMJGsFrY3Kt7lAkHuNBAJ.3dT3C7Ot2CSeKD?]a;*eB[f%-"
|
||||
"6K^'RB,aB#FP*2MSiaIhwq$vJZTEV&biqr$07>>#8EQJ(6uv9.nXAouu[XO%s[?>#p?_&#aJxjt^;>_/^1[d+=7B_4s7En3+I@X-vu/+*X0fX-]p*P(&,]]4qio05A@N@,.>T@,(r?5/"
|
||||
"=KeA?u>kB,pSaIhUT%/2.dOCjA/#2C7CA5//`Nw$*jnA#abDE-)aDE-/MXZ/8N9R//G/JdTa+W-@Isp^Z_?##EdS2^4;5##af[^$/6fX-m'4]-7^9Z-HLQ;-.`6/1xq7t%uR$w#tPR6D"
|
||||
"CIm,&=G4?Is8K%#fd0'#$sb&,`X2$#p%c00gEW@,QFVC,732m$ic``3t<7f3I.=h>K7)qiFe8V8CwBB#'8:$6-^J6atvN@,P;I80eF&b*l-AU+Q1(`.JLR$&cIqH1Vec<066V9CIBkp%"
|
||||
",<$'85fK>?uxwV.fE4g)Een2B,R(f)o77<.hp?d)BiaF3iEo8%Z_G)4@O'>.g:S_#OJ,G4oHl2Eq<@12u)Yx#IM6u?b%]=YnAv6Jex/U%ZRQ;-P2>.3hC7),'BW<BvIo#';9l<'$<=8A"
|
||||
"QI%##SJ%?R#H0%#hj9'#G`gT7LoqZ-$QdR&*oNn0@hmV-+NTj`qc=00vc%H)+,Bf3rQim$VKi9/(o?X-^hDv#@81G`Ig2Au0aYK)uXAA,/Pg;M+q//1gFB,j<34G`R=wP/ji1G`]d`oA"
|
||||
"Q$1i#`M66CL=6##)CQ$$^0+&#Kqn%#7mJR8@R6C#a?T:%cKff16t'E#E%D'S1lh8.VntD#$be#5@=e/1#6RCsVJ$F<tI`?#Of6'5r0Er:3MBk;spA/1cbg@OmWuI<^'s?#FWS5<3QP-."
|
||||
"DM_*597on2$&###ZYw4fITr+De1'<3S=>6sG)'J3W#[]4<PsD#%f%s$PL?lL14(f)MCr?#sX.r8aa#K)Nl/BHERX/2ucJ:/mu[:/vBo8%r:#?,h6n5/s39tU3*Y<UZ?85/Q4vr-VSi/:"
|
||||
"#b<c4-[xo%ls>n&;[qu$0FLS:/.r%,&@ed)$QlvG@5uj)Oi3+3G0Z**uJMk'^@3B6.xl$,eAru51Qkp'&.-,*dLW)3.,RW%EUu^$sZG0(pS4=-JvW@,8PQc4RT8,*IPgf)3;N#5G&MP0"
|
||||
"U`2p/Qkf34,N_2:o76HN7.7W$]YO@,_NG/(,a'W$%'N50ohYgL_IGG,<;:v-2@`[,=bT]$?/5##'AlY#ID(7#Fww%#QYmq%WqRJ1`tC.33Tlk0[IBN(3pm;%`ni?#A=M8.cc``3eN:;?"
|
||||
"AWw8@k%#s-00J,;4YIQ0&Z?X('P7G`C)j-&JPciuqvC)*#BU3(UH5/(omLgL0G5gLMQ(]$Y$3$#E@%%#Uqn%#fKb&#Rp8X-@[v(+vuRL(QknW$-xNn0WTP$KC[/Q/:%xC#)vsI33E0N("
|
||||
"H1:)N]*WZ#1H(0aVHt1':Z/GM%7Q;-%#h3&F'Bq%n1Goub&]:.CCK?d$SF&#T=P#$b,`tL)V[*._1x+MPr@X-Uokl8JJK/)$8h9MO4G^#P^.3M>7(#&S:A2CmEx>dOI5r%:^iqM&_V;:"
|
||||
"i51g*lBel/a)12'oon60Jn))+`'fJ1`tC.3?l0x5oSEU-a1M9.F)E`#dDp;-JY#<-GOH&%H0B^^<5=E$`Ge,Mu%2&7&bsZ5oYAA,?J<MKYsslWoV[(6DE;&$b/<-&hpE$M$oO07*pcW-"
|
||||
"j:?NMCQFv-(oHhLL2JG=$,>>#B$k>dKV;;?/addFXh)v#`._f#q%KoMhC?>#[CNJMf:-##-Q-E0rB%;QaVS;-#'e32tYg59ZF;s%BOP]uA_$'Q)uCt/OKkA#Bua1uiRJF-[d'-%q%5kO"
|
||||
"vfP&#(K6(#=3CR0*_S[#:H%O(xNUA$6*YA#Fr/l'V::8._%NT/-K?C#ued;-1rru$JMQF%'1u.)M[4;dv<[5/H5_T%:='d)/OTF&*j`B4')?N#]_h[,>eq/3l;pNM1'A5/rM?R&*dgAt"
|
||||
"UZg6&7NF*+?jTx=EIIW-@NSKug0pTV.52G`4CNP&?&3-&?A/'H2Bx9.^1tM(b,sFrjv'Q/'ZedubwtBC/:CB#jI:0C6CBh5E8I/(dcT5',m?T%eee@#.N?C#qw6u68AB-QI`_M:lpZEP"
|
||||
"sTK^P9?%RPLu6j:kmQEPKF^w'?7%-3KV;;?J(WqgNt#`40<t4SYG,juMZfF-)dGW-^Wk2DNLZY#Kp+)O8pID*IF)?#h:VX1@93/M]VXKM_oX02SkIJ1lF;?#?W$9S$tn=GE$M#$Q#HpL"
|
||||
"<D%/O(n)U/[[2Q/8a&;Q%a3^#RWU@-nR.K9u?:@IY3E$#;P6*<TH+O4hKr0aWl;;?xpSBZ,K<@I_3EiM(IkB-/RkB-,J'O.kE$`4(9a;%a0x8.>+nDS2BI4=E&=h>]^'Q/Z9V;-YOho."
|
||||
"<TqA,B/^q'%vGA#gEW@,YG8f3vf%&4O$/i)cn=X(eOnH+s1gF4`XdB,1>MZu]8+-;]kFF#'''k0[gX7IMhIw#Ri3+3Og<X(+gpk9QrD7*416AO7CsEI@cR30R,Gj^]9kT%d`>qpfnQQ%"
|
||||
"e/0i)(@n5/6a=a;KfZ_#4p#g[oEkCWnP%3:)puH;f3Yn*q=jg.:KVK2HR+8&5R&/1t.b8/mRXR-Oh#L/lYWI)*^iF=t%'Z--nii/S;3,)s<RF4#pMB,1H4Q/m$UfL_qtFb-:jB5l.$vJ"
|
||||
"2uY<,7;IwPvMc>#^XL@,709JSBlvuQ#sj?>drN+3Pr3&7b&WF=b'4fur>gf)?N=v-=Kjr7wv#K)LVsQNXSlwPPaE<%%H>[01lXI)YAOZ6#FPcMnGkIdt'e'Jh)MUdPco=d`X@>d_d?]/"
|
||||
"NX.i)Oi3+3AS.n/DEaP]ZkIJ1Bd]N/:2Cv-6I7lLg%J#/Lcp77DsX<h3KKwMOw^A?,C1na;s4T&x6v^]$@O9%(iNn0L#>u-=Fn8%$t)Z$<QJ&OvDrkJbb>a03c7uQOP]'RsxS@B+w<2C"
|
||||
"$eXw,3d]'R]'^F-LvKl3WU'^#87>##;(V$#QJZ6&0;5##@%Yw2(k^#$BUW:.eAgI*074D#;9ovektS9Ce*loL*uLp.2w@P#gO:1#/s#t-AQWjLA1(?-G-ml$c#[]4bQXA#`&ID*bQs?#"
|
||||
"(LA8%]CAC#kHSP/GI0P:?fHC#4(=(,wB3r&PC:*31Nw+33Ij,WxMvuJ3)WVRh5l?-mO4Z-Nv4wgwMPT.,GY##TFk3.je'dMT,AX-<<xX-c#g*%k*f%u_I,;Q'rw^$`Pvf;E9Z.6aq#.6"
|
||||
"d*6.6Xax9.wF5s-6/XjLdX2DdG*B_8%oK^#_.kFdx-Ns->0niLBpID>e9+@nf*,s/aNP;dextBCY?:@-[x%d=<x&#_4:ww^.oQ<_G.4[^n,?2CDOUEn's[j0Kb7G`%K>G2DLKV6dl5D<"
|
||||
"-W<T'5ek#7T#=i26k/%#>Q@k(4tFA#K;gF4C'+W-`+[^Z2UkD#A.xJ1u3YD#o]d8/@jQv$0/D_&(C=m/H,Bf3Pv@+4*ZKW$RbZV-:'ihLO`6<.`6?8C&)$?\?Yo-x6KZn^43YAA,4&huG"
|
||||
"]g&i)#VWECnp@A,Be//1?`wA,4lW0R8MnA-kvjS8ln3B,mbX9CkF:@-bI`t-[I?M93+s20jbP;-3xqr$4FG>#l7Fb3js&i)I>Cv-s$gM'OcO4]O^>r%3^lSdq_adth<e##E@%%#6`gT7"
|
||||
"l1oh(KF.<$^&ACmmE<R%v-sV$95<+MKDlh':E1qLZMCsLb7cB,H]0hL6w//1g0Vk+]gK6/7rC$#0KAN93TkM(GPS8/nr@B=5bOAu&J[n[d2&Z$tCF&#b(p#$5FNP&IeJH*)?[s&N:+A["
|
||||
"HdF)</.'Z-^I-/:#@-$$xn>V#fnG688MFAu.Zo?NosS9C+Wq-$,kq0Y5rJ&vJao,;#(C7'I]>c*ed^6&Y'fJ1`=K,3cX.f$^#lP9TAu`4/I#H28)qj&s8Kf'clnP'IEPR&-<m`-LH.wI"
|
||||
"mIAou)ouN'uK,:)0h#h1JL7%#R,Gj^x44.)_xefLa#1i)D>`:%J#G:.]L3]-kDsI3d,ID*dkS9C(8_33L#v20_gB_u(%x)$>m;U)Y12mLS2sFr,bdt(LF.[B_Tr22kHe##IXI%#.^Q(#"
|
||||
"Z=sd2PC:J)KF.<$U^nVoVB:=%iZeF4uP2)3i%7V87:Y)4/D-HN<&iM'Fvnb0O)cB,4&Jw#R>iO'Q'4$6Ga7#%-DDJ:j'VhLirMP0v$C>$lD.gL*kC80AYlN9qjTn/3`($#Fg99%OT(]$"
|
||||
"K1>u%$CZV-1q//13RgIh(17I$E/<v>8QX]u.d*X8AI]v$d>f;%XtRb%]:75)Vi-]-(^&@93_V;-YG^e6J7ws-f$L-MDMYGM_0SX-(=.p.n5UQ/D/)GuI/15AV?96/3BZ=Yxo[F:HQXLs"
|
||||
"Yw2$#/h>%.HvC;?'*Zg)n.rv-dh.T%ve#`4lYWI)QNv)4%ZFW#o(p^[2I(I#-l*#7Y<2.Is;#eoQOuf[c%q=?;5T[8`6gM=>-Q2iiO2G`K[VV$7Rjl&FnfL))?[s&bvY3'CI[s$Y-oJ1"
|
||||
"E=R<_2pDs%*$[g)mBmGMN?H)47p&;Q;GB0uwRE2CsIkA#NKX_$>aKs-8(P6MjL1_%D&###aMwFrsqou5P']m,'fNn0]_OF3JIV@,M$g://]v.4i'mG*e4B>,j^Aj0<kY)4ax;9/Tn.i)"
|
||||
"RJ))3wc``3onXj1:s?^4_Bq:d$PJ@-xq=K(NljE*b<bc2(3D1;8uO]uFf<C4](e3*4`[?AuS-*3;1(p78]F.3C;TBR6%>H&Ul68%=jQK%r$'et1-;hLRZ/@#$#bIhP$+W-U9:wpx215M"
|
||||
"t'918/Tbk4tJ*B.^,QJ(29'.$Xd`#$XoI08&s9B#Lu@P#h(>(.p9_hLxT?R&=.:%/bfQv$&tc05&1=]-6C_B#6G<GdT4Nm#Dvu8.cYxi=+'a216a.c%f#ak=dbI<$RnsK)_;W.3^J)B#"
|
||||
"=;`C&I0@)KG(@$g]s9wgaGA*n2Lh'#%&>uulY@)$U:r$#7Yvh-t'YKj*$&],+3j'%j7o]4apCg%q]WF3;X^:/oNv)4QdPw-L%O;9`H[n[ww:v/,FeB,tKO@,ep3$6vqf5'nBI(R>Nuf["
|
||||
"4:#mFxCEZuG5EC=S*cB,vj%.MMJ$291i9^#q1:kFNMY>#=5^s%2H`hLf%f^$2om8.]^C8#Qnh9VLVUV$i8SC#(<0/1$J@;?p/W;-jWGouR7Fv/Pb./1<)sFr^n-q$NsLB:K(Hg)$%nhM"
|
||||
"0U.Pd/A:.$b)g;-w#Sv&R+no%:x,W%6oiu$/%@p./6tM(.@wq$tTQ^#+r0Pds@O]u@#pG&i435&<U35&Q/bT%-Duu#,.aV$6<Xq.aXa>.>c5g)NEFs-_gPS@:;xp&FI2Pd=1.AMUV7>S"
|
||||
"un$W`w5V9CQ7T&#h-7m%qnrr$>i7@%PBBN*#DRv$t0;W-wod;%m^D.3Coh8._V_Z->-w)4D.7x67gurBK[3Ib(/&,;MV0?)<-OBkvmYf>e_VX^m'1,)0D>;+1H:q#`63.5($(U1roT3<"
|
||||
"IA]C@PGd2CKoxEI.*nMjpg&%#6x5U7n+oh(qe)<-]VsR'e)ahLKZP8.$ed19p_v;-Bviu$vj4N9G'Z'?>IKC-#_@S/j;1g:?@(XS<U?a$K5>_?tor#($o@g:1gF>d_[i5r_A-$$LYu##"
|
||||
"FdS2^Crl##9H%O(J%1N(m`0i)x1tM(Zk_a4U&>;?`04]<<Lt2CP#=2C*S+RNPjo@S(9a=#95>%&g&p%#&dZ(#:efX.mqD$#*crB#AY>v,YLU8.Od5,2]AtJ:cT3T@D&Du$@]WF3cb(f)"
|
||||
"0Zc8/xS#8RJ40:95nkp%;Omb>igZKN>P9L(44'k1K_K6MYsslW)aog(:_i[,p)IG=X13G`O39Z70$Qn&D.4x71Y=)-G@-u6KU4x-aSDe$)D([,.rbi(jEelL+iZY#kSuIU^CMc`j*io."
|
||||
".Y=W.9offL&(tu5kiE.3[Z*G4AMbI)#R6.Mp?Uv-&cUNtQ/TP/>;gF4See@#v2=v#RD.l'ncgQK=SHt7prgf)3lW`uE=AX#TVGe)B[0DLu33G`))[#8xf8qJSKOW',rKJ)=CEL#FRGE7"
|
||||
"tql?,Du5]MwY1f+TRQ##XmWF.4MG##Z.n#nW(hh&fK8<-]Cex-Ap/kLfQAa+pNq12nS.d)a5eD*jE7f3EsmC#2RQv$KVM_&:OQ^+IL>n0/[?U&FF76/5vai26bZIMaWPv.5Kuw'#h^>$"
|
||||
"jP$ND.cTs9FnNp1ZN%q/7kgv7[RiXu>['jC<;v<-OH(5'YsrQN,GkWSF&oO(:76g).CwX-DrS9CYI[i.51Gou46E/%<gOSc'cWj&%ZI*-PX=F3>GVD3<Qwb4-Pu>Cnn(ju%'DC8oA5>d"
|
||||
"Kn6mA^I6Z$(rQ-HmA4K3,0fX-H_$gL*]d8/sRh`.N-v7$hXWY$+w<2C)+r772=hf)qx8;-UsgY>FPaJ2tKZt.'fNn0=R(f)YsHd)7>1p$V>%&4&=(u(7_Aj0Y$n;'&QVA.OGg+4GF[?\?"
|
||||
"]g8P133'#*)LwLM@/2&74jj6/id1*3URQ;-8khh;$p8?,%>2e;pFNPM&+*#7;Lo0:X(Z<-8,pL:8PQv$2+:wg%&>s6t++E*$C;W-NZAX-ia&;QK=S?SF5nNSkko@SbCNJMYI(q7.uR_8"
|
||||
"`4`v#(iNn0)+niM^uQ2MgN&;Qi2_$9,lO]uKmWnLQE%q&=M.>>6oA9=AZ$B=`82t.$5K+*X:Ls-4h&K1`1[s$q[2Q/$8^F*rHNh#S5WF3NP,G4hO=j1HZU&$ZktD#5>PjL=`n]4pqi?#"
|
||||
"H&,J*/]&E#AIwZ&#s<h<PaM4'*4$O(FEPN'm4#(+:LL;&E9gq%/i1E4>E(1;>'SD*kZdh2`Dxu,mpP3',XTE#8O*t$5`tFb2_Nv#nI3p%YPw)*k9ob%$XA=1ruVs%a7kI)@=.<$kGiE#"
|
||||
"N4GD4RSE**[haR8;0h:%71#m'N1gT&f;m7&Ze7W$TmLg(ZHj@&W+2?#Mp:4'M9=x#%Sdi&ZFNP&DTo&Cft9B#jPD<%TbsJ1'<1^#_<m=Ga:)I#h_/rB.xCT.dC)I#Ulu8.3.`$#v_B^#"
|
||||
";r_':cKQYS,v:T/(N#,28YR]4He,87UH^#.f1))5EK[L2%f8q/Z)l>-:CHc*qsJ<-hHFg$?:fpg2-RAOi-5.Vx^WR%.eY9C%mD('cFM<-;^TV-<KtglJFlW?62vG*&)t.dDjZ-d<pW,M"
|
||||
"jcNK:SK4Au9^)t-=1.AM2k^KOVj*J-hVOJ-S@jM'''lA#&K-Z$3.5F%F9OW-n=.`&i<F]uSwY<-Ot/gL3S$m8N(:7'^CPV-XK+n,gBFt$)lNn0k?8m85dTN(]SWF3]+:]?q0PCHuG^[#"
|
||||
"Tvgf)QQR@,ZD;;?g$a?u3*&v5P]sD3U%-w)tWS@#@nh(*iip[krQSQ,VHf;-Dwd]/k(@D3LXDT+['uJ1.;Rv$BxF)4TMrB#`i.@'3)4I)5Djc)4gE.3jLBk$dGG)4[V)60B>'i)56tB,"
|
||||
"M(w'&xOO]uW?DX-2'B(&-C$_#wkjf)-pQ@,2W>W-u/KF%3.(B#j_n.M8=kf-XLL-Q%]L-QbiT-Q8n@.*u^Op.jAqB#aU%LGDF,gL>fxd;]Fl)4fc5bsDdQ]/$'Cn)'<)iHRp)IHIgdsL"
|
||||
"T;I]MOjNg=aupbu,6^gL5D6wJ>%r;-Jr+G-Lq;Y0`qIJ1tveF4Y0%.MiMC:%HeolWDgC5/^%AluJ<cwLI[qI=j@[#6$,vx=Fh6gLY&_mA2VLv%*<x9._HF:.>T&;Q7CNEdqDDe#b?^6$"
|
||||
"w71Pd(l*3ia0E$#JepeF9HAX-*V3D#?Kaa4o4P;-uYZ9Cj)?2COqf5/ZQdduCLk%Mew%bO>x2$#u'B?.CfP##$#d;-=5ZX$[aoI*]kbF3]%p-)F53.)62m'=WlK#$U=#-ML(i%MOA#I#"
|
||||
"nPj#$A4f:d&?-9.;M7%#o&U'#,]ZZ-^L)$#<Z[0)lw6u6J]B.*-<Tv-*Lj?#f1ie3CmQv$^^D.3k=8C#tBo8%gYiM1'cl>du@cI3,o(NE#Po'&^)T1Mf;*i29Q4;7c'(E#ANp;-PwNn/"
|
||||
"MgAa5balSVO>.Q/P0_C6AWae36C(C&G/5###oKB#,DF&#'EEjL?YqU%Y]J3%;cLs-aSV)3ig'u$?S<+3FLRLMIU8f3w<7f3owsM0`0S(6]u&)GiLY<Bm@j;7c4.1MqeP;-*[9%6wP%a6"
|
||||
"3::e)[*%u67N[v.(q3HMikT]82^03(9W?K%Q93-v7*7g).$$E3m>sI3NY&E#Z%#Gr1qD)Wv^m).Hx&;%Nx<2CFm70C?\?1(q2:d*7#Xc2:Ti>g)6sLlMl0.q$e6AwY2^P[PAa;;?enPE>"
|
||||
"(cS,&01em8Q``'8(8F`S<3KV;0M<dteWj$#OdS2^B=qp7p-m<.3,Jd)]_G)4_V8f37'Hd2Frj2RMR7m'nOgIhWwZ>#S)oShe#s%gvs4/C:12,2>Bfq1%%).M%DYcMWg;;?[75;-CdU&,"
|
||||
",h:_A2bAW-HXKZf?dnO(/,-J*AeL`$/DZ;$x,rFrXkuT:X^d4C`,LEdTCYG,qA6FS2=hf)qq[d#Gi<?8jPC*6Z[?##;(V$#PDQ6&5a_m/X36H3VF3]-`(`5/$tn=GUM6qL=LL?d,:-$$"
|
||||
"&.kFd>VAt9<NN)#'/###h=PxtIMMJ(.`JV6+522'PUX[7T=(/)F?r`$l]B.*1Wj;%I/X'%SSK5Bm;pY(uf]Y,LVZ9/eIfm0+LTfLvO5J*2u%T.jAqB#1Il805cVQ&q>6R&e^B<B0N&;Q"
|
||||
":s,W-/Snx'@^s'+^I%s$sMA@,g7,_+Br$W$+'&gL6hM@,b.$$J@%uAB_m$%'N3c%'Z:U>,jvOA#b`vn&JCf*)R)cB,]7s^oQ>uu#eBF&#Od0'#oLXs50>cQ1=G5##=Z[0)okY)4:Z]F4"
|
||||
"(cK+*x_OcM&t'E#x.<9/8C)X-fpPA[Rp7jL&c6lL#0E.35MI[')J+gL2a+c43Fa$72r.DC*Pr+M>Up_4X(';S+RM@,FQTA#&$_f+Q6@iL^^Q-3cF@q%J(oQ-5W:V%sa;e33a_`5a<=DC"
|
||||
"tT3>dE-lV$8wMfW*+n@,OuH6S'8_],G(hKMb#<e3Z],@#.TW'8kT6%-3gc40udp(PAR&##%)###QwqjtEUai0*jTS%.E-x%)iNn0mf4K0K_`8.>;gF4`m]Ku[+'b?fo+G4X_giBJ[lS/"
|
||||
"ctMm'P[cQsYx6W-VU>qrSK;^#X]J$pm2>w&]3FX$jt$A,bs(k'.e3.NO6Q$,UG(.3AV)d*m0V@,kY[-).UwHN<CUf)-_`3t0<R($@uvE2,W(v#8=nS%-bi[,;uL;$``F'oS#Gd3=F=gL"
|
||||
"2%52(8UYgLL8,LN5`SP':,:W-6wpgucHh@.Jn@X-sBj;-9a^s$J)Z20$#bIhFH*;Qu5p'&FKEx'00O$MGoU3C37PF%MSl##./Sj0Z42G`5FNP&M,@D*fh18.(N#,252Tm(u4eW.D[Zc*"
|
||||
"j,Qn&9SG##@Q@k(#dCp.pN7g)Mkgb&T)cB,@qa>d$jV=YDmZW-?kWX1RLg+uKI%>Qx$EM-+61d/IIvu#3wFQ#K%9g1oqP;-K#adun,f%ut1c98B[X&#-,K9iW*+T.ElY##>]&(10ImO("
|
||||
"ij@+4auRv$#@F,4Mk5.I=Jr@Cn=#AdU_iM=M&CJ#':Po(P1T9ChDUO&9&:Xo)sLh$+6)Z-hfDu$kDjB#'1Lc5wo&vHYA,C8v4(_5-+7f=-YV(ZW4a?>^qD<%=5gF4c<lA><J<?Q<.R?S"
|
||||
"%-/Q#@<^;-WiE30g.(bH/Dv+Kj/w-$br^+>?1DR<RA?fX39MhLO:pk2]BF:.&cGg)m`0i)2^X2COZo6<rOt:C(23qL;A]/0pSaIhFY?DCP5T;->$u$%&WO;-BjTP&B[RS%RmrZ#(iNn0"
|
||||
"q3P,MRT8f3Y8mA#r8oQWXg^R/eJ0Pd#gL*6p)M*MM4N*MZNt1'-2O$Mq&T9C[PbIh3^Ps-L5k+MHH6uulhP;-`U18.>gQ#-%ua-?=7H,*jPe)*ow3c%=CAC#DOi8.'U&@#J29f30d%H)"
|
||||
"*t%s--sxs$7)(=6@rFq&6l<d;2d8T#eGv+RrkU/$NYwi>pUHh,^26O07+20C1#kjLC^GrHoV_'R;FG&#,0,t-#L$iL<N]L(LeCH-#7w&/C7r?#41X<8W<orsneKD?A<B30+-2QC)Aa%$"
|
||||
"St005lZxF-MaI6K6?TrJV<2.I#S.3VB8xiL7Tn##a^''#I`gT7IS($-cEk9%*oNn0>0;hLs,Jd))afF4EZ$@'vKCo0o+`^#D.Cv$X>a(66hQ;-XV>=lFcof)f$Y=Yo8Yg$LiY,Kh=+9/"
|
||||
"DX=r/e0P[$snP;-f.vS%mH-Zt<E&;QK.xH,.n4&7tS2q/c=-a5)[Is&A/#2C'7O2CI+M3M_uT2^SJx/&>ImO(.@cS#GJ(p#Enk$/uw(##TQj-$cehZfWq;?#UZZ;?n_oF.Roqr$W`qP8"
|
||||
"Q@dV[Q]Th#2B0[M^eDJ'$Gb;?pFqB#W@.@#$'CJ#HSGJ?e]O&#b=Pk%Wg@?$*;YY#S1U;0e%l0M+b;;?Vs9:2rvKLNOUZ##EtTs'1-;hL6aA@#`r(kkv9L(ARc`:2mLm]ODknO($o%2'"
|
||||
";6jl?&G4Aucr?T-d$EE%4ctM(Ev>X$;FV@.PV?B=b/'Z-cpfZ0]Xj=.1(^S#FBlo>q/#+%/6B2#T++,MkeP;-:ar;?EdkfGUJK_%/XSHc91lQMS'wIU@WK`apr.;6;hV/2;s,t$w]B.*"
|
||||
"]-'u$Un0a#Mq?jBP2QK)4(7]6gH7lL$KMG)sN_hLREfX-u3YD#aUp+M=)/)*HH3$6puxl1ULY>#=<a*cOrcB,$_I70_2n+6$N&+QOg?O$Tt5;dKJDW-8biV-=xG>,jBhb=>?l132=hf)"
|
||||
"'RMx(q@K60,YpBX;s13aJ:?>#gxqs--d0)<J#tY-CgrA#/a3b$M6Ts-?\?<jLP.1Z-OYC]&6_Aj0(_JJ.oNv)4V%%aED-PEt?JxCu?W;3CetKJ)s>W]$h)*e)adwKP$.5nWHgsKPm7m=G"
|
||||
"sOY-QUt'3$AB(7#,Fil%BY6W-j9uBA#f+D#0sqYXG-Xpf%SN/Tc#Pv7CU`UI%k9xLI%###wF5s-e/O$MrQrhLhn(-M3uID*ov@+4Nf,lL$k3Q/UP5W-jkx<(v:+5A7uMvL/xocMa:2G`"
|
||||
"-DR'OK?CU9o][A,%fQ2(4b/O(0Zc8/HjE.3%q]8%MM?O(3dO;-SuMD?=[o[u.26(&io3=?N_W;-=KeA?:3js%#5L^uLJ76/%3uM'OKIIMBt;fUld%_]U8JwB8@bqg?4aY$+%^=7Kwr?#"
|
||||
"0S<+3MPsD#+IA8%J#ID*,+:^#Ka`6N_j5D#PRC16bR2o.W;LpA&H$9%KlKAt%1@A,+lbOoi0%f3hgv;Hq9<Cm+90)*X*3&6q/Qn.XLi5B'EqS%I>XDs#)LA,/0_LpO6*f3W4OrLMhgKm"
|
||||
"/2`$#>@<9..Sl##/It/1jH3Q/fU:8.&N1Dd/NYS._J@5$Ii5<-+2)2'$RCG)lNEM0%'%<&A+Cf)EcG##+crB#%1]5/?29f3^*6,MgTdP.e4B>,7u>X(>&<+3G@oT%5H8f3k?jv6,:tG+"
|
||||
"o;An1//DH?Rk)d#S>1?dn3A+`O#N$.+4J30c#HMXRpRQ0`o=8CQr,[H7uw97%3)6:wAi$>'vus-fR(dOg.:a<mUve43w?AOMgSV6`xn<:](&8q9F7.uASS;-W<ZGRJnu?CPn+2=[KA(H"
|
||||
"2lMY$>tqFrSO9MB:s79&b7m3'h`)fO=2:Z-F9B+%RS/H2oW&B)%RM1)6kjNL]PMP0^SY%&dfv1'GZWCj$kuY>fx;[$Hm$)*L4:$)G.Vv#n6+T.-E?A4)T9s$4fMB#?3Gg19[oC#^RS[u"
|
||||
"4rpl/Zw2mQi;8/(LrsGhfhQ;-D7_J#11F7)tZp(fW?A3g2IK9JCao3%C;Dk#ID(7#UEaP]&(;]/2[9&$,CTm/_R(f).73Q/W:`e$@DUv-?]d8/[Xxw#iN%;Q2=hf)t_6$6[1+51[(J80"
|
||||
"lL&s$X#c]#bcHs-I;:-<h)r50F@dY,q@M<-j6We$Z,g;-6-0b%NRg(Q%G%C#Jr0[%-'k=GYS`m$Ygh>-(7,h%6ImO(4`%b/XRG)4:AK?dU]Op@P@Wt(29:N0XDF&#D-4&#@Y:l95Y^-6"
|
||||
".p[D*MkJv$&O(02qNh'HVIR8/OM>c4o6T9Ci#:9AM68p3/bc;/wwpouVuP$7U2t(G<h4(-91`'Rlg22D(q5(-t:'`QM7`P=+WvNFLNPN09@%%#Q,Gj^..GgL?7^J1<5'eZ1Ar`FXq*,4"
|
||||
"IjTv-`aoI*?/=>d$tn=GR)Bq%.sV=Yp/R['?T3>dw]I7nr2</&fdc;d+J*F@-__$Bpi5<-92SB.;%'h(]:nW-vP8-u>)0i)<W9.$nj@e#RS`du%k=DC$fB^#QgINMEaIa$J),##^9)8$"
|
||||
"U<_+mic.)*W+]]4[*QZ%JRo8%Tc:Z#Ei?<.V,ZA#]%-29Es.[53B'EY3d$=/Xac_=V8w@HP/,j':Vh3?;a5WRYG4=CG_(T:IZ1aue)q%[6k:d2+5t9Dwfx9D1[sr$N.2KEKPB.*[hi?#"
|
||||
"#,NF357[x6[bZN))c7C#S'Ig)dk=X(pu8f31m@d)nSID*-%1N(5Llj1(7U`>#f[w#*CAu$l%W4'AWio0lV?;%*HW8$rN$ENF%mW-1h;N,fW2^#Soq68;vv$v`=At#a(U'#fdS2^7XW$#"
|
||||
";Z[0)1RL9Mc%g<$D.Y)4#,]]4(R7f3_Jp5AYFn8%CP,G4L#G:.l@h&6]?wG*^Tbp%Pp$[-YJ.d)@LR8%gTl&>bdh:%Zj::86k@e#S0P%?ZhN_,$(Q,*@:Z(+ZhEC,U;rG)cxN**5'A*+"
|
||||
"ZfrL1G9=:8ej_<9w5-%-H?[i96V22'dA4P;Ar3X.oCt$%4dChN,ZGg1AG+jLs:Rv$0DHb%/W8f3w<uD#.B8$&wLU*N`$o>QO(g^$/N]O(*X/A,7PGk<Lw(A5IrdM=&Qg1:>l*B,91Jh_"
|
||||
"1rtA#n-[F69bi=-)Y8#%%9ve<EHDr&YoBj2-BHM;`ATcGLVA>,mE&#*;a%=d]d`oA&a:%I-rY<-YwhQ8mAT;.>v:Q/xrZ&4nQXA#mJvJ1'LA8%55%&4iCAC#o4/B7@N<$6GM1Ddh10H["
|
||||
"&..Pd1MBDXp&r3C*cF1$:40@-C3A/2e:88SWq,IfiBj*%Isn<a<BsYad+m8])0KfL2=LP8ew^#$J$ok9NHSj0`N<P(p@7<.vu/+*T5Du$IU13(8E%8W;]dIh4hC#K+.VU?.MU7XtuW;-"
|
||||
"9id;@U&@#MDvEW#:,Wl=wC*-?7huM(.1wX-MxG>#Ak<PXnK[h#OUvcMK''P#vUJM&#ITa+:.OF3)DYo.ZcRUdb*(m8cKW9`%0S;-[PE`N<dic)Dqa?#aZ'r.gUMW-<SEL5:)ap^]q)$#"
|
||||
"6o/k$/k#R&Xw[J1@SW@$.kE:.K?#<.BRKfLIVOjLrND-*ThWO#leFHdT+U#X7uj>dodG%I9mqlKtE`?W(H0IV0:(Lf+hB'IWR#S&#C(,)b[18.%'%<&5ckI)A]G##=Z[0)<L:_ALR^fL"
|
||||
"fEPA#d?8d3W6[UT..;3a27wBC(DeLJ(8;=C7@Ga[$Cw:0Gu8Z$&feCa2*n_VTF^*nL'sGCo^5`HJ-(k&9D@j0SEaP]ckIJ1M]J,3x/_5/9`p>,VCs?>/>uo1NXFb329$C#mS=`uM*cB,"
|
||||
"oWG80=W3$6DC5-2hX6#6lrfs)n$wBt[_:$624L^#XX=)#o_d;-L=2e$'a8>,PkVT+BSYY#39Ks-5seC>h/>)47?v20BsZ&4vBo8%6VA1;`I,;Q'_>]u.ob318q.PdYkZ:([v'k#Ohv1'"
|
||||
"Fd<U)8:@5/U'xU.c_$<SHQ6=&&'grKV$WZ#fS6g3BgdC#D,_^usT6^gWNGFdt=(nu?+hOdteMGZh$,qKfW/%#/S2I.ZXM?#*gJD#6hX=$kpB:%X:Ls-i.<9/g]7Y.c;R)*qO`S%FpD9)"
|
||||
"kmTM')>wY7el.[7?R:F#C(ZCj^0v.3r^>r%xkkf,8>b:=AW[128wZ7-eaCo@OWe>^DKd#-sOQ-H7q/W-,hrR8[,lA#G[+Y$)?PF%Q0'#A[/_#$0CpFCUxT<hh&eA#(JU5'$fTB#agfI*"
|
||||
"66;hLQm`a4=dT3C_Z3>dg2N#$Df(T.3tuFrpD5T'd:35&CEcf(%'%<&[WpQ&Nhi2M@mnO(cFGH3L#G:.#&%Q/1r7DCUeRUdRY0[K20Biu`4+Aux$jrF;,$eko_g1<++pE@#DSq;;S?>d"
|
||||
"DA-D-FdC>8lpBmVREIU7IKh;I@^2<%-xNn0,Mp+'$,-J*)vsI3>I9]$,'30;PcD218NY7I_iq&5(p(;QX4;f$00O$M$R>L8k-=2C:L3>dw8_+$R8La<6w9B#r]i,)Lx$m/:j8>CZkTIC"
|
||||
"o:gV-ks*6L5[.Pdo_A8#.+SaExR?T.jd0'#4pm(#T%T*#(pkn8bVTf3w4eW.6itI)KF.<$/(On0xJ0s$-Q'<-)noH;HBIT*#7=.-F3OZ0O)cB,VR,W-lS#+%)[txW+=2.Itn@&FBD4Au"
|
||||
"qCxfM@fP;-tNpA,tC`e$$jE_&uh1vH?JreMiMrtOo3NK:Som_#XDF&#E@%%#S,Gj^pVr0(.j^s$uS52=34pL($A(s-R&SF4#':Z'WO2?u^GwM0GbN?k(C.>6:0niLPJ=jLiK/[#oxBI;"
|
||||
"9rS,3:wd3`g-I##BdS2^4D>##9H%O(03HA47FUhL&5oC#D6&tu&VZTIcm'^uY+'U#3CU9'Gs0&=S8-?\?1435&[,mQWh0bT%bvD#$@@.H3Q7qo.GXuS/L-YG%<j5/1wBw]-LW1F%a,bfu"
|
||||
"jn4[$rRcIhWQO>d:ThxM>rmh'*,pu,%'%<&eWAW-]VT49m:ge?M$nDNLt2.(Aa2.IRjjrq@)#)>/Gj.(Vf9vHuDPn*w9m1<BC$_#>[u##EdS2^wVvw$t4e;%VRG)48'lA#DX_a4%#q3C"
|
||||
"]DwFrwxxa#_Em=G8PL6MLnx,VR#O=(F`Aq^c93$#IL7%#`bkh(Z`#&)&*nD3BnPu%F*kp%^/p5S'9]9:KO1/1U)6<-+].:.tW`-#6,NH2KEaP]_kIJ1@16g)w*gm0dG`9&wgx9..FE:."
|
||||
"_r0%6kUlf)L6#53kw*B0_CQ;-NKxCug1uV$T$n#6PEpOMB[vY#'`87.qjQiLX5P=$Tr[fL<knO(W=K,3he9:@bb5g)-24m$=FS_#MGY2CZ.15A,m7I,Vqd[,;O&7/=,xr6Vs$21QMp=G"
|
||||
"(6B]uOTM@,d*,5T$v`K(tj;TD38t9D/9s9D,D5;-OG[#-.Y]fLB?@A4;'PA#YiWI)N_h&]cZs?#)CuM(xQ:a#2aTb%@rJ>(%seh(5qUJ)v>^c30C%X-cl^',K<Y`uak@e#8Z;v#Qts3T"
|
||||
"aCOC,/U]w:sH&;Q+^>[J6_r=G:1PG-[Hof$9REM0`:t;.2VJfLG7SX-1(:+*]R?tJec]+4wVp.*4+h$[N_j=.(0rC$G,^w6%4^S#QFD.*[h3LDVCi2Rva)re&YiPZSMuFrt^#l'**Lq%"
|
||||
"S>4G`HYET%41*I-1O/72D1IE5704mQ-Xuw#@awX)0@lm'L?^<8mIgZf^gO9%)O$]%I>mA#2K4L#5m;;?[iZ=YBul=G$jV=YA<pHS,S`du%8V9CsdVU%OYl;-jf[m-XaI_8l]B.*.eBN0"
|
||||
"oPVD3;S<+3*akBO<5:Z-tUXEeq645Cu3`19'gM*6o(PP0F7I20%RM1)UZC80bmOh#]PbIhL?R@,`f*5AIuN#-U=*OWaEj$#Xq$*..C(-M]-'CO3@Bj0LNv)4]MUM73vOG=6UfM=`ZW>C"
|
||||
"$ed19avj=GAWD80$tn=G`9#j=w[)_f-u13Vm^3$#^Kb&#B`gT7?v+B,^wnW$*oNn0]K)%%Zd*P(d+8`&3,7`&5ptNFd/<-&vX0^#0W5W-6q3+%TEKNrWtvYuT(;?#HYYF%mZ&ZulT7U."
|
||||
"a0j=GTu_H-'NA[9j=%a+0QSn0ji),)$S'41TH8&,2xg%%_c^-Q2i:8.AKwUMe8nqMST3F.?FYI)Q#P)4XIVp.`8i;dd*3I$PUSCMbV0K-Ag=,/xZ6/&n=ge$f>s-&/>i,MfER$&V)f;d"
|
||||
"'41@'_imp%Pcd/:q;h^#87>##9hVr7Fa,[-njTq%-M:;$eN;hLq[3r725Ld4ukP;-n-cp0,s$&4oLc'&*rB^#?PH$8^+Na,AX,hL(-[pgPGE,#PSuD%`=K,39sZ]4]52T/&@Rq$rUFb3"
|
||||
",asFr<o.qL0whf)a$M@,cBYG,2>bduvuMvLjmS@#+.,59+SJ=%dhLS._,$h.^LVZ#)lNn0-%.+5V`v[-kT&],Enn8%O=Y)4wHuD#v.<9/tgOU%U`G>#'6h/N7l5/1PcvsK*=4s-hN<r7"
|
||||
"'1Xg*L]rP0UXtUI7`d4Cd>O'gL/m/C2$).P`YP/CTCRr8RMB58uVZ?\?Mn78%:CRS%366Q8]`O_J>,guC(pH@9SZK<-Oe/;%>H&7WT4T&#HYTd'&fB9rp`UWf<;DD3/?ID*;^9Z-f(]]4"
|
||||
"s@&d)hJu-$6LhF=V765/.?Gu>V465/F`R9C-1niLpXn'=D(`4)-U%Zu33GouI(*kNmv2*M$tv##'X6iL%pO.)jH_Lj+wn5/Ak3Q/`W]I*=sG,*Z96a3mtIpYRxed]@86M?DrZ4:Tw/I4"
|
||||
"(cKs$l=i@@=R[euf5*523C)-::KF&#qt)W-1;b9D5DPV-T9om,NcYY#TCTfL<,OF3*wRa$)+&s$rTZd3b@u)4+Rw.:XJa`#0LQ3B9978R9j._u?5?,,,i:8..pK+`Y+Xj$::h0,CjTJD"
|
||||
"P*U@k$1P]>;>WJ2Gk<MuPQvt$N&###8&M/(N+FD*pk8K1;F9a#AM>Z,r2Gg1Y5#kkf^#;/+gOxtq6:].3fWiCR;dc.J>V@uP<[:t9KCR#Gv8h=Ed[x+:[K#Qw3l-,SUY$dp2QD-*/Zp%"
|
||||
"7L[Q''fNn0RsMhL(mUD34WFL#jL3]-``1I3(Ci;nJj+ru$,_^u=W/+%JTW;-9Ib2C(q0Pd[Ln;-`b(g@`CrT/am45&O[l^,tGn,Z.s_A*[L2*m%],G4$L[+4p/0i)NIHg))wZ)4Gt%s-"
|
||||
"*^JW$<Utn%V:.%@J@?Yc,RhVD;>tK(m-2hPZwO3C#-grec;uC$K8wp@aST/D420kL2Hf'R/ogJ*v:P^?f,Q_/P%5p@Qk(T/uxmQWl/]VW,c5g)QO*e.k*_^uV9RH.jZA>#ma;C#aOk9&"
|
||||
"I5ts'alVP&/.=X(,3cv*0NcT.m=V0$V_`=-Wwnf$P####'>uu#4#Z3#v6QtLUOvu#AbW3M1ilS.&?F&#D+2t-[.JfLf:qV-6680-XEM_&5xkA#R&+>.F.$##ejZF%Bk60Hi^u-$&m_#C"
|
||||
"NpaR3U)'#_rvg=MHu)?7]f`;Y8NkfMB8O?R4IsJ%JImQWHqPF%5lQ78Kqe`];>%RP@q44N$en]-3I^l4[1ivPx:K-MF1:x&mp`gL)7GcMZaA%#r&3aaaBV,#4e53#wDmV#*OGF#fejL#"
|
||||
"Q$bT#*1rZ#,8W`#/B=e#0@gi#5Iuu#JBr($iT<5$&IR<$ULaH$jx%T$Vl;[$uAXa$Lvc3%R)=&%*TT:%tJ%H%bCUn%Qj,V%+XAa%+%wg%8/]l%<<Bq%qrp#&HjuJ&8B[<&Bc9F&bGgQ&"
|
||||
"VZ3X&('i_&H#dn&KLSx&]ieH'NXD<'ZogB'K*<h'/?(Z')1j`'l)p.(qY,r',Knw'XP[D(,6*5(fW_;(5n+B(D9_N(:&tX(S*a))vB$k(Jo>v(>+^2)([g^)VflN)@+'#*l*qf)5@=m)"
|
||||
"B7B>*$h)-*d235*[:B>*q^vG*Wv#c*i62<+efC,+8cl3+(FD<+=u_G+uFNT+XExX+Z_p^+e(%d+hp;h+um9n+Lxsx+A3?,,9Ss5,wv%A,N$4M,[rds,meEa,PaBj,h4<9-ObL,-csjA-"
|
||||
")#NL-N^'R-uibY-T#-g-dfv4.oKp#.RTT+.pd(S.h.QG.f(Wl.o>D[.#//e..qL4/rmj&/;fDL/e>V</6]2L/Ys(W/L$9^/M48.0'W7t/RMgF0/#####YlS.oC+.#2M#<-MeR+%h)'##"
|
||||
"&/YaE0]Wh#WtLrZ[dM_&dQd(N/(1B#SdrIh01L^#iq<on1:h#$-MWY52C-?$KTfuG3LHZ$##QiT:$Ew$G%w@b'5>>#]F[0>M3o-$.(1B#L[+Vd<UL^#aYkCj1:h#$]xR.q2C-?$@fEPA"
|
||||
"3LHZ$i=w1K><jw$:n>YY.JCYG?mv1BujNe$#t7;-T<XoIu5Ad<FKWf:D49?-6J,AF8k)F.D/Wq)&APcDU^UJDk$cP9GWMDF;F5F%uuo+D#ql>-]tn92gdMk++I2GDYo'?H#-QY5+v4L#"
|
||||
"[Z'x0_6qw0>j^uG9T9X1lrIk4+-E/#:,BP8&dCEHp4`PB;^5o1a:XG<2/_oDCt7FHbmndFgkqdF-4%F-)G@@-G3FGH,C%12AMM=-H1F7/Y1Vq1CTnrL'Ch*#D):@/5d:J:<N7rL9et3N"
|
||||
"5Y>W-xrv9)iaV-#Cv#O-iBGO-aqdT-$GqS-'?Z-.;9^kLJ*xU.,3h'#WG5s-^2TkLcU$lLp6mp3Ai0JF7DmlE>FK@-1CUO1?6[L28V7ZQpRC`Nn4$##+0A'.6sarLNf=rL]3oiLPVZ-N"
|
||||
">2oiL?Z/eG38vLF%fCkL-:Mt-0aErLc_4rL0)Uk.,gpKF,r0o-T?*1#u<*1#rENvPWpT(MT)rR#(AcY#,VC;$0o$s$41[S%8I<5&tU^l8Ym@M9^/x.:$sul&@$TM'D<5/(HTlf(LmLG)"
|
||||
"P/.)*TGe`*X`EA+]x&#,a:^Y,eR>;-ikur-m-VS.qE75/u^nl/#wNM0'90/1+Qgf1/jGG23,))37D``3;]@A4?uwx4C7XY5GO9;6Khpr6O*QS7SB258WZil8[sIM9`5+/:dMbf:hfBG;"
|
||||
"l($)<p@Z`<tX;A=xqrx=&4SY>*L4;?.ekr?2'LS@6?-5A:WdlA>pDMBB2&/CFJ]fCJc=GDN%u(ER=U`EVU6AFZnmxF_0NYGcH/;HgafrHk#GSIo;(5JsS_lJwl?MK%/w.L)GWfL-`8GM"
|
||||
"1xo(N5:P`N9R1AO=khxOA-IYPEE*;QI^arQMvASRQ8#5SUPYlSYi:MT^+r.UbCRfUf[3GVjtj(Wn6K`WrN,AXvgcxXot*GV&6`uY*N@VZ.gw7[2)Xo[6A9P]:Yp1^>rPi^B42J_FLi+`"
|
||||
"JeIc`N'+DaR?b%bVWB]bZp#>c_2ZuccJ;Vdgcr7ek%Soeo=4PfsUk1gwnKig%1-Jh)Id+i-bDciu&FS()Foc2cblh25Lx_#f/mc2k0.+49eF`#j;mc2sTEC5eh#e#?inc2t/-4Ci*He#"
|
||||
"D(4)3dhuh26Ox_#h82)3l67+4:hF`#lD2)3tZNC5fk#e#Ar3)3u564Cj-He#F1OD3en(i27Rx_#jAMD3m<@+4;kF`#nMMD3uaWC5gn#e#C%OD3v;?4Ck0He#H:k`3ft1i28Ux_#lJi`3"
|
||||
"nBI+4<nF`#pVi`3vgaC5hq#e#E.k`3wAH4Cl3He#JC0&4g$;i29Xx_#nS.&4oHR+4=qF`#r`.&4wmjC5it#e#G70&4xGQ4Cm6He#LLKA4h*Di2:[x_#p]IA4pN[+4>tF`#tiIA4xssC5"
|
||||
"jw#e#I@KA4#NZ4Cn9He#NUg]4i0Mi2;_x_#rfe]4qTe+4?wF`#vre]4#$'D5k$$e#KIg]4$Td4Co<He#P_,#5j6Vi2<bx_#to*#5rZn+4@$G`#x%+#5$*0D5l'$e#MR,#5%Zm4Cp?He#"
|
||||
"RhG>5k<`i2=ex_#vxE>5saw+4A'G`#$/F>5%09D5m*$e#O[G>5&av4CqBHe#&'32B=.wm2f2$`#q712BER804jJH`#uC12BMwOH5?N%e#Jq22BNQ79CDmRe#p7LMB@=E33h;-`#tCLMB"
|
||||
"Hb]K4lSQ`#xOLMBx;D<BAW.e#M'NMBQa[TCEpRe#r@hiBACN33i>-`#vLhiBIhfK4mVQ`#$YhiB#BM<BBZ.e#O0jiBRgeTCFsRe#tI-/CBIW33jA-`#xU-/CJnoK4nYQ`#&c-/C$HV<B"
|
||||
"C^.e#Q9//CSmnTC$),##$)>>#hda1#mPh5#vTg5#pHf^?ht^6_#2S4;2ZR%@&g6c+aq-vA4rkL>S=*p.F.s##GM.tB:oHY-N]IV?:K=?.Ao.R<ZjfsAD0-Q#+^+pAj9Hm#IVoE-@/c[["
|
||||
"ZTC>]DlGQ8d*RH=q1a;.B'hI?\?C-i<8F4g7ioQV[b+MT..lbD-Lx'<.m7T)0KNI@'F]+Z2.HZV[#9U<.WKXD-1*6EO`ZwG&Y_bpLx;4/MAbl,M[kQ1MW6ErAQ.r`?IO,Q#$1_A.'$VC?"
|
||||
"i6oS1#Yp?-=$)N$hpjHQ<E[g<T=e8.?Cn8.$<*+09MglA13P/11>;E/_UOj$lM5/Mis]Z0'f:Z[$tOZ[IVxiLkEBB-0_3uL8;5Z2)[S4=Gs2f+3QUD?=5Ok+1KtC?Nx%a+t9_eH7TDj$"
|
||||
"Jk2Q8XO`Y#_0>?84I1gLq.h88mTg5#EmM^[I@'_[0c._J*'#N04El/18x7F/8o99_b`qpL7]2..KU=5Ma1tv8%N+X%jv>Q&C8H<8ng,ND,K#01`SY<-o*t^-TM@tLL_K?pewI59RNSE-"
|
||||
"7lS?-H-^V[uL+Z2@vv>-qZXv7rR)W[%)^5Bp&aE-$44^-Z,g34B3lV7G),^O[^>01hM8;]+o>290h';.>X&[-:jL01tQ5293Y)w8;pU01Z,[?-C3aQ8oaT`<*#DT.=<Z][6uY<-%sY<-"
|
||||
"7.;t-=*.hLR_vNB0G/?-C[SiB61BQ/0HesAN)NE-Gxf884cpA(Gs'D?,IAw8_,tD'QN1W1]^W0;l6Ne=Nr.a+SX`=-d[Y=6i)q5##a0D?6avQ8#rD?8h%wZ?sF:Z[>cMv[,>^;-0`uS."
|
||||
"d>N:.fIY`1)d7Q#xiD^[oV(HOtxa*I_P_;.oYs_&XZ*.-Wdi^#iB;a'J8voL,v&nLXJ4tAm`/aYx*RV[A)eU%Z:)##N`DZ[nih5#lLM>#`0>?8@8.11,L`Y#qmQ][c<9B-GbE9.C[<9."
|
||||
"wh;?8Ou*[K08o0(2xL$#=;B%BnYAj07v7b+'#vW[h6mh/?BtW[m26Q#<)d,*1=(,M;PM11c.5F%<b/t[*lu8.uVMj$@M%E+5UL,M?ir11g:5F%@n/t[.lu8.'&f,&F(O^,cjrD'T>gI-"
|
||||
"nWeI-mWeI-'-@:MC8xiLVQ#<-)-@:MED4jLVQ#<-+-@:MGPFjLVQ#<---@:MI]XjLVQ#<-/-@:MT'G311^-Q#6N3a0KJco.LeiS8PF%U.>=*p.Cb_&4Ht$[-Xt^31/5bW[U?tW[g5Y>-"
|
||||
":E%HF:/^5B)/HDO9[4h-3bqY?p=Vt7/ChB#@h0R0pXQI2Ok5R*sIZj)NQx:.)I?)4J;gJ2@_lA#lL$^(xmoi0WLq-MtS%)*[;w0#ENh>.=`EC#O5`P-Qmm*MmfC12x@HP8EktW[r89I*"
|
||||
"qI(W3lYnV[M0'qLCKV41BG$)*bf-@->u68.==*p.t2Gx9h:_5B+ktpLK&-Q#o?;W3NYWI),p,*4lS*)**SEjLLYDm0KYmp0em-=.*$GGOG[[D4bhb>-nQ=v-%=ufL]hev6ONjj<7C4g7"
|
||||
"-#fm#,7%a+W+$$$qi-<8uG@g%>^3uLVPq%/HsD^[*8WW/>+KE-vLg?-e0WE-$$esA_$d2$'#6k<+vlW--?D_&]A[][djPS3e,K*R&RW5/&;7-5Eai?B9KJ9io/vERAcM>CQ@#B#sg([K"
|
||||
">0]3FwNEp.DxvuP$.0oLGD7p._FOe$E50HbJ3jU1<o?p4lS*)*4(RV[=9q&$X/o>6rwZ55<smV[i^NmLumY?.s28b-A)8R*ma?R*X#<s.t+SW[S)+p1o+;Z->R/N-AqYhL,?(&&GWEjL"
|
||||
"nkHq9ohN)Y-Z9T(_eMs7]:^;.*dKK-0:%I-S;m)/u7%N-]_Bil[TXp.#Hu>-*D,XCBWkC?]<3p1kbMG)iEsM62Qsc<xOnY6J=rh55CXv6aQHo0$s%=7bWQo0*fR>6=Yf88F&eG.@XmP8"
|
||||
"Z(-kLE]o;8+dUv@[V[,&cHV].&,*=.V=SF/JsIg%&w+<8LV'HOK0Y<8hbxV[GQF9B&0:?6fDGY-?)1pprsqY?_?u88aQHo05nw;-a2gr-Skt)#U7[uNRdamL9dWR8O8S9]:?hc))U&X["
|
||||
"]?tW[>3:o/G*q5#Q`0U[tgt;.&PCs3j-C2:ebE-*/D+j17uqF.IiF<%$BlW[AS2Z[uBtW[L0$6#D@Ib%o_Ib%%0Pb%r]L9]/:)=-*2#HM%HgnLK1(588pWG<$]bA#u&sc<U)OX(uqIb%"
|
||||
"+TSD=6:P&#'Lx>-wS,<-%V,<-CIrIM,sPoL6:)=-7u@Y-_1(F.%.Jb%%0Pb%8)4O+2>hY?CHNX(:/4O+`OVmLDA2pL%+p+M*G;pLH:)=-:2#HM5SMpLHl+87HUaSA$]bA#/c%pAU)OX("
|
||||
"/LJb%>LxPB#%]u7k'xlB/HZV[2KL@-5a5<-e(MT.f$h5#UT=Z-JZa$'4DmW[1E(@-IMGHM^L4RMa0nlLQR=RMR>_<.N(wP5b,RGEb6L[0=-#(&_>3)Fd(nY6lxjDFndXfNanX7MS&c?-"
|
||||
"Aa5<-x9]>-P5g,Mg&5;1;k(Z#tco;6Ij@g%a:nS.Hi/Q#@oi'#Ebl:d+d7Q#hw]][rwB`$nLs5#rlq5#/YHF%4s1G%VR)##mINX(=3<%$=cDg.VndC?J7VI?+FAw86$/@':bc/Li+kS7"
|
||||
";8JoLHF_l8.V&,2a>]N0c3X(NmpL(]jh8*#1J>lLR[+##";
|
||||
|
||||
return openIconic_compressed_data_base85;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
||||
void ImGuiH::showDemoIcons()
|
||||
{
|
||||
// clang-format off
|
||||
static const char* text_icon_[] = {
|
||||
"account_login", "account_logout", "action_redo", "action_undo", "align_center",
|
||||
"align_left","align_right","aperture","arrow_bottom","arrow_circle_bottom","arrow_circle_left",
|
||||
"arrow_circle_right","arrow_circle_top","arrow_left","arrow_right","arrow_thick_bottom","arrow_thick_left",
|
||||
"arrow_thick_right","arrow_thick_top","arrow_top","audio","audio_spectrum","badge","ban","bar_chart","basket",
|
||||
"battery_empty","battery_full","beaker","bell","bluetooth","bold","bolt","book","bookmark","box","briefcase",
|
||||
"british_pound","browser","brush","bug","bullhorn","calculator","calendar","camera_slr","caret_bottom",
|
||||
"caret_left","caret_right","caret_top","cart","chat","check","chevron_bottom","chevron_left","chevron_right",
|
||||
"chevron_top","circle_check","circle_x","clipboard","clock","cloud","cloud_download","cloud_upload","cloudy",
|
||||
"code","cog","collapse_down","collapse_left","collapse_right","collapse_up","command","comment_square",
|
||||
"compass","contrast","copywriting","credit_card","crop","dashboard","data_transfer_download","data_transfer_upload",
|
||||
"delete","dial","document","dollar","double_quote_sans_left","double_quote_sans_right","double_quote_serif_left",
|
||||
"double_quote_serif_right","droplet","eject","elevator","ellipses","envelope_closed","envelope_open","euro",
|
||||
"excerpt", "expend_down", "expend_left", "expend_right", "expend_up", "external_link", "eye", "eyedropper", "file", "fire", "flag", "flash",
|
||||
"folder", "fork", "fullscreen_enter", "fullscreen_exit", "globe", "graph", "grid_four_up", "grid_three_up", "grid_two_up", "hard_drive", "header",
|
||||
"headphones", "heart", "home", "image", "inbox", "infinity", "info", "italic", "justify_center", "justify_left", "justify_right",
|
||||
"key", "laptop", "layers", "lightbulb", "link_broken", "link_intact", "list", "list_rich", "location", "lock_locked", "lock_unlocked", "loop_circular",
|
||||
"loop_square", "loop", "magnifying_glass",
|
||||
"map", "map_marquer", "media_pause", "media_play", "media_record", "media_skip_backward", "media_skip_forward", "media_step_backward", "media_step_forward",
|
||||
"media_stop", "medical_cross", "menu", "microphone", "minus", "monitor", "moon", "move", "musical_note", "paperclip",
|
||||
"pencil", "people", "person", "phone", "pie_chart", "pin", "play_circle", "plus", "power_standby", "print", "project", "pulse", "puzzle_piece",
|
||||
"question_mark", "rain", "random", "reload", "resize_both", "resize_height",
|
||||
"resize_width", "rss", "rss_alt", "script", "share", "share_boxed", "shield", "signal", "signpost", "sort_ascending", "sort_descending", "spreadsheet",
|
||||
"star", "sun", "tablet", "tag", "tags", "target", "task", "terminal",
|
||||
"text", "thumb_down", "thumb_up", "timer", "transfer", "trash", "underline", "vertical_align_bottom", "vertical_align_center", "vertical_align_top", "video",
|
||||
"volume_high", "volume_low", "volume_off", "warning", "wifi", "wrench", "x", "yen", "zoom_in", "zoom_out"
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(700, 500), ImGuiCond_FirstUseEver);
|
||||
if(!ImGui::Begin("Icons"))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
// From 0xE000 to 0xE0DF
|
||||
for(int i = 0; i < 223; i++)
|
||||
{
|
||||
std::string utf8String;
|
||||
int codePoint = i + 0xE000;
|
||||
utf8String += static_cast<char>(0xE0 | (codePoint >> 12));
|
||||
utf8String += static_cast<char>(0x80 | ((codePoint >> 6) & 0x3F));
|
||||
utf8String += static_cast<char>(0x80 | (codePoint & 0x3F));
|
||||
|
||||
ImGui::PushFont(ImGuiH::getIconicFont());
|
||||
ImGui::Text("%s", utf8String.c_str()); // Show icon
|
||||
if(((i + 1) % 20) != 0)
|
||||
ImGui::SameLine();
|
||||
ImGui::PopFont();
|
||||
ImGui::SetItemTooltip("%s", text_icon_[i]);
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
258
raytracer/nvpro_core/imgui/imgui_icon.h
Normal file
258
raytracer/nvpro_core/imgui/imgui_icon.h
Normal file
|
|
@ -0,0 +1,258 @@
|
|||
/*
|
||||
* Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/// @DOC_SKIP
|
||||
|
||||
#pragma once
|
||||
#include <imgui.h>
|
||||
|
||||
|
||||
namespace ImGuiH {
|
||||
void addIconicFont(float fontSize = 14.F); // Call this once in the application after ImGui is initialized
|
||||
void showDemoIcons(); // Show all icons in a separated window
|
||||
ImFont* getIconicFont(); // Return the iconic font
|
||||
// Ex: ImGui::PushFont(ImGuiH::getIconicFont());
|
||||
// ImGui::Button(ImGuiH::icon_account_login);
|
||||
// ImGui::PopFont();
|
||||
|
||||
[[maybe_unused]] static const char* icon_account_login = (char*)u8"\ue000";
|
||||
[[maybe_unused]] static const char* icon_account_logout = (char*)u8"\ue001";
|
||||
[[maybe_unused]] static const char* icon_action_redo = (char*)u8"\ue002";
|
||||
[[maybe_unused]] static const char* icon_action_undo = (char*)u8"\ue003";
|
||||
[[maybe_unused]] static const char* icon_align_center = (char*)u8"\ue004";
|
||||
[[maybe_unused]] static const char* icon_align_left = (char*)u8"\ue005";
|
||||
[[maybe_unused]] static const char* icon_align_right = (char*)u8"\ue006";
|
||||
[[maybe_unused]] static const char* icon_aperture = (char*)u8"\ue007";
|
||||
[[maybe_unused]] static const char* icon_arrow_bottom = (char*)u8"\ue008";
|
||||
[[maybe_unused]] static const char* icon_arrow_circle_bottom = (char*)u8"\ue009";
|
||||
[[maybe_unused]] static const char* icon_arrow_circle_left = (char*)u8"\ue00A";
|
||||
[[maybe_unused]] static const char* icon_arrow_circle_right = (char*)u8"\ue00B";
|
||||
[[maybe_unused]] static const char* icon_arrow_circle_top = (char*)u8"\ue00C";
|
||||
[[maybe_unused]] static const char* icon_arrow_left = (char*)u8"\ue00D";
|
||||
[[maybe_unused]] static const char* icon_arrow_right = (char*)u8"\ue00E";
|
||||
[[maybe_unused]] static const char* icon_arrow_thick_bottom = (char*)u8"\ue00F";
|
||||
[[maybe_unused]] static const char* icon_arrow_thick_left = (char*)u8"\ue010";
|
||||
[[maybe_unused]] static const char* icon_arrow_thick_right = (char*)u8"\ue011";
|
||||
[[maybe_unused]] static const char* icon_arrow_thick_top = (char*)u8"\ue012";
|
||||
[[maybe_unused]] static const char* icon_arrow_top = (char*)u8"\ue013";
|
||||
[[maybe_unused]] static const char* icon_audio = (char*)u8"\ue014";
|
||||
[[maybe_unused]] static const char* icon_audio_spectrum = (char*)u8"\ue015";
|
||||
[[maybe_unused]] static const char* icon_badge = (char*)u8"\ue016";
|
||||
[[maybe_unused]] static const char* icon_ban = (char*)u8"\ue017";
|
||||
[[maybe_unused]] static const char* icon_bar_chart = (char*)u8"\ue018";
|
||||
[[maybe_unused]] static const char* icon_basket = (char*)u8"\ue019";
|
||||
[[maybe_unused]] static const char* icon_battery_empty = (char*)u8"\ue01A";
|
||||
[[maybe_unused]] static const char* icon_battery_full = (char*)u8"\ue01B";
|
||||
[[maybe_unused]] static const char* icon_beaker = (char*)u8"\ue01C";
|
||||
[[maybe_unused]] static const char* icon_bell = (char*)u8"\ue01D";
|
||||
[[maybe_unused]] static const char* icon_bluetooth = (char*)u8"\ue01E";
|
||||
[[maybe_unused]] static const char* icon_bold = (char*)u8"\ue01F";
|
||||
[[maybe_unused]] static const char* icon_bolt = (char*)u8"\ue020";
|
||||
[[maybe_unused]] static const char* icon_book = (char*)u8"\ue021";
|
||||
[[maybe_unused]] static const char* icon_bookmark = (char*)u8"\ue022";
|
||||
[[maybe_unused]] static const char* icon_box = (char*)u8"\ue023";
|
||||
[[maybe_unused]] static const char* icon_briefcase = (char*)u8"\ue024";
|
||||
[[maybe_unused]] static const char* icon_british_pound = (char*)u8"\ue025";
|
||||
[[maybe_unused]] static const char* icon_browser = (char*)u8"\ue026";
|
||||
[[maybe_unused]] static const char* icon_brush = (char*)u8"\ue027";
|
||||
[[maybe_unused]] static const char* icon_bug = (char*)u8"\ue028";
|
||||
[[maybe_unused]] static const char* icon_bullhorn = (char*)u8"\ue029";
|
||||
[[maybe_unused]] static const char* icon_calculator = (char*)u8"\ue02A";
|
||||
[[maybe_unused]] static const char* icon_calendar = (char*)u8"\ue02B";
|
||||
[[maybe_unused]] static const char* icon_camera_slr = (char*)u8"\ue02C";
|
||||
[[maybe_unused]] static const char* icon_caret_bottom = (char*)u8"\ue02D";
|
||||
[[maybe_unused]] static const char* icon_caret_left = (char*)u8"\ue02E";
|
||||
[[maybe_unused]] static const char* icon_caret_right = (char*)u8"\ue02F";
|
||||
[[maybe_unused]] static const char* icon_caret_top = (char*)u8"\ue030";
|
||||
[[maybe_unused]] static const char* icon_cart = (char*)u8"\ue031";
|
||||
[[maybe_unused]] static const char* icon_chat = (char*)u8"\ue032";
|
||||
[[maybe_unused]] static const char* icon_check = (char*)u8"\ue033";
|
||||
[[maybe_unused]] static const char* icon_chevron_bottom = (char*)u8"\ue034";
|
||||
[[maybe_unused]] static const char* icon_chevron_left = (char*)u8"\ue035";
|
||||
[[maybe_unused]] static const char* icon_chevron_right = (char*)u8"\ue036";
|
||||
[[maybe_unused]] static const char* icon_chevron_top = (char*)u8"\ue037";
|
||||
[[maybe_unused]] static const char* icon_circle_check = (char*)u8"\ue038";
|
||||
[[maybe_unused]] static const char* icon_circle_x = (char*)u8"\ue039";
|
||||
[[maybe_unused]] static const char* icon_clipboard = (char*)u8"\ue03A";
|
||||
[[maybe_unused]] static const char* icon_clock = (char*)u8"\ue03B";
|
||||
[[maybe_unused]] static const char* icon_cloud_download = (char*)u8"\ue03C";
|
||||
[[maybe_unused]] static const char* icon_cloud_upload = (char*)u8"\ue03D";
|
||||
[[maybe_unused]] static const char* icon_cloud = (char*)u8"\ue03E";
|
||||
[[maybe_unused]] static const char* icon_cloudy = (char*)u8"\ue03F";
|
||||
[[maybe_unused]] static const char* icon_code = (char*)u8"\ue040";
|
||||
[[maybe_unused]] static const char* icon_cog = (char*)u8"\ue041";
|
||||
[[maybe_unused]] static const char* icon_collapse_down = (char*)u8"\ue042";
|
||||
[[maybe_unused]] static const char* icon_collapse_left = (char*)u8"\ue043";
|
||||
[[maybe_unused]] static const char* icon_collapse_right = (char*)u8"\ue044";
|
||||
[[maybe_unused]] static const char* icon_collapse_up = (char*)u8"\ue045";
|
||||
[[maybe_unused]] static const char* icon_command = (char*)u8"\ue046";
|
||||
[[maybe_unused]] static const char* icon_comment_square = (char*)u8"\ue047";
|
||||
[[maybe_unused]] static const char* icon_compass = (char*)u8"\ue048";
|
||||
[[maybe_unused]] static const char* icon_contrast = (char*)u8"\ue049";
|
||||
[[maybe_unused]] static const char* icon_copywriting = (char*)u8"\ue04A";
|
||||
[[maybe_unused]] static const char* icon_credit_card = (char*)u8"\ue04B";
|
||||
[[maybe_unused]] static const char* icon_crop = (char*)u8"\ue04C";
|
||||
[[maybe_unused]] static const char* icon_dashboard = (char*)u8"\ue04D";
|
||||
[[maybe_unused]] static const char* icon_data_transfer_download = (char*)u8"\ue04E";
|
||||
[[maybe_unused]] static const char* icon_data_transfer_upload = (char*)u8"\ue04F";
|
||||
[[maybe_unused]] static const char* icon_delete = (char*)u8"\ue050";
|
||||
[[maybe_unused]] static const char* icon_dial = (char*)u8"\ue051";
|
||||
[[maybe_unused]] static const char* icon_document = (char*)u8"\ue052";
|
||||
[[maybe_unused]] static const char* icon_dollar = (char*)u8"\ue053";
|
||||
[[maybe_unused]] static const char* icon_double_quote_sans_left = (char*)u8"\ue054";
|
||||
[[maybe_unused]] static const char* icon_double_quote_sans_right = (char*)u8"\ue055";
|
||||
[[maybe_unused]] static const char* icon_double_quote_serif_left = (char*)u8"\ue056";
|
||||
[[maybe_unused]] static const char* icon_double_quote_serif_right = (char*)u8"\ue057";
|
||||
[[maybe_unused]] static const char* icon_droplet = (char*)u8"\ue058";
|
||||
[[maybe_unused]] static const char* icon_eject = (char*)u8"\ue059";
|
||||
[[maybe_unused]] static const char* icon_elevator = (char*)u8"\ue05A";
|
||||
[[maybe_unused]] static const char* icon_ellipses = (char*)u8"\ue05B";
|
||||
[[maybe_unused]] static const char* icon_envelope_closed = (char*)u8"\ue05C";
|
||||
[[maybe_unused]] static const char* icon_envelope_open = (char*)u8"\ue05D";
|
||||
[[maybe_unused]] static const char* icon_euro = (char*)u8"\ue05E";
|
||||
[[maybe_unused]] static const char* icon_excerpt = (char*)u8"\ue05F";
|
||||
[[maybe_unused]] static const char* icon_expend_down = (char*)u8"\ue060";
|
||||
[[maybe_unused]] static const char* icon_expend_left = (char*)u8"\ue061";
|
||||
[[maybe_unused]] static const char* icon_expend_right = (char*)u8"\ue062";
|
||||
[[maybe_unused]] static const char* icon_expend_up = (char*)u8"\ue063";
|
||||
[[maybe_unused]] static const char* icon_external_link = (char*)u8"\ue064";
|
||||
[[maybe_unused]] static const char* icon_eye = (char*)u8"\ue065";
|
||||
[[maybe_unused]] static const char* icon_eyedropper = (char*)u8"\ue066";
|
||||
[[maybe_unused]] static const char* icon_file = (char*)u8"\ue067";
|
||||
[[maybe_unused]] static const char* icon_fire = (char*)u8"\ue068";
|
||||
[[maybe_unused]] static const char* icon_flag = (char*)u8"\ue069";
|
||||
[[maybe_unused]] static const char* icon_flash = (char*)u8"\ue06A";
|
||||
[[maybe_unused]] static const char* icon_folder = (char*)u8"\ue06B";
|
||||
[[maybe_unused]] static const char* icon_fork = (char*)u8"\ue06C";
|
||||
[[maybe_unused]] static const char* icon_fullscreen_enter = (char*)u8"\ue06D";
|
||||
[[maybe_unused]] static const char* icon_fullscreen_exit = (char*)u8"\ue06E";
|
||||
[[maybe_unused]] static const char* icon_globe = (char*)u8"\ue06F";
|
||||
[[maybe_unused]] static const char* icon_graph = (char*)u8"\ue070";
|
||||
[[maybe_unused]] static const char* icon_grid_four_up = (char*)u8"\ue071";
|
||||
[[maybe_unused]] static const char* icon_grid_three_up = (char*)u8"\ue072";
|
||||
[[maybe_unused]] static const char* icon_grid_two_up = (char*)u8"\ue073";
|
||||
[[maybe_unused]] static const char* icon_hard_drive = (char*)u8"\ue074";
|
||||
[[maybe_unused]] static const char* icon_header = (char*)u8"\ue075";
|
||||
[[maybe_unused]] static const char* icon_headphones = (char*)u8"\ue076";
|
||||
[[maybe_unused]] static const char* icon_heart = (char*)u8"\ue077";
|
||||
[[maybe_unused]] static const char* icon_home = (char*)u8"\ue078";
|
||||
[[maybe_unused]] static const char* icon_image = (char*)u8"\ue079";
|
||||
[[maybe_unused]] static const char* icon_inbox = (char*)u8"\ue07A";
|
||||
[[maybe_unused]] static const char* icon_infinity = (char*)u8"\ue07B";
|
||||
[[maybe_unused]] static const char* icon_info = (char*)u8"\ue07C";
|
||||
[[maybe_unused]] static const char* icon_italic = (char*)u8"\ue07D";
|
||||
[[maybe_unused]] static const char* icon_justify_center = (char*)u8"\ue07E";
|
||||
[[maybe_unused]] static const char* icon_justify_left = (char*)u8"\ue07F";
|
||||
[[maybe_unused]] static const char* icon_justify_right = (char*)u8"\ue080";
|
||||
[[maybe_unused]] static const char* icon_key = (char*)u8"\ue081";
|
||||
[[maybe_unused]] static const char* icon_laptop = (char*)u8"\ue082";
|
||||
[[maybe_unused]] static const char* icon_layers = (char*)u8"\ue083";
|
||||
[[maybe_unused]] static const char* icon_lightbulb = (char*)u8"\ue084";
|
||||
[[maybe_unused]] static const char* icon_link_broken = (char*)u8"\ue085";
|
||||
[[maybe_unused]] static const char* icon_link_intact = (char*)u8"\ue086";
|
||||
[[maybe_unused]] static const char* icon_list = (char*)u8"\ue087";
|
||||
[[maybe_unused]] static const char* icon_list_rich = (char*)u8"\ue088";
|
||||
[[maybe_unused]] static const char* icon_location = (char*)u8"\ue089";
|
||||
[[maybe_unused]] static const char* icon_lock_locked = (char*)u8"\ue08A";
|
||||
[[maybe_unused]] static const char* icon_lock_unlocked = (char*)u8"\ue08B";
|
||||
[[maybe_unused]] static const char* icon_loop_circular = (char*)u8"\ue08C";
|
||||
[[maybe_unused]] static const char* icon_loop_square = (char*)u8"\ue08D";
|
||||
[[maybe_unused]] static const char* icon_loop = (char*)u8"\ue08E";
|
||||
[[maybe_unused]] static const char* icon_magnifying_glass = (char*)u8"\ue08F";
|
||||
[[maybe_unused]] static const char* icon_map = (char*)u8"\ue090";
|
||||
[[maybe_unused]] static const char* icon_map_marquer = (char*)u8"\ue091";
|
||||
[[maybe_unused]] static const char* icon_media_pause = (char*)u8"\ue092";
|
||||
[[maybe_unused]] static const char* icon_media_play = (char*)u8"\ue093";
|
||||
[[maybe_unused]] static const char* icon_media_record = (char*)u8"\ue094";
|
||||
[[maybe_unused]] static const char* icon_media_skip_backward = (char*)u8"\ue095";
|
||||
[[maybe_unused]] static const char* icon_media_skip_forward = (char*)u8"\ue096";
|
||||
[[maybe_unused]] static const char* icon_media_step_backward = (char*)u8"\ue097";
|
||||
[[maybe_unused]] static const char* icon_media_step_forward = (char*)u8"\ue098";
|
||||
[[maybe_unused]] static const char* icon_media_stop = (char*)u8"\ue099";
|
||||
[[maybe_unused]] static const char* icon_medical_cross = (char*)u8"\ue09A";
|
||||
[[maybe_unused]] static const char* icon_menu = (char*)u8"\ue09B";
|
||||
[[maybe_unused]] static const char* icon_microphone = (char*)u8"\ue09C";
|
||||
[[maybe_unused]] static const char* icon_minus = (char*)u8"\ue09D";
|
||||
[[maybe_unused]] static const char* icon_monitor = (char*)u8"\ue09E";
|
||||
[[maybe_unused]] static const char* icon_moon = (char*)u8"\ue09F";
|
||||
[[maybe_unused]] static const char* icon_move = (char*)u8"\ue0A0";
|
||||
[[maybe_unused]] static const char* icon_musical_note = (char*)u8"\ue0A1";
|
||||
[[maybe_unused]] static const char* icon_paperclip = (char*)u8"\ue0A2";
|
||||
[[maybe_unused]] static const char* icon_pencil = (char*)u8"\ue0A3";
|
||||
[[maybe_unused]] static const char* icon_people = (char*)u8"\ue0A4";
|
||||
[[maybe_unused]] static const char* icon_person = (char*)u8"\ue0A5";
|
||||
[[maybe_unused]] static const char* icon_phone = (char*)u8"\ue0A6";
|
||||
[[maybe_unused]] static const char* icon_pie_chart = (char*)u8"\ue0A7";
|
||||
[[maybe_unused]] static const char* icon_pin = (char*)u8"\ue0A8";
|
||||
[[maybe_unused]] static const char* icon_play_circle = (char*)u8"\ue0A9";
|
||||
[[maybe_unused]] static const char* icon_plus = (char*)u8"\ue0AA";
|
||||
[[maybe_unused]] static const char* icon_power_standby = (char*)u8"\ue0AB";
|
||||
[[maybe_unused]] static const char* icon_print = (char*)u8"\ue0AC";
|
||||
[[maybe_unused]] static const char* icon_project = (char*)u8"\ue0AD";
|
||||
[[maybe_unused]] static const char* icon_pulse = (char*)u8"\ue0AE";
|
||||
[[maybe_unused]] static const char* icon_puzzle_piece = (char*)u8"\ue0AF";
|
||||
[[maybe_unused]] static const char* icon_question_mark = (char*)u8"\ue0B0";
|
||||
[[maybe_unused]] static const char* icon_rain = (char*)u8"\ue0B1";
|
||||
[[maybe_unused]] static const char* icon_random = (char*)u8"\ue0B2";
|
||||
[[maybe_unused]] static const char* icon_reload = (char*)u8"\ue0B3";
|
||||
[[maybe_unused]] static const char* icon_resize_both = (char*)u8"\ue0B4";
|
||||
[[maybe_unused]] static const char* icon_resize_height = (char*)u8"\ue0B5";
|
||||
[[maybe_unused]] static const char* icon_resize_width = (char*)u8"\ue0B6";
|
||||
[[maybe_unused]] static const char* icon_rss = (char*)u8"\ue0B7";
|
||||
[[maybe_unused]] static const char* icon_rss_alt = (char*)u8"\ue0B8";
|
||||
[[maybe_unused]] static const char* icon_script = (char*)u8"\ue0B9";
|
||||
[[maybe_unused]] static const char* icon_share = (char*)u8"\ue0BA";
|
||||
[[maybe_unused]] static const char* icon_share_boxed = (char*)u8"\ue0BB";
|
||||
[[maybe_unused]] static const char* icon_shield = (char*)u8"\ue0BC";
|
||||
[[maybe_unused]] static const char* icon_signal = (char*)u8"\ue0BD";
|
||||
[[maybe_unused]] static const char* icon_signpost = (char*)u8"\ue0BE";
|
||||
[[maybe_unused]] static const char* icon_sort_ascending = (char*)u8"\ue0BF";
|
||||
[[maybe_unused]] static const char* icon_sort_descending = (char*)u8"\ue0C0";
|
||||
[[maybe_unused]] static const char* icon_spreadsheet = (char*)u8"\ue0C1";
|
||||
[[maybe_unused]] static const char* icon_star = (char*)u8"\ue0C2";
|
||||
[[maybe_unused]] static const char* icon_sun = (char*)u8"\ue0C3";
|
||||
[[maybe_unused]] static const char* icon_tablet = (char*)u8"\ue0C4";
|
||||
[[maybe_unused]] static const char* icon_tag = (char*)u8"\ue0C5";
|
||||
[[maybe_unused]] static const char* icon_tags = (char*)u8"\ue0C6";
|
||||
[[maybe_unused]] static const char* icon_target = (char*)u8"\ue0C7";
|
||||
[[maybe_unused]] static const char* icon_task = (char*)u8"\ue0C8";
|
||||
[[maybe_unused]] static const char* icon_terminal = (char*)u8"\ue0C9";
|
||||
[[maybe_unused]] static const char* icon_text = (char*)u8"\ue0CA";
|
||||
[[maybe_unused]] static const char* icon_thumb_down = (char*)u8"\ue0CB";
|
||||
[[maybe_unused]] static const char* icon_thumb_up = (char*)u8"\ue0CC";
|
||||
[[maybe_unused]] static const char* icon_timer = (char*)u8"\ue0CD";
|
||||
[[maybe_unused]] static const char* icon_transfer = (char*)u8"\ue0CE";
|
||||
[[maybe_unused]] static const char* icon_trash = (char*)u8"\ue0CF";
|
||||
[[maybe_unused]] static const char* icon_underline = (char*)u8"\ue0D0";
|
||||
[[maybe_unused]] static const char* icon_vertical_align_bottom = (char*)u8"\ue0D1";
|
||||
[[maybe_unused]] static const char* icon_vertical_align_center = (char*)u8"\ue0D2";
|
||||
[[maybe_unused]] static const char* icon_vertical_align_top = (char*)u8"\ue0D3";
|
||||
[[maybe_unused]] static const char* icon_video = (char*)u8"\ue0D4";
|
||||
[[maybe_unused]] static const char* icon_volume_high = (char*)u8"\ue0D5";
|
||||
[[maybe_unused]] static const char* icon_volume_low = (char*)u8"\ue0D6";
|
||||
[[maybe_unused]] static const char* icon_volume_off = (char*)u8"\ue0D7";
|
||||
[[maybe_unused]] static const char* icon_warning = (char*)u8"\ue0D8";
|
||||
[[maybe_unused]] static const char* icon_wifi = (char*)u8"\ue0D9";
|
||||
[[maybe_unused]] static const char* icon_wrench = (char*)u8"\ue0DA";
|
||||
[[maybe_unused]] static const char* icon_x = (char*)u8"\ue0DB";
|
||||
[[maybe_unused]] static const char* icon_yen = (char*)u8"\ue0DC";
|
||||
[[maybe_unused]] static const char* icon_zoom_in = (char*)u8"\ue0DD";
|
||||
[[maybe_unused]] static const char* icon_zoom_out = (char*)u8"\ue0DE";
|
||||
|
||||
} // namespace ImGuiH
|
||||
806
raytracer/nvpro_core/imgui/imgui_orient.cpp
Normal file
806
raytracer/nvpro_core/imgui/imgui_orient.cpp
Normal file
|
|
@ -0,0 +1,806 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui/imgui_orient.h"
|
||||
#include "imgui_internal.h" // ImSaturate
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
ImVector<ImVec3> ImOrient::s_SphTri;
|
||||
ImVector<ImU32> ImOrient::s_SphCol;
|
||||
ImVector<ImVec2> ImOrient::s_SphTriProj;
|
||||
ImVector<ImU32> ImOrient::s_SphColLight;
|
||||
ImVector<ImVec3> ImOrient::s_ArrowTri[4];
|
||||
ImVector<ImVec2> ImOrient::s_ArrowTriProj[4];
|
||||
ImVector<ImVec3> ImOrient::s_ArrowNorm[4];
|
||||
ImVector<ImU32> ImOrient::s_ArrowColLight[4];
|
||||
|
||||
namespace ImGui {
|
||||
IMGUI_API bool QuaternionGizmo(const char* label, ImQuat& quat)
|
||||
{
|
||||
ImOrient orient;
|
||||
orient.Qt = quat;
|
||||
orient.Axis = ImVec3(1.0f, 0.0f, 0.0f);
|
||||
orient.Angle = 0;
|
||||
orient.Dir.x = orient.Dir.y = orient.Dir.z = 0;
|
||||
|
||||
orient.m_AAMode = false; // Axis & angle mode hidden
|
||||
orient.m_IsDir = false;
|
||||
orient.m_ShowDir = ImVec3(0.0f, 0.0f, 0.0f);
|
||||
orient.m_DirColor = 0xff00ffff;
|
||||
orient.ConvertToAxisAngle();
|
||||
|
||||
bool ret = orient.Draw(label);
|
||||
if(ret)
|
||||
{
|
||||
quat = orient.Qt;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
IMGUI_API bool AxisAngleGizmo(const char* label, ImVec3& axis, float& angle)
|
||||
{
|
||||
ImOrient orient;
|
||||
orient.Qt = ImQuat();
|
||||
orient.Axis = axis;
|
||||
orient.Angle = angle;
|
||||
orient.Dir = ImVec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
orient.m_AAMode = true; // Axis & angle mode hidden
|
||||
orient.m_IsDir = true;
|
||||
orient.m_ShowDir = ImVec3(0.0f, 0.0f, 0.0f);
|
||||
orient.m_DirColor = 0xff00ffff;
|
||||
orient.ConvertFromAxisAngle();
|
||||
|
||||
bool ret = orient.Draw(label);
|
||||
if(ret)
|
||||
{
|
||||
orient.ConvertToAxisAngle();
|
||||
axis = orient.Axis;
|
||||
angle = orient.Angle;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
IMGUI_API bool DirectionGizmo(const char* label, float* dir, bool flip /*= false*/, bool show_info /*= false*/)
|
||||
{
|
||||
ImOrient orient;
|
||||
orient.Qt = ImQuat();
|
||||
if(flip)
|
||||
orient.Dir = {-dir[0], -dir[1], -dir[2]};
|
||||
else
|
||||
orient.Dir = {dir[0], dir[1], dir[2]};
|
||||
orient.Axis = ImVec3(1.0f, 0.0f, 0.0f);
|
||||
orient.Angle = 0.0f;
|
||||
|
||||
|
||||
orient.m_AAMode = false; // Axis & angle mode hidden
|
||||
orient.m_IsDir = true;
|
||||
orient.m_ShowDir = ImVec3(1.0f, 0.0f, 0.0f);
|
||||
orient.m_DirColor = 0xffff0000;
|
||||
orient.QuatFromDir(orient.Qt, orient.Dir);
|
||||
orient.ConvertToAxisAngle();
|
||||
|
||||
bool ret = orient.Draw(label, show_info);
|
||||
if(ret)
|
||||
{
|
||||
ImVec3 d = orient.Qt.Rotate(ImVec3(1, 0, 0));
|
||||
d = d.Div(d.Length());
|
||||
if(flip)
|
||||
orient.Dir = {-d.x, -d.y, -d.z};
|
||||
else
|
||||
orient.Dir = d;
|
||||
dir[0] = orient.Dir.x;
|
||||
dir[1] = orient.Dir.y;
|
||||
dir[2] = orient.Dir.z;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
IMGUI_API bool ImOrient::Draw(const char* label, bool show_info /*= false*/)
|
||||
{
|
||||
// ImGuiIO& io = ImGui::GetIO();
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
if(ImOrient::s_SphTri.empty())
|
||||
{
|
||||
ImOrient::CreateArrow();
|
||||
ImOrient::CreateSphere();
|
||||
}
|
||||
|
||||
ImGui::PushID(label);
|
||||
ImGui::BeginGroup();
|
||||
|
||||
bool value_changed = false;
|
||||
|
||||
ImGui::Text("%s", label);
|
||||
if(show_info)
|
||||
{
|
||||
// Summary
|
||||
if(m_AAMode)
|
||||
{
|
||||
ImGui::Text("Axis={%.2f,%.2f,%.2f} Angle=%.0f%c", Axis.x, Axis.y, Axis.z, Angle, 176);
|
||||
}
|
||||
else if(m_IsDir)
|
||||
{
|
||||
ImGui::Text("Dir={%.2f,%.2f,%.2f}", Dir.x, Dir.y, Dir.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("Quat={x:%.2f,y:%.2f,z:%.2f,s:%.2f}", Qt.x, Qt.y, Qt.z, Qt.w);
|
||||
}
|
||||
}
|
||||
|
||||
ImVec2 orient_pos = ImGui::GetCursorScreenPos();
|
||||
|
||||
float sv_orient_size = std::min(ImGui::CalcItemWidth(), float(GIZMO_SIZE));
|
||||
float w = sv_orient_size;
|
||||
float h = sv_orient_size;
|
||||
|
||||
// We want to generate quaternion rotations relative to the quaternion in the 'down' press state.
|
||||
// This gives us cleaner control over rotation (it feels better/more natural)
|
||||
static ImQuat origQuat;
|
||||
static ImVec3 coordOld;
|
||||
bool highlighted = false;
|
||||
ImGui::InvisibleButton("orient", ImVec2(sv_orient_size, sv_orient_size));
|
||||
if(ImGui::IsItemActive())
|
||||
{
|
||||
highlighted = true;
|
||||
ImVec2 mouse = ImGui::GetMousePos() - orient_pos;
|
||||
if(ImGui::IsMouseClicked(0))
|
||||
{
|
||||
origQuat = Qt;
|
||||
coordOld = ImVec3(QuatIX((int)mouse.x, w, h), QuatIY((int)mouse.y, w, h), 1.0f);
|
||||
}
|
||||
else if(ImGui::IsMouseDragging(0))
|
||||
{
|
||||
//ImGui::ResetMouseDragDelta(0);
|
||||
ImVec3 coord(QuatIX((int)mouse.x, w, h), QuatIY((int)mouse.y, w, h), 1.0f);
|
||||
ImVec3 pVec = AxisTransform.Transform(coord);
|
||||
ImVec3 oVec = AxisTransform.Transform(coordOld);
|
||||
coord.z = 0.0f;
|
||||
float n0 = oVec.Length();
|
||||
float n1 = pVec.Length();
|
||||
if(n0 > FLT_EPSILON && n1 > FLT_EPSILON)
|
||||
{
|
||||
ImVec3 v0 = oVec.Div(n0);
|
||||
ImVec3 v1 = pVec.Div(n1);
|
||||
ImVec3 axis = v0.Cross(v1);
|
||||
float sa = axis.Length();
|
||||
float ca = v0.Dot(v1);
|
||||
float angle = (float)atan2(sa, ca);
|
||||
if(coord.x * coord.x + coord.y * coord.y > 1.0f)
|
||||
angle *= 1.0f + 1.5f * (coord.Length() - 1.0f);
|
||||
ImQuat qrot, qres, qorig;
|
||||
QuatFromAxisAngle(qrot, axis, angle);
|
||||
float nqorig =
|
||||
sqrtf(origQuat.x * origQuat.x + origQuat.y * origQuat.y + origQuat.z * origQuat.z + origQuat.w * origQuat.w);
|
||||
if(fabsf(nqorig) > FLT_EPSILON * FLT_EPSILON)
|
||||
{
|
||||
qorig = origQuat.Div(nqorig);
|
||||
qres = qrot.Mult(qorig);
|
||||
Qt = qres;
|
||||
}
|
||||
else
|
||||
{
|
||||
Qt = qrot;
|
||||
}
|
||||
//origQuat = Qt;
|
||||
value_changed = true;
|
||||
}
|
||||
}
|
||||
draw_list->AddRectFilled(orient_pos, orient_pos + ImVec2(sv_orient_size, sv_orient_size),
|
||||
ImColor(style.Colors[ImGuiCol_FrameBgActive]), style.FrameRounding);
|
||||
}
|
||||
else
|
||||
{
|
||||
highlighted = ImGui::IsItemHovered();
|
||||
draw_list->AddRectFilled(orient_pos, orient_pos + ImVec2(sv_orient_size, sv_orient_size),
|
||||
ImColor(highlighted ? style.Colors[ImGuiCol_FrameBgHovered] : style.Colors[ImGuiCol_FrameBg]),
|
||||
style.FrameRounding);
|
||||
}
|
||||
|
||||
|
||||
float normDir = m_ShowDir.Length();
|
||||
bool drawDir = m_IsDir || (normDir > FLT_EPSILON);
|
||||
|
||||
ImVec2 inner_pos = orient_pos;
|
||||
float inner_size = w;
|
||||
if(drawDir)
|
||||
{
|
||||
inner_size = sv_orient_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
inner_pos.x += sv_orient_size * .25f * .5f;
|
||||
inner_pos.y += sv_orient_size * .25f * .5f;
|
||||
inner_size *= .75f;
|
||||
}
|
||||
|
||||
ImQuat quat;
|
||||
int i, j, k, l, m;
|
||||
|
||||
// normalize quaternion
|
||||
float qn = sqrtf(Qt.w * Qt.w + Qt.x * Qt.x + Qt.y * Qt.y + Qt.z * Qt.z);
|
||||
if(qn > FLT_EPSILON)
|
||||
{
|
||||
quat.x = (float)Qt.x / qn;
|
||||
quat.y = (float)Qt.y / qn;
|
||||
quat.z = (float)Qt.z / qn;
|
||||
quat.w = (float)Qt.w / qn;
|
||||
}
|
||||
else
|
||||
{
|
||||
quat.x = quat.y = quat.z = 0.0f;
|
||||
quat.w = 1.0f;
|
||||
}
|
||||
|
||||
ImColor alpha(1.0f, 1.0f, 1.0f, highlighted ? 1.0f : 0.75f);
|
||||
|
||||
// check if frame is right-handed
|
||||
ImVec3 px = AxisTransform.Transform(ImVec3(1.0f, 0.0f, 0.0f));
|
||||
ImVec3 py = AxisTransform.Transform(ImVec3(0.0f, 1.0f, 0.0f));
|
||||
ImVec3 pz = AxisTransform.Transform(ImVec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
ImVec3 ez = px.Cross(py);
|
||||
|
||||
// Use the handedness of the frame matrix to determine cull direction
|
||||
bool frameRightHanded = pz.Dot(ez) >= 0;
|
||||
float cullDir = frameRightHanded ? 1.0f : -1.0f;
|
||||
|
||||
// Drawing an arrow
|
||||
if(drawDir)
|
||||
{
|
||||
ImVec3 dir = m_ShowDir;
|
||||
if(normDir < FLT_EPSILON)
|
||||
{
|
||||
normDir = 1;
|
||||
dir.x = 1;
|
||||
}
|
||||
ImVec3 kVec = dir;
|
||||
|
||||
ImVec3 rotDirAxis = {0, -kVec.z, kVec.y};
|
||||
if(rotDirAxis.Dot(rotDirAxis) < FLT_EPSILON * FLT_EPSILON)
|
||||
{
|
||||
rotDirAxis.x = rotDirAxis.y = 0;
|
||||
rotDirAxis.z = 1;
|
||||
}
|
||||
float rotDirAngle = (float)acos(kVec.x / normDir);
|
||||
ImQuat rotDirQuat;
|
||||
QuatFromAxisAngle(rotDirQuat, rotDirAxis, rotDirAngle);
|
||||
|
||||
kVec = ImVec3(1.0f, 0.0f, 0.0f);
|
||||
kVec = rotDirQuat.Rotate(kVec);
|
||||
kVec = quat.Rotate(kVec);
|
||||
for(k = 0; k < 4; ++k) // 4 parts of the arrow
|
||||
{
|
||||
// draw order
|
||||
ImVec3 arrowDir = AxisTransform.Transform(kVec);
|
||||
j = (arrowDir.z > 0) ? 3 - k : k;
|
||||
|
||||
assert(s_ArrowTriProj[j].size() == (s_ArrowTri[j].size()) && s_ArrowColLight[j].size() == s_ArrowTri[j].size()
|
||||
&& s_ArrowNorm[j].size() == s_ArrowTri[j].size());
|
||||
|
||||
const int ntri = (int)s_ArrowTri[j].size();
|
||||
for(i = 0; i < ntri; ++i)
|
||||
{
|
||||
ImVec3 coord = s_ArrowTri[j][i];
|
||||
ImVec3 norm = s_ArrowNorm[j][i];
|
||||
|
||||
if(coord.x > 0)
|
||||
coord.x = 2.5f * coord.x - 2.0f;
|
||||
else
|
||||
coord.x += 0.2f;
|
||||
coord.y *= 1.5f;
|
||||
coord.z *= 1.5f;
|
||||
|
||||
coord = rotDirQuat.Rotate(coord);
|
||||
coord = quat.Rotate(coord);
|
||||
coord = AxisTransform.Transform(coord);
|
||||
|
||||
norm = rotDirQuat.Rotate(norm);
|
||||
norm = quat.Rotate(norm);
|
||||
norm = AxisTransform.Transform(norm);
|
||||
|
||||
s_ArrowTriProj[j][i] = ImVec2(QuatPX(coord.x, w, h), QuatPY(coord.y, w, h));
|
||||
ImU32 col = (m_DirColor | 0xff000000) & alpha;
|
||||
s_ArrowColLight[j][i] = ColorBlend(0xff000000, col, fabsf(ImClamp(norm.z, -1.0f, 1.0f)));
|
||||
}
|
||||
DrawTriangles(draw_list, inner_pos, s_ArrowTriProj[j], s_ArrowColLight[j], ntri, cullDir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw arrows & sphere
|
||||
const float SPH_RADIUS = 0.75f;
|
||||
for(m = 0; m < 2; ++m) // m=0: back, m=1: front
|
||||
{
|
||||
for(l = 0; l < 3; ++l) // draw 3 arrows
|
||||
{
|
||||
ImVec3 kVec(1, 0, 0);
|
||||
if(l == 1)
|
||||
{
|
||||
kVec = kVec.RotZ();
|
||||
}
|
||||
else if(l == 2)
|
||||
{
|
||||
kVec = kVec.RotY();
|
||||
}
|
||||
kVec = quat.Rotate(kVec);
|
||||
for(k = 0; k < 4; ++k) // 4 parts of the arrow
|
||||
{
|
||||
// draw order
|
||||
ImVec3 arrowCoord = AxisTransform.Transform(kVec);
|
||||
j = (arrowCoord.z > 0) ? 3 - k : k;
|
||||
|
||||
bool cone = true;
|
||||
if((m == 0 && arrowCoord.z > 0) || (m == 1 && arrowCoord.z <= 0))
|
||||
{
|
||||
if(j == ImOrient::ARROW_CONE || j == ImOrient::ARROW_CONE_CAP) // do not draw cone
|
||||
continue;
|
||||
else
|
||||
cone = false;
|
||||
}
|
||||
assert(ImOrient::s_ArrowTriProj[j].size() == (ImOrient::s_ArrowTri[j].size())
|
||||
&& ImOrient::s_ArrowColLight[j].size() == ImOrient::s_ArrowTri[j].size()
|
||||
&& ImOrient::s_ArrowNorm[j].size() == ImOrient::s_ArrowTri[j].size());
|
||||
const int ntri = (int)ImOrient::s_ArrowTri[j].size();
|
||||
for(i = 0; i < ntri; ++i)
|
||||
{
|
||||
ImVec3 coord = s_ArrowTri[j][i];
|
||||
if(cone && coord.x <= 0)
|
||||
coord.x = SPH_RADIUS;
|
||||
else if(!cone && coord.x > 0)
|
||||
coord.x = -SPH_RADIUS;
|
||||
ImVec3 norm = s_ArrowNorm[j][i];
|
||||
if(l == 1)
|
||||
{
|
||||
coord = coord.RotZ();
|
||||
norm = norm.RotZ();
|
||||
}
|
||||
else if(l == 2)
|
||||
{
|
||||
coord = coord.RotY();
|
||||
norm = norm.RotY();
|
||||
}
|
||||
coord = quat.Rotate(coord);
|
||||
coord = AxisTransform.Transform(coord);
|
||||
norm = quat.Rotate(norm);
|
||||
norm = AxisTransform.Transform(norm);
|
||||
s_ArrowTriProj[j][i] = ImVec2(QuatPX(coord.x, inner_size, inner_size), QuatPY(coord.y, inner_size, inner_size));
|
||||
float fade = (m == 0 && coord.z < 0) ? ImClamp(2.0f * coord.z * coord.z, 0.0f, 1.0f) : 0;
|
||||
float alphaFade = 1.0f;
|
||||
alphaFade = alpha.Value.w;
|
||||
alphaFade *= (1.0f - fade);
|
||||
ImColor alphaFadeCol(1.0f, 1.0f, 1.0f, alphaFade);
|
||||
ImU32 col = (l == 0) ? 0xffff0000 : ((l == 1) ? 0xff00ff00 : 0xff0000ff);
|
||||
s_ArrowColLight[j][i] = ColorBlend(0xff000000, col, fabsf(ImClamp(norm.z, -1.0f, 1.0f))) & ImU32(alphaFadeCol);
|
||||
}
|
||||
DrawTriangles(draw_list, inner_pos, s_ArrowTriProj[j], s_ArrowColLight[j], ntri, cullDir);
|
||||
}
|
||||
}
|
||||
|
||||
if(m == 0)
|
||||
{
|
||||
const int ntri = (int)ImOrient::s_SphTri.size();
|
||||
for(i = 0; i < ntri; ++i) // draw sphere
|
||||
{
|
||||
ImVec3 coord = s_SphTri[i].Mult(SPH_RADIUS);
|
||||
coord = quat.Rotate(coord);
|
||||
coord = AxisTransform.Transform(coord);
|
||||
s_SphTriProj[i] = ImVec2(QuatPX(coord.x, inner_size, inner_size), QuatPY(coord.y, inner_size, inner_size));
|
||||
s_SphColLight[i] = ColorBlend(0xff000000, s_SphCol[i], fabsf(ImClamp(coord.z / SPH_RADIUS, -1.0f, 1.0f))) & ImU32(alpha);
|
||||
}
|
||||
|
||||
DrawTriangles(draw_list, inner_pos, s_SphTriProj, s_SphColLight, ntri, cullDir);
|
||||
}
|
||||
}
|
||||
|
||||
// draw x
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12, h - 36), orient_pos + ImVec2(w - 12 + 5, h - 36 + 5), 0xff0000c0);
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12 + 5, h - 36), orient_pos + ImVec2(w - 12, h - 36 + 5), 0xff0000c0);
|
||||
// draw y
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12, h - 25), orient_pos + ImVec2(w - 12 + 3, h - 25 + 4), 0xff00c000);
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12 + 5, h - 25), orient_pos + ImVec2(w - 12, h - 25 + 7), 0xff00c000);
|
||||
// draw z
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12, h - 12), orient_pos + ImVec2(w - 12 + 5, h - 12), 0xffc00000);
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12, h - 12 + 5), orient_pos + ImVec2(w - 12 + 5, h - 12 + 5), 0xffc00000);
|
||||
draw_list->AddLine(orient_pos + ImVec2(w - 12, h - 12 + 5), orient_pos + ImVec2(w - 12 + 5, h - 12), 0xffc00000);
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::PopID();
|
||||
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
|
||||
void ImOrient::DrawTriangles(ImDrawList* draw_list,
|
||||
const ImVec2& offset,
|
||||
const ImVector<ImVec2>& triProj,
|
||||
const ImVector<ImU32>& colLight,
|
||||
int numVertices,
|
||||
float cullDir)
|
||||
{
|
||||
const ImVec2 uv = ImGui::GetFontTexUvWhitePixel();
|
||||
assert(numVertices % 3 == 0);
|
||||
draw_list->PrimReserve(numVertices, numVertices); // num vert/indices
|
||||
for(int ii = 0; ii < numVertices / 3; ii++)
|
||||
{
|
||||
ImVec2 v1 = offset + triProj[ii * 3];
|
||||
ImVec2 v2 = offset + triProj[ii * 3 + 1];
|
||||
ImVec2 v3 = offset + triProj[ii * 3 + 2];
|
||||
|
||||
// 2D cross product to do culling
|
||||
ImVec2 d1 = ImVec2Subtract(v2, v1);
|
||||
ImVec2 d2 = ImVec2Subtract(v3, v1);
|
||||
float c = ImVec2Cross(d1, d2) * cullDir;
|
||||
if(c > 0.0f)
|
||||
{
|
||||
v2 = v1;
|
||||
v3 = v1;
|
||||
}
|
||||
|
||||
draw_list->PrimWriteIdx(ImDrawIdx(draw_list->_VtxCurrentIdx));
|
||||
draw_list->PrimWriteIdx(ImDrawIdx(draw_list->_VtxCurrentIdx + 1));
|
||||
draw_list->PrimWriteIdx(ImDrawIdx(draw_list->_VtxCurrentIdx + 2));
|
||||
draw_list->PrimWriteVtx(v1, uv, colLight[ii * 3]);
|
||||
draw_list->PrimWriteVtx(v2, uv, colLight[ii * 3 + 1]);
|
||||
draw_list->PrimWriteVtx(v3, uv, colLight[ii * 3 + 2]);
|
||||
}
|
||||
}
|
||||
|
||||
void ImOrient::CreateSphere()
|
||||
{
|
||||
const int SUBDIV = 7;
|
||||
s_SphTri.clear();
|
||||
s_SphCol.clear();
|
||||
|
||||
const float A[8 * 3] = {1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, -1, -1, 0, 0};
|
||||
const float B[8 * 3] = {0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0};
|
||||
const float C[8 * 3] = {0, 0, 1, 1, 0, 0, 0, 0, -1, -1, 0, 0, 1, 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 1};
|
||||
const ImU32 COL_A[8] = {0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff,
|
||||
0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff};
|
||||
const ImU32 COL_B[8] = {0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff,
|
||||
0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff};
|
||||
const ImU32 COL_C[8] = {0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff,
|
||||
0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff};
|
||||
|
||||
int i, j, k, l;
|
||||
float xa, ya, za, xb, yb, zb, xc, yc, zc, x, y, z, norm, u[3], v[3];
|
||||
ImU32 col;
|
||||
for(i = 0; i < 8; ++i)
|
||||
{
|
||||
xa = A[3 * i + 0];
|
||||
ya = A[3 * i + 1];
|
||||
za = A[3 * i + 2];
|
||||
xb = B[3 * i + 0];
|
||||
yb = B[3 * i + 1];
|
||||
zb = B[3 * i + 2];
|
||||
xc = C[3 * i + 0];
|
||||
yc = C[3 * i + 1];
|
||||
zc = C[3 * i + 2];
|
||||
for(j = 0; j <= SUBDIV; ++j)
|
||||
for(k = 0; k <= 2 * (SUBDIV - j); ++k)
|
||||
{
|
||||
if(k % 2 == 0)
|
||||
{
|
||||
u[0] = ((float)j) / (SUBDIV + 1);
|
||||
v[0] = ((float)(k / 2)) / (SUBDIV + 1);
|
||||
u[1] = ((float)(j + 1)) / (SUBDIV + 1);
|
||||
v[1] = ((float)(k / 2)) / (SUBDIV + 1);
|
||||
u[2] = ((float)j) / (SUBDIV + 1);
|
||||
v[2] = ((float)(k / 2 + 1)) / (SUBDIV + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
u[0] = ((float)j) / (SUBDIV + 1);
|
||||
v[0] = ((float)(k / 2 + 1)) / (SUBDIV + 1);
|
||||
u[1] = ((float)(j + 1)) / (SUBDIV + 1);
|
||||
v[1] = ((float)(k / 2)) / (SUBDIV + 1);
|
||||
u[2] = ((float)(j + 1)) / (SUBDIV + 1);
|
||||
v[2] = ((float)(k / 2 + 1)) / (SUBDIV + 1);
|
||||
}
|
||||
|
||||
for(l = 0; l < 3; ++l)
|
||||
{
|
||||
x = (1.0f - u[l] - v[l]) * xa + u[l] * xb + v[l] * xc;
|
||||
y = (1.0f - u[l] - v[l]) * ya + u[l] * yb + v[l] * yc;
|
||||
z = (1.0f - u[l] - v[l]) * za + u[l] * zb + v[l] * zc;
|
||||
norm = sqrtf(x * x + y * y + z * z);
|
||||
x /= norm;
|
||||
y /= norm;
|
||||
z /= norm;
|
||||
s_SphTri.push_back(ImVec3(x, y, z));
|
||||
if(u[l] + v[l] > FLT_EPSILON)
|
||||
col = ColorBlend(COL_A[i], ColorBlend(COL_B[i], COL_C[i], v[l] / (u[l] + v[l])), u[l] + v[l]);
|
||||
else
|
||||
col = COL_A[i];
|
||||
s_SphCol.push_back(col);
|
||||
}
|
||||
}
|
||||
}
|
||||
s_SphTriProj.clear();
|
||||
s_SphTriProj.resize(s_SphTri.size());
|
||||
s_SphColLight.clear();
|
||||
s_SphColLight.resize(s_SphCol.size());
|
||||
}
|
||||
|
||||
void ImOrient::CreateArrow()
|
||||
{
|
||||
const int SUBDIV = 15;
|
||||
const float CYL_RADIUS = 0.08f;
|
||||
const float CONE_RADIUS = 0.16f;
|
||||
const float CONE_LENGTH = 0.25f;
|
||||
const float ARROW_BGN = -1.1f;
|
||||
const float ARROW_END = 1.15f;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 4; ++i)
|
||||
{
|
||||
s_ArrowTri[i].clear();
|
||||
s_ArrowNorm[i].clear();
|
||||
}
|
||||
|
||||
float x0, x1, y0, y1, z0, z1, a0, a1, nx, nn;
|
||||
for(i = 0; i < SUBDIV; ++i)
|
||||
{
|
||||
a0 = 2.0f * float(M_PI) * (float(i)) / SUBDIV;
|
||||
a1 = 2.0f * float(M_PI) * (float(i + 1)) / SUBDIV;
|
||||
x0 = ARROW_BGN;
|
||||
x1 = ARROW_END - CONE_LENGTH;
|
||||
y0 = cosf(a0);
|
||||
z0 = sinf(a0);
|
||||
y1 = cosf(a1);
|
||||
z1 = sinf(a1);
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x1, CYL_RADIUS * y0, CYL_RADIUS * z0));
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x0, CYL_RADIUS * y0, CYL_RADIUS * z0));
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x0, CYL_RADIUS * y1, CYL_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x1, CYL_RADIUS * y0, CYL_RADIUS * z0));
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x0, CYL_RADIUS * y1, CYL_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CYL].push_back(ImVec3(x1, CYL_RADIUS * y1, CYL_RADIUS * z1));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y0, z0));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y0, z0));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y1, z1));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y0, z0));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y1, z1));
|
||||
s_ArrowNorm[ARROW_CYL].push_back(ImVec3(0, y1, z1));
|
||||
s_ArrowTri[ARROW_CYL_CAP].push_back(ImVec3(x0, 0, 0));
|
||||
s_ArrowTri[ARROW_CYL_CAP].push_back(ImVec3(x0, CYL_RADIUS * y1, CYL_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CYL_CAP].push_back(ImVec3(x0, CYL_RADIUS * y0, CYL_RADIUS * z0));
|
||||
s_ArrowNorm[ARROW_CYL_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
s_ArrowNorm[ARROW_CYL_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
s_ArrowNorm[ARROW_CYL_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
x0 = ARROW_END - CONE_LENGTH;
|
||||
x1 = ARROW_END;
|
||||
nx = CONE_RADIUS / (x1 - x0);
|
||||
nn = 1.0f / sqrtf(nx * nx + 1);
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x1, 0, 0));
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x0, CONE_RADIUS * y0, CONE_RADIUS * z0));
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x0, CONE_RADIUS * y1, CONE_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x1, 0, 0));
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x0, CONE_RADIUS * y1, CONE_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CONE].push_back(ImVec3(x1, 0, 0));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y0, nn * z0));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y0, nn * z0));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y1, nn * z1));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y0, nn * z0));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y1, nn * z1));
|
||||
s_ArrowNorm[ARROW_CONE].push_back(ImVec3(nn * nx, nn * y1, nn * z1));
|
||||
s_ArrowTri[ARROW_CONE_CAP].push_back(ImVec3(x0, 0, 0));
|
||||
s_ArrowTri[ARROW_CONE_CAP].push_back(ImVec3(x0, CONE_RADIUS * y1, CONE_RADIUS * z1));
|
||||
s_ArrowTri[ARROW_CONE_CAP].push_back(ImVec3(x0, CONE_RADIUS * y0, CONE_RADIUS * z0));
|
||||
s_ArrowNorm[ARROW_CONE_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
s_ArrowNorm[ARROW_CONE_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
s_ArrowNorm[ARROW_CONE_CAP].push_back(ImVec3(-1, 0, 0));
|
||||
}
|
||||
|
||||
for(i = 0; i < 4; ++i)
|
||||
{
|
||||
s_ArrowTriProj[i].clear();
|
||||
s_ArrowTriProj[i].resize(s_ArrowTri[i].size());
|
||||
s_ArrowColLight[i].clear();
|
||||
s_ArrowColLight[i].resize(s_ArrowTri[i].size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ImOrient::ConvertToAxisAngle()
|
||||
{
|
||||
if(fabs(Qt.w) > (1.0 + FLT_EPSILON))
|
||||
{
|
||||
//Axis.x = Axis.y = Axis.z = 0; // no, keep the previous value
|
||||
Angle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
float a;
|
||||
if(Qt.w >= 1.0f)
|
||||
a = 0.0f; // and keep V
|
||||
else if(Qt.w <= -1.0f)
|
||||
a = float(M_PI); // and keep V
|
||||
else if(fabsf(Qt.x * Qt.x + Qt.y * Qt.y + Qt.z * Qt.z + Qt.w * Qt.w) < (FLT_EPSILON * FLT_EPSILON))
|
||||
a = 0.0f;
|
||||
else
|
||||
{
|
||||
a = (float)acos(Qt.w);
|
||||
if(a * Angle < 0) // Preserve the sign of Angle
|
||||
a = -a;
|
||||
float f = 1.0f / (float)sin(a);
|
||||
Axis.x = Qt.x * f;
|
||||
Axis.y = Qt.y * f;
|
||||
Axis.z = Qt.z * f;
|
||||
}
|
||||
Angle = 2.0f * a;
|
||||
}
|
||||
|
||||
Angle = ImRadToDeg(Angle);
|
||||
|
||||
if(fabsf(Angle) < FLT_EPSILON && fabsf(Axis.x * Axis.x + Axis.y * Axis.y + Axis.z * Axis.z) < FLT_EPSILON * FLT_EPSILON)
|
||||
Axis.x = FLT_MIN; // all components cannot be null
|
||||
}
|
||||
|
||||
void ImOrient::ConvertFromAxisAngle()
|
||||
{
|
||||
float n = Axis.x * Axis.x + Axis.y * Axis.y + Axis.z * Axis.z;
|
||||
if(fabsf(n) > (FLT_EPSILON * FLT_EPSILON))
|
||||
{
|
||||
float f = 0.5f * ImDegToRad(Angle);
|
||||
Qt.w = (float)cos(f);
|
||||
f = (float)sin(f);
|
||||
|
||||
Qt.x = Axis.x * f;
|
||||
Qt.y = Axis.y * f;
|
||||
Qt.z = Axis.z * f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Qt.w = 1.0;
|
||||
Qt.x = Qt.y = Qt.z = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void ImGui_Orient::CopyToVar()
|
||||
{
|
||||
if( m_StructProxy!=NULL )
|
||||
{
|
||||
if( m_StructProxy->m_StructSetCallback!=NULL )
|
||||
{
|
||||
if( m_IsFloat )
|
||||
{
|
||||
if( m_IsDir )
|
||||
{
|
||||
float d[] = {1, 0, 0};
|
||||
ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qt.x, (float)Qt.y, (float)Qt.z, (float)Qt.w);
|
||||
float l = (float)sqrt(Dir.x*Dir.x + Dir.y*Dir.y + Dir.z*Dir.z);
|
||||
d[0] *= l; d[1] *= l; d[2] *= l;
|
||||
Dir.x = d[0]; Dir.y = d[1]; Dir.z = d[2]; // update also Dir.x,Dir.y,Dir.z
|
||||
m_StructProxy->m_StructSetCallback(d, m_StructProxy->m_StructClientData);
|
||||
}
|
||||
else
|
||||
{
|
||||
float q[] = { (float)Qt.x, (float)Qt.y, (float)Qt.z, (float)Qt.w };
|
||||
m_StructProxy->m_StructSetCallback(q, m_StructProxy->m_StructClientData);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( m_StructProxy->m_StructData!=NULL )
|
||||
{
|
||||
if( m_IsFloat )
|
||||
{
|
||||
if( m_IsDir )
|
||||
{
|
||||
float *d = static_cast<float *>(m_StructProxy->m_StructData);
|
||||
ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qt.x, (float)Qt.y, (float)Qt.z, (float)Qt.w);
|
||||
float l = (float)sqrt(Dir.x*Dir.x + Dir.y*Dir.y + Dir.z*Dir.z);
|
||||
d[0] *= l; d[1] *= l; d[2] *= l;
|
||||
Dir.x = d[0]; Dir.y = d[1]; Dir.z = d[2]; // update also Dir.x,Dir.y,Dir.z
|
||||
}
|
||||
else
|
||||
{
|
||||
float *q = static_cast<float *>(m_StructProxy->m_StructData);
|
||||
q[0] = (float)Qt.x; q[1] = (float)Qt.y; q[2] = (float)Qt.z; q[3] = (float)Qt.w;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_IsDir )
|
||||
{
|
||||
float *dd = static_cast<float *>(m_StructProxy->m_StructData);
|
||||
float d[] = {1, 0, 0};
|
||||
ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qt.x, (float)Qt.y, (float)Qt.z, (float)Qt.w);
|
||||
float l = sqrt(Dir.x*Dir.x + Dir.y*Dir.y + Dir.z*Dir.z);
|
||||
dd[0] = l*d[0]; dd[1] = l*d[1]; dd[2] = l*d[2];
|
||||
Dir.x = dd[0]; Dir.y = dd[1]; Dir.z = dd[2]; // update also Dir.x,Dir.y,Dir.z
|
||||
}
|
||||
else
|
||||
{
|
||||
float *q = static_cast<float *>(m_StructProxy->m_StructData);
|
||||
q[0] = Qt.x; q[1] = Qt.y; q[2] = Qt.z; q[3] = Qt.w;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
ImU32 ImOrient::ColorBlend(ImU32 _Color1, ImU32 _Color2, float sigma)
|
||||
{
|
||||
ImColor color1(_Color1);
|
||||
ImColor color2(_Color2);
|
||||
float invSigma = 1.0f - sigma;
|
||||
|
||||
color1 =
|
||||
ImColor((color1.Value.x * invSigma) + (color2.Value.x * sigma), (color1.Value.y * invSigma) + (color2.Value.y * sigma),
|
||||
(color1.Value.z * invSigma) + (color2.Value.z * sigma), (color1.Value.w * invSigma) + (color2.Value.w * sigma));
|
||||
|
||||
return color1;
|
||||
}
|
||||
|
||||
|
||||
void ImOrient::QuatFromAxisAngle(ImQuat& out, const ImVec3& axis, float angle)
|
||||
{
|
||||
float n = axis.x * axis.x + axis.y * axis.y + axis.z * axis.z;
|
||||
if(fabs(n) > FLT_EPSILON)
|
||||
{
|
||||
float f = 0.5f * angle;
|
||||
out.w = (float)cos(f);
|
||||
f = (float)(sin(f) / sqrt(n));
|
||||
out.x = axis.x * f;
|
||||
out.y = axis.y * f;
|
||||
out.z = axis.z * f;
|
||||
}
|
||||
else
|
||||
{
|
||||
out.w = 1.0;
|
||||
out.x = out.y = out.z = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
void ImOrient::QuatFromDir(ImQuat& out, const ImVec3& dir)
|
||||
{
|
||||
// compute a quaternion that rotates (1,0,0) to (dx,dy,dz)
|
||||
float dn = sqrtf(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z);
|
||||
if(dn < FLT_EPSILON * FLT_EPSILON)
|
||||
{
|
||||
out.x = out.y = out.z = 0;
|
||||
out.w = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImVec3 rotAxis = {0, -dir.z, dir.y};
|
||||
if(rotAxis.x * rotAxis.x + rotAxis.y * rotAxis.y + rotAxis.z * rotAxis.z < (FLT_EPSILON * FLT_EPSILON))
|
||||
{
|
||||
rotAxis.x = rotAxis.y = 0;
|
||||
rotAxis.z = 1;
|
||||
}
|
||||
float rotAngle = (float)acos(dir.x / dn);
|
||||
ImQuat rotQuat;
|
||||
QuatFromAxisAngle(rotQuat, rotAxis, rotAngle);
|
||||
out.x = rotQuat.x;
|
||||
out.y = rotQuat.y;
|
||||
out.z = rotQuat.z;
|
||||
out.w = rotQuat.w;
|
||||
}
|
||||
}
|
||||
254
raytracer/nvpro_core/imgui/imgui_orient.h
Normal file
254
raytracer/nvpro_core/imgui/imgui_orient.h
Normal file
|
|
@ -0,0 +1,254 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535
|
||||
#endif
|
||||
|
||||
/* @DOC_START
|
||||
|
||||
# struct ImOrient
|
||||
> brief This is a really nice implementation of an orientation widget; all due respect to the original author ;)
|
||||
|
||||
This is a port of the AntTweakBar orientation widget, which is a 3D orientation widget that allows the user to specify a
|
||||
3D orientation using a quaternion, axis-angle, or direction vector. It is a very useful widget for 3D applications.
|
||||
|
||||
--- @DOC_END ------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
Notes from: www.github.com/cmaughan
|
||||
|
||||
Ported from AntTweakBar
|
||||
|
||||
Dependencies kept to a minimum. I basically vectorized the original code, added a few math types, cleaned things up and
|
||||
made it clearer what the maths was doing.
|
||||
|
||||
I tried to make it more imgui-like, and removed all the excess stuff not needed here. This still needs work.
|
||||
|
||||
I also added triangle culling because ImGui doesn't support winding clip
|
||||
|
||||
The widget works by transforming the 3D object to screen space and clipping the triangles. This makes it work with any
|
||||
imgui back end, without modifications to the renderers.
|
||||
|
||||
\todo More cleanup.
|
||||
\todo Figure out what ShowDir is for.
|
||||
\todo Test direction vectors more
|
||||
*/
|
||||
|
||||
// --------------------------
|
||||
// Firstly, a little math, missing from ImGui but needed for this widget
|
||||
// A Vec3, Matrix 3x3, Dot & Cross products, A Quaternion. Some helper functions, bare minimum
|
||||
struct ImVec3
|
||||
{
|
||||
float x, y, z;
|
||||
ImVec3() { x = y = z = 0.0f; }
|
||||
ImVec3(float _x, float _y, float _z)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
}
|
||||
|
||||
ImVec3 RotY() const { return ImVec3(-z, y, x); }
|
||||
ImVec3 RotZ() const { return ImVec3(-y, x, z); }
|
||||
ImVec3 Cross(const ImVec3& b) const { return ImVec3(y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x); }
|
||||
float Dot(const ImVec3& b) const { return x * b.x + y * b.y + z * b.z; }
|
||||
ImVec3 Mult(float val) const { return ImVec3(x * val, y * val, z * val); }
|
||||
ImVec3 Div(float val) const { return ImVec3(x / val, y / val, z / val); }
|
||||
float Length() const { return sqrtf(x * x + y * y + z * z); }
|
||||
#ifdef IM_VEC3_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
|
||||
IM_VEC3_CLASS_EXTRA
|
||||
#endif
|
||||
};
|
||||
|
||||
// Added to the existing ImVec2 vector
|
||||
inline ImVec2 ImVec2Subtract(const ImVec2& left, const ImVec2& right)
|
||||
{
|
||||
return ImVec2(left.x - right.x, left.y - right.y);
|
||||
}
|
||||
inline float ImVec2Cross(const ImVec2& left, const ImVec2& right)
|
||||
{
|
||||
return (left.x * right.y) - (left.y * right.x);
|
||||
}
|
||||
|
||||
struct ImQuat
|
||||
{
|
||||
float x, y, z, w;
|
||||
ImQuat()
|
||||
{
|
||||
x = y = z = 0.0f;
|
||||
w = 1.0f;
|
||||
}
|
||||
ImQuat(float _x, float _y, float _z, float _w)
|
||||
{
|
||||
x = _x;
|
||||
y = _y;
|
||||
z = _z;
|
||||
w = _w;
|
||||
}
|
||||
|
||||
ImQuat Div(float val) { return ImQuat(x / val, y / val, z / val, w / val); }
|
||||
ImVec3 Rotate(const ImVec3& dir)
|
||||
{
|
||||
float ps = -x * dir.x - y * dir.y - z * dir.z;
|
||||
float px = w * dir.x + y * dir.z - z * dir.y;
|
||||
float py = w * dir.y + z * dir.x - x * dir.z;
|
||||
float pz = w * dir.z + x * dir.y - y * dir.x;
|
||||
return ImVec3(-ps * x + px * w - py * z + pz * y, -ps * y + py * w - pz * x + px * z, -ps * z + pz * w - px * y + py * x);
|
||||
}
|
||||
|
||||
ImQuat Mult(const ImQuat& q2)
|
||||
{
|
||||
ImQuat out;
|
||||
out.x = w * q2.x + x * q2.w + y * q2.z - z * q2.y;
|
||||
out.y = w * q2.y + y * q2.w + z * q2.x - x * q2.z;
|
||||
out.z = w * q2.z + z * q2.w + x * q2.y - y * q2.x;
|
||||
out.w = w * q2.w - (x * q2.x + y * q2.y + z * q2.z);
|
||||
return out;
|
||||
}
|
||||
#ifdef IM_QUAT_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
|
||||
IM_QUAT_CLASS_EXTRA
|
||||
#endif
|
||||
};
|
||||
|
||||
// Matrix used to allow user to specify axis orientation
|
||||
struct ImMat3x3
|
||||
{
|
||||
float m[3][3];
|
||||
ImMat3x3()
|
||||
{
|
||||
for(int x = 0; x < 3; x++)
|
||||
{
|
||||
for(int y = 0; y < 3; y++)
|
||||
{
|
||||
m[y][x] = (x == y) ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImVec3 Transform(const ImVec3& vec)
|
||||
{
|
||||
ImVec3 out;
|
||||
out.x = m[0][0] * vec.x + m[1][0] * vec.y + m[2][0] * vec.z;
|
||||
out.y = m[0][1] * vec.x + m[1][1] * vec.y + m[2][1] * vec.z;
|
||||
out.z = m[0][2] * vec.x + m[1][2] * vec.y + m[2][2] * vec.z;
|
||||
return out;
|
||||
}
|
||||
|
||||
ImVec3 TransformInv(const ImVec3& vec)
|
||||
{
|
||||
ImVec3 out;
|
||||
out.x = m[0][0] * vec.x + m[0][1] * vec.y + m[0][2] * vec.z;
|
||||
out.y = m[1][0] * vec.x + m[1][1] * vec.y + m[1][2] * vec.z;
|
||||
out.z = m[2][0] * vec.x + m[2][1] * vec.y + m[2][2] * vec.z;
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
inline float ImDegToRad(float degree)
|
||||
{
|
||||
return degree * (float(M_PI) / 180.0f);
|
||||
}
|
||||
inline float ImRadToDeg(float radian)
|
||||
{
|
||||
return radian * (180.0f / float(M_PI));
|
||||
}
|
||||
|
||||
// The data structure that holds the orientation among other things
|
||||
struct ImOrient
|
||||
{
|
||||
ImQuat Qt; // Quaternion value
|
||||
|
||||
ImVec3 Axis; // Axis and Angle
|
||||
float Angle = 0.0f;
|
||||
|
||||
ImVec3 Dir; // Dir value set when used as a direction
|
||||
bool m_AAMode = false; // Axis & angle mode
|
||||
bool m_IsDir = false; // Mapped to a dir vector instead of a quat
|
||||
ImVec3 m_ShowDir; // CM: Not sure what this is all about?
|
||||
ImU32 m_DirColor{}; // Direction vector color
|
||||
|
||||
ImMat3x3 AxisTransform; // Transform to required axis frame
|
||||
|
||||
// For the geometry
|
||||
enum EArrowParts
|
||||
{
|
||||
ARROW_CONE,
|
||||
ARROW_CONE_CAP,
|
||||
ARROW_CYL,
|
||||
ARROW_CYL_CAP
|
||||
};
|
||||
static ImVector<ImVec3> s_SphTri;
|
||||
static ImVector<ImU32> s_SphCol;
|
||||
static ImVector<ImVec2> s_SphTriProj;
|
||||
static ImVector<ImU32> s_SphColLight;
|
||||
static ImVector<ImVec3> s_ArrowTri[4];
|
||||
static ImVector<ImVec2> s_ArrowTriProj[4];
|
||||
static ImVector<ImVec3> s_ArrowNorm[4];
|
||||
static ImVector<ImU32> s_ArrowColLight[4];
|
||||
static void CreateSphere();
|
||||
static void CreateArrow();
|
||||
|
||||
IMGUI_API bool Draw(const char* label, bool show_info = false);
|
||||
IMGUI_API void DrawTriangles(ImDrawList* draw_list,
|
||||
const ImVec2& offset,
|
||||
const ImVector<ImVec2>& triProj,
|
||||
const ImVector<ImU32>& colLight,
|
||||
int numVertices,
|
||||
float cullDir);
|
||||
IMGUI_API void ConvertToAxisAngle();
|
||||
IMGUI_API void ConvertFromAxisAngle();
|
||||
|
||||
// Quaternions
|
||||
inline float QuatD(float w, float h) { return (float)std::min(std::abs(w), std::abs(h)) - 4.0f; }
|
||||
inline float QuatPX(float x, float w, float h) { return (x * 0.5f * QuatD(w, h) + w * 0.5f + 0.5f); }
|
||||
inline float QuatPY(float y, float w, float h) { return (-y * 0.5f * QuatD(w, h) + h * 0.5f - 0.5f); }
|
||||
inline float QuatIX(int x, float w, float h) { return (2.0f * x - w - 1.0f) / QuatD(w, h); }
|
||||
inline float QuatIY(int y, float w, float h) { return (-2.0f * y + h - 1.0f) / QuatD(w, h); }
|
||||
IMGUI_API void QuatFromDir(ImQuat& quat, const ImVec3& dir);
|
||||
IMGUI_API static void QuatFromAxisAngle(ImQuat& qt, const ImVec3& axis, float angle);
|
||||
|
||||
// Useful colors
|
||||
IMGUI_API static ImU32 ColorBlend(ImU32 _Color1, ImU32 _Color2, float _S);
|
||||
|
||||
typedef unsigned int color32;
|
||||
const ImU32 COLOR32_BLACK = 0xff000000; // Black
|
||||
const ImU32 COLOR32_WHITE = 0xffffffff; // White
|
||||
const ImU32 COLOR32_ZERO = 0x00000000; // Zero
|
||||
const ImU32 COLOR32_RED = 0xffff0000; // Red
|
||||
const ImU32 COLOR32_GREEN = 0xff00ff00; // Green
|
||||
const ImU32 COLOR32_BLUE = 0xff0000ff; // Blue
|
||||
|
||||
const int GIZMO_SIZE = 100;
|
||||
};
|
||||
|
||||
// The API
|
||||
namespace ImGui {
|
||||
|
||||
IMGUI_API bool QuaternionGizmo(const char* label, ImQuat& quat);
|
||||
IMGUI_API bool AxisAngleGizmo(const char* label, ImVec3& axis, float& angle);
|
||||
IMGUI_API bool DirectionGizmo(const char* label, float* dir, bool flip = false, bool show_info = false);
|
||||
|
||||
}; // namespace ImGui
|
||||
29
raytracer/nvpro_core/nvdx12/README.md
Normal file
29
raytracer/nvpro_core/nvdx12/README.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
## Table of Contents
|
||||
- [base_dx12.hpp](#base_dx12hpp)
|
||||
- [context_dx12.hpp](#context_dx12hpp)
|
||||
- [error_dx12.hpp](#error_dx12hpp)
|
||||
|
||||
## base_dx12.hpp
|
||||
### class nvdx12::DeviceUtils
|
||||
|
||||
Utility class for simple creation of pipeline states, root signatures,
|
||||
and buffers.
|
||||
### function nvdx12::transitionBarrier
|
||||
|
||||
Short-hand function to create a transition barrier
|
||||
|
||||
## context_dx12.hpp
|
||||
### class nvdx12::Context
|
||||
|
||||
Container class for a basic DX12 app, consisting of a DXGI factory, a DX12
|
||||
device, and a command queue.
|
||||
### struct nvdx12::ContextCreateInfo
|
||||
|
||||
Properties for context initialization.
|
||||
|
||||
## error_dx12.hpp
|
||||
### function nvdx12::checkResult
|
||||
|
||||
> Returns true on critical error result, logs errors.
|
||||
|
||||
Use `HR_CHECK(result)` to automatically log filename/linenumber.
|
||||
227
raytracer/nvpro_core/nvdx12/base_dx12.cpp
Normal file
227
raytracer/nvpro_core/nvdx12/base_dx12.cpp
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2016-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#include "base_dx12.hpp"
|
||||
#include "error_dx12.hpp"
|
||||
#include <dxgi1_5.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace nvdx12 {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
D3D12_RESOURCE_BARRIER transitionBarrier(_In_ ID3D12Resource* pResource,
|
||||
D3D12_RESOURCE_STATES stateBefore,
|
||||
D3D12_RESOURCE_STATES stateAfter,
|
||||
UINT subresource /*= D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES*/,
|
||||
D3D12_RESOURCE_BARRIER_FLAGS flags /*= D3D12_RESOURCE_BARRIER_FLAG_NONE*/)
|
||||
{
|
||||
D3D12_RESOURCE_BARRIER result;
|
||||
ZeroMemory(&result, sizeof(result));
|
||||
result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
result.Flags = flags;
|
||||
result.Transition.pResource = pResource;
|
||||
result.Transition.StateBefore = stateBefore;
|
||||
result.Transition.StateAfter = stateAfter;
|
||||
result.Transition.Subresource = subresource;
|
||||
return result;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ID3D12Device* DeviceUtils::createDevice(IDXGIFactory5* factory)
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
IDXGIAdapter1* hardwareAdapter = nullptr;
|
||||
|
||||
// Look for an actual GPU. This sample does not support WARP (software)
|
||||
// devices.
|
||||
for(UINT adapterIndex = 0; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters1(adapterIndex, &hardwareAdapter); ++adapterIndex)
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 desc;
|
||||
hardwareAdapter->GetDesc1(&desc);
|
||||
|
||||
if(desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
|
||||
{
|
||||
// Don't select the Basic Render Driver adapter.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check to see if the adapter supports Direct3D 12, but don't create the
|
||||
// actual device yet.
|
||||
if(SUCCEEDED(D3D12CreateDevice(hardwareAdapter, D3D_FEATURE_LEVEL_12_0, _uuidof(ID3D12Device), nullptr)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hardwareAdapter == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
DXGI_ADAPTER_DESC1 adapterDesc;
|
||||
hardwareAdapter->GetDesc1(&adapterDesc);
|
||||
printf("Running on DXGI Adapter %S\n", adapterDesc.Description);
|
||||
|
||||
// Create the DX12 device on the selected GPU
|
||||
hr = D3D12CreateDevice(hardwareAdapter, D3D_FEATURE_LEVEL_12_0, IID_PPV_ARGS(&m_device));
|
||||
if(FAILED(hr))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
hardwareAdapter->Release();
|
||||
return m_device;
|
||||
}
|
||||
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC DeviceUtils::createDefaultPipelineDesc(D3D12_INPUT_ELEMENT_DESC* inputDescs,
|
||||
UINT inputCount,
|
||||
ID3D12RootSignature* rootSignature,
|
||||
void* vertexShaderPointer,
|
||||
size_t vertexShaderSize,
|
||||
void* pixelShaderPointer,
|
||||
size_t pixelShaderSize)
|
||||
{
|
||||
|
||||
// Describe and create the graphics pipeline state object (PSO).
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
|
||||
psoDesc.InputLayout = {inputDescs, inputCount};
|
||||
psoDesc.pRootSignature = rootSignature;
|
||||
|
||||
psoDesc.VS = {vertexShaderPointer, vertexShaderSize};
|
||||
psoDesc.PS = {pixelShaderPointer, pixelShaderSize};
|
||||
|
||||
psoDesc.RasterizerState.FillMode = D3D12_FILL_MODE_SOLID;
|
||||
psoDesc.RasterizerState.CullMode = D3D12_CULL_MODE_BACK;
|
||||
psoDesc.RasterizerState.FrontCounterClockwise = TRUE;
|
||||
psoDesc.RasterizerState.DepthBias = D3D12_DEFAULT_DEPTH_BIAS;
|
||||
psoDesc.RasterizerState.DepthBiasClamp = D3D12_DEFAULT_DEPTH_BIAS_CLAMP;
|
||||
psoDesc.RasterizerState.SlopeScaledDepthBias = D3D12_DEFAULT_SLOPE_SCALED_DEPTH_BIAS;
|
||||
psoDesc.RasterizerState.DepthClipEnable = TRUE;
|
||||
psoDesc.RasterizerState.MultisampleEnable = FALSE;
|
||||
psoDesc.RasterizerState.AntialiasedLineEnable = FALSE;
|
||||
psoDesc.RasterizerState.ForcedSampleCount = 0;
|
||||
psoDesc.RasterizerState.ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF;
|
||||
|
||||
psoDesc.BlendState.AlphaToCoverageEnable = FALSE;
|
||||
psoDesc.BlendState.IndependentBlendEnable = FALSE;
|
||||
|
||||
const D3D12_RENDER_TARGET_BLEND_DESC defaultRenderTargetBlendDesc = {
|
||||
FALSE,
|
||||
FALSE,
|
||||
D3D12_BLEND_ONE,
|
||||
D3D12_BLEND_ZERO,
|
||||
D3D12_BLEND_OP_ADD,
|
||||
D3D12_BLEND_ONE,
|
||||
D3D12_BLEND_ZERO,
|
||||
D3D12_BLEND_OP_ADD,
|
||||
D3D12_LOGIC_OP_NOOP,
|
||||
D3D12_COLOR_WRITE_ENABLE_ALL,
|
||||
};
|
||||
for(UINT i = 0; i < D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i)
|
||||
psoDesc.BlendState.RenderTarget[i] = defaultRenderTargetBlendDesc;
|
||||
|
||||
psoDesc.DepthStencilState.DepthEnable = FALSE;
|
||||
psoDesc.DepthStencilState.StencilEnable = FALSE;
|
||||
psoDesc.SampleMask = UINT_MAX;
|
||||
psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
psoDesc.NumRenderTargets = 1;
|
||||
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
psoDesc.SampleDesc.Count = 1;
|
||||
|
||||
return psoDesc;
|
||||
}
|
||||
|
||||
void DeviceUtils::addDepthStencilTestToPipeline(D3D12_GRAPHICS_PIPELINE_STATE_DESC& psoDesc,
|
||||
bool enableDepth /*= true*/,
|
||||
bool enableStencil /*= false*/,
|
||||
DXGI_FORMAT format /*= DXGI_FORMAT_D32_FLOAT*/)
|
||||
{
|
||||
D3D12_DEPTH_STENCIL_DESC depthStencilState;
|
||||
depthStencilState.DepthEnable = enableDepth ? TRUE : FALSE;
|
||||
depthStencilState.DepthWriteMask = D3D12_DEPTH_WRITE_MASK_ALL;
|
||||
depthStencilState.DepthFunc = D3D12_COMPARISON_FUNC_LESS;
|
||||
depthStencilState.StencilEnable = enableStencil ? TRUE : FALSE;
|
||||
depthStencilState.StencilReadMask = D3D12_DEFAULT_STENCIL_READ_MASK;
|
||||
depthStencilState.StencilWriteMask = D3D12_DEFAULT_STENCIL_WRITE_MASK;
|
||||
const D3D12_DEPTH_STENCILOP_DESC defaultStencilOp = {D3D12_STENCIL_OP_KEEP, D3D12_STENCIL_OP_KEEP,
|
||||
D3D12_STENCIL_OP_KEEP, D3D12_COMPARISON_FUNC_ALWAYS};
|
||||
depthStencilState.FrontFace = defaultStencilOp;
|
||||
depthStencilState.BackFace = defaultStencilOp;
|
||||
|
||||
psoDesc.DepthStencilState = depthStencilState;
|
||||
psoDesc.DSVFormat = format;
|
||||
}
|
||||
|
||||
ID3D12Resource* DeviceUtils::createBuffer(uint64_t size, D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initState, const D3D12_HEAP_PROPERTIES& heapProps)
|
||||
{
|
||||
D3D12_RESOURCE_DESC bufDesc = {};
|
||||
bufDesc.Alignment = 0;
|
||||
bufDesc.DepthOrArraySize = 1;
|
||||
bufDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
|
||||
bufDesc.Flags = flags;
|
||||
bufDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
bufDesc.Height = 1;
|
||||
bufDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
|
||||
bufDesc.MipLevels = 1;
|
||||
bufDesc.SampleDesc.Count = 1;
|
||||
bufDesc.SampleDesc.Quality = 0;
|
||||
bufDesc.Width = size;
|
||||
|
||||
ID3D12Resource* pBuffer;
|
||||
HRESULT hr = 0;
|
||||
hr = m_device->CreateCommittedResource(&heapProps, D3D12_HEAP_FLAG_NONE, &bufDesc, initState, nullptr, IID_PPV_ARGS(&pBuffer));
|
||||
if(FAILED(hr))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
ID3D12RootSignature* DeviceUtils::createRootSignature(D3D12_ROOT_SIGNATURE_DESC rootSignatureDesc)
|
||||
{
|
||||
HRESULT hr = 0;
|
||||
|
||||
ID3DBlob* serializedRootSignature;
|
||||
ID3DBlob* error;
|
||||
ID3D12RootSignature* rootSignature;
|
||||
hr = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &serializedRootSignature, &error);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
fprintf(stderr, "Could not serialize root signature: %s\n", (LPCSTR)(error->GetBufferPointer()));
|
||||
error->Release();
|
||||
return nullptr;
|
||||
}
|
||||
hr = m_device->CreateRootSignature(0, serializedRootSignature->GetBufferPointer(),
|
||||
serializedRootSignature->GetBufferSize(), IID_PPV_ARGS(&rootSignature));
|
||||
|
||||
serializedRootSignature->Release();
|
||||
if(FAILED(hr))
|
||||
{
|
||||
fprintf(stderr, "Could not create root signature\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return rootSignature;
|
||||
}
|
||||
|
||||
} // namespace nvdx12
|
||||
102
raytracer/nvpro_core/nvdx12/base_dx12.hpp
Normal file
102
raytracer/nvpro_core/nvdx12/base_dx12.hpp
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2016-2021 NVIDIA CORPORATION
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NV_DX12_BASE_INCLUDED
|
||||
#define NV_DX12_BASE_INCLUDED
|
||||
|
||||
#include <assert.h>
|
||||
#include <d3d12.h>
|
||||
#include <dxgi1_5.h>
|
||||
#include <platform.h>
|
||||
#include <vector>
|
||||
|
||||
/// \todo Detect swap chain size
|
||||
#define D3D12_SWAP_CHAIN_SIZE 3
|
||||
|
||||
namespace nvdx12 {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/** @DOC_START
|
||||
# class nvdx12::DeviceUtils
|
||||
Utility class for simple creation of pipeline states, root signatures,
|
||||
and buffers.
|
||||
-- @DOC_END - */
|
||||
|
||||
|
||||
/** @DOC_START
|
||||
# function nvdx12::transitionBarrier
|
||||
Short-hand function to create a transition barrier
|
||||
-- @DOC_END - */
|
||||
|
||||
|
||||
// Specifies a heap used for uploading. This heap type has CPU access optimized for uploading to the GPU.
|
||||
static const D3D12_HEAP_PROPERTIES uploadHeapProps = {D3D12_HEAP_TYPE_UPLOAD, D3D12_CPU_PAGE_PROPERTY_UNKNOWN,
|
||||
D3D12_MEMORY_POOL_UNKNOWN, 0, 0};
|
||||
|
||||
// Specifies the default heap. This heap type experiences the most bandwidth for the GPU, but cannot provide CPU access.
|
||||
static const D3D12_HEAP_PROPERTIES defaultHeapProps = {D3D12_HEAP_TYPE_DEFAULT, D3D12_CPU_PAGE_PROPERTY_UNKNOWN,
|
||||
D3D12_MEMORY_POOL_UNKNOWN, 0, 0};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
D3D12_RESOURCE_BARRIER transitionBarrier(_In_ ID3D12Resource* pResource,
|
||||
D3D12_RESOURCE_STATES stateBefore,
|
||||
D3D12_RESOURCE_STATES stateAfter,
|
||||
UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
|
||||
D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE);
|
||||
|
||||
struct DeviceUtils
|
||||
{
|
||||
DeviceUtils()
|
||||
: m_device(nullptr)
|
||||
{
|
||||
}
|
||||
DeviceUtils(ID3D12Device* device)
|
||||
: m_device(device)
|
||||
{
|
||||
}
|
||||
|
||||
ID3D12Device* createDevice(IDXGIFactory5* factory);
|
||||
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC createDefaultPipelineDesc(D3D12_INPUT_ELEMENT_DESC* inputDescs,
|
||||
UINT inputCount,
|
||||
ID3D12RootSignature* rootSignature,
|
||||
void* vertexShaderPointer,
|
||||
size_t vertexShaderSize,
|
||||
void* pixelShaderPointer,
|
||||
size_t pixelShaderSize);
|
||||
|
||||
void addDepthStencilTestToPipeline(D3D12_GRAPHICS_PIPELINE_STATE_DESC& desc,
|
||||
bool enableDepth = true,
|
||||
bool enableStencil = false,
|
||||
DXGI_FORMAT format = DXGI_FORMAT_D32_FLOAT);
|
||||
|
||||
ID3D12Resource* createBuffer(uint64_t size, D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initState, const D3D12_HEAP_PROPERTIES& heapProps);
|
||||
|
||||
ID3D12RootSignature* createRootSignature(D3D12_ROOT_SIGNATURE_DESC rootSignatureDesc);
|
||||
|
||||
ID3D12Device* m_device;
|
||||
};
|
||||
|
||||
} // namespace nvdx12
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue