initial work to split into dart_filament and flutter_filament
This commit is contained in:
17
flutter_filament/windows/.gitignore
vendored
Normal file
17
flutter_filament/windows/.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
flutter/
|
||||
|
||||
# Visual Studio user-specific files.
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Visual Studio build-related files.
|
||||
x64/
|
||||
x86/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
283
flutter_filament/windows/CMakeLists.txt
Normal file
283
flutter_filament/windows/CMakeLists.txt
Normal file
@@ -0,0 +1,283 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
set(PROJECT_NAME "flutter_filament")
|
||||
project(${PROJECT_NAME} LANGUAGES C CXX)
|
||||
|
||||
cmake_policy(VERSION 3.14...3.25)
|
||||
|
||||
# This value is used when generating builds using this plugin, so it must
|
||||
# not be changed
|
||||
set(PLUGIN_NAME "flutter_filament_plugin")
|
||||
|
||||
# Any new source files that you add to the plugin should be added here.
|
||||
list(APPEND PLUGIN_SOURCES
|
||||
"flutter_filament_plugin.cpp"
|
||||
"flutter_filament_plugin.h"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneManager.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FlutterFilamentApi.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FlutterFilamentFFIApi.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/TimeIt.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/camutils/Manipulator.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/camutils/Bookmark.cpp"
|
||||
)
|
||||
|
||||
set(USE_ANGLE FALSE)
|
||||
set(WGL_USE_BACKING_WINDOW TRUE)
|
||||
|
||||
if(USE_ANGLE)
|
||||
add_compile_definitions(USE_ANGLE)
|
||||
list(APPEND PLUGIN_SOURCES "flutter_angle_texture.cpp" "egl_context.cpp" )
|
||||
else()
|
||||
if(WGL_USE_BACKING_WINDOW)
|
||||
add_compile_definitions(WGL_USE_BACKING_WINDOW)
|
||||
endif()
|
||||
list(APPEND PLUGIN_SOURCES "wgl_context.cpp" "opengl_texture_buffer.cpp" "backing_window.cpp")
|
||||
# if(WGL_USE_BACKING_WINDOW)
|
||||
# list(APPEND PLUGIN_SOURCES )
|
||||
# else()
|
||||
# list(APPEND PLUGIN_SOURCES )
|
||||
# endif()
|
||||
endif()
|
||||
|
||||
# Define the plugin library target. Its name must not be changed (see comment
|
||||
# on PLUGIN_NAME above).
|
||||
add_library(${PLUGIN_NAME} SHARED
|
||||
"include/flutter_filament/flutter_filament_plugin_c_api.h"
|
||||
"flutter_filament_plugin_c_api.cpp"
|
||||
${PLUGIN_SOURCES}
|
||||
"include/material/image.c"
|
||||
)
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
apply_standard_settings(${PLUGIN_NAME})
|
||||
|
||||
set_target_properties(${PLUGIN_NAME} PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden)
|
||||
target_compile_features(${PLUGIN_NAME} PUBLIC cxx_std_20)
|
||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
|
||||
target_include_directories(${PLUGIN_NAME} INTERFACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||
)
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/filament")
|
||||
|
||||
if(USE_ANGLE)
|
||||
list(APPEND GL_LIBS
|
||||
EGL
|
||||
GLESv2
|
||||
)
|
||||
set(ANGLE_OR_OPENGL_DIR angle)
|
||||
add_library(EGL SHARED IMPORTED)
|
||||
set_property(TARGET EGL PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/angle/libEGL.dll.lib")
|
||||
set_property(TARGET EGL PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/angle/libEGL.dll.lib")
|
||||
set_property(TARGET EGL PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/angle/libEGL.dll.lib")
|
||||
add_library(GLESv2 SHARED IMPORTED)
|
||||
set_property(TARGET GLESv2 PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/angle/libGLESv2.dll.lib")
|
||||
set_property(TARGET GLESv2 PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/angle/libGLESv2.dll.lib")
|
||||
set_property(TARGET GLESv2 PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/angle/libGLESv2.dll.lib")
|
||||
else()
|
||||
list(APPEND GL_LIBS
|
||||
bluegl
|
||||
opengl32
|
||||
dwmapi
|
||||
comctl32
|
||||
)
|
||||
set(ANGLE_OR_OPENGL_DIR opengl)
|
||||
add_library(bluegl SHARED IMPORTED)
|
||||
set_property(TARGET bluegl PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/opengl/bluegl.lib")
|
||||
set_property(TARGET bluegl PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/opengl/bluegl.lib")
|
||||
set_property(TARGET bluegl PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/opengl/bluegl.lib")
|
||||
endif()
|
||||
|
||||
add_library(backend SHARED IMPORTED)
|
||||
set_property(TARGET backend PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/${ANGLE_OR_OPENGL_DIR}/backend.lib")
|
||||
set_property(TARGET backend PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/backend.lib")
|
||||
set_property(TARGET backend PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/backend.lib")
|
||||
|
||||
add_library(geometry SHARED IMPORTED)
|
||||
set_property(TARGET geometry PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/geometry.lib")
|
||||
set_property(TARGET geometry PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/geometry.lib")
|
||||
set_property(TARGET geometry PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/geometry.lib")
|
||||
|
||||
add_library(filament SHARED IMPORTED)
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
set_property(TARGET filament PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/filament.lib")
|
||||
|
||||
add_library(filameshio SHARED IMPORTED)
|
||||
set_property(TARGET filameshio PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filameshio.lib")
|
||||
set_property(TARGET filameshio PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filameshio.lib")
|
||||
set_property(TARGET filameshio PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filameshio.lib")
|
||||
|
||||
add_library(filamat SHARED IMPORTED)
|
||||
set_property(TARGET filamat PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filamat.lib")
|
||||
set_property(TARGET filamat PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filamat.lib")
|
||||
set_property(TARGET filamat PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filamat.lib")
|
||||
|
||||
add_library(utils SHARED IMPORTED)
|
||||
set_property(TARGET utils PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/utils.lib")
|
||||
set_property(TARGET utils PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/utils.lib")
|
||||
set_property(TARGET utils PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/utils.lib")
|
||||
|
||||
add_library(filabridge SHARED IMPORTED)
|
||||
set_property(TARGET filabridge PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filabridge.lib")
|
||||
set_property(TARGET filabridge PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filabridge.lib")
|
||||
set_property(TARGET filabridge PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filabridge.lib")
|
||||
|
||||
add_library(gltfio SHARED IMPORTED)
|
||||
set_property(TARGET gltfio PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/gltfio.lib")
|
||||
set_property(TARGET gltfio PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/gltfio.lib")
|
||||
set_property(TARGET gltfio PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/gltfio.lib")
|
||||
|
||||
add_library(gltfio_core SHARED IMPORTED)
|
||||
set_property(TARGET gltfio_core PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/gltfio_core.lib")
|
||||
set_property(TARGET gltfio_core PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/gltfio_core.lib")
|
||||
set_property(TARGET gltfio_core PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/gltfio_core.lib")
|
||||
|
||||
add_library(image SHARED IMPORTED)
|
||||
set_property(TARGET image PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/image.lib")
|
||||
set_property(TARGET image PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/image.lib")
|
||||
set_property(TARGET image PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/image.lib")
|
||||
|
||||
add_library(imageio STATIC IMPORTED)
|
||||
set_property(TARGET imageio PROPERTY IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/imageio.lib")
|
||||
set_property(TARGET imageio PROPERTY IMPORTED_LOCATION_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/imageio.lib")
|
||||
set_property(TARGET imageio PROPERTY IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/imageio.lib")
|
||||
|
||||
add_library(tinyexr STATIC IMPORTED)
|
||||
set_property(TARGET tinyexr PROPERTY IMPORTED_LOCATION_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/tinyexr.lib")
|
||||
set_property(TARGET tinyexr PROPERTY IMPORTED_LOCATION_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/tinyexr.lib")
|
||||
set_property(TARGET tinyexr PROPERTY IMPORTED_LOCATION_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/tinyexr.lib")
|
||||
|
||||
add_library(camutils SHARED IMPORTED)
|
||||
set_property(TARGET camutils PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/camutils.lib")
|
||||
set_property(TARGET camutils PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/camutils.lib")
|
||||
set_property(TARGET camutils PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/camutils.lib")
|
||||
|
||||
add_library(filaflat SHARED IMPORTED)
|
||||
set_property(TARGET filaflat PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/filaflat.lib")
|
||||
set_property(TARGET filaflat PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filaflat.lib")
|
||||
set_property(TARGET filaflat PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/filaflat.lib")
|
||||
|
||||
add_library(dracodec SHARED IMPORTED)
|
||||
set_property(TARGET dracodec PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/dracodec.lib")
|
||||
set_property(TARGET dracodec PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/dracodec.lib")
|
||||
set_property(TARGET dracodec PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/dracodec.lib")
|
||||
|
||||
add_library(ibl SHARED IMPORTED)
|
||||
set_property(TARGET ibl PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/ibl.lib")
|
||||
set_property(TARGET ibl PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/ibl.lib")
|
||||
set_property(TARGET ibl PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/ibl.lib")
|
||||
|
||||
add_library(ktxreader SHARED IMPORTED)
|
||||
set_property(TARGET ktxreader PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/ktxreader.lib")
|
||||
set_property(TARGET ktxreader PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/ktxreader.lib")
|
||||
set_property(TARGET ktxreader PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/ktxreader.lib")
|
||||
|
||||
add_library(stb SHARED IMPORTED)
|
||||
set_property(TARGET stb PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/stb.lib")
|
||||
set_property(TARGET stb PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/stb.lib")
|
||||
set_property(TARGET stb PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/stb.lib")
|
||||
|
||||
add_library(bluevk SHARED IMPORTED)
|
||||
set_property(TARGET bluevk PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/bluevk.lib")
|
||||
set_property(TARGET bluevk PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/bluevk.lib")
|
||||
set_property(TARGET bluevk PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/bluevk.lib")
|
||||
|
||||
add_library(vkshaders SHARED IMPORTED)
|
||||
set_property(TARGET vkshaders PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/vkshaders.lib")
|
||||
set_property(TARGET vkshaders PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/vkshaders.lib")
|
||||
set_property(TARGET vkshaders PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/vkshaders.lib")
|
||||
|
||||
add_library(uberzlib SHARED IMPORTED)
|
||||
set_property(TARGET uberzlib PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/uberzlib.lib")
|
||||
set_property(TARGET uberzlib PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/uberzlib.lib")
|
||||
set_property(TARGET uberzlib PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/uberzlib.lib")
|
||||
|
||||
add_library(smol-v SHARED IMPORTED)
|
||||
set_property(TARGET smol-v PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/smol-v.lib")
|
||||
set_property(TARGET smol-v PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/smol-v.lib")
|
||||
set_property(TARGET smol-v PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/smol-v.lib")
|
||||
|
||||
add_library(uberarchive SHARED IMPORTED)
|
||||
set_property(TARGET uberarchive PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/${ANGLE_OR_OPENGL_DIR}/uberarchive.lib")
|
||||
set_property(TARGET uberarchive PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/uberarchive.lib")
|
||||
set_property(TARGET uberarchive PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/${ANGLE_OR_OPENGL_DIR}/uberarchive.lib")
|
||||
|
||||
add_library(meshoptimizer SHARED IMPORTED)
|
||||
set_property(TARGET meshoptimizer PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/meshoptimizer.lib")
|
||||
set_property(TARGET meshoptimizer PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/meshoptimizer.lib")
|
||||
set_property(TARGET meshoptimizer PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/meshoptimizer.lib")
|
||||
|
||||
add_library(basis_transcoder SHARED IMPORTED)
|
||||
set_property(TARGET basis_transcoder PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/basis_transcoder.lib")
|
||||
set_property(TARGET basis_transcoder PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/basis_transcoder.lib")
|
||||
set_property(TARGET basis_transcoder PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/basis_transcoder.lib")
|
||||
|
||||
add_library(z SHARED IMPORTED)
|
||||
set_property(TARGET z PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/z.lib")
|
||||
set_property(TARGET z PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/z.lib")
|
||||
set_property(TARGET z PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/z.lib")
|
||||
|
||||
add_library(zstd SHARED IMPORTED)
|
||||
set_property(TARGET zstd PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/zstd.lib")
|
||||
set_property(TARGET zstd PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/zstd.lib")
|
||||
set_property(TARGET zstd PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/zstd.lib")
|
||||
|
||||
add_library(png SHARED IMPORTED)
|
||||
set_property(TARGET png PROPERTY IMPORTED_IMPLIB_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/png.lib")
|
||||
set_property(TARGET png PROPERTY IMPORTED_IMPLIB_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/png.lib")
|
||||
set_property(TARGET png PROPERTY IMPORTED_IMPLIB_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/lib/Release/png.lib")
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../ios/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
)
|
||||
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
flutter
|
||||
flutter_wrapper_plugin
|
||||
gltfio
|
||||
gltfio_core
|
||||
filament
|
||||
backend
|
||||
geometry
|
||||
filamat
|
||||
filabridge
|
||||
camutils
|
||||
filaflat
|
||||
dracodec
|
||||
ibl
|
||||
ktxreader
|
||||
image
|
||||
imageio
|
||||
utils
|
||||
stb
|
||||
uberzlib
|
||||
smol-v
|
||||
uberarchive
|
||||
meshoptimizer
|
||||
geometry
|
||||
basis_transcoder
|
||||
z
|
||||
zstd
|
||||
png
|
||||
tinyexr
|
||||
Shlwapi
|
||||
${GL_LIBS}
|
||||
)
|
||||
|
||||
# List of absolute paths to libraries that should be bundled with the plugin
|
||||
if(USE_ANGLE)
|
||||
set(flutter_filament_bundled_libraries
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/angle/libEGL.dll
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/angle/libGLESv2.dll
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/libc++.dll
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/third_party_abseil-cpp_absl.dll
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug/third_party_zlib.dll
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
|
||||
357
flutter_filament/windows/backing_window.cpp
Normal file
357
flutter_filament/windows/backing_window.cpp
Normal file
@@ -0,0 +1,357 @@
|
||||
#include "backing_window.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <dwmapi.h>
|
||||
#include <ShObjIdl.h>
|
||||
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
#pragma comment(lib, "comctl32.lib")
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
static constexpr auto kClassName = L"FLUTTER_FILAMENT_WINDOW";
|
||||
static constexpr auto kWindowName = L"flutter_filament_window";
|
||||
static bool was_window_hidden_due_to_minimize_ = false;
|
||||
static WPARAM last_wm_size_wparam_ = SIZE_RESTORED;
|
||||
uint64_t last_thread_time_ = 0;
|
||||
static constexpr auto kNativeViewPositionAndShowDelay = 300;
|
||||
|
||||
typedef enum _WINDOWCOMPOSITIONATTRIB {
|
||||
WCA_UNDEFINED = 0,
|
||||
WCA_NCRENDERING_ENABLED = 1,
|
||||
WCA_NCRENDERING_POLICY = 2,
|
||||
WCA_TRANSITIONS_FORCEDISABLED = 3,
|
||||
WCA_ALLOW_NCPAINT = 4,
|
||||
WCA_CAPTION_BUTTON_BOUNDS = 5,
|
||||
WCA_NONCLIENT_RTL_LAYOUT = 6,
|
||||
WCA_FORCE_ICONIC_REPRESENTATION = 7,
|
||||
WCA_EXTENDED_FRAME_BOUNDS = 8,
|
||||
WCA_HAS_ICONIC_BITMAP = 9,
|
||||
WCA_THEME_ATTRIBUTES = 10,
|
||||
WCA_NCRENDERING_EXILED = 11,
|
||||
WCA_NCADORNMENTINFO = 12,
|
||||
WCA_EXCLUDED_FROM_LIVEPREVIEW = 13,
|
||||
WCA_VIDEO_OVERLAY_ACTIVE = 14,
|
||||
WCA_FORCE_ACTIVEWINDOW_APPEARANCE = 15,
|
||||
WCA_DISALLOW_PEEK = 16,
|
||||
WCA_CLOAK = 17,
|
||||
WCA_CLOAKED = 18,
|
||||
WCA_ACCENT_POLICY = 19,
|
||||
WCA_FREEZE_REPRESENTATION = 20,
|
||||
WCA_EVER_UNCLOAKED = 21,
|
||||
WCA_VISUAL_OWNER = 22,
|
||||
WCA_HOLOGRAPHIC = 23,
|
||||
WCA_EXCLUDED_FROM_DDA = 24,
|
||||
WCA_PASSIVEUPDATEMODE = 25,
|
||||
WCA_USEDARKMODECOLORS = 26,
|
||||
WCA_LAST = 27
|
||||
} WINDOWCOMPOSITIONATTRIB;
|
||||
|
||||
typedef struct _WINDOWCOMPOSITIONATTRIBDATA {
|
||||
WINDOWCOMPOSITIONATTRIB Attrib;
|
||||
PVOID pvData;
|
||||
SIZE_T cbData;
|
||||
} WINDOWCOMPOSITIONATTRIBDATA;
|
||||
|
||||
typedef enum _ACCENT_STATE {
|
||||
ACCENT_DISABLED = 0,
|
||||
ACCENT_ENABLE_GRADIENT = 1,
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
|
||||
ACCENT_ENABLE_BLURBEHIND = 3,
|
||||
ACCENT_ENABLE_ACRYLICBLURBEHIND = 4,
|
||||
ACCENT_ENABLE_HOSTBACKDROP = 5,
|
||||
ACCENT_INVALID_STATE = 6
|
||||
} ACCENT_STATE;
|
||||
|
||||
typedef struct _ACCENT_POLICY {
|
||||
ACCENT_STATE AccentState;
|
||||
DWORD AccentFlags;
|
||||
DWORD GradientColor;
|
||||
DWORD AnimationId;
|
||||
} ACCENT_POLICY;
|
||||
|
||||
typedef BOOL(WINAPI* _GetWindowCompositionAttribute)(
|
||||
HWND, WINDOWCOMPOSITIONATTRIBDATA*);
|
||||
typedef BOOL(WINAPI* _SetWindowCompositionAttribute)(
|
||||
HWND, WINDOWCOMPOSITIONATTRIBDATA*);
|
||||
|
||||
static _SetWindowCompositionAttribute g_set_window_composition_attribute = NULL;
|
||||
static bool g_set_window_composition_attribute_initialized = false;
|
||||
|
||||
typedef LONG NTSTATUS, *PNTSTATUS;
|
||||
#define STATUS_SUCCESS (0x00000000)
|
||||
|
||||
typedef NTSTATUS(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||
|
||||
RTL_OSVERSIONINFOW GetWindowsVersion() {
|
||||
HMODULE hmodule = ::GetModuleHandleW(L"ntdll.dll");
|
||||
if (hmodule) {
|
||||
RtlGetVersionPtr rtl_get_version_ptr =
|
||||
(RtlGetVersionPtr)::GetProcAddress(hmodule, "RtlGetVersion");
|
||||
if (rtl_get_version_ptr != nullptr) {
|
||||
RTL_OSVERSIONINFOW rovi = {0};
|
||||
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
||||
if (STATUS_SUCCESS == rtl_get_version_ptr(&rovi)) {
|
||||
return rovi;
|
||||
}
|
||||
}
|
||||
}
|
||||
RTL_OSVERSIONINFOW rovi = {0};
|
||||
return rovi;
|
||||
}
|
||||
|
||||
void SetWindowComposition(HWND window, int32_t accent_state,
|
||||
int32_t gradient_color) {
|
||||
// TODO: Look for a better available API.
|
||||
if (GetWindowsVersion().dwBuildNumber >= 18362) {
|
||||
if (!g_set_window_composition_attribute_initialized) {
|
||||
auto user32 = ::GetModuleHandleA("user32.dll");
|
||||
if (user32) {
|
||||
g_set_window_composition_attribute =
|
||||
reinterpret_cast<_SetWindowCompositionAttribute>(
|
||||
::GetProcAddress(user32, "SetWindowCompositionAttribute"));
|
||||
if (g_set_window_composition_attribute) {
|
||||
g_set_window_composition_attribute_initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
ACCENT_POLICY accent = {static_cast<ACCENT_STATE>(accent_state), 2,
|
||||
static_cast<DWORD>(gradient_color), 0};
|
||||
WINDOWCOMPOSITIONATTRIBDATA data;
|
||||
data.Attrib = WCA_ACCENT_POLICY;
|
||||
data.pvData = &accent;
|
||||
data.cbData = sizeof(accent);
|
||||
g_set_window_composition_attribute(window, &data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK FilamentWindowProc(HWND const window, UINT const message,
|
||||
WPARAM const wparam,
|
||||
LPARAM const lparam) noexcept {
|
||||
switch (message) {
|
||||
case WM_MOUSEMOVE: {
|
||||
TRACKMOUSEEVENT event;
|
||||
event.cbSize = sizeof(event);
|
||||
event.hwndTrack = window;
|
||||
event.dwFlags = TME_HOVER;
|
||||
event.dwHoverTime = 200;
|
||||
auto user_data = ::GetWindowLongPtr(window, GWLP_USERDATA);
|
||||
if (user_data) {
|
||||
HWND flutterRootWindow = reinterpret_cast<HWND>(user_data);
|
||||
::SetForegroundWindow(flutterRootWindow);
|
||||
LONG ex_style = ::GetWindowLong(flutterRootWindow, GWL_EXSTYLE);
|
||||
ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED);
|
||||
::SetWindowLong(flutterRootWindow, GWL_EXSTYLE, ex_style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_ERASEBKGND: {
|
||||
// Prevent erasing of |window| when it is unfocused and minimized or
|
||||
// moved out of screen etc.
|
||||
break;
|
||||
}
|
||||
case WM_SIZE:
|
||||
break;
|
||||
case WM_MOVE:
|
||||
case WM_MOVING:
|
||||
case WM_ACTIVATE:
|
||||
case WM_WINDOWPOSCHANGED: {
|
||||
// NativeViewCore::GetInstance()->SetHitTestBehavior(0);
|
||||
auto user_data = ::GetWindowLongPtr(window, GWLP_USERDATA);
|
||||
if (user_data) {
|
||||
HWND flutterRootWindow = reinterpret_cast<HWND>(user_data);
|
||||
::SetForegroundWindow(flutterRootWindow);
|
||||
// NativeViewCore::GetInstance()->SetHitTestBehavior(0);
|
||||
LONG ex_style = ::GetWindowLong(flutterRootWindow, GWL_EXSTYLE);
|
||||
ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED);
|
||||
::SetWindowLong(flutterRootWindow, GWL_EXSTYLE, ex_style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ::DefWindowProc(window, message, wparam, lparam);
|
||||
}
|
||||
|
||||
BackingWindow::BackingWindow(flutter::PluginRegistrarWindows *pluginRegistrar,
|
||||
int width,
|
||||
int height,
|
||||
int left,
|
||||
int top) : _width(width), _height(height), _left(left), _top(top) {
|
||||
// a Flutter application actually has two windows - the innner window contains the FlutterView.
|
||||
// although we will use the outer window for various events, we always position things relative to the inner window.
|
||||
_flutterViewWindow = pluginRegistrar->GetView()->GetNativeWindow();
|
||||
_flutterRootWindow = ::GetAncestor(_flutterViewWindow, GA_ROOT);
|
||||
|
||||
RECT flutterChildRect;
|
||||
::GetWindowRect(_flutterViewWindow, &flutterChildRect);
|
||||
|
||||
// set composition to allow transparency
|
||||
SetWindowComposition(_flutterRootWindow, 6, 0);
|
||||
|
||||
// register a top-level WindowProcDelegate to handle window events
|
||||
pluginRegistrar->RegisterTopLevelWindowProcDelegate([=](HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam) {
|
||||
switch (message) {
|
||||
case WM_MOUSEMOVE: {
|
||||
break;
|
||||
}
|
||||
case WM_ACTIVATE: {
|
||||
RECT rootWindowRect;
|
||||
::GetWindowRect(_flutterViewWindow, &rootWindowRect);
|
||||
// Position |native_view| such that it's z order is behind |window_| &
|
||||
// redraw aswell.
|
||||
::SetWindowPos(_windowHandle, _flutterRootWindow, rootWindowRect.left + _left,
|
||||
rootWindowRect.top + _top, _width,
|
||||
_height, SWP_NOACTIVATE);
|
||||
break;
|
||||
}
|
||||
case WM_SIZE: {
|
||||
if (wparam != SIZE_RESTORED || last_wm_size_wparam_ == SIZE_MINIMIZED ||
|
||||
last_wm_size_wparam_ == SIZE_MAXIMIZED ||
|
||||
was_window_hidden_due_to_minimize_) {
|
||||
was_window_hidden_due_to_minimize_ = false;
|
||||
// Minimize condition is handled separately inside |WM_WINDOWPOSCHANGED|
|
||||
// case, since we don't want to cause unnecessary redraws (& show/hide)
|
||||
// when user is resizing the window by dragging the window border.
|
||||
SetWindowComposition(_flutterRootWindow, 0, 0);
|
||||
::ShowWindow(_windowHandle, SW_HIDE);
|
||||
last_thread_time_ =
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::system_clock::now().time_since_epoch())
|
||||
.count();
|
||||
std::thread(
|
||||
[=](uint64_t time) {
|
||||
if (time < last_thread_time_) {
|
||||
return;
|
||||
}
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(kNativeViewPositionAndShowDelay));
|
||||
SetWindowComposition(_flutterRootWindow, 6, 0);
|
||||
// Handling SIZE_MINIMIZED separately.
|
||||
if (wparam != SIZE_MINIMIZED) {
|
||||
::ShowWindow(_windowHandle, SW_SHOWNOACTIVATE);
|
||||
}
|
||||
|
||||
RECT flutterViewRect;
|
||||
::GetWindowRect(_flutterViewWindow, &flutterViewRect);
|
||||
::SetWindowPos(_windowHandle, _flutterRootWindow, flutterViewRect.left + _left,
|
||||
flutterViewRect.top + _top, _width, _height,
|
||||
SWP_NOACTIVATE);
|
||||
},
|
||||
last_thread_time_)
|
||||
.detach();
|
||||
}
|
||||
last_wm_size_wparam_ = wparam;
|
||||
break;
|
||||
}
|
||||
case WM_MOVE:
|
||||
case WM_MOVING:
|
||||
case WM_WINDOWPOSCHANGED: {
|
||||
RECT rootWindowRect;
|
||||
::GetWindowRect(_flutterViewWindow, &rootWindowRect);
|
||||
if (rootWindowRect.right - rootWindowRect.left > 0 &&
|
||||
rootWindowRect.bottom - rootWindowRect.top > 0) {
|
||||
::SetWindowPos(_windowHandle, _flutterRootWindow, rootWindowRect.left + _left,
|
||||
rootWindowRect.top + _top, _width,
|
||||
_height, SWP_NOACTIVATE);
|
||||
// |window_| is minimized.
|
||||
if (rootWindowRect.left < 0 && rootWindowRect.top < 0 &&
|
||||
rootWindowRect.right < 0 && rootWindowRect.bottom < 0) {
|
||||
// Hide |native_view_container_| to prevent showing
|
||||
// |native_view_container_| before |window_| placement
|
||||
// i.e when restoring window after clicking the taskbar icon.
|
||||
SetWindowComposition(_flutterRootWindow, 0, 0);
|
||||
::ShowWindow(_windowHandle, SW_HIDE);
|
||||
was_window_hidden_due_to_minimize_ = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_CLOSE: {
|
||||
// close
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
// create the HWND for Filament
|
||||
auto window_class = WNDCLASSEX{};
|
||||
::SecureZeroMemory(&window_class, sizeof(window_class));
|
||||
window_class.cbSize = sizeof(window_class);
|
||||
window_class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
window_class.lpfnWndProc = FilamentWindowProc;
|
||||
window_class.hInstance = 0;
|
||||
window_class.lpszClassName = kClassName;
|
||||
window_class.hCursor = ::LoadCursorW(nullptr, IDC_ARROW);
|
||||
window_class.hbrBackground = ::CreateSolidBrush(0);
|
||||
::RegisterClassExW(&window_class);
|
||||
_windowHandle = ::CreateWindow(kClassName, kWindowName, WS_OVERLAPPEDWINDOW,
|
||||
0, 0, _width, _height, nullptr,
|
||||
nullptr, GetModuleHandle(nullptr), nullptr);
|
||||
|
||||
// Disable DWM animations
|
||||
auto disable_window_transitions = TRUE;
|
||||
DwmSetWindowAttribute(_windowHandle, DWMWA_TRANSITIONS_FORCEDISABLED,
|
||||
&disable_window_transitions,
|
||||
sizeof(disable_window_transitions));
|
||||
|
||||
auto style = ::GetWindowLong(_windowHandle, GWL_STYLE);
|
||||
style &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX |
|
||||
WS_EX_APPWINDOW);
|
||||
::SetWindowLong(_windowHandle, GWL_STYLE, style);
|
||||
|
||||
::SetWindowLongPtr(_windowHandle, GWLP_USERDATA,
|
||||
reinterpret_cast<LONG>(_flutterRootWindow));
|
||||
|
||||
RECT flutterViewRect;
|
||||
::GetWindowRect(_flutterViewWindow, &flutterViewRect);
|
||||
|
||||
::SetWindowPos(_windowHandle, _flutterRootWindow, flutterViewRect.left + _left,
|
||||
flutterViewRect.top + _top, _width, _height,
|
||||
SWP_NOACTIVATE);
|
||||
|
||||
// remove taskbar entry for the window we created
|
||||
ITaskbarList3* taskbar = nullptr;
|
||||
::CoCreateInstance(CLSID_TaskbarList, 0, CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARGS(&taskbar));
|
||||
taskbar->DeleteTab(_windowHandle);
|
||||
taskbar->Release();
|
||||
|
||||
::ShowWindow(_windowHandle, SW_SHOW);
|
||||
::ShowWindow(_flutterViewWindow, SW_SHOW);
|
||||
::SetForegroundWindow(_flutterViewWindow);
|
||||
::SetFocus(_flutterViewWindow);
|
||||
LONG ex_style = ::GetWindowLong(_flutterRootWindow, GWL_EXSTYLE);
|
||||
ex_style &= ~(WS_EX_TRANSPARENT | WS_EX_LAYERED);
|
||||
::SetWindowLong(_flutterRootWindow, GWL_EXSTYLE, ex_style);
|
||||
}
|
||||
|
||||
void BackingWindow::Resize(int width, int height, int left, int top) {
|
||||
_width = width;
|
||||
_height = height;
|
||||
_left = left;
|
||||
_top = top;
|
||||
RECT flutterViewRect;
|
||||
::GetWindowRect(_flutterViewWindow, &flutterViewRect);
|
||||
std::cout << "Resizing to " << _width << " x " << _height << " with LT" << _left << " " << _top << " flutter view rect" << flutterViewRect.left << " " << flutterViewRect.top << " " << flutterViewRect.right << " " << flutterViewRect.bottom << std::endl;
|
||||
|
||||
::SetWindowPos(_windowHandle, _flutterRootWindow, flutterViewRect.left + _left,
|
||||
flutterViewRect.top + _top, _width, _height,
|
||||
SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
HWND BackingWindow::GetHandle() { return _windowHandle; }
|
||||
} // namespace flutter_filament
|
||||
31
flutter_filament/windows/backing_window.h
Normal file
31
flutter_filament/windows/backing_window.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _BACKING_WINDOW_H
|
||||
#define _BACKING_WINDOW_H
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class BackingWindow {
|
||||
public:
|
||||
BackingWindow(
|
||||
flutter::PluginRegistrarWindows *pluginRegistrar,
|
||||
int width,
|
||||
int height,
|
||||
int left,
|
||||
int top);
|
||||
HWND GetHandle();
|
||||
void Resize(int width, int height, int left, int top);
|
||||
private:
|
||||
HWND _windowHandle;
|
||||
HWND _flutterRootWindow;
|
||||
HWND _flutterViewWindow;
|
||||
uint32_t _width = 0;
|
||||
uint32_t _height = 0;
|
||||
uint32_t _left = 0;
|
||||
uint32_t _top = 0;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
200
flutter_filament/windows/egl_context.cpp
Normal file
200
flutter_filament/windows/egl_context.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
|
||||
#include "egl_context.h"
|
||||
|
||||
#define FILAMENT_USE_EXTERNAL_GLES3
|
||||
#include <gl_headers.h>
|
||||
|
||||
#pragma comment(lib, "dwmapi.lib")
|
||||
#pragma comment(lib, "comctl32.lib")
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
FlutterEGLContext::FlutterEGLContext(
|
||||
flutter::PluginRegistrarWindows* pluginRegistrar,
|
||||
flutter::TextureRegistrar* textureRegistrar) : FlutterRenderContext(pluginRegistrar, textureRegistrar) {
|
||||
|
||||
_platform = new filament::backend::PlatformEGL();
|
||||
|
||||
// D3D starts here
|
||||
IDXGIAdapter *adapter_ = nullptr;
|
||||
|
||||
// first, we need to initialize the D3D device and create the backing texture
|
||||
// this has been taken from
|
||||
// https://github.com/alexmercerind/flutter-windows-ANGLE-OpenGL-ES/blob/master/windows/angle_surface_manager.cc
|
||||
auto feature_levels = {
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
};
|
||||
// NOTE: Not enabling DirectX 12.
|
||||
// |D3D11CreateDevice| crashes directly on Windows 7.
|
||||
// D3D_FEATURE_LEVEL_12_2, D3D_FEATURE_LEVEL_12_1, D3D_FEATURE_LEVEL_12_0,
|
||||
// D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1,
|
||||
// D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3,
|
||||
IDXGIFactory *dxgi = nullptr;
|
||||
::CreateDXGIFactory(__uuidof(IDXGIFactory), (void **)&dxgi);
|
||||
// Manually selecting adapter. As far as my experience goes, this is the
|
||||
// safest approach. Passing NULL (so-called default) seems to cause issues
|
||||
// on Windows 7 or maybe some older graphics drivers.
|
||||
// First adapter is the default.
|
||||
// |D3D_DRIVER_TYPE_UNKNOWN| must be passed with manual adapter selection.
|
||||
dxgi->EnumAdapters(0, &adapter_);
|
||||
dxgi->Release();
|
||||
if (!adapter_) {
|
||||
std::cout << "Failed to locate default D3D adapter" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
DXGI_ADAPTER_DESC adapter_desc_;
|
||||
adapter_->GetDesc(&adapter_desc_);
|
||||
std::wcout << L"D3D adapter description: " << adapter_desc_.Description
|
||||
<< std::endl;
|
||||
|
||||
auto hr = ::D3D11CreateDevice(
|
||||
adapter_, D3D_DRIVER_TYPE_UNKNOWN, 0, 0, feature_levels.begin(),
|
||||
static_cast<UINT>(feature_levels.size()), D3D11_SDK_VERSION,
|
||||
&_D3D11Device, 0, &_D3D11DeviceContext);
|
||||
|
||||
if (FAILED(hr)) {
|
||||
std::cout << "Failed to create D3D device" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device = nullptr;
|
||||
auto dxgi_device_success = _D3D11Device->QueryInterface(
|
||||
__uuidof(IDXGIDevice), (void **)&dxgi_device);
|
||||
if (SUCCEEDED(dxgi_device_success) && dxgi_device != nullptr) {
|
||||
dxgi_device->SetGPUThreadPriority(5); // Must be in interval [-7, 7].
|
||||
}
|
||||
auto level = _D3D11Device->GetFeatureLevel();
|
||||
std::cout << "media_kit: ANGLESurfaceManager: Direct3D Feature Level: "
|
||||
<< (((unsigned)level) >> 12) << "_"
|
||||
<< ((((unsigned)level) >> 8) & 0xf) << std::endl;
|
||||
|
||||
// *******************
|
||||
// * *
|
||||
// * *
|
||||
// * EGL starts here *
|
||||
// * *
|
||||
// * *
|
||||
// * *
|
||||
// *******************
|
||||
EGLBoolean bindAPI = eglBindAPI(EGL_OPENGL_ES_API);
|
||||
if (UTILS_UNLIKELY(!bindAPI)) {
|
||||
std::cout << "eglBindAPI EGL_OPENGL_ES_API failed" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
_eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
assert_invariant(_eglDisplay != EGL_NO_DISPLAY);
|
||||
|
||||
EGLint major, minor;
|
||||
EGLBoolean initialized = false;
|
||||
|
||||
EGLDeviceEXT eglDevice;
|
||||
EGLint numDevices;
|
||||
|
||||
if (auto *getPlatformDisplay =
|
||||
reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(
|
||||
eglGetProcAddress("eglGetPlatformDisplayEXT"))) {
|
||||
|
||||
EGLint kD3D11DisplayAttributes[] = {
|
||||
EGL_PLATFORM_ANGLE_TYPE_ANGLE,
|
||||
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE,
|
||||
EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE,
|
||||
EGL_TRUE,
|
||||
EGL_NONE,
|
||||
};
|
||||
_eglDisplay = getPlatformDisplay(
|
||||
EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, kD3D11DisplayAttributes);
|
||||
initialized = eglInitialize(_eglDisplay, &major, &minor);
|
||||
}
|
||||
|
||||
std::cout << "Got major " << major << " and minor " << minor << std::endl;
|
||||
|
||||
if (UTILS_UNLIKELY(!initialized)) {
|
||||
std::cout << "eglInitialize failed" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
glext::importGLESExtensionsEntryPoints();
|
||||
|
||||
EGLint configsCount;
|
||||
|
||||
EGLint configAttribs[] = {EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8, EGL_DEPTH_SIZE, 24,
|
||||
EGL_STENCIL_SIZE, 8, EGL_ALPHA_SIZE, 8,
|
||||
EGL_NONE};
|
||||
|
||||
EGLint contextAttribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE,
|
||||
EGL_NONE, // reserved for EGL_CONTEXT_OPENGL_NO_ERROR_KHR below
|
||||
EGL_NONE};
|
||||
|
||||
// find an opaque config
|
||||
if (!eglChooseConfig(_eglDisplay, configAttribs, &_eglConfig, 1,
|
||||
&configsCount)) {
|
||||
std::cout << "Failed to find EGL config" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
auto ctx = eglCreateContext(_eglDisplay, _eglConfig, EGL_NO_CONTEXT,contextAttribs);
|
||||
_context = (void*)ctx;
|
||||
|
||||
if (UTILS_UNLIKELY(_context == EGL_NO_CONTEXT)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterEGLContext::CreateRenderingSurface(
|
||||
uint32_t width, uint32_t height,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result,
|
||||
uint32_t left, uint32_t top
|
||||
) {
|
||||
|
||||
glext::importGLESExtensionsEntryPoints();
|
||||
|
||||
if(left != 0 || top != 0) {
|
||||
result->Error("ERROR",
|
||||
"Rendering with EGL uses a Texture render target/Flutter widget and does not need a window offset.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_active.get()) {
|
||||
result->Error("ERROR",
|
||||
"Texture already exists. You must call destroyTexture before "
|
||||
"attempting to create a new one.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<FlutterTextureBuffer> active = std::make_unique<FlutterAngleTexture>(
|
||||
_pluginRegistrar, _textureRegistrar, std::move(result), width, height,
|
||||
_D3D11Device, _D3D11DeviceContext, _eglConfig, _eglDisplay, _context,
|
||||
[=](size_t width, size_t height) {
|
||||
std::cout << "RESIZE" << std::endl;
|
||||
std::vector<int64_t> list;
|
||||
list.push_back((int64_t)width);
|
||||
list.push_back((int64_t)height);
|
||||
// auto val = std::make_unique<flutter::EncodableValue>(list);
|
||||
// this->_channel->InvokeMethod("resize", std::move(val), nullptr);
|
||||
});
|
||||
_active = std::move(active);
|
||||
|
||||
}
|
||||
|
||||
void FlutterEGLContext::RenderCallback() {
|
||||
if(_active.get()) {
|
||||
((FlutterAngleTexture*)_active.get())->RenderCallback();
|
||||
}
|
||||
}
|
||||
|
||||
void* FlutterEGLContext::GetSharedContext() {
|
||||
return (void*)_context;
|
||||
}
|
||||
|
||||
void* FlutterEGLContext::GetPlatform() {
|
||||
return (void*)_platform;
|
||||
}
|
||||
|
||||
}
|
||||
36
flutter_filament/windows/egl_context.h
Normal file
36
flutter_filament/windows/egl_context.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef _EGL_CONTEXT_H
|
||||
#define _EGL_CONTEXT_H
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
#include <flutter/texture_registrar.h>
|
||||
|
||||
#include "flutter_angle_texture.h"
|
||||
#include "backend/platforms/PlatformEGL.h"
|
||||
#include "flutter_render_context.h"
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class FlutterEGLContext : public FlutterRenderContext {
|
||||
public:
|
||||
FlutterEGLContext(flutter::PluginRegistrarWindows* pluginRegistrar, flutter::TextureRegistrar* textureRegistrar);
|
||||
void* GetSharedContext();
|
||||
void RenderCallback();
|
||||
void* GetPlatform();
|
||||
void CreateRenderingSurface(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result, uint32_t left, uint32_t top );
|
||||
|
||||
private:
|
||||
void* _context = nullptr;
|
||||
EGLConfig _eglConfig = NULL;
|
||||
EGLDisplay _eglDisplay = NULL;
|
||||
ID3D11Device* _D3D11Device = nullptr;
|
||||
ID3D11DeviceContext* _D3D11DeviceContext = nullptr;
|
||||
filament::backend::Platform* _platform = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
243
flutter_filament/windows/flutter_angle_texture.cpp
Normal file
243
flutter_filament/windows/flutter_angle_texture.cpp
Normal file
@@ -0,0 +1,243 @@
|
||||
#include "flutter_angle_texture.h"
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
#include <flutter/texture_registrar.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
static void logEglError(const char *name) noexcept {
|
||||
const char *err;
|
||||
switch (eglGetError()) {
|
||||
case EGL_NOT_INITIALIZED:
|
||||
err = "EGL_NOT_INITIALIZED";
|
||||
break;
|
||||
case EGL_BAD_ACCESS:
|
||||
err = "EGL_BAD_ACCESS";
|
||||
break;
|
||||
case EGL_BAD_ALLOC:
|
||||
err = "EGL_BAD_ALLOC";
|
||||
break;
|
||||
case EGL_BAD_ATTRIBUTE:
|
||||
err = "EGL_BAD_ATTRIBUTE";
|
||||
break;
|
||||
case EGL_BAD_CONTEXT:
|
||||
err = "EGL_BAD_CONTEXT";
|
||||
break;
|
||||
case EGL_BAD_CONFIG:
|
||||
err = "EGL_BAD_CONFIG";
|
||||
break;
|
||||
case EGL_BAD_CURRENT_SURFACE:
|
||||
err = "EGL_BAD_CURRENT_SURFACE";
|
||||
break;
|
||||
case EGL_BAD_DISPLAY:
|
||||
err = "EGL_BAD_DISPLAY";
|
||||
break;
|
||||
case EGL_BAD_SURFACE:
|
||||
err = "EGL_BAD_SURFACE";
|
||||
break;
|
||||
case EGL_BAD_MATCH:
|
||||
err = "EGL_BAD_MATCH";
|
||||
break;
|
||||
case EGL_BAD_PARAMETER:
|
||||
err = "EGL_BAD_PARAMETER";
|
||||
break;
|
||||
case EGL_BAD_NATIVE_PIXMAP:
|
||||
err = "EGL_BAD_NATIVE_PIXMAP";
|
||||
break;
|
||||
case EGL_BAD_NATIVE_WINDOW:
|
||||
err = "EGL_BAD_NATIVE_WINDOW";
|
||||
break;
|
||||
case EGL_CONTEXT_LOST:
|
||||
err = "EGL_CONTEXT_LOST";
|
||||
break;
|
||||
default:
|
||||
err = "unknown";
|
||||
break;
|
||||
}
|
||||
std::cout << name << " failed with " << err << std::endl;
|
||||
}
|
||||
|
||||
void FlutterAngleTexture::RenderCallback() {
|
||||
glFinish();
|
||||
_D3D11DeviceContext->CopyResource(_externalD3DTexture2D.Get(),
|
||||
_internalD3DTexture2D.Get());
|
||||
_D3D11DeviceContext->Flush();
|
||||
}
|
||||
|
||||
FlutterAngleTexture::~FlutterAngleTexture() {
|
||||
if (_eglDisplay != EGL_NO_DISPLAY && _eglSurface != EGL_NO_SURFACE) {
|
||||
eglReleaseTexImage(_eglDisplay, _eglSurface, EGL_BACK_BUFFER);
|
||||
}
|
||||
auto success = eglDestroySurface(this->_eglDisplay, this->_eglSurface);
|
||||
if(success != EGL_TRUE) {
|
||||
std::cout << "Failed to destroy EGL Surface" << std::endl;
|
||||
}
|
||||
_internalD3DTexture2D->Release();
|
||||
_externalD3DTexture2D->Release();
|
||||
glDeleteTextures(1, &this->glTextureId);
|
||||
}
|
||||
|
||||
FlutterAngleTexture::FlutterAngleTexture(
|
||||
flutter::PluginRegistrarWindows *pluginRegistrar,
|
||||
flutter::TextureRegistrar *textureRegistrar,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result,
|
||||
uint32_t width, uint32_t height, ID3D11Device *D3D11Device,
|
||||
ID3D11DeviceContext *D3D11DeviceContext, EGLConfig eglConfig,
|
||||
EGLDisplay eglDisplay, EGLContext eglContext,
|
||||
std::function<void(size_t, size_t)> onResizeRequested
|
||||
)
|
||||
: _pluginRegistrar(pluginRegistrar), _textureRegistrar(textureRegistrar),
|
||||
_width(width), _height(height), _D3D11Device(D3D11Device),
|
||||
_D3D11DeviceContext(D3D11DeviceContext), _eglConfig(eglConfig),
|
||||
_eglDisplay(eglDisplay), _eglContext(eglContext), _onResizeRequested(onResizeRequested) {
|
||||
|
||||
auto d3d11_texture2D_desc = D3D11_TEXTURE2D_DESC{0};
|
||||
d3d11_texture2D_desc.Width = width;
|
||||
d3d11_texture2D_desc.Height = height;
|
||||
d3d11_texture2D_desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
d3d11_texture2D_desc.MipLevels = 1;
|
||||
d3d11_texture2D_desc.ArraySize = 1;
|
||||
d3d11_texture2D_desc.SampleDesc.Count = 1;
|
||||
d3d11_texture2D_desc.SampleDesc.Quality = 0;
|
||||
d3d11_texture2D_desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
d3d11_texture2D_desc.BindFlags =
|
||||
D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
|
||||
d3d11_texture2D_desc.CPUAccessFlags = 0;
|
||||
d3d11_texture2D_desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED;
|
||||
|
||||
// create internal texture
|
||||
auto hr = _D3D11Device->CreateTexture2D(&d3d11_texture2D_desc, nullptr,
|
||||
&_internalD3DTexture2D);
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR", "Failed to create D3D texture", nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
auto resource = Microsoft::WRL::ComPtr<IDXGIResource>{};
|
||||
hr = _internalD3DTexture2D.As(&resource);
|
||||
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR", "Failed to create D3D texture", nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
hr = resource->GetSharedHandle(&_internalD3DTextureHandle);
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR", "Failed to get shared handle to D3D texture",
|
||||
nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
_internalD3DTexture2D->AddRef();
|
||||
|
||||
std::cout << "Created internal D3D texture" << std::endl;
|
||||
|
||||
// external
|
||||
hr = _D3D11Device->CreateTexture2D(&d3d11_texture2D_desc, nullptr,
|
||||
&_externalD3DTexture2D);
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR", "Failed to create D3D texture", nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
hr = _externalD3DTexture2D.As(&resource);
|
||||
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR", "Failed to create D3D texture", nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
hr = resource->GetSharedHandle(&_externalD3DTextureHandle);
|
||||
if FAILED (hr) {
|
||||
result->Error("ERROR",
|
||||
"Failed to get shared handle to external D3D texture",
|
||||
nullptr);
|
||||
return;
|
||||
;
|
||||
}
|
||||
_externalD3DTexture2D->AddRef();
|
||||
|
||||
std::cout << "Created external D3D texture" << std::endl;
|
||||
|
||||
EGLint pbufferAttribs[] = {
|
||||
EGL_WIDTH, width, EGL_HEIGHT, height,
|
||||
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, EGL_TEXTURE_FORMAT, EGL_TEXTURE_RGBA,
|
||||
EGL_NONE,
|
||||
};
|
||||
|
||||
_eglSurface = eglCreatePbufferFromClientBuffer(
|
||||
_eglDisplay, EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
|
||||
_internalD3DTextureHandle, _eglConfig, pbufferAttribs);
|
||||
|
||||
if (!eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext)) {
|
||||
// eglMakeCurrent failed
|
||||
logEglError("eglMakeCurrent");
|
||||
return;
|
||||
}
|
||||
|
||||
glGenTextures(1, &glTextureId);
|
||||
|
||||
if (glTextureId == 0) {
|
||||
std::cout
|
||||
<< "Failed to generate OpenGL texture for ANGLE, OpenGL err was %d",
|
||||
glGetError();
|
||||
return;
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, glTextureId);
|
||||
eglBindTexImage(_eglDisplay, _eglSurface, EGL_BACK_BUFFER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
// clearGlError
|
||||
GLenum const error = glGetError();
|
||||
if (error != GL_NO_ERROR) {
|
||||
std::cout << "Ignoring pending GL error " << error << std::endl;
|
||||
}
|
||||
char const *version;
|
||||
|
||||
version = (char const *)glGetString(GL_VERSION);
|
||||
std::cout << "Got version " << version << std::endl;
|
||||
|
||||
EGLint major, minor;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &major);
|
||||
glGetIntegerv(GL_MINOR_VERSION, &minor);
|
||||
|
||||
_textureDescriptor = std::make_unique<FlutterDesktopGpuSurfaceDescriptor>();
|
||||
_textureDescriptor->struct_size = sizeof(FlutterDesktopGpuSurfaceDescriptor);
|
||||
_textureDescriptor->handle = _externalD3DTextureHandle;
|
||||
_textureDescriptor->width = _textureDescriptor->visible_width = width;
|
||||
_textureDescriptor->height = _textureDescriptor->visible_height = height;
|
||||
_textureDescriptor->release_context = nullptr;
|
||||
_textureDescriptor->release_callback = [](void *release_context) {
|
||||
|
||||
};
|
||||
_textureDescriptor->format = kFlutterDesktopPixelFormatBGRA8888;
|
||||
|
||||
texture =
|
||||
std::make_unique<flutter::TextureVariant>(flutter::GpuSurfaceTexture(
|
||||
kFlutterDesktopGpuSurfaceTypeDxgiSharedHandle,
|
||||
[&](size_t width, size_t height) {
|
||||
if(width != this->_width || height != this->_height) {
|
||||
this->_onResizeRequested(width, height);
|
||||
}
|
||||
return _textureDescriptor.get();
|
||||
}));
|
||||
|
||||
flutterTextureId = _textureRegistrar->RegisterTexture(texture.get());
|
||||
std::cout << "Registered Flutter texture ID " << flutterTextureId
|
||||
<< std::endl;
|
||||
|
||||
std::vector<flutter::EncodableValue> resultList;
|
||||
resultList.push_back(flutter::EncodableValue(flutterTextureId));
|
||||
resultList.push_back(flutter::EncodableValue((int64_t) nullptr));
|
||||
resultList.push_back(flutter::EncodableValue(glTextureId));
|
||||
resultList.push_back(flutter::EncodableValue((int64_t) eglContext));
|
||||
result->Success(resultList);
|
||||
}
|
||||
|
||||
} // namespace flutter_filament
|
||||
80
flutter_filament/windows/flutter_angle_texture.h
Normal file
80
flutter_filament/windows/flutter_angle_texture.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef _FLUTTER_ANGLE_TEXTURE_H
|
||||
#define _FLUTTER_ANGLE_TEXTURE_H
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <flutter/texture_registrar.h>
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
|
||||
#include <d3d.h>
|
||||
#include <d3d11.h>
|
||||
|
||||
#include "EGL/egl.h"
|
||||
#include "EGL/eglext.h"
|
||||
#include "EGL/eglplatform.h"
|
||||
#include "GLES2/gl2.h"
|
||||
#include "GLES2/gl2ext.h"
|
||||
#include <GLES3/gl31.h>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <wrl.h>
|
||||
|
||||
#include "flutter_texture_buffer.h"
|
||||
|
||||
typedef uint32_t GLuint;
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class FlutterAngleTexture : public FlutterTextureBuffer {
|
||||
public:
|
||||
FlutterAngleTexture(
|
||||
flutter::PluginRegistrarWindows* pluginRegistrar,
|
||||
flutter::TextureRegistrar* textureRegistrar,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
ID3D11Device* D3D11Device,
|
||||
ID3D11DeviceContext* D3D11DeviceContext,
|
||||
EGLConfig eglConfig,
|
||||
EGLDisplay eglDisplay,
|
||||
EGLContext eglContext,
|
||||
std::function<void(size_t, size_t)> onResizeRequested
|
||||
);
|
||||
~FlutterAngleTexture();
|
||||
|
||||
void RenderCallback();
|
||||
|
||||
GLuint glTextureId = 0;
|
||||
std::unique_ptr<flutter::TextureVariant> texture;
|
||||
|
||||
private:
|
||||
flutter::PluginRegistrarWindows* _pluginRegistrar;
|
||||
flutter::TextureRegistrar* _textureRegistrar;
|
||||
uint32_t _width = 0;
|
||||
uint32_t _height = 0;
|
||||
bool logged = false;
|
||||
std::function<void(size_t, size_t)> _onResizeRequested;
|
||||
|
||||
// Device
|
||||
ID3D11Device* _D3D11Device = nullptr;
|
||||
ID3D11DeviceContext* _D3D11DeviceContext = nullptr;
|
||||
// Texture objects/shared handles
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> _externalD3DTexture2D;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> _internalD3DTexture2D;
|
||||
HANDLE _externalD3DTextureHandle = nullptr;
|
||||
HANDLE _internalD3DTextureHandle = nullptr;
|
||||
|
||||
EGLDisplay _eglDisplay = EGL_NO_DISPLAY;
|
||||
EGLContext _eglContext = EGL_NO_CONTEXT;
|
||||
EGLConfig _eglConfig = EGL_NO_CONFIG_KHR;
|
||||
EGLSurface _eglSurface = EGL_NO_SURFACE;
|
||||
|
||||
std::unique_ptr<FlutterDesktopGpuSurfaceDescriptor> _textureDescriptor = nullptr;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif // _FLUTTER_ANGLE_TEXTURE
|
||||
270
flutter_filament/windows/flutter_filament_plugin.cpp
Normal file
270
flutter_filament/windows/flutter_filament_plugin.cpp
Normal file
@@ -0,0 +1,270 @@
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
|
||||
#include "flutter_filament_plugin.h"
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
#include <flutter/texture_registrar.h>
|
||||
|
||||
#include <codecvt>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <map>
|
||||
#include <math.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
#include "FlutterFilamentApi.h"
|
||||
|
||||
#include "flutter_render_context.h"
|
||||
|
||||
#if USE_ANGLE
|
||||
#include "egl_context.h"
|
||||
#else
|
||||
#include "wgl_context.h"
|
||||
#endif
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
|
||||
void FlutterFilamentPlugin::RegisterWithRegistrar(
|
||||
flutter::PluginRegistrarWindows *registrar) {
|
||||
auto channel =
|
||||
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
|
||||
registrar->messenger(), "app.polyvox.filament/event",
|
||||
&flutter::StandardMethodCodec::GetInstance());
|
||||
|
||||
auto plugin = std::make_unique<FlutterFilamentPlugin>(
|
||||
registrar->texture_registrar(), registrar, channel);
|
||||
|
||||
registrar->AddPlugin(std::move(plugin));
|
||||
}
|
||||
|
||||
FlutterFilamentPlugin::FlutterFilamentPlugin(
|
||||
flutter::TextureRegistrar *textureRegistrar,
|
||||
flutter::PluginRegistrarWindows *pluginRegistrar,
|
||||
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>> &channel)
|
||||
: _textureRegistrar(textureRegistrar), _pluginRegistrar(pluginRegistrar),
|
||||
_channel(std::move(channel)) {
|
||||
|
||||
// attach the method call handler for incoming messages
|
||||
_channel->SetMethodCallHandler([=](const auto &call, auto result) {
|
||||
std::cout << call.method_name() << std::endl;
|
||||
this->HandleMethodCall(call, std::move(result));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
FlutterFilamentPlugin::~FlutterFilamentPlugin() {}
|
||||
|
||||
ResourceBuffer FlutterFilamentPlugin::loadResource(const char *name) {
|
||||
|
||||
std::string name_str(name);
|
||||
std::filesystem::path targetFilePath;
|
||||
|
||||
if (name_str.rfind("file://", 0) == 0) {
|
||||
targetFilePath = name_str.substr(7);
|
||||
} else {
|
||||
|
||||
if (name_str.rfind("asset://", 0) == 0) {
|
||||
name_str = name_str.substr(8);
|
||||
}
|
||||
|
||||
TCHAR pBuf[512];
|
||||
size_t len = sizeof(pBuf);
|
||||
int bytes = GetModuleFileName(NULL, pBuf, len);
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring assetPath = converter.from_bytes(name_str.c_str());
|
||||
|
||||
std::wstring exePathBuf(pBuf);
|
||||
std::filesystem::path exePath(exePathBuf);
|
||||
auto exeDir = exePath.remove_filename();
|
||||
targetFilePath = exeDir.wstring() + L"data/flutter_assets/" + assetPath;
|
||||
}
|
||||
std::streampos length;
|
||||
|
||||
std::ifstream is(targetFilePath.c_str(), std::ios::binary);
|
||||
if (!is) {
|
||||
std::cout << "Failed to find resource at file path " << targetFilePath
|
||||
<< std::endl;
|
||||
return ResourceBuffer(nullptr, 0, -1);
|
||||
}
|
||||
is.seekg(0, std::ios::end);
|
||||
length = is.tellg();
|
||||
|
||||
char *buffer;
|
||||
buffer = new char[length];
|
||||
is.seekg(0, std::ios::beg);
|
||||
is.read(buffer, length);
|
||||
is.close();
|
||||
auto id = _resources.size();
|
||||
auto rb = ResourceBuffer(buffer, length, id);
|
||||
_resources.emplace(id, rb);
|
||||
|
||||
std::wcout << "Loaded resource of length " << length << " from path "
|
||||
<< targetFilePath << std::endl;
|
||||
|
||||
return rb;
|
||||
}
|
||||
|
||||
void FlutterFilamentPlugin::freeResource(ResourceBuffer rbuf) {
|
||||
free((void *)rbuf.data);
|
||||
}
|
||||
|
||||
static ResourceBuffer _loadResource(const char *path, void *const plugin) {
|
||||
return ((FlutterFilamentPlugin *)plugin)->loadResource(path);
|
||||
}
|
||||
|
||||
static void _freeResource(ResourceBuffer rbf, void *const plugin) {
|
||||
((FlutterFilamentPlugin *)plugin)->freeResource(rbf);
|
||||
}
|
||||
|
||||
// this is the C-style function that will be returned via getRenderCallback
|
||||
// called on every frame by the FFI API
|
||||
// this is just a convenient wrapper to call RenderCallback on the actual plugin
|
||||
// instance
|
||||
void render_callback(void *owner) {
|
||||
((FlutterFilamentPlugin *)owner)->RenderCallback();
|
||||
}
|
||||
|
||||
// this is the method on FlutterFilamentPlugin that will copy between D3D
|
||||
// textures
|
||||
void FlutterFilamentPlugin::RenderCallback() {
|
||||
if (_context) {
|
||||
auto flutterTextureId = _context->GetFlutterTextureId();
|
||||
if(flutterTextureId == -1) {
|
||||
std::cout << "Bad texture" << std::endl;
|
||||
return;
|
||||
}
|
||||
#ifdef USE_ANGLE
|
||||
_context->RenderCallback();
|
||||
#endif
|
||||
#if !WGL_USE_BACKING_WINDOW
|
||||
_textureRegistrar->MarkTextureFrameAvailable(flutterTextureId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void FlutterFilamentPlugin::CreateTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
||||
|
||||
const auto *args =
|
||||
std::get_if<flutter::EncodableList>(methodCall.arguments());
|
||||
|
||||
double dWidth = *(std::get_if<double>(&(args->at(0))));
|
||||
double dHeight = *(std::get_if<double>(&(args->at(1))));
|
||||
double dLeft = *(std::get_if<double>(&(args->at(2))));
|
||||
double dTop = *(std::get_if<double>(&(args->at(3))));
|
||||
auto width = (uint32_t)round(dWidth );
|
||||
auto height = (uint32_t)round(dHeight );
|
||||
auto left = (uint32_t)round(dLeft );
|
||||
auto top = (uint32_t)round(dTop );
|
||||
|
||||
std::cout << "Using " << width << "x" << height << std::endl;
|
||||
|
||||
// create a single shared context for the life of the application
|
||||
// this will be used to create a backing texture and passed to Filament
|
||||
if (!_context) {
|
||||
#ifdef USE_ANGLE
|
||||
_context = std::make_unique<FlutterEGLContext>(_pluginRegistrar, _textureRegistrar);
|
||||
#else
|
||||
_context = std::make_unique<WGLContext>(_pluginRegistrar, _textureRegistrar);
|
||||
#endif
|
||||
}
|
||||
_context->CreateRenderingSurface(width, height, std::move(result), left, top);
|
||||
}
|
||||
|
||||
void FlutterFilamentPlugin::DestroyTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
||||
|
||||
const auto *flutterTextureId = std::get_if<int64_t>(methodCall.arguments());
|
||||
|
||||
if (!flutterTextureId) {
|
||||
result->Error("NOT_IMPLEMENTED", "Flutter texture ID must be provided");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_context) {
|
||||
_context->DestroyTexture(std::move(result));
|
||||
}
|
||||
else {
|
||||
result->Error("NO_CONTEXT", "No rendering context is active");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FlutterFilamentPlugin::HandleMethodCall(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
||||
|
||||
if (methodCall.method_name() == "usesBackingWindow") {
|
||||
result->Success(flutter::EncodableValue(
|
||||
#ifdef WGL_USE_BACKING_WINDOW
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
));
|
||||
} else if (methodCall.method_name() == "getResourceLoaderWrapper") {
|
||||
const ResourceLoaderWrapper *const resourceLoader =
|
||||
new ResourceLoaderWrapper(_loadResource, _freeResource, this);
|
||||
result->Success(flutter::EncodableValue((int64_t)resourceLoader));
|
||||
} else if (methodCall.method_name() == "resizeWindow") {
|
||||
#if WGL_USE_BACKING_WINDOW
|
||||
const auto *args =
|
||||
std::get_if<flutter::EncodableList>(methodCall.arguments());
|
||||
double dWidth = *(std::get_if<double>(&(args->at(0))));
|
||||
double dHeight = *(std::get_if<double>(&(args->at(1))));
|
||||
double dLeft = *(std::get_if<double>(&(args->at(2))));
|
||||
double dTop = *(std::get_if<double>(&(args->at(3))));
|
||||
auto width = (uint32_t)round(dWidth );
|
||||
auto height = (uint32_t)round(dHeight );
|
||||
auto left = (uint32_t)round(dLeft );
|
||||
auto top = (uint32_t)round(dTop );
|
||||
_context->ResizeRenderingSurface(width, height, left, top);
|
||||
result->Success();
|
||||
#else
|
||||
result->Error("ERROR", "resizeWindow is only available when using a backing window");
|
||||
#endif
|
||||
} else if (methodCall.method_name() == "createTexture") {
|
||||
CreateTexture(methodCall, std::move(result));
|
||||
} else if (methodCall.method_name() == "destroyTexture") {
|
||||
DestroyTexture(methodCall, std::move(result));
|
||||
} else if (methodCall.method_name() == "getRenderCallback") {
|
||||
flutter::EncodableList resultList;
|
||||
#if !ANGLE && WGL_USE_BACKING_WINDOW
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)nullptr));
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)nullptr));
|
||||
#else
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)&render_callback));
|
||||
resultList.push_back(flutter::EncodableValue((int64_t)this));
|
||||
#endif
|
||||
result->Success(resultList);
|
||||
} else if (methodCall.method_name() == "getDriverPlatform") {
|
||||
#ifdef USE_ANGLE
|
||||
result->Success(flutter::EncodableValue((int64_t)_context->GetPlatform()));
|
||||
#else
|
||||
result->Success(flutter::EncodableValue((int64_t) nullptr));
|
||||
#endif
|
||||
} else {
|
||||
result->Error("NOT_IMPLEMENTED", "Method is not implemented %s",
|
||||
methodCall.method_name());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace flutter_filament
|
||||
71
flutter_filament/windows/flutter_filament_plugin.h
Normal file
71
flutter_filament/windows/flutter_filament_plugin.h
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef FLUTTER_PLUGIN_FLUTTER_FILAMENT_PLUGIN_H_
|
||||
#define FLUTTER_PLUGIN_FLUTTER_FILAMENT_PLUGIN_H_
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <wrl.h>
|
||||
|
||||
#include "GL/GL.h"
|
||||
#include "GL/GLu.h"
|
||||
|
||||
#include "FlutterFilamentApi.h"
|
||||
|
||||
#if USE_ANGLE
|
||||
#include "egl_context.h"
|
||||
#else
|
||||
#include "wgl_context.h"
|
||||
#endif
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class FlutterFilamentPlugin : public flutter::Plugin {
|
||||
public:
|
||||
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar);
|
||||
|
||||
FlutterFilamentPlugin(flutter::TextureRegistrar *textureRegistrar,
|
||||
flutter::PluginRegistrarWindows *registrar,
|
||||
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>>& channel);
|
||||
virtual ~FlutterFilamentPlugin();
|
||||
|
||||
// Disallow copy and assign.
|
||||
FlutterFilamentPlugin(const FlutterFilamentPlugin &) = delete;
|
||||
FlutterFilamentPlugin &operator=(const FlutterFilamentPlugin &) = delete;
|
||||
|
||||
// Called when a method is called on this plugin's channel from Dart.
|
||||
void HandleMethodCall(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &method_call,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
|
||||
flutter::PluginRegistrarWindows *_pluginRegistrar;
|
||||
flutter::TextureRegistrar *_textureRegistrar;
|
||||
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>> _channel;
|
||||
std::map<uint32_t, ResourceBuffer> _resources;
|
||||
|
||||
void CreateTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
void DestroyTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
void RenderCallback();
|
||||
|
||||
ResourceBuffer loadResource(const char *path);
|
||||
void freeResource(ResourceBuffer rbuf);
|
||||
|
||||
private:
|
||||
#ifdef USE_ANGLE
|
||||
std::unique_ptr<FlutterEGLContext> _context = nullptr;
|
||||
#else
|
||||
std::unique_ptr<WGLContext> _context = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace flutter_filament
|
||||
|
||||
#endif // FLUTTER_PLUGIN_FLUTTER_FILAMENT_PLUGIN_H_
|
||||
12
flutter_filament/windows/flutter_filament_plugin_c_api.cpp
Normal file
12
flutter_filament/windows/flutter_filament_plugin_c_api.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "include/flutter_filament/flutter_filament_plugin_c_api.h"
|
||||
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
|
||||
#include "flutter_filament_plugin.h"
|
||||
|
||||
void FlutterFilamentPluginCApiRegisterWithRegistrar(
|
||||
FlutterDesktopPluginRegistrarRef registrar) {
|
||||
flutter_filament::FlutterFilamentPlugin::RegisterWithRegistrar(
|
||||
flutter::PluginRegistrarManager::GetInstance()
|
||||
->GetRegistrar<flutter::PluginRegistrarWindows>(registrar));
|
||||
}
|
||||
53
flutter_filament/windows/flutter_render_context.h
Normal file
53
flutter_filament/windows/flutter_render_context.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef _FLUTTER_RENDER_CONTEXT_H
|
||||
#define _FLUTTER_RENDER_CONTEXT_H
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
#include <flutter/texture_registrar.h>
|
||||
|
||||
#include "flutter_texture_buffer.h"
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class FlutterRenderContext {
|
||||
public:
|
||||
|
||||
void CreateRenderingSurface(uint32_t width, uint32_t height, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result, uint32_t left, uint32_t top );
|
||||
|
||||
void DestroyTexture(std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
||||
if (!_active) {
|
||||
result->Success("Texture has already been detroyed, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
auto sh = std::make_shared<
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>>>(
|
||||
std::move(result));
|
||||
|
||||
_textureRegistrar->UnregisterTexture(
|
||||
_active->flutterTextureId, [=, sharedResult = std::move(sh)]() {
|
||||
this->_inactive = std::move(this->_active);
|
||||
auto unique = std::move(*(sharedResult.get()));
|
||||
unique->Success(flutter::EncodableValue(true));
|
||||
std::cout << "Unregistered/destroyed texture." << std::endl;
|
||||
});
|
||||
}
|
||||
int64_t GetFlutterTextureId() {
|
||||
if(!_active) {
|
||||
return -1;
|
||||
}
|
||||
return _active->flutterTextureId;
|
||||
}
|
||||
|
||||
protected:
|
||||
FlutterRenderContext( flutter::PluginRegistrarWindows* pluginRegistrar, flutter::TextureRegistrar* textureRegistrar) : _pluginRegistrar(pluginRegistrar), _textureRegistrar(textureRegistrar) {};
|
||||
|
||||
flutter::PluginRegistrarWindows* _pluginRegistrar;
|
||||
flutter::TextureRegistrar* _textureRegistrar;
|
||||
std::unique_ptr<FlutterTextureBuffer> _active = nullptr;
|
||||
std::unique_ptr<FlutterTextureBuffer> _inactive = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
18
flutter_filament/windows/flutter_texture_buffer.h
Normal file
18
flutter_filament/windows/flutter_texture_buffer.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _FLUTTER_TEXTURE_BUFFER_H
|
||||
#define _FLUTTER_TEXTURE_BUFFER_H
|
||||
|
||||
#include <flutter/method_channel.h>
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
#include <flutter/texture_registrar.h>
|
||||
|
||||
|
||||
namespace flutter_filament {
|
||||
|
||||
class FlutterTextureBuffer {
|
||||
public:
|
||||
int64_t flutterTextureId = -1;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
342
flutter_filament/windows/include/EGL/egl.h
Normal file
342
flutter_filament/windows/include/EGL/egl.h
Normal file
@@ -0,0 +1,342 @@
|
||||
#ifndef __egl_h_
|
||||
#define __egl_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright 2013-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
**
|
||||
** This header is generated from the Khronos EGL XML API Registry.
|
||||
** The current version of the Registry, generator scripts
|
||||
** used to make the header, and the header can be found at
|
||||
** http://www.khronos.org/registry/egl
|
||||
**
|
||||
** Khronos $Git commit SHA1: 5a9a7e3fcb $ on $Git commit date: 2020-08-24 11:05:32 -0700 $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
#ifndef EGL_EGL_PROTOTYPES
|
||||
#define EGL_EGL_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Generated on date 20201001 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef EGL_VERSION_1_0
|
||||
#define EGL_VERSION_1_0 1
|
||||
typedef unsigned int EGLBoolean;
|
||||
typedef void *EGLDisplay;
|
||||
#include <EGL/eglplatform.h>
|
||||
#include <KHR/khrplatform.h>
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLContext;
|
||||
typedef void (*__eglMustCastToProperFunctionPointerType)(void);
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_EXTENSIONS 0x3055
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
#define EGL_NONE 0x3038
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
|
||||
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
|
||||
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
|
||||
#define EGL_PBUFFER_BIT 0x0001
|
||||
#define EGL_PIXMAP_BIT 0x0002
|
||||
#define EGL_READ 0x305A
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SLOW_CONFIG 0x3050
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_TRANSPARENT_RGB 0x3052
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRUE 1
|
||||
#define EGL_VENDOR 0x3053
|
||||
#define EGL_VERSION 0x3054
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_WINDOW_BIT 0x0004
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSECONFIGPROC) (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
typedef EGLContext (EGLAPIENTRYP PFNEGLCREATECONTEXTPROC) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERSURFACEPROC) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGATTRIBPROC) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCONFIGSPROC) (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETCURRENTDISPLAYPROC) (void);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLGETCURRENTSURFACEPROC) (EGLint readdraw);
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDISPLAYPROC) (EGLNativeDisplayType display_id);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLGETERRORPROC) (void);
|
||||
typedef __eglMustCastToProperFunctionPointerType (EGLAPIENTRYP PFNEGLGETPROCADDRESSPROC) (const char *procname);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLINITIALIZEPROC) (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLMAKECURRENTPROC) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYCONTEXTPROC) (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGPROC) (EGLDisplay dpy, EGLint name);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSPROC) (EGLDisplay dpy, EGLSurface surface);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLTERMINATEPROC) (EGLDisplay dpy);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITGLPROC) (void);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITNATIVEPROC) (EGLint engine);
|
||||
#if EGL_EGL_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
|
||||
EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
|
||||
EGLAPI EGLint EGLAPIENTRY eglGetError (void);
|
||||
EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
|
||||
#endif
|
||||
#endif /* EGL_VERSION_1_0 */
|
||||
|
||||
#ifndef EGL_VERSION_1_1
|
||||
#define EGL_VERSION_1_1 1
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_CONTEXT_LOST 0x300E
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082
|
||||
#define EGL_MIPMAP_LEVEL 0x3083
|
||||
#define EGL_NO_TEXTURE 0x305C
|
||||
#define EGL_TEXTURE_2D 0x305F
|
||||
#define EGL_TEXTURE_FORMAT 0x3080
|
||||
#define EGL_TEXTURE_RGB 0x305D
|
||||
#define EGL_TEXTURE_RGBA 0x305E
|
||||
#define EGL_TEXTURE_TARGET 0x3081
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDTEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETEXIMAGEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSURFACEATTRIBPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPINTERVALPROC) (EGLDisplay dpy, EGLint interval);
|
||||
#if EGL_EGL_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
|
||||
#endif
|
||||
#endif /* EGL_VERSION_1_1 */
|
||||
|
||||
#ifndef EGL_VERSION_1_2
|
||||
#define EGL_VERSION_1_2 1
|
||||
typedef unsigned int EGLenum;
|
||||
typedef void *EGLClientBuffer;
|
||||
#define EGL_ALPHA_FORMAT 0x3088
|
||||
#define EGL_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_BUFFER_PRESERVED 0x3094
|
||||
#define EGL_BUFFER_DESTROYED 0x3095
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
#define EGL_COLORSPACE 0x3087
|
||||
#define EGL_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_OPENGL_ES_BIT 0x0001
|
||||
#define EGL_OPENVG_BIT 0x0002
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_RGB_BUFFER 0x308E
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDAPIPROC) (EGLenum api);
|
||||
typedef EGLenum (EGLAPIENTRYP PFNEGLQUERYAPIPROC) (void);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPBUFFERFROMCLIENTBUFFERPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLRELEASETHREADPROC) (void);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITCLIENTPROC) (void);
|
||||
#if EGL_EGL_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
|
||||
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
|
||||
#endif
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
#ifndef EGL_VERSION_1_3
|
||||
#define EGL_VERSION_1_3 1
|
||||
#define EGL_CONFORMANT 0x3042
|
||||
#define EGL_CONTEXT_CLIENT_VERSION 0x3098
|
||||
#define EGL_MATCH_NATIVE_PIXMAP 0x3041
|
||||
#define EGL_OPENGL_ES2_BIT 0x0004
|
||||
#define EGL_VG_ALPHA_FORMAT 0x3088
|
||||
#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
|
||||
#define EGL_VG_COLORSPACE 0x3087
|
||||
#define EGL_VG_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_VG_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
|
||||
#endif /* EGL_VERSION_1_3 */
|
||||
|
||||
#ifndef EGL_VERSION_1_4
|
||||
#define EGL_VERSION_1_4 1
|
||||
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
|
||||
#define EGL_MULTISAMPLE_RESOLVE 0x3099
|
||||
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
|
||||
#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
|
||||
#define EGL_OPENGL_API 0x30A2
|
||||
#define EGL_OPENGL_BIT 0x0008
|
||||
#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
|
||||
typedef EGLContext (EGLAPIENTRYP PFNEGLGETCURRENTCONTEXTPROC) (void);
|
||||
#if EGL_EGL_PROTOTYPES
|
||||
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
|
||||
#endif
|
||||
#endif /* EGL_VERSION_1_4 */
|
||||
|
||||
#ifndef EGL_VERSION_1_5
|
||||
#define EGL_VERSION_1_5 1
|
||||
typedef void *EGLSync;
|
||||
typedef intptr_t EGLAttrib;
|
||||
typedef khronos_utime_nanoseconds_t EGLTime;
|
||||
typedef void *EGLImage;
|
||||
#define EGL_CONTEXT_MAJOR_VERSION 0x3098
|
||||
#define EGL_CONTEXT_MINOR_VERSION 0x30FB
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
|
||||
#define EGL_OPENGL_ES3_BIT 0x00000040
|
||||
#define EGL_CL_EVENT_HANDLE 0x309C
|
||||
#define EGL_SYNC_CL_EVENT 0x30FE
|
||||
#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
|
||||
#define EGL_SYNC_TYPE 0x30F7
|
||||
#define EGL_SYNC_STATUS 0x30F1
|
||||
#define EGL_SYNC_CONDITION 0x30F8
|
||||
#define EGL_SIGNALED 0x30F2
|
||||
#define EGL_UNSIGNALED 0x30F3
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
|
||||
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_TIMEOUT_EXPIRED 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED 0x30F6
|
||||
#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
|
||||
#define EGL_SYNC_FENCE 0x30F9
|
||||
#define EGL_GL_COLORSPACE 0x309D
|
||||
#define EGL_GL_COLORSPACE_SRGB 0x3089
|
||||
#define EGL_GL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_GL_RENDERBUFFER 0x30B9
|
||||
#define EGL_GL_TEXTURE_2D 0x30B1
|
||||
#define EGL_GL_TEXTURE_LEVEL 0x30BC
|
||||
#define EGL_GL_TEXTURE_3D 0x30B2
|
||||
#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
|
||||
#define EGL_IMAGE_PRESERVED 0x30D2
|
||||
#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
|
||||
typedef EGLSync (EGLAPIENTRYP PFNEGLCREATESYNCPROC) (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCPROC) (EGLDisplay dpy, EGLSync sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBPROC) (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
|
||||
typedef EGLImage (EGLAPIENTRYP PFNEGLCREATEIMAGEPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEPROC) (EGLDisplay dpy, EGLImage image);
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYPROC) (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLWAITSYNCPROC) (EGLDisplay dpy, EGLSync sync, EGLint flags);
|
||||
#if EGL_EGL_PROTOTYPES
|
||||
EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
|
||||
EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
|
||||
#endif
|
||||
#endif /* EGL_VERSION_1_5 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1422
flutter_filament/windows/include/EGL/eglext.h
Normal file
1422
flutter_filament/windows/include/EGL/eglext.h
Normal file
File diff suppressed because it is too large
Load Diff
403
flutter_filament/windows/include/EGL/eglext_angle.h
Normal file
403
flutter_filament/windows/include/EGL/eglext_angle.h
Normal file
@@ -0,0 +1,403 @@
|
||||
//
|
||||
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// eglext_angle.h: ANGLE modifications to the eglext.h header file.
|
||||
// Currently we don't include this file directly, we patch eglext.h
|
||||
// to include it implicitly so it is visible throughout our code.
|
||||
|
||||
#ifndef INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
#define INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef EGL_ANGLE_robust_resource_initialization
|
||||
#define EGL_ANGLE_robust_resource_initialization 1
|
||||
#define EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x3453
|
||||
#endif /* EGL_ANGLE_robust_resource_initialization */
|
||||
|
||||
#ifndef EGL_ANGLE_keyed_mutex
|
||||
#define EGL_ANGLE_keyed_mutex 1
|
||||
#define EGL_DXGI_KEYED_MUTEX_ANGLE 0x33A2
|
||||
#endif /* EGL_ANGLE_keyed_mutex */
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_texture_client_buffer
|
||||
#define EGL_ANGLE_d3d_texture_client_buffer 1
|
||||
#define EGL_D3D_TEXTURE_ANGLE 0x33A3
|
||||
#define EGL_TEXTURE_OFFSET_X_ANGLE 0x3490
|
||||
#define EGL_TEXTURE_OFFSET_Y_ANGLE 0x3491
|
||||
#define EGL_D3D11_TEXTURE_PLANE_ANGLE 0x3492
|
||||
#define EGL_D3D11_TEXTURE_ARRAY_SLICE_ANGLE 0x3493
|
||||
#endif /* EGL_ANGLE_d3d_texture_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_software_display
|
||||
#define EGL_ANGLE_software_display 1
|
||||
#define EGL_SOFTWARE_DISPLAY_ANGLE ((EGLNativeDisplayType)-1)
|
||||
#endif /* EGL_ANGLE_software_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct3d_display
|
||||
#define EGL_ANGLE_direct3d_display 1
|
||||
#define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ((EGLNativeDisplayType)-2)
|
||||
#define EGL_D3D11_ONLY_DISPLAY_ANGLE ((EGLNativeDisplayType)-3)
|
||||
#endif /* EGL_ANGLE_direct3d_display */
|
||||
|
||||
#ifndef EGL_ANGLE_direct_composition
|
||||
#define EGL_ANGLE_direct_composition 1
|
||||
#define EGL_DIRECT_COMPOSITION_ANGLE 0x33A5
|
||||
#endif /* EGL_ANGLE_direct_composition */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle
|
||||
#define EGL_ANGLE_platform_angle 1
|
||||
#define EGL_PLATFORM_ANGLE_ANGLE 0x3202
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3203
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3204
|
||||
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3205
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3206
|
||||
#define EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED_ANGLE 0x3451
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE 0x3209
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE 0x320A
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x345E
|
||||
#define EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE 0x348F
|
||||
#endif /* EGL_ANGLE_platform_angle */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d
|
||||
#define EGL_ANGLE_platform_angle_d3d 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3207
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3208
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_WARP_ANGLE 0x320B
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_D3D_REFERENCE_ANGLE 0x320C
|
||||
#define EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE 0x320F
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d_luid
|
||||
#define EGL_ANGLE_platform_angle_d3d_luid 1
|
||||
#define EGL_PLATFORM_ANGLE_D3D_LUID_HIGH_ANGLE 0x34A0
|
||||
#define EGL_PLATFORM_ANGLE_D3D_LUID_LOW_ANGLE 0x34A1
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d_luid */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_d3d11on12
|
||||
#define EGL_ANGLE_platform_angle_d3d11on12 1
|
||||
#define EGL_PLATFORM_ANGLE_D3D11ON12_ANGLE 0x3488
|
||||
#endif /* EGL_ANGLE_platform_angle_d3d11on12 */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_opengl
|
||||
#define EGL_ANGLE_platform_angle_opengl 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x320D
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320E
|
||||
#define EGL_PLATFORM_ANGLE_EGL_HANDLE_ANGLE 0x3480
|
||||
#endif /* EGL_ANGLE_platform_angle_opengl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_null
|
||||
#define EGL_ANGLE_platform_angle_null 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE 0x33AE
|
||||
#endif /* EGL_ANGLE_platform_angle_null */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_vulkan
|
||||
#define EGL_ANGLE_platform_angle_vulkan 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE 0x3450
|
||||
#define EGL_PLATFORM_VULKAN_DISPLAY_MODE_SIMPLE_ANGLE 0x34A4
|
||||
#define EGL_PLATFORM_VULKAN_DISPLAY_MODE_HEADLESS_ANGLE 0x34A5
|
||||
#endif /* EGL_ANGLE_platform_angle_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_metal
|
||||
#define EGL_ANGLE_platform_angle_metal 1
|
||||
#define EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE 0x3489
|
||||
#endif /* EGL_ANGLE_platform_angle_metal */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
#define EGL_ANGLE_platform_angle_device_type_swiftshader
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE 0x3487
|
||||
#endif /* EGL_ANGLE_platform_angle_device_type_swiftshader */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_type_egl_angle
|
||||
#define EGL_ANGLE_platform_angle_device_type_egl_angle
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_EGL_ANGLE 0x348E
|
||||
#endif /* EGL_ANGLE_platform_angle_device_type_egl_angle */
|
||||
|
||||
#ifndef EGL_ANGLE_context_virtualization
|
||||
#define EGL_ANGLE_context_virtualization 1
|
||||
#define EGL_CONTEXT_VIRTUALIZATION_GROUP_ANGLE 0x3481
|
||||
#endif /* EGL_ANGLE_context_virtualization */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_context_volatile_eagl
|
||||
#define EGL_ANGLE_platform_angle_device_context_volatile_eagl 1
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_CONTEXT_VOLATILE_EAGL_ANGLE 0x34A2
|
||||
#endif /* EGL_ANGLE_platform_angle_device_context_volatile_eagl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_context_volatile_cgl
|
||||
#define EGL_ANGLE_platform_angle_device_context_volatile_cgl 1
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_CONTEXT_VOLATILE_CGL_ANGLE 0x34A3
|
||||
#endif /* EGL_ANGLE_platform_angle_device_context_volatile_cgl */
|
||||
|
||||
#ifndef EGL_ANGLE_platform_angle_device_id
|
||||
#define EGL_ANGLE_platform_angle_device_id
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_ID_HIGH_ANGLE 0x34D6
|
||||
#define EGL_PLATFORM_ANGLE_DEVICE_ID_LOW_ANGLE 0x34D7
|
||||
#endif /* EGL_ANGLE_platform_angle_device_id */
|
||||
|
||||
#ifndef EGL_ANGLE_x11_visual
|
||||
#define EGL_ANGLE_x11_visual
|
||||
#define EGL_X11_VISUAL_ID_ANGLE 0x33A3
|
||||
#endif /* EGL_ANGLE_x11_visual */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_orientation
|
||||
#define EGL_ANGLE_surface_orientation
|
||||
#define EGL_OPTIMAL_SURFACE_ORIENTATION_ANGLE 0x33A7
|
||||
#define EGL_SURFACE_ORIENTATION_ANGLE 0x33A8
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE 0x0001
|
||||
#define EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE 0x0002
|
||||
#endif /* EGL_ANGLE_surface_orientation */
|
||||
|
||||
#ifndef EGL_ANGLE_experimental_present_path
|
||||
#define EGL_ANGLE_experimental_present_path
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE 0x33A4
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE 0x33A9
|
||||
#define EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE 0x33AA
|
||||
#endif /* EGL_ANGLE_experimental_present_path */
|
||||
|
||||
#ifndef EGL_ANGLE_stream_producer_d3d_texture
|
||||
#define EGL_ANGLE_stream_producer_d3d_texture
|
||||
#define EGL_D3D_TEXTURE_SUBRESOURCE_ID_ANGLE 0x33AB
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC)(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglCreateStreamProducerD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamPostD3DTextureANGLE(EGLDisplay dpy, EGLStreamKHR stream, void *texture, const EGLAttrib *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_stream_producer_d3d_texture */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_webgl_compatibility
|
||||
#define EGL_ANGLE_create_context_webgl_compatibility 1
|
||||
#define EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE 0x33AC
|
||||
#endif /* EGL_ANGLE_create_context_webgl_compatibility */
|
||||
|
||||
#ifndef EGL_ANGLE_display_texture_share_group
|
||||
#define EGL_ANGLE_display_texture_share_group 1
|
||||
#define EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE 0x33AF
|
||||
#endif /* EGL_ANGLE_display_texture_share_group */
|
||||
|
||||
#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
|
||||
#define EGL_CHROMIUM_create_context_bind_generates_resource 1
|
||||
#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD
|
||||
#endif /* EGL_CHROMIUM_create_context_bind_generates_resource */
|
||||
|
||||
#ifndef EGL_ANGLE_metal_create_context_ownership_identity
|
||||
#define EGL_ANGLE_metal_create_context_ownership_identity 1
|
||||
#define EGL_CONTEXT_METAL_OWNERSHIP_IDENTITY_ANGLE 0x34D2
|
||||
#endif /* EGL_ANGLE_metal_create_context_ownership_identity */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_client_arrays
|
||||
#define EGL_ANGLE_create_context_client_arrays 1
|
||||
#define EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE 0x3452
|
||||
#endif /* EGL_ANGLE_create_context_client_arrays */
|
||||
|
||||
#ifndef EGL_ANGLE_device_creation
|
||||
#define EGL_ANGLE_device_creation 1
|
||||
typedef EGLDeviceEXT(EGLAPIENTRYP PFNEGLCREATEDEVICEANGLEPROC) (EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
typedef EGLBoolean(EGLAPIENTRYP PFNEGLRELEASEDEVICEANGLEPROC) (EGLDeviceEXT device);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDeviceEXT EGLAPIENTRY eglCreateDeviceANGLE(EGLint device_type, void *native_device, const EGLAttrib *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseDeviceANGLE(EGLDeviceEXT device);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_device_creation */
|
||||
|
||||
#ifndef EGL_ANGLE_program_cache_control
|
||||
#define EGL_ANGLE_program_cache_control 1
|
||||
#define EGL_PROGRAM_CACHE_SIZE_ANGLE 0x3455
|
||||
#define EGL_PROGRAM_CACHE_KEY_LENGTH_ANGLE 0x3456
|
||||
#define EGL_PROGRAM_CACHE_RESIZE_ANGLE 0x3457
|
||||
#define EGL_PROGRAM_CACHE_TRIM_ANGLE 0x3458
|
||||
#define EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE 0x3459
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHEGETATTRIBANGLEPROC) (EGLDisplay dpy, EGLenum attrib);
|
||||
typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEQUERYANGLEPROC) (EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
typedef void (EGLAPIENTRYP PFNEGLPROGRAMCACHEPOPULATEANGLEPROC) (EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLPROGRAMCACHERESIZEANGLEPROC) (EGLDisplay dpy, EGLint limit, EGLint mode);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheGetAttribANGLE(EGLDisplay dpy, EGLenum attrib);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCacheQueryANGLE(EGLDisplay dpy, EGLint index, void *key, EGLint *keysize, void *binary, EGLint *binarysize);
|
||||
EGLAPI void EGLAPIENTRY eglProgramCachePopulateANGLE(EGLDisplay dpy, const void *key, EGLint keysize, const void *binary, EGLint binarysize);
|
||||
EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limit, EGLint mode);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_program_cache_control */
|
||||
|
||||
#ifndef EGL_ANGLE_iosurface_client_buffer
|
||||
#define EGL_ANGLE_iosurface_client_buffer 1
|
||||
#define EGL_IOSURFACE_ANGLE 0x3454
|
||||
#define EGL_IOSURFACE_PLANE_ANGLE 0x345A
|
||||
#define EGL_TEXTURE_RECTANGLE_ANGLE 0x345B
|
||||
#define EGL_TEXTURE_TYPE_ANGLE 0x345C
|
||||
#define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
|
||||
#define EGL_IOSURFACE_USAGE_HINT_ANGLE 0x348A
|
||||
#define EGL_IOSURFACE_READ_HINT_ANGLE 0x0001
|
||||
#define EGL_IOSURFACE_WRITE_HINT_ANGLE 0x0002
|
||||
#define EGL_BIND_TO_TEXTURE_TARGET_ANGLE 0x348D
|
||||
#endif /* EGL_ANGLE_iosurface_client_buffer */
|
||||
|
||||
#ifndef ANGLE_metal_texture_client_buffer
|
||||
#define ANGLE_metal_texture_client_buffer 1
|
||||
#define EGL_METAL_TEXTURE_ANGLE 0x34A7
|
||||
#endif /* ANGLE_metal_texture_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_extensions_enabled
|
||||
#define EGL_ANGLE_create_context_extensions_enabled 1
|
||||
#define EGL_EXTENSIONS_ENABLED_ANGLE 0x345F
|
||||
#endif /* EGL_ANGLE_create_context_extensions_enabled */
|
||||
|
||||
#ifndef EGL_CHROMIUM_sync_control
|
||||
#define EGL_CHROMIUM_sync_control 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCVALUESCHROMIUMPROC) (EGLDisplay dpy,
|
||||
EGLSurface surface,
|
||||
EGLuint64KHR *ust,
|
||||
EGLuint64KHR *msc,
|
||||
EGLuint64KHR *sbc);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
|
||||
EGLSurface surface,
|
||||
EGLuint64KHR *ust,
|
||||
EGLuint64KHR *msc,
|
||||
EGLuint64KHR *sbc);
|
||||
#endif
|
||||
#endif /* EGL_CHROMIUM_sync_control */
|
||||
|
||||
#ifndef EGL_ANGLE_sync_control_rate
|
||||
#define EGL_ANGLE_sync_control_rate 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMSCRATEANGLEPROC) (EGLDisplay dpy,
|
||||
EGLSurface surface,
|
||||
EGLint *numerator,
|
||||
EGLint *denominator);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetMscRateANGLE(EGLDisplay dpy,
|
||||
EGLSurface surface,
|
||||
EGLint *numerator,
|
||||
EGLint *denominator);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_sync_control_rate */
|
||||
|
||||
#ifndef EGL_ANGLE_power_preference
|
||||
#define EGL_ANGLE_power_preference 1
|
||||
#define EGL_POWER_PREFERENCE_ANGLE 0x3482
|
||||
#define EGL_LOW_POWER_ANGLE 0x0001
|
||||
#define EGL_HIGH_POWER_ANGLE 0x0002
|
||||
typedef void(EGLAPIENTRYP PFNEGLRELEASEHIGHPOWERGPUANGLEPROC) (EGLDisplay dpy, EGLContext ctx);
|
||||
typedef void(EGLAPIENTRYP PFNEGLREACQUIREHIGHPOWERGPUANGLEPROC) (EGLDisplay dpy, EGLContext ctx);
|
||||
typedef void(EGLAPIENTRYP PFNEGLHANDLEGPUSWITCHANGLEPROC) (EGLDisplay dpy);
|
||||
typedef void(EGLAPIENTRYP PFNEGLFORCEGPUSWITCHANGLEPROC) (EGLDisplay dpy, EGLint gpuIDHigh, EGLint gpuIDLow);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI void EGLAPIENTRY eglReleaseHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI void EGLAPIENTRY eglReacquireHighPowerGPUANGLE(EGLDisplay dpy, EGLContext ctx);
|
||||
EGLAPI void EGLAPIENTRY eglHandleGPUSwitchANGLE(EGLDisplay dpy);
|
||||
EGLAPI void EGLAPIENTRY eglForceGPUSwitchANGLE(EGLDisplay dpy, EGLint gpuIDHigh, EGLint gpuIDLow);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_power_preference */
|
||||
|
||||
#ifndef EGL_ANGLE_feature_control
|
||||
#define EGL_ANGLE_feature_control 1
|
||||
#define EGL_FEATURE_NAME_ANGLE 0x3460
|
||||
#define EGL_FEATURE_CATEGORY_ANGLE 0x3461
|
||||
#define EGL_FEATURE_DESCRIPTION_ANGLE 0x3462
|
||||
#define EGL_FEATURE_BUG_ANGLE 0x3463
|
||||
#define EGL_FEATURE_STATUS_ANGLE 0x3464
|
||||
#define EGL_FEATURE_COUNT_ANGLE 0x3465
|
||||
#define EGL_FEATURE_OVERRIDES_ENABLED_ANGLE 0x3466
|
||||
#define EGL_FEATURE_OVERRIDES_DISABLED_ANGLE 0x3467
|
||||
#define EGL_FEATURE_CONDITION_ANGLE 0x3468
|
||||
#define EGL_FEATURE_ALL_DISABLED_ANGLE 0x3469
|
||||
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBANGLEPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribANGLE(EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_feature_control */
|
||||
|
||||
#ifndef EGL_ANGLE_image_d3d11_texture
|
||||
#define EGL_D3D11_TEXTURE_ANGLE 0x3484
|
||||
#define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
|
||||
#endif /* EGL_ANGLE_image_d3d11_texture */
|
||||
|
||||
#ifndef EGL_ANGLE_create_context_backwards_compatible
|
||||
#define EGL_ANGLE_create_context_backwards_compatible 1
|
||||
#define EGL_CONTEXT_OPENGL_BACKWARDS_COMPATIBLE_ANGLE 0x3483
|
||||
#endif /* EGL_ANGLE_create_context_backwards_compatible */
|
||||
|
||||
#ifndef EGL_ANGLE_device_cgl
|
||||
#define EGL_ANGLE_device_cgl 1
|
||||
#define EGL_CGL_CONTEXT_ANGLE 0x3485
|
||||
#define EGL_CGL_PIXEL_FORMAT_ANGLE 0x3486
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_ggp_stream_descriptor
|
||||
#define EGL_ANGLE_ggp_stream_descriptor 1
|
||||
#define EGL_GGP_STREAM_DESCRIPTOR_ANGLE 0x348B
|
||||
#endif /* EGL_ANGLE_ggp_stream_descriptor */
|
||||
|
||||
#ifndef EGL_ANGLE_swap_with_frame_token
|
||||
#define EGL_ANGLE_swap_with_frame_token 1
|
||||
typedef khronos_uint64_t EGLFrameTokenANGLE;
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHFRAMETOKENANGLEPROC)(EGLDisplay dpy, EGLSurface surface, EGLFrameTokenANGLE frametoken);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithFrameTokenANGLE(EGLDisplay dpy, EGLSurface surface, EGLFrameTokenANGLE frametoken);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_swap_with_frame_token */
|
||||
|
||||
#ifndef EGL_ANGLE_prepare_swap_buffers
|
||||
#define EGL_ANGLE_prepare_swap_buffers 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPREPARESWAPBUFFERSANGLEPROC)(EGLDisplay dpy, EGLSurface surface);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPrepareSwapBuffersANGLE(EGLDisplay dpy, EGLSurface surface);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_prepare_swap_buffers */
|
||||
|
||||
#ifndef EGL_ANGLE_device_eagl
|
||||
#define EGL_ANGLE_device_eagl 1
|
||||
#define EGL_EAGL_CONTEXT_ANGLE 0x348C
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_device_metal
|
||||
#define EGL_ANGLE_device_metal 1
|
||||
#define EGL_METAL_DEVICE_ANGLE 0x34A6
|
||||
#endif /* EGL_ANGLE_device_metal */
|
||||
|
||||
#ifndef EGL_ANGLE_display_semaphore_share_group
|
||||
#define EGL_ANGLE_display_semaphore_share_group 1
|
||||
#define EGL_DISPLAY_SEMAPHORE_SHARE_GROUP_ANGLE 0x348D
|
||||
#endif /* EGL_ANGLE_display_semaphore_share_group */
|
||||
|
||||
#ifndef EGL_ANGLE_external_context_and_surface
|
||||
#define EGL_ANGLE_external_context_and_surface 1
|
||||
#define EGL_EXTERNAL_CONTEXT_ANGLE 0x348E
|
||||
#define EGL_EXTERNAL_SURFACE_ANGLE 0x348F
|
||||
#define EGL_EXTERNAL_CONTEXT_SAVE_STATE_ANGLE 0x3490
|
||||
#endif /* EGL_ANGLE_external_context_and_surface */
|
||||
|
||||
#ifndef EGL_ANGLE_create_surface_swap_interval
|
||||
#define EGL_ANGLE_create_surface_swap_interval 1
|
||||
#define EGL_SWAP_INTERVAL_ANGLE 0x322F
|
||||
#endif /* EGL_ANGLE_create_surface_swap_interval */
|
||||
|
||||
#ifndef EGL_ANGLE_device_vulkan
|
||||
#define EGL_ANGLE_device_vulkan 1
|
||||
#define EGL_VULKAN_VERSION_ANGLE 0x34A8
|
||||
#define EGL_VULKAN_INSTANCE_ANGLE 0x34A9
|
||||
#define EGL_VULKAN_INSTANCE_EXTENSIONS_ANGLE 0x34AA
|
||||
#define EGL_VULKAN_PHYSICAL_DEVICE_ANGLE 0x34AB
|
||||
#define EGL_VULKAN_DEVICE_ANGLE 0x34AC
|
||||
#define EGL_VULKAN_DEVICE_EXTENSIONS_ANGLE 0x34AD
|
||||
#define EGL_VULKAN_FEATURES_ANGLE 0x34AE
|
||||
#define EGL_VULKAN_QUEUE_ANGLE 0x34AF
|
||||
#define EGL_VULKAN_QUEUE_FAMILIY_INDEX_ANGLE 0x34D0
|
||||
#define EGL_VULKAN_GET_INSTANCE_PROC_ADDR 0x34D1
|
||||
#endif /* EGL_ANGLE_device_vulkan */
|
||||
|
||||
#ifndef EGL_ANGLE_vulkan_image
|
||||
#define EGL_ANGLE_vulkan_image
|
||||
#define EGL_VULKAN_IMAGE_ANGLE 0x34D3
|
||||
#define EGL_VULKAN_IMAGE_CREATE_INFO_HI_ANGLE 0x34D4
|
||||
#define EGL_VULKAN_IMAGE_CREATE_INFO_LO_ANGLE 0x34D5
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTVKIMAGEANGLEPROC)(EGLDisplay dpy, EGLImage image, void* vk_image, void* vk_image_create_info);
|
||||
#endif /* EGL_ANGLE_vulkan_image */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // INCLUDE_EGL_EGLEXT_ANGLE_
|
||||
175
flutter_filament/windows/include/EGL/eglplatform.h
Normal file
175
flutter_filament/windows/include/EGL/eglplatform.h
Normal file
@@ -0,0 +1,175 @@
|
||||
#ifndef __eglplatform_h_
|
||||
#define __eglplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright 2007-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for egl.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* You are encouraged to submit all modifications to the Khronos group so that
|
||||
* they can be included in future versions of this file. Please submit changes
|
||||
* by filing an issue or pull request on the public Khronos EGL Registry, at
|
||||
* https://www.github.com/KhronosGroup/EGL-Registry/
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* Macros used in EGL function prototype declarations.
|
||||
*
|
||||
* EGL functions should be prototyped as:
|
||||
*
|
||||
* EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
|
||||
* typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
|
||||
*
|
||||
* KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
|
||||
*/
|
||||
|
||||
#ifndef EGLAPI
|
||||
#define EGLAPI KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef EGLAPIENTRY
|
||||
#define EGLAPIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
#define EGLAPIENTRYP EGLAPIENTRY*
|
||||
|
||||
/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
|
||||
* are aliases of window-system-dependent types, such as X Display * or
|
||||
* Windows Device Context. They must be defined in platform-specific
|
||||
* code below. The EGL-prefixed versions of Native*Type are the same
|
||||
* types, renamed in EGL 1.3 so all types in the API start with "EGL".
|
||||
*
|
||||
* Khronos STRONGLY RECOMMENDS that you use the default definitions
|
||||
* provided below, since these changes affect both binary and source
|
||||
* portability of applications using EGL running on different EGL
|
||||
* implementations.
|
||||
*/
|
||||
|
||||
#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
|
||||
#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) /* Windows Desktop */
|
||||
typedef HWND EGLNativeWindowType;
|
||||
#else /* Windows Store */
|
||||
#include <inspectable.h>
|
||||
typedef IInspectable* EGLNativeWindowType;
|
||||
#endif
|
||||
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef int EGLNativePixmapType;
|
||||
typedef int EGLNativeWindowType;
|
||||
|
||||
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
|
||||
#elif defined(WL_EGL_PLATFORM)
|
||||
|
||||
typedef struct wl_display *EGLNativeDisplayType;
|
||||
typedef struct wl_egl_pixmap *EGLNativePixmapType;
|
||||
typedef struct wl_egl_window *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__GBM__)
|
||||
|
||||
typedef struct gbm_device *EGLNativeDisplayType;
|
||||
typedef struct gbm_bo *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__ANDROID__) || defined(ANDROID)
|
||||
|
||||
struct ANativeWindow;
|
||||
struct egl_native_pixmap_t;
|
||||
|
||||
typedef void* EGLNativeDisplayType;
|
||||
typedef struct egl_native_pixmap_t* EGLNativePixmapType;
|
||||
typedef struct ANativeWindow* EGLNativeWindowType;
|
||||
|
||||
#elif defined(USE_OZONE)
|
||||
|
||||
typedef intptr_t EGLNativeDisplayType;
|
||||
typedef intptr_t EGLNativePixmapType;
|
||||
typedef intptr_t EGLNativeWindowType;
|
||||
|
||||
#elif defined(__unix__) && defined(EGL_NO_X11)
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef khronos_uintptr_t EGLNativePixmapType;
|
||||
typedef khronos_uintptr_t EGLNativeWindowType;
|
||||
|
||||
#elif defined(__unix__) || defined(USE_X11)
|
||||
|
||||
/* X11 (tentative) */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
typedef Display *EGLNativeDisplayType;
|
||||
typedef Pixmap EGLNativePixmapType;
|
||||
typedef Window EGLNativeWindowType;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
typedef int EGLNativeDisplayType;
|
||||
typedef void *EGLNativePixmapType;
|
||||
typedef void *EGLNativeWindowType;
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
|
||||
#include <kernel/image.h>
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef khronos_uintptr_t EGLNativePixmapType;
|
||||
typedef khronos_uintptr_t EGLNativeWindowType;
|
||||
|
||||
#elif defined(__Fuchsia__)
|
||||
|
||||
typedef void *EGLNativeDisplayType;
|
||||
typedef khronos_uintptr_t EGLNativePixmapType;
|
||||
typedef khronos_uintptr_t EGLNativeWindowType;
|
||||
|
||||
#else
|
||||
#error "Platform not recognized"
|
||||
#endif
|
||||
|
||||
/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
|
||||
typedef EGLNativeDisplayType NativeDisplayType;
|
||||
typedef EGLNativePixmapType NativePixmapType;
|
||||
typedef EGLNativeWindowType NativeWindowType;
|
||||
|
||||
|
||||
/* Define EGLint. This must be a signed integral type large enough to contain
|
||||
* all legal attribute names and values passed into and out of EGL, whether
|
||||
* their type is boolean, bitmask, enumerant (symbolic constant), integer,
|
||||
* handle, or other. While in general a 32-bit integer will suffice, if
|
||||
* handles are 64 bit types, then EGLint should be defined as a signed 64-bit
|
||||
* integer type.
|
||||
*/
|
||||
typedef khronos_int32_t EGLint;
|
||||
|
||||
|
||||
/* C++ / C typecast macros for special EGL handle values */
|
||||
#if defined(__cplusplus)
|
||||
#define EGL_CAST(type, value) (static_cast<type>(value))
|
||||
#else
|
||||
#define EGL_CAST(type, value) ((type) (value))
|
||||
#endif
|
||||
|
||||
#endif /* __eglplatform_h */
|
||||
3621
flutter_filament/windows/include/GL/glcorearb.h
Normal file
3621
flutter_filament/windows/include/GL/glcorearb.h
Normal file
File diff suppressed because it is too large
Load Diff
12050
flutter_filament/windows/include/GL/glext.h
Normal file
12050
flutter_filament/windows/include/GL/glext.h
Normal file
File diff suppressed because it is too large
Load Diff
850
flutter_filament/windows/include/GL/wglext.h
Normal file
850
flutter_filament/windows/include/GL/wglext.h
Normal file
@@ -0,0 +1,850 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2013-2017 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
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define WGL_WGLEXT_VERSION 20171125
|
||||
|
||||
/* Generated C header for:
|
||||
* API: wgl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: wgl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#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 0x3087
|
||||
#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
|
||||
656
flutter_filament/windows/include/GLES2/gl2.h
Normal file
656
flutter_filament/windows/include/GLES2/gl2.h
Normal file
@@ -0,0 +1,656 @@
|
||||
#ifndef __gles2_gl2_h_
|
||||
#define __gles2_gl2_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright 2013-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: MIT
|
||||
**
|
||||
** 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
|
||||
*/
|
||||
|
||||
#include <GLES2/gl2platform.h>
|
||||
|
||||
#ifndef GL_APIENTRYP
|
||||
#define GL_APIENTRYP GL_APIENTRY*
|
||||
#endif
|
||||
|
||||
#ifndef GL_GLES_PROTOTYPES
|
||||
#define GL_GLES_PROTOTYPES 1
|
||||
#endif
|
||||
|
||||
/* Generated on date 20210107 */
|
||||
|
||||
/* Generated C header for:
|
||||
* API: gles2
|
||||
* Profile: common
|
||||
* Versions considered: 2\.[0-9]
|
||||
* Versions emitted: .*
|
||||
* Default extensions included: None
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
#define GL_ES_VERSION_2_0 1
|
||||
#include <KHR/khrplatform.h>
|
||||
typedef khronos_int8_t GLbyte;
|
||||
typedef khronos_float_t GLclampf;
|
||||
typedef khronos_int32_t GLfixed;
|
||||
typedef khronos_int16_t GLshort;
|
||||
typedef khronos_uint16_t GLushort;
|
||||
typedef void GLvoid;
|
||||
typedef struct __GLsync *GLsync;
|
||||
typedef khronos_int64_t GLint64;
|
||||
typedef khronos_uint64_t GLuint64;
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLuint;
|
||||
typedef char GLchar;
|
||||
typedef khronos_float_t GLfloat;
|
||||
typedef khronos_ssize_t GLsizeiptr;
|
||||
typedef khronos_intptr_t GLintptr;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef int GLint;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef int GLsizei;
|
||||
typedef khronos_uint8_t GLubyte;
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_FALSE 0
|
||||
#define GL_TRUE 1
|
||||
#define GL_POINTS 0x0000
|
||||
#define GL_LINES 0x0001
|
||||
#define GL_LINE_LOOP 0x0002
|
||||
#define GL_LINE_STRIP 0x0003
|
||||
#define GL_TRIANGLES 0x0004
|
||||
#define GL_TRIANGLE_STRIP 0x0005
|
||||
#define GL_TRIANGLE_FAN 0x0006
|
||||
#define GL_ZERO 0
|
||||
#define GL_ONE 1
|
||||
#define GL_SRC_COLOR 0x0300
|
||||
#define GL_ONE_MINUS_SRC_COLOR 0x0301
|
||||
#define GL_SRC_ALPHA 0x0302
|
||||
#define GL_ONE_MINUS_SRC_ALPHA 0x0303
|
||||
#define GL_DST_ALPHA 0x0304
|
||||
#define GL_ONE_MINUS_DST_ALPHA 0x0305
|
||||
#define GL_DST_COLOR 0x0306
|
||||
#define GL_ONE_MINUS_DST_COLOR 0x0307
|
||||
#define GL_SRC_ALPHA_SATURATE 0x0308
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#define GL_BLEND_DST_RGB 0x80C8
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
#define GL_CONSTANT_ALPHA 0x8003
|
||||
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
#define GL_BUFFER_SIZE 0x8764
|
||||
#define GL_BUFFER_USAGE 0x8765
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
#define GL_FRONT 0x0404
|
||||
#define GL_BACK 0x0405
|
||||
#define GL_FRONT_AND_BACK 0x0408
|
||||
#define GL_TEXTURE_2D 0x0DE1
|
||||
#define GL_CULL_FACE 0x0B44
|
||||
#define GL_BLEND 0x0BE2
|
||||
#define GL_DITHER 0x0BD0
|
||||
#define GL_STENCIL_TEST 0x0B90
|
||||
#define GL_DEPTH_TEST 0x0B71
|
||||
#define GL_SCISSOR_TEST 0x0C11
|
||||
#define GL_POLYGON_OFFSET_FILL 0x8037
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
#define GL_NO_ERROR 0
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
#define GL_CW 0x0900
|
||||
#define GL_CCW 0x0901
|
||||
#define GL_LINE_WIDTH 0x0B21
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#define GL_CULL_FACE_MODE 0x0B45
|
||||
#define GL_FRONT_FACE 0x0B46
|
||||
#define GL_DEPTH_RANGE 0x0B70
|
||||
#define GL_DEPTH_WRITEMASK 0x0B72
|
||||
#define GL_DEPTH_CLEAR_VALUE 0x0B73
|
||||
#define GL_DEPTH_FUNC 0x0B74
|
||||
#define GL_STENCIL_CLEAR_VALUE 0x0B91
|
||||
#define GL_STENCIL_FUNC 0x0B92
|
||||
#define GL_STENCIL_FAIL 0x0B94
|
||||
#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
|
||||
#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
|
||||
#define GL_STENCIL_REF 0x0B97
|
||||
#define GL_STENCIL_VALUE_MASK 0x0B93
|
||||
#define GL_STENCIL_WRITEMASK 0x0B98
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
|
||||
#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
|
||||
#define GL_STENCIL_BACK_REF 0x8CA3
|
||||
#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#define GL_VIEWPORT 0x0BA2
|
||||
#define GL_SCISSOR_BOX 0x0C10
|
||||
#define GL_COLOR_CLEAR_VALUE 0x0C22
|
||||
#define GL_COLOR_WRITEMASK 0x0C23
|
||||
#define GL_UNPACK_ALIGNMENT 0x0CF5
|
||||
#define GL_PACK_ALIGNMENT 0x0D05
|
||||
#define GL_MAX_TEXTURE_SIZE 0x0D33
|
||||
#define GL_MAX_VIEWPORT_DIMS 0x0D3A
|
||||
#define GL_SUBPIXEL_BITS 0x0D50
|
||||
#define GL_RED_BITS 0x0D52
|
||||
#define GL_GREEN_BITS 0x0D53
|
||||
#define GL_BLUE_BITS 0x0D54
|
||||
#define GL_ALPHA_BITS 0x0D55
|
||||
#define GL_DEPTH_BITS 0x0D56
|
||||
#define GL_STENCIL_BITS 0x0D57
|
||||
#define GL_POLYGON_OFFSET_UNITS 0x2A00
|
||||
#define GL_POLYGON_OFFSET_FACTOR 0x8038
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
#define GL_DONT_CARE 0x1100
|
||||
#define GL_FASTEST 0x1101
|
||||
#define GL_NICEST 0x1102
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_BYTE 0x1400
|
||||
#define GL_UNSIGNED_BYTE 0x1401
|
||||
#define GL_SHORT 0x1402
|
||||
#define GL_UNSIGNED_SHORT 0x1403
|
||||
#define GL_INT 0x1404
|
||||
#define GL_UNSIGNED_INT 0x1405
|
||||
#define GL_FLOAT 0x1406
|
||||
#define GL_FIXED 0x140C
|
||||
#define GL_DEPTH_COMPONENT 0x1902
|
||||
#define GL_ALPHA 0x1906
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define GL_LUMINANCE 0x1909
|
||||
#define GL_LUMINANCE_ALPHA 0x190A
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_SHORT_5_6_5 0x8363
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
|
||||
#define GL_MAX_VARYING_VECTORS 0x8DFC
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
|
||||
#define GL_SHADER_TYPE 0x8B4F
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_ATTACHED_SHADERS 0x8B85
|
||||
#define GL_ACTIVE_UNIFORMS 0x8B86
|
||||
#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
|
||||
#define GL_ACTIVE_ATTRIBUTES 0x8B89
|
||||
#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
|
||||
#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
|
||||
#define GL_CURRENT_PROGRAM 0x8B8D
|
||||
#define GL_NEVER 0x0200
|
||||
#define GL_LESS 0x0201
|
||||
#define GL_EQUAL 0x0202
|
||||
#define GL_LEQUAL 0x0203
|
||||
#define GL_GREATER 0x0204
|
||||
#define GL_NOTEQUAL 0x0205
|
||||
#define GL_GEQUAL 0x0206
|
||||
#define GL_ALWAYS 0x0207
|
||||
#define GL_KEEP 0x1E00
|
||||
#define GL_REPLACE 0x1E01
|
||||
#define GL_INCR 0x1E02
|
||||
#define GL_DECR 0x1E03
|
||||
#define GL_INVERT 0x150A
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
#define GL_NEAREST 0x2600
|
||||
#define GL_LINEAR 0x2601
|
||||
#define GL_NEAREST_MIPMAP_NEAREST 0x2700
|
||||
#define GL_LINEAR_MIPMAP_NEAREST 0x2701
|
||||
#define GL_NEAREST_MIPMAP_LINEAR 0x2702
|
||||
#define GL_LINEAR_MIPMAP_LINEAR 0x2703
|
||||
#define GL_TEXTURE_MAG_FILTER 0x2800
|
||||
#define GL_TEXTURE_MIN_FILTER 0x2801
|
||||
#define GL_TEXTURE_WRAP_S 0x2802
|
||||
#define GL_TEXTURE_WRAP_T 0x2803
|
||||
#define GL_TEXTURE 0x1702
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_REPEAT 0x2901
|
||||
#define GL_CLAMP_TO_EDGE 0x812F
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
#define GL_FLOAT_VEC2 0x8B50
|
||||
#define GL_FLOAT_VEC3 0x8B51
|
||||
#define GL_FLOAT_VEC4 0x8B52
|
||||
#define GL_INT_VEC2 0x8B53
|
||||
#define GL_INT_VEC3 0x8B54
|
||||
#define GL_INT_VEC4 0x8B55
|
||||
#define GL_BOOL 0x8B56
|
||||
#define GL_BOOL_VEC2 0x8B57
|
||||
#define GL_BOOL_VEC3 0x8B58
|
||||
#define GL_BOOL_VEC4 0x8B59
|
||||
#define GL_FLOAT_MAT2 0x8B5A
|
||||
#define GL_FLOAT_MAT3 0x8B5B
|
||||
#define GL_FLOAT_MAT4 0x8B5C
|
||||
#define GL_SAMPLER_2D 0x8B5E
|
||||
#define GL_SAMPLER_CUBE 0x8B60
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
#define GL_SHADER_SOURCE_LENGTH 0x8B88
|
||||
#define GL_SHADER_COMPILER 0x8DFA
|
||||
#define GL_SHADER_BINARY_FORMATS 0x8DF8
|
||||
#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
|
||||
#define GL_LOW_FLOAT 0x8DF0
|
||||
#define GL_MEDIUM_FLOAT 0x8DF1
|
||||
#define GL_HIGH_FLOAT 0x8DF2
|
||||
#define GL_LOW_INT 0x8DF3
|
||||
#define GL_MEDIUM_INT 0x8DF4
|
||||
#define GL_HIGH_INT 0x8DF5
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
#define GL_RGBA4 0x8056
|
||||
#define GL_RGB5_A1 0x8057
|
||||
#define GL_RGB565 0x8D62
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_STENCIL_INDEX8 0x8D48
|
||||
#define GL_RENDERBUFFER_WIDTH 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
|
||||
#define GL_RENDERBUFFER_RED_SIZE 0x8D50
|
||||
#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
|
||||
#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
|
||||
#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
#define GL_NONE 0
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
|
||||
typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
|
||||
typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
|
||||
typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
|
||||
typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
|
||||
typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
|
||||
typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
|
||||
typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||
typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
|
||||
typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
|
||||
typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
|
||||
typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
|
||||
typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
|
||||
typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
|
||||
typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
|
||||
typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
|
||||
typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#if GL_GLES_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
|
||||
GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||
GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
|
||||
GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||
GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
||||
GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
|
||||
GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
|
||||
GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
|
||||
GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
|
||||
GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
|
||||
GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
|
||||
GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
|
||||
GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
|
||||
GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
|
||||
GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
|
||||
GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||
GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
|
||||
GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
|
||||
GL_APICALL void GL_APIENTRY glFinish (void);
|
||||
GL_APICALL void GL_APIENTRY glFlush (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
|
||||
GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||
GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
|
||||
GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
|
||||
GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
|
||||
GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL GLenum GL_APIENTRY glGetError (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
|
||||
GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
|
||||
GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
|
||||
GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
|
||||
GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
|
||||
GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
|
||||
GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
|
||||
GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
|
||||
GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
|
||||
GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length);
|
||||
GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
|
||||
GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
|
||||
GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
|
||||
GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
|
||||
GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
|
||||
GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
|
||||
GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
|
||||
GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
#endif /* GL_ES_VERSION_2_0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
3949
flutter_filament/windows/include/GLES2/gl2ext.h
Normal file
3949
flutter_filament/windows/include/GLES2/gl2ext.h
Normal file
File diff suppressed because it is too large
Load Diff
739
flutter_filament/windows/include/GLES2/gl2ext_angle.h
Normal file
739
flutter_filament/windows/include/GLES2/gl2ext_angle.h
Normal file
@@ -0,0 +1,739 @@
|
||||
//
|
||||
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// gl2ext_angle.h: ANGLE modifications to the gl2ext.h header file.
|
||||
// Currently we don't include this file directly, we patch gl2ext.h
|
||||
// to include it implicitly so it is visible throughout our code.
|
||||
|
||||
#ifndef INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
#define INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
|
||||
// clang-format off
|
||||
|
||||
#ifndef GL_ANGLE_client_arrays
|
||||
#define GL_ANGLE_client_arrays 1
|
||||
#define GL_CLIENT_ARRAYS_ANGLE 0x93AA
|
||||
#endif /* GL_ANGLE_client_arrays */
|
||||
|
||||
#ifndef GL_ANGLE_request_extension
|
||||
#define GL_ANGLE_request_extension 1
|
||||
#define GL_REQUESTABLE_EXTENSIONS_ANGLE 0x93A8
|
||||
#define GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE 0x93A9
|
||||
typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONANGLEPROC) (const GLchar *name);
|
||||
typedef void (GL_APIENTRYP PFNGLDISABLEEXTENSIONANGLEPROC) (const GLchar *name);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glRequestExtensionANGLE (const GLchar *name);
|
||||
GL_APICALL void GL_APIENTRY glDisableExtensionANGLE (const GLchar *name);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_webgl_compatibility */
|
||||
|
||||
#ifndef GL_ANGLE_robust_resource_initialization
|
||||
#define GL_ANGLE_robust_resource_initialization 1
|
||||
#define GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE 0x93AB
|
||||
#define GL_RESOURCE_INITIALIZED_ANGLE 0x969F
|
||||
#endif /* GL_ANGLE_robust_resource_initialization */
|
||||
|
||||
#ifndef GL_ANGLE_polygon_mode
|
||||
#define GL_ANGLE_polygon_mode 1
|
||||
#define GL_POLYGON_MODE_ANGLE 0x0B40
|
||||
#define GL_POLYGON_OFFSET_LINE_ANGLE 0x2A02
|
||||
#define GL_LINE_ANGLE 0x1B01
|
||||
#define GL_FILL_ANGLE 0x1B02
|
||||
typedef void (GL_APIENTRYP PFNGLPOLYGONMODEANGLEPROC) (GLenum face, GLenum mode);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glPolygonModeANGLE (GLenum face, GLenum mode);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_polygon_mode */
|
||||
|
||||
#ifndef GL_ANGLE_provoking_vertex
|
||||
#define GL_ANGLE_provoking_vertex 1
|
||||
#define GL_FIRST_VERTEX_CONVENTION_ANGLE 0x8E4D
|
||||
#define GL_LAST_VERTEX_CONVENTION_ANGLE 0x8E4E
|
||||
#define GL_PROVOKING_VERTEX_ANGLE 0x8E4F
|
||||
typedef void (GL_APIENTRYP PFNGLPROVOKINGVERTEXANGLEPROC) (GLenum);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glProvokingVertexANGLE(GLenum provokeMode);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_provoking_vertex */
|
||||
|
||||
#ifndef GL_ANGLE_clip_cull_distance
|
||||
#define GL_ANGLE_clip_cull_distance 1
|
||||
#define GL_MAX_CLIP_DISTANCES_ANGLE 0x0D32
|
||||
#define GL_MAX_CULL_DISTANCES_ANGLE 0x82F9
|
||||
#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_ANGLE 0x82FA
|
||||
#define GL_CLIP_DISTANCE0_ANGLE 0x3000
|
||||
#define GL_CLIP_DISTANCE1_ANGLE 0x3001
|
||||
#define GL_CLIP_DISTANCE2_ANGLE 0x3002
|
||||
#define GL_CLIP_DISTANCE3_ANGLE 0x3003
|
||||
#define GL_CLIP_DISTANCE4_ANGLE 0x3004
|
||||
#define GL_CLIP_DISTANCE5_ANGLE 0x3005
|
||||
#define GL_CLIP_DISTANCE6_ANGLE 0x3006
|
||||
#define GL_CLIP_DISTANCE7_ANGLE 0x3007
|
||||
#endif /* GL_ANGLE_clip_cull_distance */
|
||||
|
||||
#ifndef GL_ANGLE_stencil_texturing
|
||||
#define GL_ANGLE_stencil_texturing 1
|
||||
#define GL_DEPTH_STENCIL_TEXTURE_MODE_ANGLE 0x90EA
|
||||
#define GL_STENCIL_INDEX_ANGLE 0x1901
|
||||
#endif /* GL_ANGLE_stencil_texturing */
|
||||
|
||||
#ifndef GL_ANGLE_renderability_validation
|
||||
#define GL_ANGLE_renderability_validation 1
|
||||
#define GL_RENDERABILITY_VALIDATION_ANGLE 0x9EA0
|
||||
#endif /* GL_ANGLE_renderability_validation */
|
||||
|
||||
#ifndef GL_CHROMIUM_framebuffer_mixed_samples
|
||||
#define GL_CHROMIUM_frambuffer_mixed_samples 1
|
||||
#define GL_COVERAGE_MODULATION_CHROMIUM 0x9332
|
||||
typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONCHROMIUMPROC) (GLenum components);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_framebuffer_mixed_samples */
|
||||
|
||||
#ifndef GL_CHROMIUM_bind_generates_resource
|
||||
#define GL_CHROMIUM_bind_generates_resource 1
|
||||
#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
|
||||
#endif /* GL_CHROMIUM_bind_generates_resource */
|
||||
|
||||
#ifndef GL_ANGLE_memory_size
|
||||
#define GL_ANGLE_memory_size
|
||||
#define GL_MEMORY_SIZE_ANGLE 0x93AD
|
||||
#endif /* GL_ANGLE_memory_size */
|
||||
|
||||
// needed by NV_path_rendering (and thus CHROMIUM_path_rendering)
|
||||
// but CHROMIUM_path_rendering only needs MatrixLoadfEXT, MatrixLoadIdentityEXT
|
||||
#ifndef GL_EXT_direct_state_access
|
||||
#define GL_EXT_direct_state_access 1
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC)(GLenum matrixMode, const GLfloat *m);
|
||||
typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC)(GLenum matrixMode);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadfEXT(GLenum matrixMode, const GLfloat *m);
|
||||
GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT(GLenum matrixMode);
|
||||
#endif
|
||||
#endif /* GL_EXT_direct_state_access */
|
||||
|
||||
#ifndef GL_CHROMIUM_copy_texture
|
||||
#define GL_CHROMIUM_copy_texture 1
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_copy_texture */
|
||||
|
||||
#ifndef GL_CHROMIUM_compressed_copy_texture
|
||||
#define GL_CHROMIUM_compressed_copy_texture 1
|
||||
typedef void(GL_APIENTRYP PFNGLCOMPRESSEDCOPYTEXTURECHROMIUMPROC)(GLuint sourceId, GLuint destId);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_compressed_copy_texture */
|
||||
|
||||
|
||||
#ifndef GL_ANGLE_copy_texture_3d
|
||||
#define GL_ANGLE_copy_texture_3d 1
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYTEXTURE3DANGLEPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURE3DANGLEPROC)(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint zoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLint z,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLsizei depth,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glCopyTexture3DANGLE(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint internalFormat,
|
||||
GLenum destType,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
GL_APICALL void GL_APIENTRY glCopySubTexture3DANGLE(GLuint sourceId,
|
||||
GLint sourceLevel,
|
||||
GLenum destTarget,
|
||||
GLuint destId,
|
||||
GLint destLevel,
|
||||
GLint xoffset,
|
||||
GLint yoffset,
|
||||
GLint zoffset,
|
||||
GLint x,
|
||||
GLint y,
|
||||
GLint z,
|
||||
GLsizei width,
|
||||
GLsizei height,
|
||||
GLsizei depth,
|
||||
GLboolean unpackFlipY,
|
||||
GLboolean unpackPremultiplyAlpha,
|
||||
GLboolean unpackUnmultiplyAlpha);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_copy_texture_3d */
|
||||
|
||||
#ifndef GL_CHROMIUM_sync_query
|
||||
#define GL_CHROMIUM_sync_query 1
|
||||
#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
|
||||
#endif /* GL_CHROMIUM_sync_query */
|
||||
|
||||
#ifndef GL_EXT_texture_compression_s3tc_srgb
|
||||
#define GL_EXT_texture_compression_s3tc_srgb 1
|
||||
#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
|
||||
#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
|
||||
#endif /* GL_EXT_texture_compression_s3tc_srgb */
|
||||
|
||||
#ifndef GL_ANGLE_lossy_etc_decode
|
||||
#define GL_ANGLE_lossy_etc_decode 1
|
||||
#define GL_ETC1_RGB8_LOSSY_DECODE_ANGLE 0x9690
|
||||
#define GL_COMPRESSED_R11_LOSSY_DECODE_EAC_ANGLE 0x9691
|
||||
#define GL_COMPRESSED_SIGNED_R11_LOSSY_DECODE_EAC_ANGLE 0x9692
|
||||
#define GL_COMPRESSED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9693
|
||||
#define GL_COMPRESSED_SIGNED_RG11_LOSSY_DECODE_EAC_ANGLE 0x9694
|
||||
#define GL_COMPRESSED_RGB8_LOSSY_DECODE_ETC2_ANGLE 0x9695
|
||||
#define GL_COMPRESSED_SRGB8_LOSSY_DECODE_ETC2_ANGLE 0x9696
|
||||
#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9697
|
||||
#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_LOSSY_DECODE_ETC2_ANGLE 0x9698
|
||||
#define GL_COMPRESSED_RGBA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x9699
|
||||
#define GL_COMPRESSED_SRGB8_ALPHA8_LOSSY_DECODE_ETC2_EAC_ANGLE 0x969A
|
||||
#endif /* GL_ANGLE_lossy_etc_decode */
|
||||
|
||||
#ifndef GL_ANGLE_robust_client_memory
|
||||
#define GL_ANGLE_robust_client_memory 1
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFLOATVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERVROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVROBUSTANGLEPROC) (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSHADERIVROBUSTANGLEPROC) (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
|
||||
typedef void (GL_APIENTRYP PFNGLREADPIXELSROBUSTANGLEPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DROBUSTANGLEPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVROBUSTANGLEPROC) (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVROBUSTANGLEPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVROBUSTANGLEPROC) (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVROBUSTANGLEPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64VROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVROBUSTANGLEPROC) (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETBOOLEANI_VROBUSTANGLEPROC) (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVROBUSTANGLEPROC) (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVROBUSTANGLEPROC) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVROBUSTANGLEPROC) (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETPOINTERVROBUSTANGLEROBUSTANGLEPROC) (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
typedef void (GL_APIENTRYP PFNGLREADNPIXELSROBUSTANGLEPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVROBUSTANGLEPROC) (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVROBUSTANGLEPROC) (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVROBUSTANGLEPROC) (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VROBUSTANGLEPROC)(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetBooleanvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFloatvRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *data);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivRobustANGLE (GLenum target, GLenum attachment, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegervRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramivRobustANGLE (GLuint program, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetShaderivRobustANGLE (GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribfvRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribPointervRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, void **pointer);
|
||||
GL_APICALL void GL_APIENTRY glReadPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexImage2DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterfvRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage2DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexImage3DRobustANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glTexSubImage3DRobustANGLE (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, const void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage2DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage2DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexImage3DRobustANGLE(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DRobustANGLE(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei bufSize, const void *data);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectuivRobustANGLE (GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferPointervRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
GL_APICALL void GL_APIENTRY glGetIntegeri_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data);
|
||||
GL_APICALL void GL_APIENTRY glGetInternalformativRobustANGLE (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribIivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetVertexAttribIuivRobustANGLE (GLuint index, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetActiveUniformBlockivRobustANGLE (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetInteger64vRobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
GL_APICALL void GL_APIENTRY glGetInteger64i_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data);
|
||||
GL_APICALL void GL_APIENTRY glGetBufferParameteri64vRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLfloat *param);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterfvRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferParameterivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetProgramInterfaceivRobustANGLE (GLuint program, GLenum programInterface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetBooleani_vRobustANGLE (GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLboolean *data);
|
||||
GL_APICALL void GL_APIENTRY glGetMultisamplefvRobustANGLE (GLenum pname, GLuint index, GLsizei bufSize, GLsizei *length, GLfloat *val);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvRobustANGLE (GLenum target, GLint level, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetPointervRobustANGLERobustANGLE (GLenum pname, GLsizei bufSize, GLsizei *length, void **params);
|
||||
GL_APICALL void GL_APIENTRY glReadnPixelsRobustANGLE (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLsizei *length, GLsizei *columns, GLsizei *rows, void *data);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformfvRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetnUniformuivRobustANGLE (GLuint program, GLint location, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, const GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexParameterIuivRobustANGLE (GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLint *param);
|
||||
GL_APICALL void GL_APIENTRY glSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, const GLuint *param);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivRobustANGLE (GLuint sampler, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectivRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjecti64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params);
|
||||
GL_APICALL void GL_APIENTRY glGetQueryObjectui64vRobustANGLE(GLuint id, GLenum pname, GLsizei bufSize, GLsizei *length, GLuint64 *params);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_robust_client_memory */
|
||||
|
||||
#ifndef GL_ANGLE_program_cache_control
|
||||
#define GL_ANGLE_program_cache_control 1
|
||||
#define GL_PROGRAM_CACHE_ENABLED_ANGLE 0x93AC
|
||||
#endif /* GL_ANGLE_program_cache_control */
|
||||
|
||||
#ifndef GL_ANGLE_texture_rectangle
|
||||
#define GL_ANGLE_texture_rectangle 1
|
||||
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE 0x84F8
|
||||
#define GL_TEXTURE_RECTANGLE_ANGLE 0x84F5
|
||||
#define GL_TEXTURE_BINDING_RECTANGLE_ANGLE 0x84F6
|
||||
#define GL_SAMPLER_2D_RECT_ANGLE 0x8B63
|
||||
#endif /* GL_ANGLE_texture_rectangle */
|
||||
|
||||
#ifndef GL_ANGLE_texture_multisample
|
||||
#define GL_ANGLE_texture_multisample 1
|
||||
#define GL_SAMPLE_POSITION_ANGLE 0x8E50
|
||||
#define GL_SAMPLE_MASK_ANGLE 0x8E51
|
||||
#define GL_SAMPLE_MASK_VALUE_ANGLE 0x8E52
|
||||
#define GL_TEXTURE_2D_MULTISAMPLE_ANGLE 0x9100
|
||||
#define GL_MAX_SAMPLE_MASK_WORDS_ANGLE 0x8E59
|
||||
#define GL_MAX_COLOR_TEXTURE_SAMPLES_ANGLE 0x910E
|
||||
#define GL_MAX_DEPTH_TEXTURE_SAMPLES_ANGLE 0x910F
|
||||
#define GL_MAX_INTEGER_SAMPLES_ANGLE 0x9110
|
||||
#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ANGLE 0x9104
|
||||
#define GL_TEXTURE_SAMPLES_ANGLE 0x9106
|
||||
#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS_ANGLE 0x9107
|
||||
typedef void(GL_APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEANGLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETMULTISAMPLEFVANGLEPROC)(GLenum pname, GLuint index, GLfloat *val);
|
||||
typedef void (GL_APIENTRYP PFNGLSAMPLEMASKIANGLEPROC)(GLuint maskNumber, GLbitfield mask);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glTexStorage2DMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvANGLE(GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivANGLE(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetMultisamplefvANGLE(GLenum pname, GLuint index, GLfloat *val);
|
||||
GL_APICALL void GL_APIENTRY glSampleMaskiANGLE(GLuint maskNumber, GLbitfield mask);
|
||||
#endif
|
||||
#endif // !GL_ANGLE_texture_multisample
|
||||
|
||||
#ifndef GL_ANGLE_get_tex_level_parameter
|
||||
#define GL_ANGLE_get_tex_level_parameter 1
|
||||
typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERFVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
typedef void(GL_APIENTRYP PFNGLGETTEXLEVELPARAMETERIVANGLEPROC)(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterfvANGLE(GLenum target, GLint level, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetTexLevelParameterivANGLE(GLenum target, GLint level, GLenum pname, GLint *params);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_get_tex_level_parameter */
|
||||
|
||||
#ifndef GL_ANGLE_multi_draw
|
||||
#define GL_ANGLE_multi_draw 1
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSANGLEPROC) (GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSANGLEPROC) (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, GLsizei drawcount);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawArraysANGLE (GLenum mode, const GLint *firsts, const GLsizei *counts, GLsizei drawcount);
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawArraysInstancedANGLE (GLenum mode, const GLint *firsts, const GLsizei *counts, const GLsizei *instanceCounts, GLsizei drawcount);
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawElementsANGLE (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedANGLE (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, GLsizei drawcount);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_multi_draw */
|
||||
|
||||
#ifndef GL_ANGLE_base_vertex_base_instance
|
||||
#define GL_ANGLE_base_vertex_base_instance 1
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount, GLuint baseInstance);
|
||||
typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount, GLint baseVertex, GLuint baseInstance);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC) (GLenum mode, const GLsizei *firsts, const GLsizei *counts, const GLsizei *instanceCounts, const GLuint *baseInstances, GLsizei drawCount);
|
||||
typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC) (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, const GLint *baseVertices, const GLuint *baseInstances, GLsizei drawCount);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceANGLE (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount, GLuint baseInstance);
|
||||
GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceANGLE (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount, GLint baseVertex, GLuint baseInstance);
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawArraysInstancedBaseInstanceANGLE (GLenum mode, const GLsizei *firsts, const GLsizei *counts, const GLsizei *instanceCounts, const GLuint *baseInstances, GLsizei drawCount);
|
||||
GL_APICALL void GL_APIENTRY glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE (GLenum mode, const GLsizei *counts, GLenum type, const GLvoid* const *indices, const GLsizei *instanceCounts, const GLint *baseVertices, const GLuint *baseInstances, GLsizei drawCount);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GL_CHROMIUM_bind_uniform_location
|
||||
#define GL_CHROMIUM_bind_uniform_location 1
|
||||
typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMPROC)(GLuint program, GLint location, const GLchar *name);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name);
|
||||
#endif
|
||||
#endif /* GL_CHROMIUM_bind_uniform_location */
|
||||
|
||||
/* GL_CHROMIUM_lose_context */
|
||||
#ifndef GL_CHROMIUM_lose_context
|
||||
#define GL_CHROMIUM_lose_context 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glLoseContextCHROMIUM(GLenum current, GLenum other);
|
||||
#endif
|
||||
typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMPROC) (GLenum current, GLenum other);
|
||||
#endif /* GL_CHROMIUM_lose_context */
|
||||
|
||||
#ifndef GL_ANGLE_texture_external_update
|
||||
#define GL_ANGLE_texture_external_update 1
|
||||
#define GL_TEXTURE_NATIVE_ID_ANGLE 0x3481
|
||||
typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DEXTERNALANGLEPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
typedef void (GL_APIENTRYP PFNGLINVALIDATETEXTUREANGLEPROC) (GLenum target);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glTexImage2DExternalANGLE (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type);
|
||||
GL_APICALL void GL_APIENTRY glInvalidateTextureANGLE (GLenum target);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_texture_external_update */
|
||||
|
||||
#ifndef GL_ANGLE_get_image
|
||||
#define GL_ANGLE_get_image
|
||||
typedef void (GL_APIENTRYP PFNGLGETTEXIMAGEANGLEPROC) (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEANGLEPROC) (GLenum target, GLint level, void *pixels);
|
||||
typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERIMAGEANGLEPROC) (GLenum target, GLenum format, GLenum type, void *pixels);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glGetTexImageANGLE (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glGetCompressedTexImageANGLE (GLenum target, GLint level, void *pixels);
|
||||
GL_APICALL void GL_APIENTRY glGetRenderbufferImageANGLE (GLenum target, GLenum format, GLenum type, void *pixels);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_get_image */
|
||||
|
||||
#ifndef GL_WEBGL_video_texture
|
||||
#define GL_WEBGL_video_texture 1
|
||||
#define GL_TEXTURE_VIDEO_IMAGE_WEBGL 0x9248
|
||||
#define GL_SAMPLER_VIDEO_IMAGE_WEBGL 0x9249
|
||||
#endif /* GL_WEBGL_video_texture */
|
||||
|
||||
#ifndef GL_ANGLE_memory_object_flags
|
||||
#define GL_ANGLE_memory_object_flags 1
|
||||
#define GL_CREATE_SPARSE_BINDING_BIT_ANGLE 0x00000001
|
||||
#define GL_CREATE_SPARSE_RESIDENCY_BIT_ANGLE 0x00000002
|
||||
#define GL_CREATE_SPARSE_ALIASED_BIT_ANGLE 0x00000004
|
||||
#define GL_CREATE_MUTABLE_FORMAT_BIT_ANGLE 0x00000008
|
||||
#define GL_CREATE_CUBE_COMPATIBLE_BIT_ANGLE 0x00000010
|
||||
#define GL_CREATE_ALIAS_BIT_ANGLE 0x00000400
|
||||
#define GL_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_ANGLE 0x00000040
|
||||
#define GL_CREATE_2D_ARRAY_COMPATIBLE_BIT_ANGLE 0x00000020
|
||||
#define GL_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_ANGLE 0x00000080
|
||||
#define GL_CREATE_EXTENDED_USAGE_BIT_ANGLE 0x00000100
|
||||
#define GL_CREATE_PROTECTED_BIT_ANGLE 0x00000800
|
||||
#define GL_CREATE_DISJOINT_BIT_ANGLE 0x00000200
|
||||
#define GL_CREATE_CORNER_SAMPLED_BIT_ANGLE 0x00002000
|
||||
#define GL_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_ANGLE 0x00001000
|
||||
#define GL_CREATE_SUBSAMPLED_BIT_ANGLE 0x00004000
|
||||
#define GL_USAGE_TRANSFER_SRC_BIT_ANGLE 0x00000001
|
||||
#define GL_USAGE_TRANSFER_DST_BIT_ANGLE 0x00000002
|
||||
#define GL_USAGE_SAMPLED_BIT_ANGLE 0x00000004
|
||||
#define GL_USAGE_STORAGE_BIT_ANGLE 0x00000008
|
||||
#define GL_USAGE_COLOR_ATTACHMENT_BIT_ANGLE 0x00000010
|
||||
#define GL_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT_ANGLE 0x00000020
|
||||
#define GL_USAGE_TRANSIENT_ATTACHMENT_BIT_ANGLE 0x00000040
|
||||
#define GL_USAGE_INPUT_ATTACHMENT_BIT_ANGLE 0x00000080
|
||||
#define GL_USAGE_SHADING_RATE_IMAGE_BIT_ANGLE 0x00000100
|
||||
#define GL_USAGE_FRAGMENT_DENSITY_MAP_BIT_ANGLE 0x00000200
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEMFLAGS2DANGLEPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEMFLAGS2DMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEMFLAGS3DANGLEPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEMFLAGS3DMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMemFlags2DANGLE (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMemFlags2DMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMemFlags3DANGLE (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
GL_APICALL void GL_APIENTRY glTexStorageMemFlags3DMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset, GLbitfield createFlags, GLbitfield usageFlags, const void *imageCreateInfoPNext);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_memory_object_flags */
|
||||
|
||||
#ifndef GL_ANGLE_memory_object_fuchsia
|
||||
#define GL_ANGLE_memory_object_fuchsia 1
|
||||
#define GL_HANDLE_TYPE_ZIRCON_VMO_ANGLE 0x93AE
|
||||
typedef void(GL_APIENTRYP PFNGLIMPORTMEMORYZIRCONHANDLEANGLEPROC)(GLuint memory,
|
||||
GLuint64 size,
|
||||
GLenum handleType,
|
||||
GLuint handle);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportMemoryZirconHandleANGLE(GLuint memory,
|
||||
GLuint64 size,
|
||||
GLenum handleType,
|
||||
GLuint handle);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_memory_object_fuchsia */
|
||||
|
||||
#ifndef GL_ANGLE_semaphore_fuchsia
|
||||
#define GL_ANGLE_semaphore_fuchsia 1
|
||||
#define GL_HANDLE_TYPE_ZIRCON_EVENT_ANGLE 0x93AF
|
||||
typedef void(GL_APIENTRYP PFNGLIMPORTSEMAPHOREZIRCONHANDLEANGLEPROC)(GLuint semaphore,
|
||||
GLenum handleType,
|
||||
GLuint handle);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glImportSemaphoreZirconHandleANGLE(GLuint memory,
|
||||
GLenum handleType,
|
||||
GLuint handle);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_semaphore_fuchsia */
|
||||
|
||||
#ifndef GL_ANGLE_vulkan_image
|
||||
#define GL_ANGLE_vulkan_image 1
|
||||
typedef void(GL_APIENTRYP PFNGLACQUIRETEXTURESANGLEPROC)(GLuint numTexture, const GLuint *textures, const GLenum *layouts);
|
||||
typedef void(GL_APIENTRYP PFNGLRELEASETEXTURESANGLEPROC)(GLuint numTexture, const GLuint *textures, GLenum *layouts);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glAcquireTexturesANGLE(GLuint numTexture, const GLuint *textures, const GLenum *layouts);
|
||||
GL_APICALL void GL_APIENTRY glReleaseTexturesANGLE(GLuint numTexture, const GLuint *textures, GLenum *layouts);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_vulkan_image */
|
||||
|
||||
#ifndef GL_CHROMIUM_texture_filtering_hint
|
||||
#define GL_CHROMIUM_texture_filtering_hint
|
||||
#define GL_TEXTURE_FILTERING_HINT_CHROMIUM 0x8AF0
|
||||
#endif /* GL_CHROMIUM_texture_filtering_hint */
|
||||
|
||||
#ifndef GL_NV_robustness_video_memory
|
||||
#define GL_NV_robustness_video_memory
|
||||
#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
|
||||
#endif /* GL_NV_robustness_video_memory */
|
||||
|
||||
#ifndef GL_ANGLE_get_serialized_context_string
|
||||
#define GL_ANGLE_get_serialized_context_string
|
||||
#define GL_SERIALIZED_CONTEXT_STRING_ANGLE 0x96B0
|
||||
#endif /* GL_ANGLE_get_serialized_context_string */
|
||||
|
||||
#ifndef GL_ANGLE_robust_fragment_shader_output
|
||||
#define GL_ANGLE_robust_fragment_shader_output
|
||||
#define GL_ROBUST_FRAGMENT_SHADER_OUTPUT_ANGLE 0x96B9
|
||||
#endif /* GL_ANGLE_robust_fragment_shader_output */
|
||||
|
||||
#ifndef GL_ANGLE_shader_pixel_local_storage
|
||||
#define GL_ANGLE_shader_pixel_local_storage 1
|
||||
#define GL_MAX_PIXEL_LOCAL_STORAGE_PLANES_ANGLE 0x96E0
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_ANGLE 0x96E1
|
||||
#define GL_MAX_COMBINED_DRAW_BUFFERS_AND_PIXEL_LOCAL_STORAGE_PLANES_ANGLE 0x96E2
|
||||
#define GL_PIXEL_LOCAL_STORAGE_ACTIVE_PLANES_ANGLE 0x96E3
|
||||
#define GL_LOAD_OP_ZERO_ANGLE 0x96E4
|
||||
#define GL_LOAD_OP_CLEAR_ANGLE 0x96E5
|
||||
#define GL_LOAD_OP_LOAD_ANGLE 0x96E6
|
||||
#define GL_STORE_OP_STORE_ANGLE 0x96E7
|
||||
#define GL_PIXEL_LOCAL_FORMAT_ANGLE 0x96E8
|
||||
#define GL_PIXEL_LOCAL_TEXTURE_NAME_ANGLE 0x96E9
|
||||
#define GL_PIXEL_LOCAL_TEXTURE_LEVEL_ANGLE 0x96EA
|
||||
#define GL_PIXEL_LOCAL_TEXTURE_LAYER_ANGLE 0x96EB
|
||||
#define GL_PIXEL_LOCAL_CLEAR_VALUE_FLOAT_ANGLE 0x96EC
|
||||
#define GL_PIXEL_LOCAL_CLEAR_VALUE_INT_ANGLE 0x96ED
|
||||
#define GL_PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_ANGLE 0x96EE
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERMEMORYLESSPIXELLOCALSTORAGEANGLEPROC) (GLint plane, GLenum internalformat);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREPIXELLOCALSTORAGEANGLEPROC) (GLint plane, GLuint backingtexture, GLint level, GLint layer);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALCLEARVALUEFVANGLEPROC) (GLint plane, const GLfloat value[]);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALCLEARVALUEIVANGLEPROC) (GLint plane, const GLint value[]);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALCLEARVALUEUIVANGLEPROC) (GLint plane, const GLuint value[]);
|
||||
typedef void (GL_APIENTRYP PFNGLBEGINPIXELLOCALSTORAGEANGLEPROC) (GLsizei n, const GLenum loadops[]);
|
||||
typedef void (GL_APIENTRYP PFNGLENDPIXELLOCALSTORAGEANGLEPROC) (GLsizei n, const GLenum storeops[]);
|
||||
typedef void (GL_APIENTRYP PFNGLPIXELLOCALSTORAGEBARRIERANGLEPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGEINTERRUPTANGLEPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGERESTOREANGLEPROC) (void);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGEPARAMETERFVANGLEPROC) (GLint plane, GLenum pname, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGEPARAMETERIVANGLEPROC) (GLint plane, GLenum pname, GLint *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGEPARAMETERFVROBUSTANGLEPROC) (GLint plane, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGEPARAMETERIVROBUSTANGLEPROC) (GLint plane, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glFramebufferMemorylessPixelLocalStorageANGLE (GLint plane, GLenum internalformat);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferTexturePixelLocalStorageANGLE (GLint plane, GLuint backingtexture, GLint level, GLint layer);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalClearValuefvANGLE (GLint plane, const GLfloat value[]);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalClearValueivANGLE (GLint plane, const GLint value[]);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalClearValueuivANGLE (GLint plane, const GLuint value[]);
|
||||
GL_APICALL void GL_APIENTRY glBeginPixelLocalStorageANGLE (GLsizei n, const GLenum loadops[]);
|
||||
GL_APICALL void GL_APIENTRY glEndPixelLocalStorageANGLE (GLsizei n, const GLenum storeops[]);
|
||||
GL_APICALL void GL_APIENTRY glPixelLocalStorageBarrierANGLE (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageInterruptANGLE (void);
|
||||
GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageRestoreANGLE (void);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferPixelLocalStorageParameterfvANGLE (GLint plane, GLenum pname, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferPixelLocalStorageParameterivANGLE (GLint plane, GLenum pname, GLint *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferPixelLocalStorageParameterfvRobustANGLE (GLint plane, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params);
|
||||
GL_APICALL void GL_APIENTRY glGetFramebufferPixelLocalStorageParameterivRobustANGLE (GLint plane, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_shader_pixel_local_storage */
|
||||
|
||||
// clang-format on
|
||||
|
||||
#ifndef GL_ANGLE_yuv_internal_format
|
||||
#define GL_ANGLE_yuv_internal_format
|
||||
|
||||
// YUV formats introduced by GL_ANGLE_yuv_internal_format
|
||||
// 8-bit YUV formats
|
||||
#define GL_G8_B8R8_2PLANE_420_UNORM_ANGLE 0x96B1
|
||||
#define GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE 0x96B2
|
||||
|
||||
// 10-bit YUV formats
|
||||
#define GL_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_ANGLE 0x96B3
|
||||
#define GL_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_ANGLE 0x96B4
|
||||
|
||||
// 12-bit YUV formats
|
||||
#define GL_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_ANGLE 0x96B5
|
||||
#define GL_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_ANGLE 0x96B6
|
||||
|
||||
// 16-bit YUV formats
|
||||
#define GL_G16_B16R16_2PLANE_420_UNORM_ANGLE 0x96B7
|
||||
#define GL_G16_B16_R16_3PLANE_420_UNORM_ANGLE 0x96B8
|
||||
|
||||
#endif /* GL_ANGLE_yuv_internal_format */
|
||||
|
||||
#ifndef GL_ANGLE_rgbx_internal_format
|
||||
#define GL_ANGLE_rgbx_internal_format
|
||||
|
||||
#define GL_RGBX8_ANGLE 0x96BA
|
||||
|
||||
#endif /* GL_ANGLE_rgbx_internal_format */
|
||||
|
||||
#ifndef GL_ANGLE_shader_binary
|
||||
#define GL_ANGLE_shader_binary
|
||||
|
||||
// General shader binary format
|
||||
#define GL_SHADER_BINARY_ANGLE 0x96BB
|
||||
|
||||
#endif /* GL_ANGLE_shader_binary */
|
||||
|
||||
#ifndef GL_ANGLE_logic_op
|
||||
#define GL_ANGLE_logic_op
|
||||
|
||||
// Enums identical to GLES1 and desktop GL
|
||||
#define GL_COLOR_LOGIC_OP_ANGLE 0x0BF2
|
||||
#define GL_LOGIC_OP_CLEAR_ANGLE 0x1500
|
||||
#define GL_LOGIC_OP_AND_ANGLE 0x1501
|
||||
#define GL_LOGIC_OP_AND_REVERSE_ANGLE 0x1502
|
||||
#define GL_LOGIC_OP_COPY_ANGLE 0x1503
|
||||
#define GL_LOGIC_OP_AND_INVERTED_ANGLE 0x1504
|
||||
#define GL_LOGIC_OP_NOOP_ANGLE 0x1505
|
||||
#define GL_LOGIC_OP_XOR_ANGLE 0x1506
|
||||
#define GL_LOGIC_OP_OR_ANGLE 0x1507
|
||||
#define GL_LOGIC_OP_NOR_ANGLE 0x1508
|
||||
#define GL_LOGIC_OP_EQUIV_ANGLE 0x1509
|
||||
#define GL_LOGIC_OP_INVERT_ANGLE 0x150A
|
||||
#define GL_LOGIC_OP_OR_REVERSE_ANGLE 0x150B
|
||||
#define GL_LOGIC_OP_COPY_INVERTED_ANGLE 0x150C
|
||||
#define GL_LOGIC_OP_OR_INVERTED_ANGLE 0x150D
|
||||
#define GL_LOGIC_OP_NAND_ANGLE 0x150E
|
||||
#define GL_LOGIC_OP_SET_ANGLE 0x150F
|
||||
typedef void (GL_APIENTRYP PFNGLLOGICOPANGLEPROC) (GLenum);
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GL_APICALL void GL_APIENTRY glLogicOpANGLE (GLenum);
|
||||
#endif
|
||||
#endif /* GL_ANGLE_logic_op */
|
||||
|
||||
#endif // INCLUDE_GLES2_GL2EXT_ANGLE_H_
|
||||
27
flutter_filament/windows/include/GLES2/gl2platform.h
Normal file
27
flutter_filament/windows/include/GLES2/gl2platform.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __gl2platform_h_
|
||||
#define __gl2platform_h_
|
||||
|
||||
/*
|
||||
** Copyright 2017-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* Please contribute modifications back to Khronos as pull requests on the
|
||||
* public github repository:
|
||||
* https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_APICALL
|
||||
#define GL_APICALL KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __gl2platform_h_ */
|
||||
2
flutter_filament/windows/include/GLES3/.clang-format
Normal file
2
flutter_filament/windows/include/GLES3/.clang-format
Normal file
@@ -0,0 +1,2 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: false
|
||||
1192
flutter_filament/windows/include/GLES3/gl3.h
Normal file
1192
flutter_filament/windows/include/GLES3/gl3.h
Normal file
File diff suppressed because it is too large
Load Diff
1507
flutter_filament/windows/include/GLES3/gl31.h
Normal file
1507
flutter_filament/windows/include/GLES3/gl31.h
Normal file
File diff suppressed because it is too large
Load Diff
1808
flutter_filament/windows/include/GLES3/gl32.h
Normal file
1808
flutter_filament/windows/include/GLES3/gl32.h
Normal file
File diff suppressed because it is too large
Load Diff
27
flutter_filament/windows/include/GLES3/gl3platform.h
Normal file
27
flutter_filament/windows/include/GLES3/gl3platform.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __gl3platform_h_
|
||||
#define __gl3platform_h_
|
||||
|
||||
/*
|
||||
** Copyright 2017-2020 The Khronos Group Inc.
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
|
||||
*
|
||||
* Adopters may modify khrplatform.h and this file to suit their platform.
|
||||
* Please contribute modifications back to Khronos as pull requests on the
|
||||
* public github repository:
|
||||
* https://github.com/KhronosGroup/OpenGL-Registry
|
||||
*/
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
#ifndef GL_APICALL
|
||||
#define GL_APICALL KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
#ifndef GL_APIENTRY
|
||||
#define GL_APIENTRY KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
#endif /* __gl3platform_h_ */
|
||||
2
flutter_filament/windows/include/KHR/.clang-format
Normal file
2
flutter_filament/windows/include/KHR/.clang-format
Normal file
@@ -0,0 +1,2 @@
|
||||
DisableFormat: true
|
||||
SortIncludes: false
|
||||
290
flutter_filament/windows/include/KHR/khrplatform.h
Normal file
290
flutter_filament/windows/include/KHR/khrplatform.h
Normal file
@@ -0,0 +1,290 @@
|
||||
#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;
|
||||
*/
|
||||
|
||||
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
|
||||
# define KHRONOS_STATIC 1
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(KHRONOS_STATIC)
|
||||
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
|
||||
* header compatible with static linking. */
|
||||
# define KHRONOS_APICALL
|
||||
#elif defined(_WIN32)
|
||||
# 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_ */
|
||||
86
flutter_filament/windows/include/NullGLES.h
Normal file
86
flutter_filament/windows/include/NullGLES.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_NULLGLES_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_NULLGLES_H
|
||||
|
||||
/*
|
||||
* This is used for debugging (stubbing out GLES calls)
|
||||
*
|
||||
* Simply uncomment the line
|
||||
* using namespace nullgles;
|
||||
*
|
||||
* below.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace filament::backend {
|
||||
namespace nullgles {
|
||||
|
||||
inline void glScissor(GLint, GLint, GLsizei, GLsizei) { }
|
||||
inline void glViewport(GLint, GLint, GLsizei, GLsizei) { }
|
||||
inline void glDepthRangef(GLfloat, GLfloat) { }
|
||||
inline void glClearColor(GLfloat, GLfloat, GLfloat, GLfloat) { }
|
||||
inline void glClearStencil(GLint) { }
|
||||
inline void glClearDepthf(GLfloat) { }
|
||||
|
||||
inline void glBindBufferBase(GLenum, GLuint, GLuint) { }
|
||||
inline void glBindVertexArray (GLuint) { }
|
||||
inline void glBindTexture (GLenum, GLuint) { }
|
||||
inline void glBindBuffer (GLenum, GLuint) { }
|
||||
inline void glBindFramebuffer (GLenum, GLuint) { }
|
||||
inline void glBindRenderbuffer (GLenum, GLuint) { }
|
||||
inline void glUseProgram (GLuint) { }
|
||||
|
||||
inline void glBufferData(GLenum, GLsizeiptr, const void *, GLenum) { }
|
||||
inline void glBufferSubData(GLenum, GLintptr, GLsizeiptr, const void *) { }
|
||||
inline void glCompressedTexSubImage2D(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *) { }
|
||||
inline void glTexSubImage2D(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const void *) { }
|
||||
inline void glGenerateMipmap(GLenum) { }
|
||||
|
||||
inline void glVertexAttribPointer(GLuint, GLint, GLenum, GLboolean, GLsizei, const void *) { }
|
||||
inline void glDisableVertexAttribArray (GLuint) { }
|
||||
inline void glEnableVertexAttribArray (GLuint) { }
|
||||
inline void glDisable (GLenum cap) { }
|
||||
inline void glEnable (GLenum cap) { }
|
||||
inline void glCullFace (GLenum mode) { }
|
||||
inline void glBlendFunc (GLenum, GLenum) { }
|
||||
|
||||
inline void glInvalidateFramebuffer (GLenum, GLsizei, const GLenum *) { }
|
||||
inline void glInvalidateSubFramebuffer (GLenum, GLsizei, const GLenum *, GLint, GLint, GLsizei, GLsizei);
|
||||
|
||||
inline void glSamplerParameteri (GLuint, GLenum, GLint) { }
|
||||
inline void glSamplerParameterf (GLuint, GLenum, GLfloat) { }
|
||||
|
||||
inline void glFramebufferRenderbuffer (GLenum, GLenum, GLenum, GLuint) { }
|
||||
inline void glRenderbufferStorageMultisample (GLenum, GLsizei, GLenum, GLsizei, GLsizei) { }
|
||||
inline void glRenderbufferStorage (GLenum, GLenum, GLsizei, GLsizei) { }
|
||||
|
||||
inline void glClear(GLbitfield) { }
|
||||
inline void glDrawRangeElements(GLenum, GLuint, GLuint, GLsizei, GLenum, const void *) { }
|
||||
inline void glBlitFramebuffer (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum) { }
|
||||
inline void glReadPixels (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void *) { }
|
||||
|
||||
inline GLenum glGetError() { return GL_NO_ERROR; }
|
||||
|
||||
} // namespace nullgles
|
||||
|
||||
// turn GLES calls defined above into no-ops
|
||||
//using namespace nullgles;
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_NULLGLES_H
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRIVATE_ACQUIREDIMAGE_H
|
||||
#define TNT_FILAMENT_BACKEND_PRIVATE_ACQUIREDIMAGE_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class CallbackHandler;
|
||||
|
||||
// This lightweight POD allows us to bundle the state required to process an ACQUIRED stream.
|
||||
// Since these types of external images need to be moved around and queued up, an encapsulation is
|
||||
// very useful.
|
||||
|
||||
struct AcquiredImage {
|
||||
void* image = nullptr;
|
||||
backend::StreamCallback callback = nullptr;
|
||||
void* userData = nullptr;
|
||||
CallbackHandler* handler = nullptr;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRIVATE_ACQUIREDIMAGE_H
|
||||
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/ostream.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class CallbackHandler;
|
||||
|
||||
/**
|
||||
* A CPU memory-buffer descriptor, typically used to transfer data from the CPU to the GPU.
|
||||
*
|
||||
* A BufferDescriptor owns the memory buffer it references, therefore BufferDescriptor cannot
|
||||
* be copied, but can be moved.
|
||||
*
|
||||
* BufferDescriptor releases ownership of the memory-buffer when it's destroyed.
|
||||
*/
|
||||
class UTILS_PUBLIC BufferDescriptor {
|
||||
public:
|
||||
/**
|
||||
* Callback used to destroy the buffer data.
|
||||
* Guarantees:
|
||||
* Called on the main filament thread.
|
||||
*
|
||||
* Limitations:
|
||||
* Must be lightweight.
|
||||
* Must not call filament APIs.
|
||||
*/
|
||||
using Callback = void(*)(void* buffer, size_t size, void* user);
|
||||
|
||||
//! creates an empty descriptor
|
||||
BufferDescriptor() noexcept = default;
|
||||
|
||||
//! calls the callback to advertise BufferDescriptor no-longer owns the buffer
|
||||
~BufferDescriptor() noexcept {
|
||||
if (mCallback) {
|
||||
mCallback(buffer, size, mUser);
|
||||
}
|
||||
}
|
||||
|
||||
BufferDescriptor(const BufferDescriptor& rhs) = delete;
|
||||
BufferDescriptor& operator=(const BufferDescriptor& rhs) = delete;
|
||||
|
||||
BufferDescriptor(BufferDescriptor&& rhs) noexcept
|
||||
: buffer(rhs.buffer), size(rhs.size),
|
||||
mCallback(rhs.mCallback), mUser(rhs.mUser), mHandler(rhs.mHandler) {
|
||||
rhs.buffer = nullptr;
|
||||
rhs.mCallback = nullptr;
|
||||
}
|
||||
|
||||
BufferDescriptor& operator=(BufferDescriptor&& rhs) noexcept {
|
||||
if (this != &rhs) {
|
||||
buffer = rhs.buffer;
|
||||
size = rhs.size;
|
||||
mCallback = rhs.mCallback;
|
||||
mUser = rhs.mUser;
|
||||
mHandler = rhs.mHandler;
|
||||
rhs.buffer = nullptr;
|
||||
rhs.mCallback = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a BufferDescriptor that references a CPU memory-buffer
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @param callback A callback used to release the CPU buffer from this BufferDescriptor
|
||||
* @param user An opaque user pointer passed to the callback function when it's called
|
||||
*/
|
||||
BufferDescriptor(void const* buffer, size_t size,
|
||||
Callback callback = nullptr, void* user = nullptr) noexcept
|
||||
: buffer(const_cast<void*>(buffer)), size(size), mCallback(callback), mUser(user) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a BufferDescriptor that references a CPU memory-buffer
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @param callback A callback used to release the CPU buffer from this BufferDescriptor
|
||||
* @param user An opaque user pointer passed to the callback function when it's called
|
||||
*/
|
||||
BufferDescriptor(void const* buffer, size_t size,
|
||||
CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept
|
||||
: buffer(const_cast<void*>(buffer)), size(size),
|
||||
mCallback(callback), mUser(user), mHandler(handler) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Helper to create a BufferDescriptor that uses a KNOWN method pointer w/ object passed
|
||||
* by pointer as the callback. e.g.:
|
||||
* auto bd = BufferDescriptor::make(buffer, size, &Foo::method, foo);
|
||||
*
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @param handler Handler to use to dispatch the callback, or nullptr for the default handler
|
||||
* @return a new BufferDescriptor
|
||||
*/
|
||||
template<typename T, void(T::*method)(void const*, size_t)>
|
||||
static BufferDescriptor make(
|
||||
void const* buffer, size_t size, T* data, CallbackHandler* handler = nullptr) noexcept {
|
||||
return {
|
||||
buffer, size,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s);
|
||||
}, data
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to create a BufferDescriptor that uses a functor as the callback.
|
||||
*
|
||||
* Caveats:
|
||||
* - DO NOT CALL setCallback() when using this helper.
|
||||
* - This make a heap allocation
|
||||
*
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @param functor functor of type f(void const* buffer, size_t size)
|
||||
* @param handler Handler to use to dispatch the callback, or nullptr for the default handler
|
||||
* @return a new BufferDescriptor
|
||||
*/
|
||||
template<typename T>
|
||||
static BufferDescriptor make(
|
||||
void const* buffer, size_t size, T&& functor, CallbackHandler* handler = nullptr) noexcept {
|
||||
return {
|
||||
buffer, size,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
},
|
||||
new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set or replace the release callback function
|
||||
* @param callback The new callback function
|
||||
* @param user An opaque user pointer passed to the callbeck function when it's called
|
||||
*/
|
||||
void setCallback(Callback callback, void* user = nullptr) noexcept {
|
||||
this->mCallback = callback;
|
||||
this->mUser = user;
|
||||
this->mHandler = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set or replace the release callback function
|
||||
* @param handler The Handler to use to dispatch the callback
|
||||
* @param callback The new callback function
|
||||
* @param user An opaque user pointer passed to the callbeck function when it's called
|
||||
*/
|
||||
void setCallback(CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept {
|
||||
mCallback = callback;
|
||||
mUser = user;
|
||||
mHandler = handler;
|
||||
}
|
||||
|
||||
//! Returns whether a release callback is set
|
||||
bool hasCallback() const noexcept { return mCallback != nullptr; }
|
||||
|
||||
//! Returns the currently set release callback function
|
||||
Callback getCallback() const noexcept {
|
||||
return mCallback;
|
||||
}
|
||||
|
||||
//! Returns the handler for this callback or nullptr if the default handler is to be used.
|
||||
CallbackHandler* getHandler() const noexcept {
|
||||
return mHandler;
|
||||
}
|
||||
|
||||
//! Returns the user opaque pointer associated to this BufferDescriptor
|
||||
void* getUser() const noexcept {
|
||||
return mUser;
|
||||
}
|
||||
|
||||
//! CPU mempry-buffer virtual address
|
||||
void* buffer = nullptr;
|
||||
|
||||
//! CPU memory-buffer size in bytes
|
||||
size_t size = 0;
|
||||
|
||||
private:
|
||||
// callback when the buffer is consumed.
|
||||
Callback mCallback = nullptr;
|
||||
void* mUser = nullptr;
|
||||
CallbackHandler* mHandler = nullptr;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::BufferDescriptor& b);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_CALLBACKHANDLER_H
|
||||
#define TNT_FILAMENT_BACKEND_CALLBACKHANDLER_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A generic interface to dispatch callbacks.
|
||||
*
|
||||
* All APIs that take a callback as argument also take a
|
||||
* CallbackHandler* which is used to dispatch the
|
||||
* callback: CallbackHandler::post() method is called from a service thread as soon
|
||||
* as possible (this will NEVER be the main thread), CallbackHandler::post()
|
||||
* is responsible for scheduling the callback onto the thread the
|
||||
* user desires.
|
||||
*
|
||||
* This is intended to make callbacks interoperate with
|
||||
* the platform/OS's own messaging system.
|
||||
*
|
||||
* CallbackHandler* can always be nullptr in which case the default handler is used. The
|
||||
* default handler always dispatches callbacks on filament's main thread opportunistically.
|
||||
*
|
||||
* Life time:
|
||||
* ---------
|
||||
*
|
||||
* Filament make no attempts to manage the life time of the CallbackHandler* and never takes
|
||||
* ownership.
|
||||
* In particular, this means that the CallbackHandler instance must stay valid until all
|
||||
* pending callbacks are been dispatched.
|
||||
*
|
||||
* Similarly, when shutting down filament, care must be taken to ensure that all pending callbacks
|
||||
* that might access filament's state have been dispatched. Filament can no longer ensure this
|
||||
* because callback execution is the responsibility of the CallbackHandler, which is external to
|
||||
* filament.
|
||||
* Typically, the concrete CallbackHandler would have a mechanism to drain and/or wait for all
|
||||
* callbacks to be processed.
|
||||
*
|
||||
*/
|
||||
class CallbackHandler {
|
||||
public:
|
||||
using Callback = void(*)(void* user);
|
||||
|
||||
/**
|
||||
* Schedules the callback to be called onto the appropriate thread.
|
||||
* Typically this will be the application's main thead.
|
||||
*
|
||||
* Must be thread-safe.
|
||||
*/
|
||||
virtual void post(void* user, Callback callback) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~CallbackHandler();
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_CALLBACKHANDLER_H
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRIVATE_DRIVERAPIFORWARD_H
|
||||
#define TNT_FILAMENT_BACKEND_PRIVATE_DRIVERAPIFORWARD_H
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class CommandStream;
|
||||
|
||||
using DriverApi = CommandStream;
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRIVATE_DRIVERAPIFORWARD_H
|
||||
1181
flutter_filament/windows/include/filament/backend/DriverEnums.h
Normal file
1181
flutter_filament/windows/include/filament/backend/DriverEnums.h
Normal file
File diff suppressed because it is too large
Load Diff
136
flutter_filament/windows/include/filament/backend/Handle.h
Normal file
136
flutter_filament/windows/include/filament/backend/Handle.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
#define TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#if !defined(NDEBUG)
|
||||
#include <utils/Log.h>
|
||||
#endif
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
#include <type_traits>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
struct HwBufferObject;
|
||||
struct HwFence;
|
||||
struct HwIndexBuffer;
|
||||
struct HwProgram;
|
||||
struct HwRenderPrimitive;
|
||||
struct HwRenderTarget;
|
||||
struct HwSamplerGroup;
|
||||
struct HwStream;
|
||||
struct HwSwapChain;
|
||||
struct HwSync;
|
||||
struct HwTexture;
|
||||
struct HwTimerQuery;
|
||||
struct HwVertexBuffer;
|
||||
|
||||
/*
|
||||
* A handle to a backend resource. HandleBase is for internal use only.
|
||||
* HandleBase *must* be a trivial for the purposes of calls, that is, it cannot have user-defined
|
||||
* copy or move constructors.
|
||||
*/
|
||||
|
||||
//! \privatesection
|
||||
|
||||
class HandleBase {
|
||||
public:
|
||||
using HandleId = uint32_t;
|
||||
static constexpr const HandleId nullid = HandleId{ std::numeric_limits<HandleId>::max() };
|
||||
|
||||
constexpr HandleBase() noexcept: object(nullid) {}
|
||||
|
||||
// whether this Handle is initialized
|
||||
explicit operator bool() const noexcept { return object != nullid; }
|
||||
|
||||
// clear the handle, this doesn't free associated resources
|
||||
void clear() noexcept { object = nullid; }
|
||||
|
||||
// compare handles
|
||||
bool operator==(const HandleBase& rhs) const noexcept { return object == rhs.object; }
|
||||
bool operator!=(const HandleBase& rhs) const noexcept { return object != rhs.object; }
|
||||
bool operator<(const HandleBase& rhs) const noexcept { return object < rhs.object; }
|
||||
bool operator<=(const HandleBase& rhs) const noexcept { return object <= rhs.object; }
|
||||
bool operator>(const HandleBase& rhs) const noexcept { return object > rhs.object; }
|
||||
bool operator>=(const HandleBase& rhs) const noexcept { return object >= rhs.object; }
|
||||
|
||||
// get this handle's handleId
|
||||
HandleId getId() const noexcept { return object; }
|
||||
|
||||
// initialize a handle, for internal use only.
|
||||
explicit HandleBase(HandleId id) noexcept : object(id) {
|
||||
assert_invariant(object != nullid); // usually means an uninitialized handle is used
|
||||
}
|
||||
|
||||
protected:
|
||||
HandleBase(HandleBase const& rhs) noexcept = default;
|
||||
HandleBase& operator=(HandleBase const& rhs) noexcept = default;
|
||||
|
||||
private:
|
||||
HandleId object;
|
||||
};
|
||||
|
||||
/**
|
||||
* Type-safe handle to backend resources
|
||||
* @tparam T Type of the resource
|
||||
*/
|
||||
template<typename T>
|
||||
struct Handle : public HandleBase {
|
||||
|
||||
Handle() noexcept = default;
|
||||
|
||||
Handle(Handle const& rhs) noexcept = default;
|
||||
|
||||
Handle& operator=(Handle const& rhs) noexcept = default;
|
||||
|
||||
explicit Handle(HandleId id) noexcept : HandleBase(id) { }
|
||||
|
||||
// type-safe Handle cast
|
||||
template<typename B, typename = std::enable_if_t<std::is_base_of<T, B>::value> >
|
||||
Handle(Handle<B> const& base) noexcept : HandleBase(base) { } // NOLINT(hicpp-explicit-conversions,google-explicit-constructor)
|
||||
|
||||
private:
|
||||
#if !defined(NDEBUG)
|
||||
template <typename U>
|
||||
friend utils::io::ostream& operator<<(utils::io::ostream& out, const Handle<U>& h) noexcept;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Types used by the command stream
|
||||
// (we use this renaming because the macro-system doesn't deal well with "<" and ">")
|
||||
using BufferObjectHandle = Handle<HwBufferObject>;
|
||||
using FenceHandle = Handle<HwFence>;
|
||||
using IndexBufferHandle = Handle<HwIndexBuffer>;
|
||||
using ProgramHandle = Handle<HwProgram>;
|
||||
using RenderPrimitiveHandle = Handle<HwRenderPrimitive>;
|
||||
using RenderTargetHandle = Handle<HwRenderTarget>;
|
||||
using SamplerGroupHandle = Handle<HwSamplerGroup>;
|
||||
using StreamHandle = Handle<HwStream>;
|
||||
using SwapChainHandle = Handle<HwSwapChain>;
|
||||
using SyncHandle = Handle<HwSync>;
|
||||
using TextureHandle = Handle<HwTexture>;
|
||||
using TimerQueryHandle = Handle<HwTimerQuery>;
|
||||
using VertexBufferHandle = Handle<HwVertexBuffer>;
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
#define TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/Handle.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
//! \privatesection
|
||||
|
||||
struct PipelineState {
|
||||
Handle<HwProgram> program;
|
||||
RasterState rasterState;
|
||||
StencilState stencilState;
|
||||
PolygonOffset polygonOffset;
|
||||
Viewport scissor{ 0, 0,
|
||||
(uint32_t)std::numeric_limits<int32_t>::max(),
|
||||
(uint32_t)std::numeric_limits<int32_t>::max()
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PipelineState& ps);
|
||||
#endif
|
||||
|
||||
#endif //TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
|
||||
#include <backend/BufferDescriptor.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A descriptor to an image in main memory, typically used to transfer image data from the CPU
|
||||
* to the GPU.
|
||||
*
|
||||
* A PixelBufferDescriptor owns the memory buffer it references, therefore PixelBufferDescriptor
|
||||
* cannot be copied, but can be moved.
|
||||
*
|
||||
* PixelBufferDescriptor releases ownership of the memory-buffer when it's destroyed.
|
||||
*/
|
||||
class UTILS_PUBLIC PixelBufferDescriptor : public BufferDescriptor {
|
||||
public:
|
||||
using PixelDataFormat = backend::PixelDataFormat;
|
||||
using PixelDataType = backend::PixelDataType;
|
||||
|
||||
PixelBufferDescriptor() = default;
|
||||
|
||||
/**
|
||||
* Creates a new PixelBufferDescriptor referencing an image in main memory
|
||||
*
|
||||
* @param buffer Virtual address of the buffer containing the image
|
||||
* @param size Size in bytes of the buffer containing the image
|
||||
* @param format Format of the image pixels
|
||||
* @param type Type of the image pixels
|
||||
* @param alignment Alignment in bytes of pixel rows
|
||||
* @param left Left coordinate in pixels
|
||||
* @param top Top coordinate in pixels
|
||||
* @param stride Stride of a row in pixels
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler
|
||||
* @param callback A callback used to release the CPU buffer
|
||||
* @param user An opaque user pointer passed to the callback function when it's called
|
||||
*/
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment,
|
||||
uint32_t left, uint32_t top, uint32_t stride,
|
||||
CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, handler, callback, user),
|
||||
left(left), top(top), stride(stride),
|
||||
format(format), type(type), alignment(alignment) {
|
||||
}
|
||||
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment = 1,
|
||||
uint32_t left = 0, uint32_t top = 0, uint32_t stride = 0,
|
||||
Callback callback = nullptr, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, callback, user),
|
||||
left(left), top(top), stride(stride),
|
||||
format(format), type(type), alignment(alignment) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new PixelBufferDescriptor referencing an image in main memory
|
||||
*
|
||||
* @param buffer Virtual address of the buffer containing the image
|
||||
* @param size Size in bytes of the buffer containing the image
|
||||
* @param format Format of the image pixels
|
||||
* @param type Type of the image pixels
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler
|
||||
* @param callback A callback used to release the CPU buffer
|
||||
* @param user An opaque user pointer passed to the callback function when it's called
|
||||
*/
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type,
|
||||
CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, handler, callback, user),
|
||||
stride(0), format(format), type(type), alignment(1) {
|
||||
}
|
||||
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type,
|
||||
Callback callback, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, callback, user),
|
||||
stride(0), format(format), type(type), alignment(1) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new PixelBufferDescriptor referencing a compressed image in main memory
|
||||
*
|
||||
* @param buffer Virtual address of the buffer containing the image
|
||||
* @param size Size in bytes of the buffer containing the image
|
||||
* @param format Compressed format of the image
|
||||
* @param imageSize Compressed size of the image
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler
|
||||
* @param callback A callback used to release the CPU buffer
|
||||
* @param user An opaque user pointer passed to the callback function when it's called
|
||||
*/
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize,
|
||||
CallbackHandler* handler, Callback callback, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, handler, callback, user),
|
||||
imageSize(imageSize), compressedFormat(format), type(PixelDataType::COMPRESSED),
|
||||
alignment(1) {
|
||||
}
|
||||
|
||||
PixelBufferDescriptor(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize,
|
||||
Callback callback, void* user = nullptr) noexcept
|
||||
: BufferDescriptor(buffer, size, callback, user),
|
||||
imageSize(imageSize), compressedFormat(format), type(PixelDataType::COMPRESSED),
|
||||
alignment(1) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
template<typename T, void(T::*method)(void const*, size_t)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment,
|
||||
uint32_t left, uint32_t top, uint32_t stride, T* data,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, type, alignment, left, top, stride,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data };
|
||||
}
|
||||
|
||||
template<typename T, void(T::*method)(void const*, size_t)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, T* data,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, type, handler, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data };
|
||||
}
|
||||
|
||||
template<typename T, void(T::*method)(void const*, size_t)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize, T* data,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, imageSize, handler, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment,
|
||||
uint32_t left, uint32_t top, uint32_t stride, T&& functor,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, type, alignment, left, top, stride,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, T&& functor,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, type,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize, T&& functor,
|
||||
CallbackHandler* handler = nullptr) noexcept {
|
||||
return { buffer, size, format, imageSize,
|
||||
handler, [](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Computes the size in bytes needed to fit an image of given dimensions and format
|
||||
*
|
||||
* @param format Format of the image pixels
|
||||
* @param type Type of the image pixels
|
||||
* @param stride Stride of a row in pixels
|
||||
* @param height Height of the image in rows
|
||||
* @param alignment Alignment in bytes of pixel rows
|
||||
* @return The buffer size needed to fit this image in bytes
|
||||
*/
|
||||
static constexpr size_t computeDataSize(PixelDataFormat format, PixelDataType type,
|
||||
size_t stride, size_t height, size_t alignment) noexcept {
|
||||
assert_invariant(alignment);
|
||||
|
||||
if (type == PixelDataType::COMPRESSED) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t n = 0;
|
||||
switch (format) {
|
||||
case PixelDataFormat::R:
|
||||
case PixelDataFormat::R_INTEGER:
|
||||
case PixelDataFormat::DEPTH_COMPONENT:
|
||||
case PixelDataFormat::ALPHA:
|
||||
n = 1;
|
||||
break;
|
||||
case PixelDataFormat::RG:
|
||||
case PixelDataFormat::RG_INTEGER:
|
||||
case PixelDataFormat::DEPTH_STENCIL:
|
||||
n = 2;
|
||||
break;
|
||||
case PixelDataFormat::RGB:
|
||||
case PixelDataFormat::RGB_INTEGER:
|
||||
n = 3;
|
||||
break;
|
||||
case PixelDataFormat::UNUSED: // shouldn't happen (used to be rgbm)
|
||||
case PixelDataFormat::RGBA:
|
||||
case PixelDataFormat::RGBA_INTEGER:
|
||||
n = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
size_t bpp = n;
|
||||
switch (type) {
|
||||
case PixelDataType::COMPRESSED: // Impossible -- to squash the IDE warnings
|
||||
case PixelDataType::UBYTE:
|
||||
case PixelDataType::BYTE:
|
||||
// nothing to do
|
||||
break;
|
||||
case PixelDataType::USHORT:
|
||||
case PixelDataType::SHORT:
|
||||
case PixelDataType::HALF:
|
||||
bpp *= 2;
|
||||
break;
|
||||
case PixelDataType::UINT:
|
||||
case PixelDataType::INT:
|
||||
case PixelDataType::FLOAT:
|
||||
bpp *= 4;
|
||||
break;
|
||||
case PixelDataType::UINT_10F_11F_11F_REV:
|
||||
// Special case, format must be RGB and uses 4 bytes
|
||||
assert_invariant(format == PixelDataFormat::RGB);
|
||||
bpp = 4;
|
||||
break;
|
||||
case PixelDataType::UINT_2_10_10_10_REV:
|
||||
// Special case, format must be RGBA and uses 4 bytes
|
||||
assert_invariant(format == PixelDataFormat::RGBA);
|
||||
bpp = 4;
|
||||
break;
|
||||
case PixelDataType::USHORT_565:
|
||||
// Special case, format must be RGB and uses 2 bytes
|
||||
assert_invariant(format == PixelDataFormat::RGB);
|
||||
bpp = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
size_t const bpr = bpp * stride;
|
||||
size_t const bprAligned = (bpr + (alignment - 1)) & (~alignment + 1);
|
||||
return bprAligned * height;
|
||||
}
|
||||
|
||||
//! left coordinate in pixels
|
||||
uint32_t left = 0;
|
||||
//! top coordinate in pixels
|
||||
uint32_t top = 0;
|
||||
union {
|
||||
struct {
|
||||
//! stride in pixels
|
||||
uint32_t stride;
|
||||
//! Pixel data format
|
||||
PixelDataFormat format;
|
||||
};
|
||||
struct {
|
||||
//! compressed image size
|
||||
uint32_t imageSize;
|
||||
//! compressed image format
|
||||
backend::CompressedPixelDataType compressedFormat;
|
||||
};
|
||||
};
|
||||
//! pixel data type
|
||||
PixelDataType type : 4;
|
||||
//! row alignment in bytes
|
||||
uint8_t alignment : 4;
|
||||
};
|
||||
|
||||
} // namespace backend::filament
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PixelBufferDescriptor& b);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
86
flutter_filament/windows/include/filament/backend/Platform.h
Normal file
86
flutter_filament/windows/include/filament/backend/Platform.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
#define TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class Driver;
|
||||
|
||||
/**
|
||||
* Platform is an interface that abstracts how the backend (also referred to as Driver) is
|
||||
* created. The backend provides several common Platform concrete implementations, which are
|
||||
* selected automatically. It is possible however to provide a custom Platform when creating
|
||||
* the filament Engine.
|
||||
*/
|
||||
class UTILS_PUBLIC Platform {
|
||||
public:
|
||||
struct SwapChain {};
|
||||
struct Fence {};
|
||||
struct Stream {};
|
||||
|
||||
struct DriverConfig {
|
||||
/*
|
||||
* size of handle arena in bytes. Setting to 0 indicates default value is to be used.
|
||||
* Driver clamps to valid values.
|
||||
*/
|
||||
size_t handleArenaSize = 0;
|
||||
};
|
||||
|
||||
virtual ~Platform() noexcept;
|
||||
|
||||
/**
|
||||
* Queries the underlying OS version.
|
||||
* @return The OS version.
|
||||
*/
|
||||
virtual int getOSVersion() const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Creates and initializes the low-level API (e.g. an OpenGL context or Vulkan instance),
|
||||
* then creates the concrete Driver.
|
||||
* The caller takes ownership of the returned Driver* and must destroy it with delete.
|
||||
*
|
||||
* @param sharedContext an optional shared context. This is not meaningful with all graphic
|
||||
* APIs and platforms.
|
||||
* For EGL platforms, this is an EGLContext.
|
||||
*
|
||||
* @param driverConfig specifies driver initialization parameters
|
||||
*
|
||||
* @return nullptr on failure, or a pointer to the newly created driver.
|
||||
*/
|
||||
virtual backend::Driver* createDriver(void* sharedContext,
|
||||
const DriverConfig& driverConfig) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Processes the platform's event queue when called from its primary event-handling thread.
|
||||
*
|
||||
* Internally, Filament might need to call this when waiting on a fence. It is only implemented
|
||||
* on platforms that need it, such as macOS + OpenGL. Returns false if this is not the main
|
||||
* thread, or if the platform does not need to perform any special processing.
|
||||
*/
|
||||
virtual bool pumpEvents() noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
#define TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
|
||||
/**
|
||||
* A PresentCallable is a callable object that, when called, schedules a frame for presentation on
|
||||
* a SwapChain.
|
||||
*
|
||||
* Typically, Filament's backend is responsible scheduling a frame's presentation. However, there
|
||||
* are certain cases where the application might want to control when a frame is scheduled for
|
||||
* presentation.
|
||||
*
|
||||
* For example, on iOS, UIKit elements can be synchronized to 3D content by scheduling a present
|
||||
* within a CATransation:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* void myFrameScheduledCallback(PresentCallable presentCallable, void* user) {
|
||||
* [CATransaction begin];
|
||||
* // Update other UI elements...
|
||||
* presentCallable();
|
||||
* [CATransaction commit];
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* To obtain a PresentCallable, set a SwapChain::FrameScheduledCallback on a SwapChain with the
|
||||
* SwapChain::setFrameScheduledCallback method. The callback is called with a PresentCallable object
|
||||
* and optional user data:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* swapChain->setFrameScheduledCallback(myFrameScheduledCallback, nullptr);
|
||||
* if (renderer->beginFrame(swapChain)) {
|
||||
* renderer->render(view);
|
||||
* renderer->endFrame();
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @remark Only Filament's Metal backend supports PresentCallables and frame callbacks. Other
|
||||
* backends ignore the callback (which will never be called) and proceed normally.
|
||||
*
|
||||
* @remark The SwapChain::FrameScheduledCallback is called on an arbitrary thread.
|
||||
*
|
||||
* Applications *must* call each PresentCallable they receive. Each PresentCallable represents a
|
||||
* frame that is waiting to be presented. If an application fails to call a PresentCallable, a
|
||||
* memory leak could occur. To "cancel" the presentation of a frame, pass false to the
|
||||
* PresentCallable, which will cancel the presentation of the frame and release associated memory.
|
||||
*
|
||||
* @see Renderer, SwapChain::setFrameScheduledCallback
|
||||
*/
|
||||
class UTILS_PUBLIC PresentCallable {
|
||||
public:
|
||||
|
||||
using PresentFn = void(*)(bool presentFrame, void* user);
|
||||
|
||||
PresentCallable(PresentFn fn, void* user) noexcept;
|
||||
~PresentCallable() noexcept = default;
|
||||
PresentCallable(const PresentCallable& rhs) = default;
|
||||
PresentCallable& operator=(const PresentCallable& rhs) = default;
|
||||
|
||||
/**
|
||||
* Call this PresentCallable, scheduling the associated frame for presentation. Pass false for
|
||||
* presentFrame to effectively "cancel" the presentation of the frame.
|
||||
*
|
||||
* @param presentFrame if false, will not present the frame but releases associated memory
|
||||
*/
|
||||
void operator()(bool presentFrame = true) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
PresentFn mPresentFn;
|
||||
void* mUser = nullptr;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated, FrameFinishedCallback has been renamed to SwapChain::FrameScheduledCallback.
|
||||
*/
|
||||
using FrameFinishedCallback UTILS_DEPRECATED = void(*)(PresentCallable callable, void* user);
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
129
flutter_filament/windows/include/filament/backend/Program.h
Normal file
129
flutter_filament/windows/include/filament/backend/Program.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRIVATE_PROGRAM_H
|
||||
#define TNT_FILAMENT_BACKEND_PRIVATE_PROGRAM_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/CString.h>
|
||||
#include <utils/FixedCapacityVector.h>
|
||||
#include <utils/Invocable.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/ostream.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <array>
|
||||
#include <variant>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class Program {
|
||||
public:
|
||||
|
||||
static constexpr size_t SHADER_TYPE_COUNT = 3;
|
||||
static constexpr size_t UNIFORM_BINDING_COUNT = CONFIG_UNIFORM_BINDING_COUNT;
|
||||
static constexpr size_t SAMPLER_BINDING_COUNT = CONFIG_SAMPLER_BINDING_COUNT;
|
||||
|
||||
struct Sampler {
|
||||
utils::CString name = {}; // name of the sampler in the shader
|
||||
uint32_t binding = 0; // binding point of the sampler in the shader
|
||||
};
|
||||
|
||||
struct SamplerGroupData {
|
||||
utils::FixedCapacityVector<Sampler> samplers;
|
||||
ShaderStageFlags stageFlags = ShaderStageFlags::ALL_SHADER_STAGE_FLAGS;
|
||||
};
|
||||
|
||||
using UniformBlockInfo = std::array<utils::CString, UNIFORM_BINDING_COUNT>;
|
||||
using SamplerGroupInfo = std::array<SamplerGroupData, SAMPLER_BINDING_COUNT>;
|
||||
using ShaderBlob = utils::FixedCapacityVector<uint8_t>;
|
||||
using ShaderSource = std::array<ShaderBlob, SHADER_TYPE_COUNT>;
|
||||
|
||||
Program() noexcept;
|
||||
|
||||
Program(const Program& rhs) = delete;
|
||||
Program& operator=(const Program& rhs) = delete;
|
||||
|
||||
Program(Program&& rhs) noexcept;
|
||||
Program& operator=(Program&& rhs) noexcept;
|
||||
|
||||
~Program() noexcept;
|
||||
|
||||
// sets the material name and variant for diagnostic purposes only
|
||||
Program& diagnostics(utils::CString const& name,
|
||||
utils::Invocable<utils::io::ostream&(utils::io::ostream& out)>&& logger);
|
||||
|
||||
// sets one of the program's shader (e.g. vertex, fragment)
|
||||
// string-based shaders are null terminated, consequently the size parameter must include the
|
||||
// null terminating character.
|
||||
Program& shader(ShaderStage shader, void const* data, size_t size);
|
||||
|
||||
// Note: This is only needed for GLES3.0 backends, because the layout(binding=) syntax is
|
||||
// not permitted in glsl. The backend needs a way to associate a uniform block
|
||||
// to a binding point.
|
||||
Program& uniformBlockBindings(
|
||||
utils::FixedCapacityVector<std::pair<utils::CString, uint8_t>> const& uniformBlockBindings) noexcept;
|
||||
|
||||
// sets the 'bindingPoint' sampler group descriptor for this program.
|
||||
// 'samplers' can be destroyed after this call.
|
||||
// This effectively associates a set of (BindingPoints, index) to a texture unit in the shader.
|
||||
// Or more precisely, what layout(binding=) is set to in GLSL.
|
||||
Program& setSamplerGroup(size_t bindingPoint, ShaderStageFlags stageFlags,
|
||||
Sampler const* samplers, size_t count) noexcept;
|
||||
|
||||
struct SpecializationConstant {
|
||||
uint32_t id; // id set in glsl
|
||||
std::variant<int32_t, float, bool> value; // value and type
|
||||
};
|
||||
|
||||
Program& specializationConstants(
|
||||
utils::FixedCapacityVector<SpecializationConstant> specConstants) noexcept;
|
||||
|
||||
|
||||
ShaderSource const& getShadersSource() const noexcept { return mShadersSource; }
|
||||
ShaderSource& getShadersSource() noexcept { return mShadersSource; }
|
||||
|
||||
UniformBlockInfo const& getUniformBlockBindings() const noexcept { return mUniformBlocks; }
|
||||
UniformBlockInfo& getUniformBlockBindings() noexcept { return mUniformBlocks; }
|
||||
|
||||
SamplerGroupInfo const& getSamplerGroupInfo() const { return mSamplerGroups; }
|
||||
SamplerGroupInfo& getSamplerGroupInfo() { return mSamplerGroups; }
|
||||
|
||||
utils::CString const& getName() const noexcept { return mName; }
|
||||
utils::CString& getName() noexcept { return mName; }
|
||||
|
||||
utils::FixedCapacityVector<SpecializationConstant> const& getSpecializationConstants() const noexcept {
|
||||
return mSpecializationConstants;
|
||||
}
|
||||
utils::FixedCapacityVector<SpecializationConstant>& getSpecializationConstants() noexcept {
|
||||
return mSpecializationConstants;
|
||||
}
|
||||
|
||||
private:
|
||||
friend utils::io::ostream& operator<<(utils::io::ostream& out, const Program& builder);
|
||||
|
||||
UniformBlockInfo mUniformBlocks = {};
|
||||
SamplerGroupInfo mSamplerGroups = {};
|
||||
ShaderSource mShadersSource;
|
||||
utils::CString mName;
|
||||
utils::Invocable<utils::io::ostream&(utils::io::ostream& out)> mLogger;
|
||||
utils::FixedCapacityVector<SpecializationConstant> mSpecializationConstants;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRIVATE_PROGRAM_H
|
||||
@@ -0,0 +1,4 @@
|
||||
# include/backend Headers
|
||||
|
||||
Headers in `include/backend/` are fully public, in particular they can be included in filament's
|
||||
public headers.
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_SAMPLERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_BACKEND_SAMPLERDESCRIPTOR_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/Handle.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
struct UTILS_PUBLIC SamplerDescriptor {
|
||||
Handle<HwTexture> t;
|
||||
SamplerParams s{};
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_SAMPLERDESCRIPTOR_H
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
#define TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/Handle.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
//! \privatesection
|
||||
|
||||
struct TargetBufferInfo {
|
||||
// texture to be used as render target
|
||||
Handle<HwTexture> handle;
|
||||
|
||||
// level to be used
|
||||
uint8_t level = 0;
|
||||
|
||||
// for cubemaps and 3D textures. See TextureCubemapFace for the face->layer mapping
|
||||
uint16_t layer = 0;
|
||||
};
|
||||
|
||||
class MRT {
|
||||
public:
|
||||
static constexpr uint8_t MIN_SUPPORTED_RENDER_TARGET_COUNT = 4u;
|
||||
|
||||
// When updating this, make sure to also take care of RenderTarget.java
|
||||
static constexpr uint8_t MAX_SUPPORTED_RENDER_TARGET_COUNT = 8u;
|
||||
|
||||
private:
|
||||
TargetBufferInfo mInfos[MAX_SUPPORTED_RENDER_TARGET_COUNT];
|
||||
|
||||
public:
|
||||
TargetBufferInfo const& operator[](size_t i) const noexcept {
|
||||
return mInfos[i];
|
||||
}
|
||||
|
||||
TargetBufferInfo& operator[](size_t i) noexcept {
|
||||
return mInfos[i];
|
||||
}
|
||||
|
||||
MRT() noexcept = default;
|
||||
|
||||
MRT(TargetBufferInfo const& color) noexcept // NOLINT(hicpp-explicit-conversions)
|
||||
: mInfos{ color } {
|
||||
}
|
||||
|
||||
MRT(TargetBufferInfo const& color0, TargetBufferInfo const& color1) noexcept
|
||||
: mInfos{ color0, color1 } {
|
||||
}
|
||||
|
||||
MRT(TargetBufferInfo const& color0, TargetBufferInfo const& color1,
|
||||
TargetBufferInfo const& color2) noexcept
|
||||
: mInfos{ color0, color1, color2 } {
|
||||
}
|
||||
|
||||
MRT(TargetBufferInfo const& color0, TargetBufferInfo const& color1,
|
||||
TargetBufferInfo const& color2, TargetBufferInfo const& color3) noexcept
|
||||
: mInfos{ color0, color1, color2, color3 } {
|
||||
}
|
||||
|
||||
// this is here for backward compatibility
|
||||
MRT(Handle<HwTexture> handle, uint8_t level, uint16_t layer) noexcept
|
||||
: mInfos{{ handle, level, layer }} {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::MRT& mrt);
|
||||
#endif
|
||||
|
||||
#endif //TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRIVATE_OPENGLPLATFORM_H
|
||||
#define TNT_FILAMENT_BACKEND_PRIVATE_OPENGLPLATFORM_H
|
||||
|
||||
#include <backend/AcquiredImage.h>
|
||||
#include <backend/Platform.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class Driver;
|
||||
|
||||
/**
|
||||
* A Platform interface that creates an OpenGL backend.
|
||||
*
|
||||
* WARNING: None of the methods below are allowed to change the GL state and must restore it
|
||||
* upon return.
|
||||
*
|
||||
*/
|
||||
class OpenGLPlatform : public Platform {
|
||||
protected:
|
||||
|
||||
/*
|
||||
* Derived classes can use this to instantiate the default OpenGLDriver backend.
|
||||
* This is typically called from your implementation of createDriver()
|
||||
*/
|
||||
static Driver* createDefaultDriver(OpenGLPlatform* platform,
|
||||
void* sharedContext, const DriverConfig& driverConfig);
|
||||
|
||||
~OpenGLPlatform() noexcept override;
|
||||
|
||||
public:
|
||||
|
||||
struct ExternalTexture {
|
||||
unsigned int target; // GLenum target
|
||||
unsigned int id; // GLuint id
|
||||
};
|
||||
|
||||
/**
|
||||
* Called by the driver to destroy the OpenGL context. This should clean up any windows
|
||||
* or buffers from initialization. This is for instance where `eglDestroyContext` would be
|
||||
* called.
|
||||
*/
|
||||
virtual void terminate() noexcept = 0;
|
||||
|
||||
/**
|
||||
* Called by the driver to create a SwapChain for this driver.
|
||||
*
|
||||
* @param nativeWindow a token representing the native window. See concrete implementation
|
||||
* for details.
|
||||
* @param flags extra flags used by the implementation, see filament::SwapChain
|
||||
* @return The driver's SwapChain object.
|
||||
*
|
||||
*/
|
||||
virtual SwapChain* createSwapChain(void* nativeWindow, uint64_t flags) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.
|
||||
* The default implementation returns false.
|
||||
*
|
||||
* @return true if SWAP_CHAIN_CONFIG_SRGB_COLORSPACE is supported, false otherwise.
|
||||
*/
|
||||
virtual bool isSRGBSwapChainSupported() const noexcept;
|
||||
|
||||
/**
|
||||
* Called by the driver create a headless SwapChain.
|
||||
*
|
||||
* @param width width of the buffer
|
||||
* @param height height of the buffer
|
||||
* @param flags extra flags used by the implementation, see filament::SwapChain
|
||||
* @return The driver's SwapChain object.
|
||||
*
|
||||
* TODO: we need a more generic way of passing construction parameters
|
||||
* A void* might be enough.
|
||||
*/
|
||||
virtual SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Called by the driver to destroys the SwapChain
|
||||
* @param swapChain SwapChain to be destroyed.
|
||||
*/
|
||||
virtual void destroySwapChain(SwapChain* swapChain) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Called by the driver to establish the default FBO. The default implementation returns 0.
|
||||
* @return a GLuint casted to a uint32_t that is an OpenGL framebuffer object.
|
||||
*/
|
||||
virtual uint32_t createDefaultRenderTarget() noexcept;
|
||||
|
||||
/**
|
||||
* Called by the driver to make the OpenGL context active on the calling thread and bind
|
||||
* the drawSwapChain to the default render target (FBO) created with createDefaultRenderTarget.
|
||||
* @param drawSwapChain SwapChain to draw to. It must be bound to the default FBO.
|
||||
* @param readSwapChain SwapChain to read from (for operation like `glBlitFramebuffer`)
|
||||
*/
|
||||
virtual void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Called by the driver once the current frame finishes drawing. Typically, this should present
|
||||
* the drawSwapChain. This is for example where `eglMakeCurrent()` would be called.
|
||||
* @param swapChain the SwapChain to present.
|
||||
*/
|
||||
virtual void commit(SwapChain* swapChain) noexcept = 0;
|
||||
|
||||
/**
|
||||
* Set the time the next committed buffer should be presented to the user at.
|
||||
*
|
||||
* @param presentationTimeInNanosecond time in the future in nanosecond. The clock used depends
|
||||
* on the concrete platform implementation.
|
||||
*/
|
||||
virtual void setPresentationTime(int64_t presentationTimeInNanosecond) noexcept;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Fence support
|
||||
|
||||
/**
|
||||
* Can this implementation create a Fence.
|
||||
* @return true if supported, false otherwise. The default implementation returns false.
|
||||
*/
|
||||
virtual bool canCreateFence() noexcept;
|
||||
|
||||
/**
|
||||
* Creates a Fence (e.g. eglCreateSyncKHR). This must be implemented if `canCreateFence`
|
||||
* returns true. Fences are used for frame pacing.
|
||||
*
|
||||
* @return A Fence object. The default implementation returns nullptr.
|
||||
*/
|
||||
virtual Fence* createFence() noexcept;
|
||||
|
||||
/**
|
||||
* Destroys a Fence object. The default implementation does nothing.
|
||||
*
|
||||
* @param fence Fence to destroy.
|
||||
*/
|
||||
virtual void destroyFence(Fence* fence) noexcept;
|
||||
|
||||
/**
|
||||
* Waits on a Fence.
|
||||
*
|
||||
* @param fence Fence to wait on.
|
||||
* @param timeout Timeout.
|
||||
* @return Whether the fence signaled or timed out. See backend::FenceStatus.
|
||||
* The default implementation always return backend::FenceStatus::ERROR.
|
||||
*/
|
||||
virtual backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Streaming support
|
||||
|
||||
/**
|
||||
* Creates a Stream from a native Stream.
|
||||
*
|
||||
* WARNING: This is called synchronously from the application thread (NOT the Driver thread)
|
||||
*
|
||||
* @param nativeStream The native stream, this parameter depends on the concrete implementation.
|
||||
* @return A new Stream object.
|
||||
*/
|
||||
virtual Stream* createStream(void* nativeStream) noexcept;
|
||||
|
||||
/**
|
||||
* Destroys a Stream.
|
||||
* @param stream Stream to destroy.
|
||||
*/
|
||||
virtual void destroyStream(Stream* stream) noexcept;
|
||||
|
||||
/**
|
||||
* The specified stream takes ownership of the texture (tname) object
|
||||
* Once attached, the texture is automatically updated with the Stream's content, which
|
||||
* could be a video stream for instance.
|
||||
*
|
||||
* @param stream Stream to take ownership of the texture
|
||||
* @param tname GL texture id to "bind" to the Stream.
|
||||
*/
|
||||
virtual void attach(Stream* stream, intptr_t tname) noexcept;
|
||||
|
||||
/**
|
||||
* Destroys the texture associated to the stream
|
||||
* @param stream Stream to detach from its texture
|
||||
*/
|
||||
virtual void detach(Stream* stream) noexcept;
|
||||
|
||||
/**
|
||||
* Updates the content of the texture attached to the stream.
|
||||
* @param stream Stream to update
|
||||
* @param timestamp Output parameter: Timestamp of the image bound to the texture.
|
||||
*/
|
||||
virtual void updateTexImage(Stream* stream, int64_t* timestamp) noexcept;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// External Image support
|
||||
|
||||
/**
|
||||
* Creates an external texture handle. External textures don't have any parameters because
|
||||
* these are undefined until setExternalImage() is called.
|
||||
* @return a pointer to an ExternalTexture structure filled with valid token. However, the
|
||||
* implementation could just return { 0, GL_TEXTURE_2D } at this point. The actual
|
||||
* values can be delayed until setExternalImage.
|
||||
*/
|
||||
virtual ExternalTexture *createExternalImageTexture() noexcept;
|
||||
|
||||
/**
|
||||
* Destroys an external texture handle and associated data.
|
||||
* @param texture a pointer to the handle to destroy.
|
||||
*/
|
||||
virtual void destroyExternalImage(ExternalTexture* texture) noexcept;
|
||||
|
||||
// called on the application thread to allow Filament to take ownership of the image
|
||||
|
||||
/**
|
||||
* Takes ownership of the externalImage. The externalImage parameter depends on the Platform's
|
||||
* concrete implementation. Ownership is released when destroyExternalImage() is called.
|
||||
*
|
||||
* WARNING: This is called synchronously from the application thread (NOT the Driver thread)
|
||||
*
|
||||
* @param externalImage A token representing the platform's external image.
|
||||
* @see destroyExternalImage
|
||||
*/
|
||||
virtual void retainExternalImage(void* externalImage) noexcept;
|
||||
|
||||
/**
|
||||
* Called to bind the platform-specific externalImage to an ExternalTexture.
|
||||
* ExternalTexture::id is guaranteed to be bound when this method is called and ExternalTexture
|
||||
* is updated with new values for id/target if necessary.
|
||||
*
|
||||
* WARNING: this method is not allowed to change the bound texture, or must restore the previous
|
||||
* binding upon return. This is to avoid problem with a backend doing state caching.
|
||||
*
|
||||
* @param externalImage The platform-specific external image.
|
||||
* @param texture an in/out pointer to ExternalTexture, id and target can be updated if necessary.
|
||||
* @return true on success, false on error.
|
||||
*/
|
||||
virtual bool setExternalImage(void* externalImage, ExternalTexture* texture) noexcept;
|
||||
|
||||
/**
|
||||
* The method allows platforms to convert a user-supplied external image object into a new type
|
||||
* (e.g. HardwareBuffer => EGLImage). The default implementation returns source.
|
||||
* @param source Image to transform.
|
||||
* @return Transformed image.
|
||||
*/
|
||||
virtual AcquiredImage transformAcquiredImage(AcquiredImage source) noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRIVATE_OPENGLPLATFORM_H
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_GL_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_GL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
struct PlatformCocoaGLImpl;
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports macOS's Cocoa.
|
||||
*/
|
||||
class PlatformCocoaGL : public OpenGLPlatform {
|
||||
public:
|
||||
PlatformCocoaGL();
|
||||
~PlatformCocoaGL() noexcept override;
|
||||
|
||||
protected:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
Driver* createDriver(void* sharedContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
// Currently returns 0
|
||||
int getOSVersion() const noexcept override;
|
||||
|
||||
bool pumpEvents() noexcept override;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
OpenGLPlatform::ExternalTexture* createExternalImageTexture() noexcept override;
|
||||
void destroyExternalImage(ExternalTexture* texture) noexcept override;
|
||||
void retainExternalImage(void* externalImage) noexcept override;
|
||||
bool setExternalImage(void* externalImage, ExternalTexture* texture) noexcept override;
|
||||
|
||||
private:
|
||||
PlatformCocoaGLImpl* pImpl = nullptr;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_GL_H
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_TOUCH_GL_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_TOUCH_GL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
struct PlatformCocoaTouchGLImpl;
|
||||
|
||||
class PlatformCocoaTouchGL : public OpenGLPlatform {
|
||||
public:
|
||||
PlatformCocoaTouchGL();
|
||||
~PlatformCocoaTouchGL() noexcept;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
Driver* createDriver(void* sharedGLContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept final { return 0; }
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
uint32_t createDefaultRenderTarget() noexcept override;
|
||||
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
|
||||
OpenGLPlatform::ExternalTexture* createExternalImageTexture() noexcept override;
|
||||
void destroyExternalImage(ExternalTexture* texture) noexcept override;
|
||||
void retainExternalImage(void* externalImage) noexcept override;
|
||||
bool setExternalImage(void* externalImage, ExternalTexture* texture) noexcept override;
|
||||
|
||||
private:
|
||||
PlatformCocoaTouchGLImpl* pImpl = nullptr;
|
||||
};
|
||||
|
||||
using ContextManager = PlatformCocoaTouchGL;
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_COCOA_TOUCH_GL_H
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports EGL.
|
||||
*/
|
||||
class PlatformEGL : public OpenGLPlatform {
|
||||
public:
|
||||
|
||||
PlatformEGL() noexcept;
|
||||
|
||||
protected:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
/**
|
||||
* Initializes EGL, creates the OpenGL context and returns a concrete Driver implementation
|
||||
* that supports OpenGL/OpenGL ES.
|
||||
*/
|
||||
Driver* createDriver(void* sharedContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
/**
|
||||
* This returns zero. This method can be overridden to return something more useful.
|
||||
* @return zero
|
||||
*/
|
||||
int getOSVersion() const noexcept override;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
bool isSRGBSwapChainSupported() const noexcept override;
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
|
||||
bool canCreateFence() noexcept override;
|
||||
Fence* createFence() noexcept override;
|
||||
void destroyFence(Fence* fence) noexcept override;
|
||||
FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept override;
|
||||
|
||||
OpenGLPlatform::ExternalTexture* createExternalImageTexture() noexcept override;
|
||||
void destroyExternalImage(ExternalTexture* texture) noexcept override;
|
||||
bool setExternalImage(void* externalImage, ExternalTexture* texture) noexcept override;
|
||||
|
||||
/**
|
||||
* Logs glGetError() to slog.e
|
||||
* @param name a string giving some context on the error. Typically __func__.
|
||||
*/
|
||||
static void logEglError(const char* name) noexcept;
|
||||
|
||||
/**
|
||||
* Calls glGetError() to clear the current error flags. logs a warning to log.w if
|
||||
* an error was pending.
|
||||
*/
|
||||
static void clearGlError() noexcept;
|
||||
|
||||
/**
|
||||
* Always use this instead of eglMakeCurrent().
|
||||
*/
|
||||
EGLBoolean makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) noexcept;
|
||||
|
||||
// TODO: this should probably use getters instead.
|
||||
EGLDisplay mEGLDisplay = EGL_NO_DISPLAY;
|
||||
EGLContext mEGLContext = EGL_NO_CONTEXT;
|
||||
EGLSurface mCurrentDrawSurface = EGL_NO_SURFACE;
|
||||
EGLSurface mCurrentReadSurface = EGL_NO_SURFACE;
|
||||
EGLSurface mEGLDummySurface = EGL_NO_SURFACE;
|
||||
EGLConfig mEGLConfig = EGL_NO_CONFIG_KHR;
|
||||
|
||||
// supported extensions detected at runtime
|
||||
struct {
|
||||
struct {
|
||||
bool OES_EGL_image_external_essl3 = false;
|
||||
} gl;
|
||||
struct {
|
||||
bool KHR_no_config_context = false;
|
||||
bool KHR_gl_colorspace = false;
|
||||
} egl;
|
||||
} ext;
|
||||
|
||||
private:
|
||||
void initializeGlExtensions() noexcept;
|
||||
EGLConfig findSwapChainConfig(uint64_t flags) const;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_H
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_ANDROID_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_ANDROID_H
|
||||
|
||||
#include <backend/platforms/PlatformEGL.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
class ExternalStreamManagerAndroid;
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform and subclass of PlatformEGL that supports
|
||||
* EGL on Android. It adds Android streaming functionality to PlatformEGL.
|
||||
*/
|
||||
class PlatformEGLAndroid : public PlatformEGL {
|
||||
public:
|
||||
|
||||
PlatformEGLAndroid() noexcept;
|
||||
~PlatformEGLAndroid() noexcept override;
|
||||
|
||||
protected:
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
/**
|
||||
* Returns the Android SDK version.
|
||||
* @return Android SDK version.
|
||||
*/
|
||||
int getOSVersion() const noexcept override;
|
||||
|
||||
Driver* createDriver(void* sharedContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
/**
|
||||
* Set the presentation time using `eglPresentationTimeANDROID`
|
||||
* @param presentationTimeInNanosecond
|
||||
*/
|
||||
void setPresentationTime(int64_t presentationTimeInNanosecond) noexcept override;
|
||||
|
||||
|
||||
Stream* createStream(void* nativeStream) noexcept override;
|
||||
void destroyStream(Stream* stream) noexcept override;
|
||||
void attach(Stream* stream, intptr_t tname) noexcept override;
|
||||
void detach(Stream* stream) noexcept override;
|
||||
void updateTexImage(Stream* stream, int64_t* timestamp) noexcept override;
|
||||
|
||||
/**
|
||||
* Converts a AHardwareBuffer to EGLImage
|
||||
* @param source source.image is a AHardwareBuffer
|
||||
* @return source.image contains an EGLImage
|
||||
*/
|
||||
AcquiredImage transformAcquiredImage(AcquiredImage source) noexcept override;
|
||||
|
||||
private:
|
||||
int mOSVersion;
|
||||
ExternalStreamManagerAndroid& mExternalStreamManager;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_EGL_ANDROID_H
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_OPENGL_PLATFORM_EGL_HEADLESS_H
|
||||
#define TNT_FILAMENT_DRIVER_OPENGL_PLATFORM_EGL_HEADLESS_H
|
||||
|
||||
#include "PlatformEGL.h"
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports EGL with only headless swapchains.
|
||||
*/
|
||||
class PlatformEGLHeadless : public PlatformEGL {
|
||||
public:
|
||||
PlatformEGLHeadless() noexcept;
|
||||
|
||||
Driver* createDriver(void* sharedContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_OPENGL_PLATFORM_EGL_HEADLESS_H
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_GLX_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_GLX_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "bluegl/BlueGL.h"
|
||||
#include <GL/glx.h>
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports GLX.
|
||||
*/
|
||||
class PlatformGLX : public OpenGLPlatform {
|
||||
protected:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
Driver* createDriver(void* sharedGLContext,
|
||||
const DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept final override { return 0; }
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
|
||||
private:
|
||||
Display *mGLXDisplay;
|
||||
GLXContext mGLXContext;
|
||||
GLXFBConfig* mGLXConfig;
|
||||
GLXPbuffer mDummySurface;
|
||||
std::vector<GLXPbuffer> mPBuffers;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_GLX_H
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_WGL_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_WGL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include "utils/unwindows.h"
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports WGL.
|
||||
*/
|
||||
class PlatformWGL : public OpenGLPlatform {
|
||||
protected:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
Driver* createDriver(void* sharedGLContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept final override { return 0; }
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
|
||||
protected:
|
||||
HGLRC mContext = NULL;
|
||||
HWND mHWnd = NULL;
|
||||
HDC mWhdc = NULL;
|
||||
PIXELFORMATDESCRIPTOR mPfd = {};
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_GLX_H
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_WEBGL_H
|
||||
#define TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_WEBGL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <backend/platforms/OpenGLPlatform.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A concrete implementation of OpenGLPlatform that supports WebGL.
|
||||
*/
|
||||
class PlatformWebGL : public OpenGLPlatform {
|
||||
protected:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// Platform Interface
|
||||
|
||||
Driver* createDriver(void* sharedGLContext,
|
||||
const Platform::DriverConfig& driverConfig) noexcept override;
|
||||
|
||||
int getOSVersion() const noexcept override;
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// OpenGLPlatform Interface
|
||||
|
||||
void terminate() noexcept override;
|
||||
|
||||
SwapChain* createSwapChain(void* nativewindow, uint64_t flags) noexcept override;
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags) noexcept override;
|
||||
void destroySwapChain(SwapChain* swapChain) noexcept override;
|
||||
void makeCurrent(SwapChain* drawSwapChain, SwapChain* readSwapChain) noexcept override;
|
||||
void commit(SwapChain* swapChain) noexcept override;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_OPENGL_OPENGL_PLATFORM_WEBGL_H
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PLATFORMS_VULKANPLATFORM_H
|
||||
#define TNT_FILAMENT_BACKEND_PLATFORMS_VULKANPLATFORM_H
|
||||
|
||||
#include <backend/Platform.h>
|
||||
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A Platform interface that creates a Vulkan backend.
|
||||
*/
|
||||
|
||||
class VulkanPlatform : public Platform {
|
||||
public:
|
||||
struct SurfaceBundle {
|
||||
void* surface;
|
||||
// On certain platforms, the extent of the surface cannot be queried from Vulkan. In those
|
||||
// situations, we allow the frontend to pass in the extent to use in creating the swap
|
||||
// chains. Platform implementation should set extent to 0 if they do not expect to set the
|
||||
// swap chain extent.
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
// Given a Vulkan instance and native window handle, creates the platform-specific surface.
|
||||
virtual SurfaceBundle createVkSurfaceKHR(void* nativeWindow, void* instance,
|
||||
uint64_t flags) noexcept = 0;
|
||||
|
||||
~VulkanPlatform() override;
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif //TNT_FILAMENT_BACKEND_PLATFORMS_VULKANPLATFORM_H
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CAMUTILS_BOOKMARK_H
|
||||
#define CAMUTILS_BOOKMARK_H
|
||||
|
||||
#include <camutils/compiler.h>
|
||||
|
||||
#include <math/vec2.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
namespace filament {
|
||||
namespace camutils {
|
||||
|
||||
template <typename FLOAT> class FreeFlightManipulator;
|
||||
template <typename FLOAT> class OrbitManipulator;
|
||||
template <typename FLOAT> class MapManipulator;
|
||||
template <typename FLOAT> class Manipulator;
|
||||
|
||||
enum class Mode { ORBIT, MAP, FREE_FLIGHT };
|
||||
|
||||
/**
|
||||
* Opaque memento to a viewing position and orientation (e.g. the "home" camera position).
|
||||
*
|
||||
* This little struct is meant to be passed around by value and can be used to track camera
|
||||
* animation between waypoints. In map mode this implements Van Wijk interpolation.
|
||||
*
|
||||
* @see Manipulator::getCurrentBookmark, Manipulator::jumpToBookmark
|
||||
*/
|
||||
template <typename FLOAT>
|
||||
struct CAMUTILS_PUBLIC Bookmark {
|
||||
/**
|
||||
* Interpolates between two bookmarks. The t argument must be between 0 and 1 (inclusive), and
|
||||
* the two endpoints must have the same mode (ORBIT or MAP).
|
||||
*/
|
||||
static Bookmark<FLOAT> interpolate(Bookmark<FLOAT> a, Bookmark<FLOAT> b, double t);
|
||||
|
||||
/**
|
||||
* Recommends a duration for animation between two MAP endpoints. The return value is a unitless
|
||||
* multiplier.
|
||||
*/
|
||||
static double duration(Bookmark<FLOAT> a, Bookmark<FLOAT> b);
|
||||
|
||||
private:
|
||||
struct MapParams {
|
||||
FLOAT extent;
|
||||
filament::math::vec2<FLOAT> center;
|
||||
};
|
||||
struct OrbitParams {
|
||||
FLOAT phi;
|
||||
FLOAT theta;
|
||||
FLOAT distance;
|
||||
filament::math::vec3<FLOAT> pivot;
|
||||
};
|
||||
struct FlightParams {
|
||||
FLOAT pitch;
|
||||
FLOAT yaw;
|
||||
filament::math::vec3<FLOAT> position;
|
||||
};
|
||||
Mode mode;
|
||||
MapParams map;
|
||||
OrbitParams orbit;
|
||||
FlightParams flight;
|
||||
friend class FreeFlightManipulator<FLOAT>;
|
||||
friend class OrbitManipulator<FLOAT>;
|
||||
friend class MapManipulator<FLOAT>;
|
||||
};
|
||||
|
||||
} // namespace camutils
|
||||
} // namespace filament
|
||||
|
||||
#endif // CAMUTILS_BOOKMARK_H
|
||||
298
flutter_filament/windows/include/filament/camutils/Manipulator.h
Normal file
298
flutter_filament/windows/include/filament/camutils/Manipulator.h
Normal file
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CAMUTILS_MANIPULATOR_H
|
||||
#define CAMUTILS_MANIPULATOR_H
|
||||
|
||||
#include <camutils/Bookmark.h>
|
||||
#include <camutils/compiler.h>
|
||||
|
||||
#include <math/vec2.h>
|
||||
#include <math/vec3.h>
|
||||
#include <math/vec4.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace filament {
|
||||
namespace camutils {
|
||||
|
||||
enum class Fov { VERTICAL, HORIZONTAL };
|
||||
|
||||
/**
|
||||
* Helper that enables camera interaction similar to sketchfab or Google Maps.
|
||||
*
|
||||
* Clients notify the camera manipulator of various mouse or touch events, then periodically call
|
||||
* its getLookAt() method so that they can adjust their camera(s). Three modes are supported: ORBIT,
|
||||
* MAP, and FREE_FLIGHT. To construct a manipulator instance, the desired mode is passed into the
|
||||
* create method.
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
* using CameraManipulator = camutils::Manipulator<float>;
|
||||
* CameraManipulator* manip;
|
||||
*
|
||||
* void init() {
|
||||
* manip = CameraManipulator::Builder()
|
||||
* .viewport(1024, 768)
|
||||
* .build(camutils::Mode::ORBIT);
|
||||
* }
|
||||
*
|
||||
* void onMouseDown(int x, int y) {
|
||||
* manip->grabBegin(x, y, false);
|
||||
* }
|
||||
*
|
||||
* void onMouseMove(int x, int y) {
|
||||
* manip->grabUpdate(x, y);
|
||||
* }
|
||||
*
|
||||
* void onMouseUp(int x, int y) {
|
||||
* manip->grabEnd();
|
||||
* }
|
||||
*
|
||||
* void gameLoop() {
|
||||
* while (true) {
|
||||
* filament::math::float3 eye, center, up;
|
||||
* manip->getLookAt(&eye, ¢er, &up);
|
||||
* camera->lookAt(eye, center, up);
|
||||
* render();
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @see Bookmark
|
||||
*/
|
||||
template <typename FLOAT>
|
||||
class CAMUTILS_PUBLIC Manipulator {
|
||||
public:
|
||||
using vec2 = filament::math::vec2<FLOAT>;
|
||||
using vec3 = filament::math::vec3<FLOAT>;
|
||||
using vec4 = filament::math::vec4<FLOAT>;
|
||||
|
||||
/** Opaque handle to a viewing position and orientation to facilitate camera animation. */
|
||||
using Bookmark = filament::camutils::Bookmark<FLOAT>;
|
||||
|
||||
/** Optional raycasting function to enable perspective-correct panning. */
|
||||
typedef bool (*RayCallback)(const vec3& origin, const vec3& dir, FLOAT* t, void* userdata);
|
||||
|
||||
/** Builder state, direct access is allowed but Builder methods are preferred. **/
|
||||
struct Config {
|
||||
int viewport[2];
|
||||
vec3 targetPosition;
|
||||
vec3 upVector;
|
||||
FLOAT zoomSpeed;
|
||||
vec3 orbitHomePosition;
|
||||
vec2 orbitSpeed;
|
||||
Fov fovDirection;
|
||||
FLOAT fovDegrees;
|
||||
FLOAT farPlane;
|
||||
vec2 mapExtent;
|
||||
FLOAT mapMinDistance;
|
||||
vec3 flightStartPosition;
|
||||
FLOAT flightStartPitch;
|
||||
FLOAT flightStartYaw;
|
||||
FLOAT flightMaxSpeed;
|
||||
FLOAT flightSpeedSteps;
|
||||
vec2 flightPanSpeed;
|
||||
FLOAT flightMoveDamping;
|
||||
vec4 groundPlane;
|
||||
RayCallback raycastCallback;
|
||||
void* raycastUserdata;
|
||||
};
|
||||
|
||||
struct Builder {
|
||||
// Common properties
|
||||
Builder& viewport(int width, int height); //! Width and height of the viewing area
|
||||
Builder& targetPosition(FLOAT x, FLOAT y, FLOAT z); //! World-space position of interest, defaults to (0,0,0)
|
||||
Builder& upVector(FLOAT x, FLOAT y, FLOAT z); //! Orientation for the home position, defaults to (0,1,0)
|
||||
Builder& zoomSpeed(FLOAT val); //! Multiplied with scroll delta, defaults to 0.01
|
||||
|
||||
// Orbit mode properties
|
||||
Builder& orbitHomePosition(FLOAT x, FLOAT y, FLOAT z); //! Initial eye position in world space, defaults to (0,0,1)
|
||||
Builder& orbitSpeed(FLOAT x, FLOAT y); //! Multiplied with viewport delta, defaults to 0.01
|
||||
|
||||
// Map mode properties
|
||||
Builder& fovDirection(Fov fov); //! The axis that's held constant when viewport changes
|
||||
Builder& fovDegrees(FLOAT degrees); //! The full FOV (not the half-angle)
|
||||
Builder& farPlane(FLOAT distance); //! The distance to the far plane
|
||||
Builder& mapExtent(FLOAT worldWidth, FLOAT worldHeight); //! The ground size for computing home position
|
||||
Builder& mapMinDistance(FLOAT mindist); //! Constrains the zoom-in level
|
||||
|
||||
// Free flight properties
|
||||
Builder& flightStartPosition(FLOAT x, FLOAT y, FLOAT z); //! Initial eye position in world space, defaults to (0,0,0)
|
||||
Builder& flightStartOrientation(FLOAT pitch, FLOAT yaw); //! Initial orientation in pitch and yaw, defaults to (0,0)
|
||||
Builder& flightMaxMoveSpeed(FLOAT maxSpeed); //! The maximum camera speed in world units per second, defaults to 10
|
||||
Builder& flightSpeedSteps(int steps); //! The number of speed steps adjustable with scroll wheel, defaults to 80
|
||||
Builder& flightPanSpeed(FLOAT x, FLOAT y); //! Multiplied with viewport delta, defaults to 0.01,0.01
|
||||
Builder& flightMoveDamping(FLOAT damping); //! Applies a deceleration to camera movement, defaults to 0 (no damping)
|
||||
//! Lower values give slower damping times, a good default is 15
|
||||
//! Too high a value may lead to instability
|
||||
|
||||
// Raycast properties
|
||||
Builder& groundPlane(FLOAT a, FLOAT b, FLOAT c, FLOAT d); //! Plane equation used as a raycast fallback
|
||||
Builder& raycastCallback(RayCallback cb, void* userdata); //! Raycast function for accurate grab-and-pan
|
||||
|
||||
/**
|
||||
* Creates a new camera manipulator, either ORBIT, MAP, or FREE_FLIGHT.
|
||||
*
|
||||
* Clients can simply use "delete" to destroy the manipulator.
|
||||
*/
|
||||
Manipulator* build(Mode mode);
|
||||
|
||||
Config details = {};
|
||||
};
|
||||
|
||||
virtual ~Manipulator() = default;
|
||||
|
||||
/**
|
||||
* Gets the immutable mode of the manipulator.
|
||||
*/
|
||||
Mode getMode() const { return mMode; }
|
||||
|
||||
/**
|
||||
* Sets the viewport dimensions. The manipulator uses this to process grab events and raycasts.
|
||||
*/
|
||||
void setViewport(int width, int height);
|
||||
|
||||
/**
|
||||
* Gets the current orthonormal basis; this is usually called once per frame.
|
||||
*/
|
||||
void getLookAt(vec3* eyePosition, vec3* targetPosition, vec3* upward) const;
|
||||
|
||||
/**
|
||||
* Given a viewport coordinate, picks a point in the ground plane, or in the actual scene if the
|
||||
* raycast callback was provided.
|
||||
*/
|
||||
bool raycast(int x, int y, vec3* result) const;
|
||||
|
||||
/**
|
||||
* Given a viewport coordinate, computes a picking ray (origin + direction).
|
||||
*/
|
||||
void getRay(int x, int y, vec3* origin, vec3* dir) const;
|
||||
|
||||
/**
|
||||
* Starts a grabbing session (i.e. the user is dragging around in the viewport).
|
||||
*
|
||||
* In MAP mode, this starts a panning session.
|
||||
* In ORBIT mode, this starts either rotating or strafing.
|
||||
* In FREE_FLIGHT mode, this starts a nodal panning session.
|
||||
*
|
||||
* @param x X-coordinate for point of interest in viewport space
|
||||
* @param y Y-coordinate for point of interest in viewport space
|
||||
* @param strafe ORBIT mode only; if true, starts a translation rather than a rotation
|
||||
*/
|
||||
virtual void grabBegin(int x, int y, bool strafe) = 0;
|
||||
|
||||
/**
|
||||
* Updates a grabbing session.
|
||||
*
|
||||
* This must be called at least once between grabBegin / grabEnd to dirty the camera.
|
||||
*/
|
||||
virtual void grabUpdate(int x, int y) = 0;
|
||||
|
||||
/**
|
||||
* Ends a grabbing session.
|
||||
*/
|
||||
virtual void grabEnd() = 0;
|
||||
|
||||
/**
|
||||
* Keys used to translate the camera in FREE_FLIGHT mode.
|
||||
* FORWARD and BACKWARD dolly the camera forwards and backwards.
|
||||
* LEFT and RIGHT strafe the camera left and right.
|
||||
* UP and DOWN boom the camera upwards and downwards.
|
||||
*/
|
||||
enum class Key {
|
||||
FORWARD,
|
||||
LEFT,
|
||||
BACKWARD,
|
||||
RIGHT,
|
||||
UP,
|
||||
DOWN,
|
||||
|
||||
COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
* Signals that a key is now in the down state.
|
||||
*
|
||||
* In FREE_FLIGHT mode, the camera is translated forward and backward and strafed left and right
|
||||
* depending on the depressed keys. This allows WASD-style movement.
|
||||
*/
|
||||
virtual void keyDown(Key key);
|
||||
|
||||
/**
|
||||
* Signals that a key is now in the up state.
|
||||
*
|
||||
* @see keyDown
|
||||
*/
|
||||
virtual void keyUp(Key key);
|
||||
|
||||
/**
|
||||
* In MAP and ORBIT modes, dollys the camera along the viewing direction.
|
||||
* In FREE_FLIGHT mode, adjusts the move speed of the camera.
|
||||
*
|
||||
* @param x X-coordinate for point of interest in viewport space, ignored in FREE_FLIGHT mode
|
||||
* @param y Y-coordinate for point of interest in viewport space, ignored in FREE_FLIGHT mode
|
||||
* @param scrolldelta In MAP and ORBIT modes, negative means "zoom in", positive means "zoom out"
|
||||
* In FREE_FLIGHT mode, negative means "slower", positive means "faster"
|
||||
*/
|
||||
virtual void scroll(int x, int y, FLOAT scrolldelta) = 0;
|
||||
|
||||
/**
|
||||
* Processes input and updates internal state.
|
||||
*
|
||||
* This must be called once every frame before getLookAt is valid.
|
||||
*
|
||||
* @param deltaTime The amount of time, in seconds, passed since the previous call to update.
|
||||
*/
|
||||
virtual void update(FLOAT deltaTime);
|
||||
|
||||
/**
|
||||
* Gets a handle that can be used to reset the manipulator back to its current position.
|
||||
*
|
||||
* @see jumpToBookmark
|
||||
*/
|
||||
virtual Bookmark getCurrentBookmark() const = 0;
|
||||
|
||||
/**
|
||||
* Gets a handle that can be used to reset the manipulator back to its home position.
|
||||
*
|
||||
* @see jumpToBookmark
|
||||
*/
|
||||
virtual Bookmark getHomeBookmark() const = 0;
|
||||
|
||||
/**
|
||||
* Sets the manipulator position and orientation back to a stashed state.
|
||||
*
|
||||
* @see getCurrentBookmark, getHomeBookmark
|
||||
*/
|
||||
virtual void jumpToBookmark(const Bookmark& bookmark) = 0;
|
||||
|
||||
protected:
|
||||
Manipulator(Mode mode, const Config& props);
|
||||
|
||||
virtual void setProperties(const Config& props);
|
||||
|
||||
vec3 raycastFarPlane(int x, int y) const;
|
||||
|
||||
const Mode mMode;
|
||||
Config mProps;
|
||||
vec3 mEye;
|
||||
vec3 mTarget;
|
||||
};
|
||||
|
||||
} // namespace camutils
|
||||
} // namespace filament
|
||||
|
||||
#endif /* CAMUTILS_MANIPULATOR_H */
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CAMUTILS_COMPILER_H
|
||||
#define CAMUTILS_COMPILER_H
|
||||
|
||||
#if __has_attribute(visibility)
|
||||
# define CAMUTILS_PUBLIC __attribute__((visibility("default")))
|
||||
#else
|
||||
# define CAMUTILS_PUBLIC
|
||||
#endif
|
||||
|
||||
#endif // CAMUTILS_COMPILER_H
|
||||
98
flutter_filament/windows/include/filament/filamat/Enums.h
Normal file
98
flutter_filament/windows/include/filament/filamat/Enums.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_ENUMMANAGER_H
|
||||
#define TNT_ENUMMANAGER_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <filamat/MaterialBuilder.h>
|
||||
|
||||
namespace filamat {
|
||||
|
||||
using Property = MaterialBuilder::Property;
|
||||
using UniformType = MaterialBuilder::UniformType;
|
||||
using SamplerType = MaterialBuilder::SamplerType;
|
||||
using SubpassType = MaterialBuilder::SubpassType;
|
||||
using SamplerFormat = MaterialBuilder::SamplerFormat;
|
||||
using ParameterPrecision = MaterialBuilder::ParameterPrecision;
|
||||
using OutputTarget = MaterialBuilder::OutputTarget;
|
||||
using OutputQualifier = MaterialBuilder::VariableQualifier;
|
||||
using OutputType = MaterialBuilder::OutputType;
|
||||
using ConstantType = MaterialBuilder::ConstantType;
|
||||
|
||||
// Convenience methods to convert std::string to Enum and also iterate over Enum values.
|
||||
class Enums {
|
||||
public:
|
||||
|
||||
// Returns true if string "s" is a valid string representation of an element of enum T.
|
||||
template<typename T>
|
||||
static bool isValid(const std::string& s) noexcept {
|
||||
std::unordered_map<std::string, T>& map = getMap<T>();
|
||||
return map.find(s) != map.end();
|
||||
}
|
||||
|
||||
// Return enum matching its string representation. Returns undefined if s is not a valid enum T
|
||||
// value. You should always call isValid() first to validate a string before calling toEnum().
|
||||
template<typename T>
|
||||
static T toEnum(const std::string& s) noexcept {
|
||||
std::unordered_map<std::string, T>& map = getMap<T>();
|
||||
return map.at(s);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static std::string toString(T t) noexcept;
|
||||
|
||||
// Return a map of all values in an enum with their string representation.
|
||||
template<typename T>
|
||||
static std::unordered_map<std::string, T>& map() noexcept {
|
||||
std::unordered_map<std::string, T>& map = getMap<T>();
|
||||
return map;
|
||||
};
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
static std::unordered_map<std::string, T>& getMap() noexcept;
|
||||
|
||||
static std::unordered_map<std::string, Property> mStringToProperty;
|
||||
static std::unordered_map<std::string, UniformType> mStringToUniformType;
|
||||
static std::unordered_map<std::string, SamplerType> mStringToSamplerType;
|
||||
static std::unordered_map<std::string, SubpassType> mStringToSubpassType;
|
||||
static std::unordered_map<std::string, SamplerFormat> mStringToSamplerFormat;
|
||||
static std::unordered_map<std::string, ParameterPrecision> mStringToSamplerPrecision;
|
||||
static std::unordered_map<std::string, OutputTarget> mStringToOutputTarget;
|
||||
static std::unordered_map<std::string, OutputQualifier> mStringToOutputQualifier;
|
||||
static std::unordered_map<std::string, OutputType> mStringToOutputType;
|
||||
static std::unordered_map<std::string, ConstantType> mStringToConstantType;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
std::string Enums::toString(T t) noexcept {
|
||||
std::unordered_map<std::string, T>& map = getMap<T>();
|
||||
auto result = std::find_if(map.begin(), map.end(), [t](auto& pair) {
|
||||
return pair.second == t;
|
||||
});
|
||||
if (result != map.end()) {
|
||||
return result->first;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace filamat
|
||||
|
||||
#endif //TNT_ENUMMANAGER_H
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMAT_INCLUDER_H
|
||||
#define TNT_FILAMAT_INCLUDER_H
|
||||
|
||||
#include <utils/CString.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace filamat {
|
||||
|
||||
struct IncludeResult {
|
||||
// The include name of the root file, as if it were being included.
|
||||
// I.e., 'foobar.h' in the case of #include "foobar.h"
|
||||
const utils::CString includeName;
|
||||
|
||||
// The following fields should be filled out by the IncludeCallback when processing an include,
|
||||
// or when calling resolveIncludes for the root file.
|
||||
|
||||
// The full contents of the include file. This may contain additional, recursive include
|
||||
// directives.
|
||||
utils::CString text;
|
||||
|
||||
// The line number for the first line of text (first line is 0).
|
||||
size_t lineNumberOffset = 0;
|
||||
|
||||
// The name of the include file. This gets passed as "includerName" for any includes inside of
|
||||
// source. This field isn't used by the include system; it's up to the callback to give meaning
|
||||
// to this value and interpret it accordingly. In the case of DirIncluder, this is an empty
|
||||
// string to represent the root include file, and a canonical path for subsequent included
|
||||
// files.
|
||||
utils::CString name;
|
||||
};
|
||||
|
||||
/**
|
||||
* A callback invoked by the include system when an #include "file.h" directive is found.
|
||||
*
|
||||
* For example, if a file main.h includes file.h on line 10, then IncludeCallback would be called
|
||||
* with the following:
|
||||
* includeCallback("main.h", {.includeName = "file.h" })
|
||||
* It's then up to the IncludeCallback to fill out the .text, .name, and (optionally)
|
||||
* lineNumberOffset fields.
|
||||
*
|
||||
* @param includedBy is the value that was given to IncludeResult.name for this source file, or
|
||||
* the empty string for the root source file.
|
||||
* @param result is the IncludeResult that the callback should fill out.
|
||||
* @return true, if the include was resolved successfully, false otherwise.
|
||||
*
|
||||
* For an example of implementing this callback, see tools/matc/src/matc/DirIncluder.h.
|
||||
*/
|
||||
using IncludeCallback = std::function<bool(
|
||||
const utils::CString& includedBy,
|
||||
IncludeResult& result)>;
|
||||
|
||||
} // namespace filamat
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,861 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMAT_MATERIAL_PACKAGE_BUILDER_H
|
||||
#define TNT_FILAMAT_MATERIAL_PACKAGE_BUILDER_H
|
||||
|
||||
#include <filament/MaterialEnums.h>
|
||||
|
||||
#include <filamat/IncludeCallback.h>
|
||||
#include <filamat/Package.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/TargetBufferInfo.h>
|
||||
|
||||
#include <utils/BitmaskEnum.h>
|
||||
#include <utils/bitset.h>
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/CString.h>
|
||||
|
||||
#include <math/vec3.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <variant>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace utils {
|
||||
class JobSystem;
|
||||
}
|
||||
|
||||
namespace filament {
|
||||
class BufferInterfaceBlock;
|
||||
}
|
||||
|
||||
namespace filamat {
|
||||
|
||||
struct MaterialInfo;
|
||||
struct Variant;
|
||||
class ChunkContainer;
|
||||
|
||||
class UTILS_PUBLIC MaterialBuilderBase {
|
||||
public:
|
||||
/**
|
||||
* High-level hint that works in concert with TargetApi to determine the shader models (used to
|
||||
* generate GLSL) and final output representations (spirv and/or text).
|
||||
* When generating the GLSL this is used to differentiate OpenGL from OpenGLES, it is also
|
||||
* used to make some performance adjustments.
|
||||
*/
|
||||
enum class Platform {
|
||||
DESKTOP,
|
||||
MOBILE,
|
||||
ALL
|
||||
};
|
||||
|
||||
/**
|
||||
* TargetApi defines which language after transpilation will be used, it is used to
|
||||
* account for some differences between these languages when generating the GLSL.
|
||||
*/
|
||||
enum class TargetApi : uint8_t {
|
||||
OPENGL = 0x01u,
|
||||
VULKAN = 0x02u,
|
||||
METAL = 0x04u,
|
||||
ALL = OPENGL | VULKAN | METAL
|
||||
};
|
||||
|
||||
/*
|
||||
* Generally we generate GLSL that will be converted to SPIRV, optimized and then
|
||||
* transpiled to the backend's language such as MSL, ESSL300, GLSL410 or SPIRV, in this
|
||||
* case the generated GLSL uses ESSL310 or GLSL450 and has Vulkan semantics and
|
||||
* TargetLanguage::SPIRV must be used.
|
||||
*
|
||||
* However, in some cases (e.g. when no optimization is asked) we generate the *final* GLSL
|
||||
* directly, this GLSL must be ESSL300 or GLSL410 and cannot use any Vulkan syntax, for this
|
||||
* situation we use TargetLanguage::GLSL. In this case TargetApi is guaranteed to be OPENGL.
|
||||
*
|
||||
* Note that TargetLanguage::GLSL is not the common case, as it is generally not used in
|
||||
* release builds.
|
||||
*
|
||||
* Also note that glslang performs semantics analysis on whichever GLSL ends up being generated.
|
||||
*/
|
||||
enum class TargetLanguage {
|
||||
GLSL, // GLSL with OpenGL 4.1 / OpenGL ES 3.0 semantics
|
||||
SPIRV // GLSL with Vulkan semantics
|
||||
};
|
||||
|
||||
enum class Optimization {
|
||||
NONE,
|
||||
PREPROCESSOR,
|
||||
SIZE,
|
||||
PERFORMANCE
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize MaterialBuilder.
|
||||
*
|
||||
* init must be called first before building any materials.
|
||||
*/
|
||||
static void init();
|
||||
|
||||
/**
|
||||
* Release internal MaterialBuilder resources.
|
||||
*
|
||||
* Call shutdown when finished building materials to release all internal resources. After
|
||||
* calling shutdown, another call to MaterialBuilder::init must precede another material build.
|
||||
*/
|
||||
static void shutdown();
|
||||
|
||||
protected:
|
||||
// Looks at platform and target API, then decides on shader models and output formats.
|
||||
void prepare(bool vulkanSemantics);
|
||||
|
||||
using ShaderModel = filament::backend::ShaderModel;
|
||||
Platform mPlatform = Platform::DESKTOP;
|
||||
TargetApi mTargetApi = (TargetApi) 0;
|
||||
Optimization mOptimization = Optimization::PERFORMANCE;
|
||||
bool mPrintShaders = false;
|
||||
bool mGenerateDebugInfo = false;
|
||||
utils::bitset32 mShaderModels;
|
||||
struct CodeGenParams {
|
||||
ShaderModel shaderModel;
|
||||
TargetApi targetApi;
|
||||
TargetLanguage targetLanguage;
|
||||
};
|
||||
std::vector<CodeGenParams> mCodeGenPermutations;
|
||||
// For finding properties and running semantic analysis, we always use the same code gen
|
||||
// permutation. This is the first permutation generated with default arguments passed to matc.
|
||||
static constexpr const CodeGenParams mSemanticCodeGenParams = {
|
||||
.shaderModel = ShaderModel::MOBILE,
|
||||
.targetApi = TargetApi::OPENGL,
|
||||
.targetLanguage = TargetLanguage::SPIRV
|
||||
};
|
||||
|
||||
// Keeps track of how many times MaterialBuilder::init() has been called without a call to
|
||||
// MaterialBuilder::shutdown(). Internally, glslang does something similar. We keep track for
|
||||
// ourselves, so we can inform the user if MaterialBuilder::init() hasn't been called before
|
||||
// attempting to build a material.
|
||||
static std::atomic<int> materialBuilderClients;
|
||||
};
|
||||
|
||||
// Utility function that looks at an Engine backend to determine TargetApi
|
||||
inline constexpr MaterialBuilderBase::TargetApi targetApiFromBackend(
|
||||
filament::backend::Backend backend) noexcept {
|
||||
using filament::backend::Backend;
|
||||
using TargetApi = MaterialBuilderBase::TargetApi;
|
||||
switch (backend) {
|
||||
case Backend::DEFAULT: return TargetApi::ALL;
|
||||
case Backend::OPENGL: return TargetApi::OPENGL;
|
||||
case Backend::VULKAN: return TargetApi::VULKAN;
|
||||
case Backend::METAL: return TargetApi::METAL;
|
||||
case Backend::NOOP: return TargetApi::OPENGL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MaterialBuilder builds Filament materials from shader code.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filamat/MaterialBuilder.h>
|
||||
* using namespace filamat;
|
||||
*
|
||||
* // Must be called before any materials can be built.
|
||||
* MaterialBuilder::init();
|
||||
|
||||
* MaterialBuilder builder;
|
||||
* builder
|
||||
* .name("My material")
|
||||
* .material("void material (inout MaterialInputs material) {"
|
||||
* " prepareMaterial(material);"
|
||||
* " material.baseColor.rgb = float3(1.0, 0.0, 0.0);"
|
||||
* "}")
|
||||
* .shading(MaterialBuilder::Shading::LIT)
|
||||
* .targetApi(MaterialBuilder::TargetApi::ALL)
|
||||
* .platform(MaterialBuilder::Platform::ALL);
|
||||
|
||||
* Package package = builder.build();
|
||||
* if (package.isValid()) {
|
||||
* // success!
|
||||
* }
|
||||
|
||||
* // Call when finished building all materials to release internal
|
||||
* // MaterialBuilder resources.
|
||||
* MaterialBuilder::shutdown();
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @see filament::Material
|
||||
*/
|
||||
class UTILS_PUBLIC MaterialBuilder : public MaterialBuilderBase {
|
||||
public:
|
||||
MaterialBuilder();
|
||||
~MaterialBuilder();
|
||||
|
||||
MaterialBuilder(const MaterialBuilder& rhs) = delete;
|
||||
MaterialBuilder& operator=(const MaterialBuilder& rhs) = delete;
|
||||
|
||||
MaterialBuilder(MaterialBuilder&& rhs) noexcept = default;
|
||||
MaterialBuilder& operator=(MaterialBuilder&& rhs) noexcept = default;
|
||||
|
||||
static constexpr size_t MATERIAL_VARIABLES_COUNT = 4;
|
||||
enum class Variable : uint8_t {
|
||||
CUSTOM0,
|
||||
CUSTOM1,
|
||||
CUSTOM2,
|
||||
CUSTOM3
|
||||
// when adding more variables, make sure to update MATERIAL_VARIABLES_COUNT
|
||||
};
|
||||
|
||||
using MaterialDomain = filament::MaterialDomain;
|
||||
using RefractionMode = filament::RefractionMode;
|
||||
using RefractionType = filament::RefractionType;
|
||||
using ReflectionMode = filament::ReflectionMode;
|
||||
using VertexAttribute = filament::VertexAttribute;
|
||||
|
||||
using ShaderQuality = filament::ShaderQuality;
|
||||
using BlendingMode = filament::BlendingMode;
|
||||
using Shading = filament::Shading;
|
||||
using Interpolation = filament::Interpolation;
|
||||
using VertexDomain = filament::VertexDomain;
|
||||
using TransparencyMode = filament::TransparencyMode;
|
||||
using SpecularAmbientOcclusion = filament::SpecularAmbientOcclusion;
|
||||
|
||||
using UniformType = filament::backend::UniformType;
|
||||
using ConstantType = filament::backend::ConstantType;
|
||||
using SamplerType = filament::backend::SamplerType;
|
||||
using SubpassType = filament::backend::SubpassType;
|
||||
using SamplerFormat = filament::backend::SamplerFormat;
|
||||
using ParameterPrecision = filament::backend::Precision;
|
||||
using CullingMode = filament::backend::CullingMode;
|
||||
using FeatureLevel = filament::backend::FeatureLevel;
|
||||
|
||||
enum class VariableQualifier : uint8_t {
|
||||
OUT
|
||||
};
|
||||
|
||||
enum class OutputTarget : uint8_t {
|
||||
COLOR,
|
||||
DEPTH
|
||||
};
|
||||
|
||||
enum class OutputType : uint8_t {
|
||||
FLOAT,
|
||||
FLOAT2,
|
||||
FLOAT3,
|
||||
FLOAT4
|
||||
};
|
||||
|
||||
struct PreprocessorDefine {
|
||||
std::string name;
|
||||
std::string value;
|
||||
|
||||
PreprocessorDefine(std::string name, std::string value) :
|
||||
name(std::move(name)), value(std::move(value)) {}
|
||||
};
|
||||
using PreprocessorDefineList = std::vector<PreprocessorDefine>;
|
||||
|
||||
//! Set the name of this material.
|
||||
MaterialBuilder& name(const char* name) noexcept;
|
||||
|
||||
//! Set the file name of this material file. Used in error reporting.
|
||||
MaterialBuilder& fileName(const char* name) noexcept;
|
||||
|
||||
//! Set the shading model.
|
||||
MaterialBuilder& shading(Shading shading) noexcept;
|
||||
|
||||
//! Set the interpolation mode.
|
||||
MaterialBuilder& interpolation(Interpolation interpolation) noexcept;
|
||||
|
||||
//! Add a parameter (i.e., a uniform) to this material.
|
||||
MaterialBuilder& parameter(const char* name, UniformType type,
|
||||
ParameterPrecision precision = ParameterPrecision::DEFAULT) noexcept;
|
||||
|
||||
//! Add a parameter array to this material.
|
||||
MaterialBuilder& parameter(const char* name, size_t size, UniformType type,
|
||||
ParameterPrecision precision = ParameterPrecision::DEFAULT) noexcept;
|
||||
|
||||
//! Add a constant parameter to this material.
|
||||
template<typename T>
|
||||
using is_supported_constant_parameter_t = typename std::enable_if<
|
||||
std::is_same<int32_t, T>::value ||
|
||||
std::is_same<float, T>::value ||
|
||||
std::is_same<bool, T>::value>::type;
|
||||
template<typename T, typename = is_supported_constant_parameter_t<T>>
|
||||
MaterialBuilder& constant(const char *name, ConstantType type, T defaultValue = 0);
|
||||
|
||||
/**
|
||||
* Add a sampler parameter to this material.
|
||||
*
|
||||
* When SamplerType::SAMPLER_EXTERNAL is specified, format and precision are ignored.
|
||||
*/
|
||||
MaterialBuilder& parameter(const char* name, SamplerType samplerType,
|
||||
SamplerFormat format = SamplerFormat::FLOAT,
|
||||
ParameterPrecision precision = ParameterPrecision::DEFAULT) noexcept;
|
||||
|
||||
/// @copydoc parameter(SamplerType, SamplerFormat, ParameterPrecision, const char*)
|
||||
MaterialBuilder& parameter(const char* name, SamplerType samplerType,
|
||||
ParameterPrecision precision) noexcept;
|
||||
|
||||
|
||||
MaterialBuilder& buffer(filament::BufferInterfaceBlock bib) noexcept;
|
||||
|
||||
//! Custom variables (all float4).
|
||||
MaterialBuilder& variable(Variable v, const char* name) noexcept;
|
||||
|
||||
/**
|
||||
* Require a specified attribute.
|
||||
*
|
||||
* position is always required and normal depends on the shading model.
|
||||
*/
|
||||
MaterialBuilder& require(VertexAttribute attribute) noexcept;
|
||||
|
||||
//! Specify the domain that this material will operate in.
|
||||
MaterialBuilder& materialDomain(MaterialBuilder::MaterialDomain materialDomain) noexcept;
|
||||
|
||||
/**
|
||||
* Set the code content of this material.
|
||||
*
|
||||
* Surface Domain
|
||||
* --------------
|
||||
*
|
||||
* Materials in the SURFACE domain must declare a function:
|
||||
* ~~~~~
|
||||
* void material(inout MaterialInputs material) {
|
||||
* prepareMaterial(material);
|
||||
* material.baseColor.rgb = float3(1.0, 0.0, 0.0);
|
||||
* }
|
||||
* ~~~~~
|
||||
* this function *must* call `prepareMaterial(material)` before it returns.
|
||||
*
|
||||
* Post-process Domain
|
||||
* -------------------
|
||||
*
|
||||
* Materials in the POST_PROCESS domain must declare a function:
|
||||
* ~~~~~
|
||||
* void postProcess(inout PostProcessInputs postProcess) {
|
||||
* postProcess.color = float4(1.0);
|
||||
* }
|
||||
* ~~~~~
|
||||
*
|
||||
* @param code The source code of the material.
|
||||
* @param line The line number offset of the material, where 0 is the first line. Used for error
|
||||
* reporting
|
||||
*/
|
||||
MaterialBuilder& material(const char* code, size_t line = 0) noexcept;
|
||||
|
||||
/**
|
||||
* Set the callback used for resolving include directives.
|
||||
* The default is no callback, which disallows all includes.
|
||||
*/
|
||||
MaterialBuilder& includeCallback(IncludeCallback callback) noexcept;
|
||||
|
||||
/**
|
||||
* Set the vertex code content of this material.
|
||||
*
|
||||
* Surface Domain
|
||||
* --------------
|
||||
*
|
||||
* Materials in the SURFACE domain must declare a function:
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* void materialVertex(inout MaterialVertexInputs material) {
|
||||
*
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Post-process Domain
|
||||
* -------------------
|
||||
*
|
||||
* Materials in the POST_PROCESS domain must declare a function:
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* void postProcessVertex(inout PostProcessVertexInputs postProcess) {
|
||||
*
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* @param code The source code of the material.
|
||||
* @param line The line number offset of the material, where 0 is the first line. Used for error
|
||||
* reporting
|
||||
*/
|
||||
MaterialBuilder& materialVertex(const char* code, size_t line = 0) noexcept;
|
||||
|
||||
|
||||
MaterialBuilder& quality(ShaderQuality quality) noexcept;
|
||||
|
||||
MaterialBuilder& featureLevel(FeatureLevel featureLevel) noexcept;
|
||||
|
||||
/**
|
||||
* Set the blending mode for this material. When set to MASKED, alpha to coverage is turned on.
|
||||
* You can override this behavior using alphaToCoverage(false).
|
||||
*/
|
||||
MaterialBuilder& blending(BlendingMode blending) noexcept;
|
||||
|
||||
/**
|
||||
* Set the blending mode of the post-lighting color for this material.
|
||||
* Only OPAQUE, TRANSPARENT and ADD are supported, the default is TRANSPARENT.
|
||||
* This setting requires the material property "postLightingColor" to be set.
|
||||
*/
|
||||
MaterialBuilder& postLightingBlending(BlendingMode blending) noexcept;
|
||||
|
||||
//! Set the vertex domain for this material.
|
||||
MaterialBuilder& vertexDomain(VertexDomain domain) noexcept;
|
||||
|
||||
/**
|
||||
* How triangles are culled by default (doesn't affect points or lines, BACK by default).
|
||||
* Material instances can override this.
|
||||
*/
|
||||
MaterialBuilder& culling(CullingMode culling) noexcept;
|
||||
|
||||
//! Enable / disable color-buffer write (enabled by default, material instances can override).
|
||||
MaterialBuilder& colorWrite(bool enable) noexcept;
|
||||
|
||||
//! Enable / disable depth-buffer write (enabled by default for opaque, disabled for others, material instances can override).
|
||||
MaterialBuilder& depthWrite(bool enable) noexcept;
|
||||
|
||||
//! Enable / disable depth based culling (enabled by default, material instances can override).
|
||||
MaterialBuilder& depthCulling(bool enable) noexcept;
|
||||
|
||||
//! Enable / disable instanced primitives (disabled by default).
|
||||
MaterialBuilder& instanced(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Double-sided materials don't cull faces, equivalent to culling(CullingMode::NONE).
|
||||
* doubleSided() overrides culling() if called.
|
||||
* When called with "false", this enables the capability for a run-time toggle.
|
||||
*/
|
||||
MaterialBuilder& doubleSided(bool doubleSided) noexcept;
|
||||
|
||||
/**
|
||||
* Any fragment with an alpha below this threshold is clipped (MASKED blending mode only).
|
||||
* The mask threshold can also be controlled by using the float material parameter called
|
||||
* `_maskThreshold`, or by calling
|
||||
* @ref filament::MaterialInstance::setMaskThreshold "MaterialInstance::setMaskThreshold".
|
||||
*/
|
||||
MaterialBuilder& maskThreshold(float threshold) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables alpha-to-coverage. When enabled, the coverage of a fragment is based
|
||||
* on its alpha value. This parameter is only useful when MSAA is in use. Alpha to coverage
|
||||
* is enabled automatically when the blend mode is set to MASKED; this behavior can be
|
||||
* overridden by calling alphaToCoverage(false).
|
||||
*/
|
||||
MaterialBuilder& alphaToCoverage(bool enable) noexcept;
|
||||
|
||||
//! The material output is multiplied by the shadowing factor (UNLIT model only).
|
||||
MaterialBuilder& shadowMultiplier(bool shadowMultiplier) noexcept;
|
||||
|
||||
//! This material casts transparent shadows. The blending mode must be TRANSPARENT or FADE.
|
||||
MaterialBuilder& transparentShadow(bool transparentShadow) noexcept;
|
||||
|
||||
/**
|
||||
* Reduces specular aliasing for materials that have low roughness. Turning this feature on also
|
||||
* helps preserve the shapes of specular highlights as an object moves away from the camera.
|
||||
* When turned on, two float material parameters are added to control the effect:
|
||||
* `_specularAAScreenSpaceVariance` and `_specularAAThreshold`. You can also use
|
||||
* @ref filament::MaterialInstance::setSpecularAntiAliasingVariance
|
||||
* "MaterialInstance::setSpecularAntiAliasingVariance" and
|
||||
* @ref filament::MaterialInstance::setSpecularAntiAliasingThreshold
|
||||
* "setSpecularAntiAliasingThreshold"
|
||||
*
|
||||
* Disabled by default.
|
||||
*/
|
||||
MaterialBuilder& specularAntiAliasing(bool specularAntiAliasing) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the screen-space variance of the filter kernel used when applying specular
|
||||
* anti-aliasing. The default value is set to 0.15. The specified value should be between 0 and
|
||||
* 1 and will be clamped if necessary.
|
||||
*/
|
||||
MaterialBuilder& specularAntiAliasingVariance(float screenSpaceVariance) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the clamping threshold used to suppress estimation errors when applying specular
|
||||
* anti-aliasing. The default value is set to 0.2. The specified value should be between 0 and 1
|
||||
* and will be clamped if necessary.
|
||||
*/
|
||||
MaterialBuilder& specularAntiAliasingThreshold(float threshold) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables the index of refraction (IoR) change caused by the clear coat layer when
|
||||
* present. When the IoR changes, the base color is darkened. Disabling this feature preserves
|
||||
* the base color as initially specified.
|
||||
*
|
||||
* Enabled by default.
|
||||
*/
|
||||
MaterialBuilder& clearCoatIorChange(bool clearCoatIorChange) noexcept;
|
||||
|
||||
//! Enable / disable flipping of the Y coordinate of UV attributes, enabled by default.
|
||||
MaterialBuilder& flipUV(bool flipUV) noexcept;
|
||||
|
||||
//! Enable / disable multi-bounce ambient occlusion, disabled by default on mobile.
|
||||
MaterialBuilder& multiBounceAmbientOcclusion(bool multiBounceAO) noexcept;
|
||||
|
||||
//! Set the specular ambient occlusion technique. Disabled by default on mobile.
|
||||
MaterialBuilder& specularAmbientOcclusion(SpecularAmbientOcclusion specularAO) noexcept;
|
||||
|
||||
//! Specify the refraction
|
||||
MaterialBuilder& refractionMode(RefractionMode refraction) noexcept;
|
||||
|
||||
//! Specify the refraction type
|
||||
MaterialBuilder& refractionType(RefractionType refractionType) noexcept;
|
||||
|
||||
//! Specifies how reflections should be rendered (default is DEFAULT).
|
||||
MaterialBuilder& reflectionMode(ReflectionMode mode) noexcept;
|
||||
|
||||
//! Specifies how transparent objects should be rendered (default is DEFAULT).
|
||||
MaterialBuilder& transparencyMode(TransparencyMode mode) noexcept;
|
||||
|
||||
/**
|
||||
* Enable / disable custom surface shading. Custom surface shading requires the LIT
|
||||
* shading model. In addition, the following function must be defined in the fragment
|
||||
* block:
|
||||
*
|
||||
* ~~~~~
|
||||
* vec3 surfaceShading(const MaterialInputs materialInputs,
|
||||
* const ShadingData shadingData, const LightData lightData) {
|
||||
*
|
||||
* return vec3(1.0); // Compute surface shading with custom BRDF, etc.
|
||||
* }
|
||||
* ~~~~~
|
||||
*
|
||||
* This function is invoked once per light. Please refer to the materials documentation
|
||||
* for more information about the different parameters.
|
||||
*
|
||||
* @param customSurfaceShading Enables or disables custom surface shading
|
||||
*/
|
||||
MaterialBuilder& customSurfaceShading(bool customSurfaceShading) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies desktop vs mobile; works in concert with TargetApi to determine the shader models
|
||||
* (used to generate code) and final output representations (spirv and/or text).
|
||||
*/
|
||||
MaterialBuilder& platform(Platform platform) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies OpenGL, Vulkan, or Metal.
|
||||
* This can be called repeatedly to build for multiple APIs.
|
||||
* Works in concert with Platform to determine the shader models (used to generate code) and
|
||||
* final output representations (spirv and/or text).
|
||||
* If linking against filamat_lite, only `OPENGL` is allowed.
|
||||
*/
|
||||
MaterialBuilder& targetApi(TargetApi targetApi) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the level of optimization to apply to the shaders (default is PERFORMANCE).
|
||||
* If linking against filamat_lite, this _must_ be called with Optimization::NONE.
|
||||
*/
|
||||
MaterialBuilder& optimization(Optimization optimization) noexcept;
|
||||
|
||||
// TODO: this is present here for matc's "--print" flag, but ideally does not belong inside
|
||||
// MaterialBuilder.
|
||||
//! If true, will output the generated GLSL shader code to stdout.
|
||||
MaterialBuilder& printShaders(bool printShaders) noexcept;
|
||||
|
||||
//! If true, will include debugging information in generated SPIRV.
|
||||
MaterialBuilder& generateDebugInfo(bool generateDebugInfo) noexcept;
|
||||
|
||||
//! Specifies a list of variants that should be filtered out during code generation.
|
||||
MaterialBuilder& variantFilter(filament::UserVariantFilterMask variantFilter) noexcept;
|
||||
|
||||
//! Adds a new preprocessor macro definition to the shader code. Can be called repeatedly.
|
||||
MaterialBuilder& shaderDefine(const char* name, const char* value) noexcept;
|
||||
|
||||
//! Add a new fragment shader output variable. Only valid for materials in the POST_PROCESS domain.
|
||||
MaterialBuilder& output(VariableQualifier qualifier, OutputTarget target,
|
||||
OutputType type, const char* name, int location = -1) noexcept;
|
||||
|
||||
MaterialBuilder& enableFramebufferFetch() noexcept;
|
||||
|
||||
MaterialBuilder& vertexDomainDeviceJittered(bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* Legacy morphing uses the data in the VertexAttribute slots (\c MORPH_POSITION_0, etc) and is
|
||||
* limited to 4 morph targets. See filament::RenderableManager::Builder::morphing().
|
||||
*/
|
||||
MaterialBuilder& useLegacyMorphing() noexcept;
|
||||
|
||||
//! specify compute kernel group size
|
||||
MaterialBuilder& groupSize(filament::math::uint3 groupSize) noexcept;
|
||||
|
||||
/**
|
||||
* Build the material. If you are using the Filament engine with this library, you should use
|
||||
* the job system provided by Engine.
|
||||
*/
|
||||
Package build(utils::JobSystem& jobSystem) noexcept;
|
||||
|
||||
public:
|
||||
// The methods and types below are for internal use
|
||||
/// @cond never
|
||||
|
||||
/**
|
||||
* Add a subpass parameter to this material.
|
||||
*/
|
||||
MaterialBuilder& subpass(SubpassType subpassType,
|
||||
SamplerFormat format, ParameterPrecision precision, const char* name) noexcept;
|
||||
MaterialBuilder& subpass(SubpassType subpassType,
|
||||
SamplerFormat format, const char* name) noexcept;
|
||||
MaterialBuilder& subpass(SubpassType subpassType,
|
||||
ParameterPrecision precision, const char* name) noexcept;
|
||||
MaterialBuilder& subpass(SubpassType subpassType, const char* name) noexcept;
|
||||
|
||||
struct Parameter {
|
||||
Parameter() noexcept: parameterType(INVALID) {}
|
||||
|
||||
// Sampler
|
||||
Parameter(const char* paramName, SamplerType t, SamplerFormat f, ParameterPrecision p)
|
||||
: name(paramName), size(1), precision(p), samplerType(t), format(f), parameterType(SAMPLER) { }
|
||||
|
||||
// Uniform
|
||||
Parameter(const char* paramName, UniformType t, size_t typeSize, ParameterPrecision p)
|
||||
: name(paramName), size(typeSize), uniformType(t), precision(p), parameterType(UNIFORM) { }
|
||||
|
||||
// Subpass
|
||||
Parameter(const char* paramName, SubpassType t, SamplerFormat f, ParameterPrecision p)
|
||||
: name(paramName), size(1), precision(p), subpassType(t), format(f), parameterType(SUBPASS) { }
|
||||
|
||||
utils::CString name;
|
||||
size_t size;
|
||||
UniformType uniformType;
|
||||
ParameterPrecision precision;
|
||||
SamplerType samplerType;
|
||||
SubpassType subpassType;
|
||||
SamplerFormat format;
|
||||
enum {
|
||||
INVALID,
|
||||
UNIFORM,
|
||||
SAMPLER,
|
||||
SUBPASS
|
||||
} parameterType;
|
||||
|
||||
bool isSampler() const { return parameterType == SAMPLER; }
|
||||
bool isUniform() const { return parameterType == UNIFORM; }
|
||||
bool isSubpass() const { return parameterType == SUBPASS; }
|
||||
};
|
||||
|
||||
struct Output {
|
||||
Output() noexcept = default;
|
||||
Output(const char* outputName, VariableQualifier qualifier, OutputTarget target,
|
||||
OutputType type, int location) noexcept
|
||||
: name(outputName), qualifier(qualifier), target(target), type(type),
|
||||
location(location) { }
|
||||
|
||||
utils::CString name;
|
||||
VariableQualifier qualifier;
|
||||
OutputTarget target;
|
||||
OutputType type;
|
||||
int location;
|
||||
};
|
||||
|
||||
struct Constant {
|
||||
utils::CString name;
|
||||
ConstantType type;
|
||||
union {
|
||||
int32_t i;
|
||||
float f;
|
||||
bool b;
|
||||
} defaultValue;
|
||||
};
|
||||
|
||||
static constexpr size_t MATERIAL_PROPERTIES_COUNT = filament::MATERIAL_PROPERTIES_COUNT;
|
||||
using Property = filament::Property;
|
||||
|
||||
using PropertyList = bool[MATERIAL_PROPERTIES_COUNT];
|
||||
using VariableList = utils::CString[MATERIAL_VARIABLES_COUNT];
|
||||
using OutputList = std::vector<Output>;
|
||||
|
||||
static constexpr size_t MAX_COLOR_OUTPUT = filament::backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT;
|
||||
static constexpr size_t MAX_DEPTH_OUTPUT = 1;
|
||||
static_assert(MAX_COLOR_OUTPUT == 8,
|
||||
"When updating MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT, manually update post_process_inputs.fs"
|
||||
" and post_process.fs");
|
||||
|
||||
// Preview the first shader generated by the given CodeGenParams.
|
||||
// This is used to run Static Code Analysis before generating a package.
|
||||
std::string peek(filament::backend::ShaderStage type,
|
||||
const CodeGenParams& params, const PropertyList& properties) noexcept;
|
||||
|
||||
// Returns true if any of the parameter samplers is of type samplerExternal
|
||||
bool hasExternalSampler() const noexcept;
|
||||
|
||||
static constexpr size_t MAX_PARAMETERS_COUNT = 48;
|
||||
static constexpr size_t MAX_SUBPASS_COUNT = 1;
|
||||
static constexpr size_t MAX_BUFFERS_COUNT = 4;
|
||||
using ParameterList = Parameter[MAX_PARAMETERS_COUNT];
|
||||
using SubpassList = Parameter[MAX_SUBPASS_COUNT];
|
||||
using BufferList = std::vector<std::unique_ptr<filament::BufferInterfaceBlock>>;
|
||||
using ConstantList = std::vector<Constant>;
|
||||
|
||||
// returns the number of parameters declared in this material
|
||||
uint8_t getParameterCount() const noexcept { return mParameterCount; }
|
||||
|
||||
// returns a list of at least getParameterCount() parameters
|
||||
const ParameterList& getParameters() const noexcept { return mParameters; }
|
||||
|
||||
// returns the number of parameters declared in this material
|
||||
uint8_t getSubpassCount() const noexcept { return mSubpassCount; }
|
||||
|
||||
// returns a list of at least getParameterCount() parameters
|
||||
const SubpassList& getSubPasses() const noexcept { return mSubpasses; }
|
||||
|
||||
filament::UserVariantFilterMask getVariantFilter() const { return mVariantFilter; }
|
||||
|
||||
FeatureLevel getFeatureLevel() const noexcept { return mFeatureLevel; }
|
||||
/// @endcond
|
||||
|
||||
private:
|
||||
void prepareToBuild(MaterialInfo& info) noexcept;
|
||||
|
||||
// Return true if the shader is syntactically and semantically valid.
|
||||
// This method finds all the properties defined in the fragment and
|
||||
// vertex shaders of the material.
|
||||
bool findAllProperties() noexcept;
|
||||
|
||||
// Multiple calls to findProperties accumulate the property sets across fragment
|
||||
// and vertex shaders in mProperties.
|
||||
bool findProperties(filament::backend::ShaderStage type,
|
||||
MaterialBuilder::PropertyList& p) noexcept;
|
||||
|
||||
bool runSemanticAnalysis(MaterialInfo const& info) noexcept;
|
||||
|
||||
bool checkLiteRequirements() noexcept;
|
||||
|
||||
bool checkMaterialLevelFeatures(MaterialInfo const& info) const noexcept;
|
||||
|
||||
void writeCommonChunks(ChunkContainer& container, MaterialInfo& info) const noexcept;
|
||||
void writeSurfaceChunks(ChunkContainer& container) const noexcept;
|
||||
|
||||
bool generateShaders(
|
||||
utils::JobSystem& jobSystem,
|
||||
const std::vector<filamat::Variant>& variants, ChunkContainer& container,
|
||||
const MaterialInfo& info) const noexcept;
|
||||
|
||||
bool hasCustomVaryings() const noexcept;
|
||||
bool needsStandardDepthProgram() const noexcept;
|
||||
|
||||
bool isLit() const noexcept { return mShading != filament::Shading::UNLIT; }
|
||||
|
||||
utils::CString mMaterialName;
|
||||
utils::CString mFileName;
|
||||
|
||||
class ShaderCode {
|
||||
public:
|
||||
void setLineOffset(size_t offset) noexcept { mLineOffset = offset; }
|
||||
void setUnresolved(const utils::CString& code) noexcept {
|
||||
mIncludesResolved = false;
|
||||
mCode = code;
|
||||
}
|
||||
|
||||
// Resolve all the #include directives, returns true if successful.
|
||||
bool resolveIncludes(IncludeCallback callback, const utils::CString& fileName) noexcept;
|
||||
|
||||
const utils::CString& getResolved() const noexcept {
|
||||
assert(mIncludesResolved);
|
||||
return mCode;
|
||||
}
|
||||
|
||||
size_t getLineOffset() const noexcept { return mLineOffset; }
|
||||
|
||||
private:
|
||||
utils::CString mCode;
|
||||
size_t mLineOffset = 0;
|
||||
bool mIncludesResolved = false;
|
||||
};
|
||||
|
||||
ShaderCode mMaterialFragmentCode;
|
||||
ShaderCode mMaterialVertexCode;
|
||||
|
||||
IncludeCallback mIncludeCallback = nullptr;
|
||||
|
||||
PropertyList mProperties;
|
||||
ParameterList mParameters;
|
||||
ConstantList mConstants;
|
||||
SubpassList mSubpasses;
|
||||
VariableList mVariables;
|
||||
OutputList mOutputs;
|
||||
BufferList mBuffers;
|
||||
|
||||
ShaderQuality mShaderQuality = ShaderQuality::DEFAULT;
|
||||
FeatureLevel mFeatureLevel = FeatureLevel::FEATURE_LEVEL_1;
|
||||
BlendingMode mBlendingMode = BlendingMode::OPAQUE;
|
||||
BlendingMode mPostLightingBlendingMode = BlendingMode::TRANSPARENT;
|
||||
CullingMode mCullingMode = CullingMode::BACK;
|
||||
Shading mShading = Shading::LIT;
|
||||
MaterialDomain mMaterialDomain = MaterialDomain::SURFACE;
|
||||
RefractionMode mRefractionMode = RefractionMode::NONE;
|
||||
RefractionType mRefractionType = RefractionType::SOLID;
|
||||
ReflectionMode mReflectionMode = ReflectionMode::DEFAULT;
|
||||
Interpolation mInterpolation = Interpolation::SMOOTH;
|
||||
VertexDomain mVertexDomain = VertexDomain::OBJECT;
|
||||
TransparencyMode mTransparencyMode = TransparencyMode::DEFAULT;
|
||||
|
||||
filament::AttributeBitset mRequiredAttributes;
|
||||
|
||||
float mMaskThreshold = 0.4f;
|
||||
float mSpecularAntiAliasingVariance = 0.15f;
|
||||
float mSpecularAntiAliasingThreshold = 0.2f;
|
||||
|
||||
filament::math::uint3 mGroupSize = { 1, 1, 1 };
|
||||
|
||||
bool mShadowMultiplier = false;
|
||||
bool mTransparentShadow = false;
|
||||
|
||||
uint8_t mParameterCount = 0;
|
||||
uint8_t mSubpassCount = 0;
|
||||
|
||||
bool mDoubleSided = false;
|
||||
bool mDoubleSidedCapability = false;
|
||||
bool mColorWrite = true;
|
||||
bool mDepthTest = true;
|
||||
bool mInstanced = false;
|
||||
bool mDepthWrite = true;
|
||||
bool mDepthWriteSet = false;
|
||||
bool mAlphaToCoverage = false;
|
||||
bool mAlphaToCoverageSet = false;
|
||||
|
||||
bool mSpecularAntiAliasing = false;
|
||||
bool mClearCoatIorChange = true;
|
||||
|
||||
bool mFlipUV = true;
|
||||
|
||||
bool mMultiBounceAO = false;
|
||||
bool mMultiBounceAOSet = false;
|
||||
|
||||
SpecularAmbientOcclusion mSpecularAO = SpecularAmbientOcclusion::NONE;
|
||||
bool mSpecularAOSet = false;
|
||||
|
||||
bool mCustomSurfaceShading = false;
|
||||
|
||||
bool mEnableFramebufferFetch = false;
|
||||
|
||||
bool mVertexDomainDeviceJittered = false;
|
||||
|
||||
bool mUseLegacyMorphing = false;
|
||||
|
||||
PreprocessorDefineList mDefines;
|
||||
|
||||
filament::UserVariantFilterMask mVariantFilter = {};
|
||||
};
|
||||
|
||||
} // namespace filamat
|
||||
|
||||
template<> struct utils::EnableBitMaskOperators<filamat::MaterialBuilder::TargetApi>
|
||||
: public std::true_type {};
|
||||
|
||||
#endif
|
||||
103
flutter_filament/windows/include/filament/filamat/Package.h
Normal file
103
flutter_filament/windows/include/filament/filamat/Package.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMAT_PACKAGE_H
|
||||
#define TNT_FILAMAT_PACKAGE_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filamat {
|
||||
|
||||
class UTILS_PUBLIC Package {
|
||||
public:
|
||||
Package() = default;
|
||||
|
||||
// Regular constructor
|
||||
explicit Package(size_t size) : mSize(size) {
|
||||
mPayload = new uint8_t[size];
|
||||
}
|
||||
|
||||
Package(const void* src, size_t size) : Package(size) {
|
||||
memcpy(mPayload, src, size);
|
||||
}
|
||||
|
||||
// Move Constructor
|
||||
Package(Package&& other) noexcept : mPayload(other.mPayload), mSize(other.mSize),
|
||||
mValid(other.mValid) {
|
||||
other.mPayload = nullptr;
|
||||
other.mSize = 0;
|
||||
other.mValid = false;
|
||||
}
|
||||
|
||||
// Move assignment
|
||||
Package& operator=(Package&& other) noexcept {
|
||||
std::swap(mPayload, other.mPayload);
|
||||
std::swap(mSize, other.mSize);
|
||||
std::swap(mValid, other.mValid);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Copy assignment operator disallowed.
|
||||
Package& operator=(const Package& other) = delete;
|
||||
|
||||
// Copy constructor disallowed.
|
||||
Package(const Package& other) = delete;
|
||||
|
||||
~Package() {
|
||||
delete[] mPayload;
|
||||
}
|
||||
|
||||
uint8_t* getData() const noexcept {
|
||||
return mPayload;
|
||||
}
|
||||
|
||||
size_t getSize() const noexcept {
|
||||
return mSize;
|
||||
}
|
||||
|
||||
uint8_t* getEnd() const noexcept {
|
||||
return mPayload + mSize;
|
||||
}
|
||||
|
||||
void setValid(bool valid) noexcept {
|
||||
mValid = valid;
|
||||
}
|
||||
|
||||
bool isValid() const noexcept {
|
||||
return mValid;
|
||||
}
|
||||
|
||||
static Package invalidPackage() {
|
||||
Package package(0);
|
||||
package.setValid(false);
|
||||
return package;
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t* mPayload = nullptr;
|
||||
size_t mSize = 0;
|
||||
bool mValid = true;
|
||||
};
|
||||
|
||||
} // namespace filamat
|
||||
#endif
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_IBL_PREFILTER_IBLPREFILTER_H
|
||||
#define TNT_IBL_PREFILTER_IBLPREFILTER_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Entity.h>
|
||||
|
||||
#include <filament/Texture.h>
|
||||
|
||||
namespace filament {
|
||||
class Engine;
|
||||
class View;
|
||||
class Scene;
|
||||
class Renderer;
|
||||
class Material;
|
||||
class MaterialInstance;
|
||||
class VertexBuffer;
|
||||
class IndexBuffer;
|
||||
class Camera;
|
||||
class Texture;
|
||||
} // namespace filament
|
||||
|
||||
/**
|
||||
* IBLPrefilterContext creates and initializes GPU state common to all environment map filters
|
||||
* supported. Typically, only one instance per filament Engine of this object needs to exist.
|
||||
*
|
||||
* Usage Example:
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
*
|
||||
* IBLPrefilterContext context(engine);
|
||||
* IBLPrefilterContext::SpecularFilter filter(context);
|
||||
* Texture* texture = filter(environment_cubemap);
|
||||
*
|
||||
* IndirectLight* indirectLight = IndirectLight::Builder()
|
||||
* .reflections(texture)
|
||||
* .build(engine);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
class UTILS_PUBLIC IBLPrefilterContext {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates an IBLPrefilter context.
|
||||
* @param engine filament engine to use
|
||||
*/
|
||||
explicit IBLPrefilterContext(filament::Engine& engine);
|
||||
|
||||
/**
|
||||
* Destroys all GPU resources created during initialization.
|
||||
*/
|
||||
~IBLPrefilterContext() noexcept;
|
||||
|
||||
// not copyable
|
||||
IBLPrefilterContext(IBLPrefilterContext const&) = delete;
|
||||
IBLPrefilterContext& operator=(IBLPrefilterContext const&) = delete;
|
||||
|
||||
// movable
|
||||
IBLPrefilterContext(IBLPrefilterContext&& rhs) noexcept;
|
||||
IBLPrefilterContext& operator=(IBLPrefilterContext&& rhs) noexcept;
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* EquirectangularToCubemap is use to convert an equirectangluar image to a cubemap.
|
||||
*/
|
||||
class EquirectangularToCubemap {
|
||||
public:
|
||||
/**
|
||||
* Creates a EquirectangularToCubemap processor.
|
||||
* @param context IBLPrefilterContext to use
|
||||
*/
|
||||
explicit EquirectangularToCubemap(IBLPrefilterContext& context);
|
||||
|
||||
/**
|
||||
* Destroys all GPU resources created during initialization.
|
||||
*/
|
||||
~EquirectangularToCubemap() noexcept;
|
||||
|
||||
EquirectangularToCubemap(EquirectangularToCubemap const&) = delete;
|
||||
EquirectangularToCubemap& operator=(EquirectangularToCubemap const&) = delete;
|
||||
EquirectangularToCubemap(EquirectangularToCubemap&& rhs) noexcept;
|
||||
EquirectangularToCubemap& operator=(EquirectangularToCubemap&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Converts an equirectangular image to a cubemap.
|
||||
* @param equirectangular Texture to convert to a cubemap.
|
||||
* - Can't be null.
|
||||
* - Must be a 2d texture
|
||||
* - Must have equirectangular geometry, that is width == 2*height.
|
||||
* - Must be allocated with all mip levels.
|
||||
* - Must be SAMPLEABLE
|
||||
* @param outCubemap Output cubemap. If null the texture is automatically created
|
||||
* with default parameters (size of 256 with 5 levels).
|
||||
* - Must be a cubemap
|
||||
* - Must have SAMPLEABLE and COLOR_ATTACHMENT usage bits
|
||||
* @return returns outCubemap
|
||||
*/
|
||||
filament::Texture* operator()(
|
||||
filament::Texture const* equirectangular,
|
||||
filament::Texture* outCubemap = nullptr);
|
||||
|
||||
private:
|
||||
IBLPrefilterContext& mContext;
|
||||
filament::Material* mEquirectMaterial = nullptr;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* SpecularFilter is a GPU based implementation of the specular probe pre-integration filter.
|
||||
* An instance of SpecularFilter is needed per filter configuration. A filter configuration
|
||||
* contains the filter's kernel and sample count.
|
||||
*/
|
||||
class SpecularFilter {
|
||||
public:
|
||||
enum class Kernel : uint8_t {
|
||||
D_GGX, // Trowbridge-reitz distribution
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter configuration.
|
||||
*/
|
||||
struct Config {
|
||||
uint16_t sampleCount = 1024u; //!< filter sample count (max 2048)
|
||||
uint8_t levelCount = 5u; //!< number of roughness levels
|
||||
Kernel kernel = Kernel::D_GGX; //!< filter kernel
|
||||
};
|
||||
|
||||
/**
|
||||
* Filtering options for the current environment.
|
||||
*/
|
||||
struct Options {
|
||||
float hdrLinear = 1024.0f; //!< no HDR compression up to this value
|
||||
float hdrMax = 16384.0f; //!< HDR compression between hdrLinear and hdrMax
|
||||
float lodOffset = 1.0f; //!< Good values are 1.0 or 2.0. Higher values help with heavily HDR inputs.
|
||||
bool generateMipmap = true; //!< set to false if the environment map already has mipmaps
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a SpecularFilter processor.
|
||||
* @param context IBLPrefilterContext to use
|
||||
* @param config Configuration of the filter
|
||||
*/
|
||||
SpecularFilter(IBLPrefilterContext& context, Config config);
|
||||
|
||||
/**
|
||||
* Creates a filter with the default configuration.
|
||||
* @param context IBLPrefilterContext to use
|
||||
*/
|
||||
explicit SpecularFilter(IBLPrefilterContext& context);
|
||||
|
||||
/**
|
||||
* Destroys all GPU resources created during initialization.
|
||||
*/
|
||||
~SpecularFilter() noexcept;
|
||||
|
||||
SpecularFilter(SpecularFilter const&) = delete;
|
||||
SpecularFilter& operator=(SpecularFilter const&) = delete;
|
||||
SpecularFilter(SpecularFilter&& rhs) noexcept;
|
||||
SpecularFilter& operator=(SpecularFilter&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Generates a prefiltered cubemap.
|
||||
* @param options Options for this environment
|
||||
* @param environmentCubemap Environment cubemap (input). Can't be null.
|
||||
* This cubemap must be SAMPLEABLE and must have all its
|
||||
* levels allocated. If Options.generateMipmap is true,
|
||||
* the mipmap levels will be overwritten, otherwise
|
||||
* it is assumed that all levels are correctly initialized.
|
||||
* @param outReflectionsTexture Output prefiltered texture or, if null, it is
|
||||
* automatically created with some default parameters.
|
||||
* outReflectionsTexture must be a cubemap, it must have
|
||||
* at least COLOR_ATTACHMENT and SAMPLEABLE usages and at
|
||||
* least the same number of levels than requested by Config.
|
||||
* @return returns outReflectionsTexture
|
||||
*/
|
||||
filament::Texture* operator()(Options options,
|
||||
filament::Texture const* environmentCubemap,
|
||||
filament::Texture* outReflectionsTexture = nullptr);
|
||||
|
||||
/**
|
||||
* Generates a prefiltered cubemap.
|
||||
* @param environmentCubemap Environment cubemap (input). Can't be null.
|
||||
* This cubemap must be SAMPLEABLE and must have all its
|
||||
* levels allocated. All mipmap levels will be overwritten.
|
||||
* @param outReflectionsTexture Output prefiltered texture or, if null, it is
|
||||
* automatically created with some default parameters.
|
||||
* outReflectionsTexture must be a cubemap, it must have
|
||||
* at least COLOR_ATTACHMENT and SAMPLEABLE usages and at
|
||||
* least the same number of levels than requested by Config.
|
||||
* @return returns outReflectionsTexture
|
||||
*/
|
||||
filament::Texture* operator()(
|
||||
filament::Texture const* environmentCubemap,
|
||||
filament::Texture* outReflectionsTexture = nullptr);
|
||||
|
||||
// TODO: option for progressive filtering
|
||||
|
||||
// TODO: add a callback for when the processing is done?
|
||||
|
||||
private:
|
||||
filament::Texture* createReflectionsTexture();
|
||||
IBLPrefilterContext& mContext;
|
||||
filament::Material* mKernelMaterial = nullptr;
|
||||
filament::Texture* mKernelTexture = nullptr;
|
||||
uint32_t mSampleCount = 0u;
|
||||
uint8_t mLevelCount = 1u;
|
||||
};
|
||||
|
||||
private:
|
||||
friend class Filter;
|
||||
filament::Engine& mEngine;
|
||||
filament::Renderer* mRenderer{};
|
||||
filament::Scene* mScene{};
|
||||
filament::VertexBuffer* mVertexBuffer{};
|
||||
filament::IndexBuffer* mIndexBuffer{};
|
||||
filament::Camera* mCamera{};
|
||||
utils::Entity mFullScreenQuadEntity{};
|
||||
utils::Entity mCameraEntity{};
|
||||
filament::View* mView{};
|
||||
filament::Material* mIntegrationMaterial{};
|
||||
};
|
||||
|
||||
#endif //TNT_IBL_PREFILTER_IBLPREFILTER_H
|
||||
240
flutter_filament/windows/include/filament/filament/Box.h
Normal file
240
flutter_filament/windows/include/filament/filament/Box.h
Normal file
@@ -0,0 +1,240 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BOX_H
|
||||
#define TNT_FILAMENT_BOX_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <math/mat4.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* An axis aligned 3D box represented by its center and half-extent.
|
||||
*/
|
||||
class UTILS_PUBLIC Box {
|
||||
public:
|
||||
/** Center of the 3D box */
|
||||
math::float3 center = {};
|
||||
|
||||
/** Half extent from the center on all 3 axis */
|
||||
math::float3 halfExtent = {};
|
||||
|
||||
/**
|
||||
* Whether the box is empty, i.e.: it's volume is null.
|
||||
* @return true if the volume of the box is null
|
||||
*/
|
||||
constexpr bool isEmpty() const noexcept {
|
||||
return length2(halfExtent) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the lowest coordinates corner of the box.
|
||||
* @return center - halfExtent
|
||||
*/
|
||||
constexpr math::float3 getMin() const noexcept {
|
||||
return center - halfExtent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the largest coordinates corner of the box.
|
||||
* @return center + halfExtent
|
||||
*/
|
||||
constexpr math::float3 getMax() const noexcept {
|
||||
return center + halfExtent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the 3D box from its min / max coordinates on each axis
|
||||
* @param min lowest coordinates corner of the box
|
||||
* @param max largest coordinates corner of the box
|
||||
* @return This bounding box
|
||||
*/
|
||||
Box& set(const math::float3& min, const math::float3& max) noexcept {
|
||||
// float3 ctor needed for visual studio
|
||||
center = (max + min) * math::float3(0.5f);
|
||||
halfExtent = (max - min) * math::float3(0.5f);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the bounding box of the union of two boxes
|
||||
* @param box The box to be combined with
|
||||
* @return The bounding box of the union of *this and box
|
||||
*/
|
||||
Box& unionSelf(const Box& box) noexcept {
|
||||
set(min(getMin(), box.getMin()), max(getMax(), box.getMax()));
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the box *to* a given center position
|
||||
* @param tr position to translate the box to
|
||||
* @return A box centered in \p tr with the same extent than *this
|
||||
*/
|
||||
constexpr Box translateTo(const math::float3& tr) const noexcept {
|
||||
return Box{ tr, halfExtent };
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the smallest bounding sphere of the box.
|
||||
* @return The smallest sphere defined by its center (.xyz) and radius (.w) that contains *this
|
||||
*/
|
||||
math::float4 getBoundingSphere() const noexcept {
|
||||
return { center, length(halfExtent) };
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a Box by a linear transform and a translation.
|
||||
*
|
||||
* @param m a 3x3 matrix, the linear transform
|
||||
* @param t a float3, the translation
|
||||
* @param box the box to transform
|
||||
* @return the bounding box of the transformed box
|
||||
*/
|
||||
static Box transform(const math::mat3f& m, math::float3 const& t, const Box& box) noexcept {
|
||||
return { m * box.center + t, abs(m) * box.halfExtent };
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use transform() instead
|
||||
* @see transform()
|
||||
*/
|
||||
friend Box rigidTransform(Box const& box, const math::mat4f& m) noexcept {
|
||||
return transform(m.upperLeft(), m[3].xyz, box);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* An axis aligned box represented by its min and max coordinates
|
||||
*/
|
||||
struct UTILS_PUBLIC Aabb {
|
||||
|
||||
/** min coordinates */
|
||||
math::float3 min = std::numeric_limits<float>::max();
|
||||
|
||||
/** max coordinates */
|
||||
math::float3 max = std::numeric_limits<float>::lowest();
|
||||
|
||||
/**
|
||||
* Computes the center of the box.
|
||||
* @return (max + min)/2
|
||||
*/
|
||||
math::float3 center() const noexcept {
|
||||
// float3 ctor needed for visual studio
|
||||
return (max + min) * math::float3(0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the half-extent of the box.
|
||||
* @return (max - min)/2
|
||||
*/
|
||||
math::float3 extent() const noexcept {
|
||||
// float3 ctor needed for visual studio
|
||||
return (max - min) * math::float3(0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the box is empty, i.e.: it's volume is null or negative.
|
||||
* @return true if min >= max, i.e: the volume of the box is null or negative
|
||||
*/
|
||||
bool isEmpty() const noexcept {
|
||||
return any(greaterThanEqual(min, max));
|
||||
}
|
||||
|
||||
struct Corners {
|
||||
using value_type = math::float3;
|
||||
value_type const* begin() const { return vertices; }
|
||||
value_type const* end() const { return vertices + 8; }
|
||||
value_type * begin() { return vertices; }
|
||||
value_type * end() { return vertices + 8; }
|
||||
value_type const* data() const { return vertices; }
|
||||
value_type * data() { return vertices; }
|
||||
size_t size() const { return 8; }
|
||||
value_type vertices[8];
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the 8 corner vertices of the AABB.
|
||||
*/
|
||||
Corners getCorners() const {
|
||||
return Aabb::Corners{ .vertices = {
|
||||
{ min.x, min.y, min.z },
|
||||
{ max.x, min.y, min.z },
|
||||
{ min.x, max.y, min.z },
|
||||
{ max.x, max.y, min.z },
|
||||
{ min.x, min.y, max.z },
|
||||
{ max.x, min.y, max.z },
|
||||
{ min.x, max.y, max.z },
|
||||
{ max.x, max.y, max.z },
|
||||
}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the box contains a given point.
|
||||
*
|
||||
* @param p the point to test
|
||||
* @return the maximum signed distance to the box. Negative if p is in the box
|
||||
*/
|
||||
float contains(math::float3 p) const noexcept {
|
||||
float d = min.x - p.x;
|
||||
d = std::max(d, min.y - p.y);
|
||||
d = std::max(d, min.z - p.z);
|
||||
d = std::max(d, p.x - max.x);
|
||||
d = std::max(d, p.y - max.y);
|
||||
d = std::max(d, p.z - max.z);
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies an affine transformation to the AABB.
|
||||
*
|
||||
* @param m the 3x3 transformation to apply
|
||||
* @param t the translation
|
||||
* @return the transformed box
|
||||
*/
|
||||
static Aabb transform(const math::mat3f& m, math::float3 const& t, const Aabb& box) noexcept {
|
||||
// Fast AABB transformation per Jim Arvo in Graphics Gems (1990).
|
||||
Aabb result{ t, t };
|
||||
for (size_t col = 0; col < 3; ++col) {
|
||||
for (size_t row = 0; row < 3; ++row) {
|
||||
const float a = m[col][row] * box.min[col];
|
||||
const float b = m[col][row] * box.max[col];
|
||||
result.min[row] += a < b ? a : b;
|
||||
result.max[row] += a < b ? b : a;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use transform() instead
|
||||
* @see transform()
|
||||
*/
|
||||
Aabb transform(const math::mat4f& m) const noexcept {
|
||||
return transform(m.upperLeft(), m[3].xyz, *this);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BOX_H
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BUFFEROBJECT_H
|
||||
#define TNT_FILAMENT_BUFFEROBJECT_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <backend/BufferDescriptor.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FBufferObject;
|
||||
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* A generic GPU buffer containing data.
|
||||
*
|
||||
* Usage of this BufferObject is optional. For simple use cases it is not necessary. It is useful
|
||||
* only when you need to share data between multiple VertexBuffer instances. It also allows you to
|
||||
* efficiently swap-out the buffers in VertexBuffer.
|
||||
*
|
||||
* NOTE: For now this is only used for vertex data, but in the future we may use it for other things
|
||||
* (e.g. compute).
|
||||
*
|
||||
* @see VertexBuffer
|
||||
*/
|
||||
class UTILS_PUBLIC BufferObject : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using BufferDescriptor = backend::BufferDescriptor;
|
||||
using BindingType = backend::BufferObjectBinding;
|
||||
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Size of the buffer in bytes.
|
||||
* @param byteCount Maximum number of bytes the BufferObject can hold.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& size(uint32_t byteCount) noexcept;
|
||||
|
||||
/**
|
||||
* The binding type for this buffer object. (defaults to VERTEX)
|
||||
* @param BindingType Distinguishes between SSBO, VBO, etc. For now this must be VERTEX.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& bindingType(BindingType bindingType) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the BufferObject and returns a pointer to it. After creation, the buffer
|
||||
* object is uninitialized. Use BufferObject::setBuffer() to initialize it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this BufferObject with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*
|
||||
* @see IndexBuffer::setBuffer
|
||||
*/
|
||||
BufferObject* build(Engine& engine);
|
||||
private:
|
||||
friend class FBufferObject;
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously copy-initializes a region of this BufferObject from the data provided.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine associated with this BufferObject.
|
||||
* @param buffer A BufferDescriptor representing the data used to initialize the BufferObject.
|
||||
* @param byteOffset Offset in bytes into the BufferObject
|
||||
*/
|
||||
void setBuffer(Engine& engine, BufferDescriptor&& buffer, uint32_t byteOffset = 0);
|
||||
|
||||
/**
|
||||
* Returns the size of this BufferObject in elements.
|
||||
* @return The maximum capacity of the BufferObject.
|
||||
*/
|
||||
size_t getByteCount() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BUFFEROBJECT_H
|
||||
526
flutter_filament/windows/include/filament/filament/Camera.h
Normal file
526
flutter_filament/windows/include/filament/filament/Camera.h
Normal file
@@ -0,0 +1,526 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_CAMERA_H
|
||||
#define TNT_FILAMENT_CAMERA_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
#include <math/vec2.h>
|
||||
#include <math/vec4.h>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Camera represents the eye through which the scene is viewed.
|
||||
*
|
||||
* A Camera has a position and orientation and controls the projection and exposure parameters.
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* In Filament, Camera is a component that must be associated with an entity. To do so,
|
||||
* use Engine::createCamera(Entity). A Camera component is destroyed using
|
||||
* Engine::destroyCameraComponent(Entity).
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
*
|
||||
* utils::Entity myCameraEntity = utils::EntityManager::get().create();
|
||||
* filament::Camera* myCamera = engine->createCamera(myCameraEntity);
|
||||
* myCamera->setProjection(45, 16.0/9.0, 0.1, 1.0);
|
||||
* myCamera->lookAt({0, 1.60, 1}, {0, 0, 0});
|
||||
* engine->destroyCameraComponent(myCamera);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
*
|
||||
* Coordinate system
|
||||
* =================
|
||||
*
|
||||
* The camera coordinate system defines the *view space*. The camera points towards its -z axis
|
||||
* and is oriented such that its top side is in the direction of +y, and its right side in the
|
||||
* direction of +x.
|
||||
*
|
||||
* @note
|
||||
* Since the *near* and *far* planes are defined by the distance from the camera,
|
||||
* their respective coordinates are -\p distance(near) and -\p distance(far).
|
||||
*
|
||||
* Clipping planes
|
||||
* ===============
|
||||
*
|
||||
* The camera defines six *clipping planes* which together create a *clipping volume*. The
|
||||
* geometry outside this volume is clipped.
|
||||
*
|
||||
* The clipping volume can either be a box or a frustum depending on which projection is used,
|
||||
* respectively Projection.ORTHO or Projection.PERSPECTIVE. The six planes are specified either
|
||||
* directly or indirectly using setProjection().
|
||||
*
|
||||
* The six planes are:
|
||||
* - left
|
||||
* - right
|
||||
* - bottom
|
||||
* - top
|
||||
* - near
|
||||
* - far
|
||||
*
|
||||
* @note
|
||||
* To increase the depth-buffer precision, the *far* clipping plane is always assumed to be at
|
||||
* infinity for rendering. That is, it is not used to clip geometry during rendering.
|
||||
* However, it is used during the culling phase (objects entirely behind the *far*
|
||||
* plane are culled).
|
||||
*
|
||||
*
|
||||
* Choosing the *near* plane distance
|
||||
* ==================================
|
||||
*
|
||||
* The *near* plane distance greatly affects the depth-buffer resolution.
|
||||
*
|
||||
* Example: Precision at 1m, 10m, 100m and 1Km for various near distances assuming a 32-bit float
|
||||
* depth-buffer:
|
||||
*
|
||||
* near (m) | 1 m | 10 m | 100 m | 1 Km
|
||||
* -----------:|:------:|:-------:|:--------:|:--------:
|
||||
* 0.001 | 7.2e-5 | 0.0043 | 0.4624 | 48.58
|
||||
* 0.01 | 6.9e-6 | 0.0001 | 0.0430 | 4.62
|
||||
* 0.1 | 3.6e-7 | 7.0e-5 | 0.0072 | 0.43
|
||||
* 1.0 | 0 | 3.8e-6 | 0.0007 | 0.07
|
||||
*
|
||||
* As can be seen in the table above, the depth-buffer precision drops rapidly with the
|
||||
* distance to the camera.
|
||||
*
|
||||
* Make sure to pick the highest *near* plane distance possible.
|
||||
*
|
||||
* On Vulkan and Metal platforms (or OpenGL platforms supporting either EXT_clip_control or
|
||||
* ARB_clip_control extensions), the depth-buffer precision is much less dependent on the *near*
|
||||
* plane value:
|
||||
*
|
||||
* near (m) | 1 m | 10 m | 100 m | 1 Km
|
||||
* -----------:|:------:|:-------:|:--------:|:--------:
|
||||
* 0.001 | 1.2e-7 | 9.5e-7 | 7.6e-6 | 6.1e-5
|
||||
* 0.01 | 1.2e-7 | 9.5e-7 | 7.6e-6 | 6.1e-5
|
||||
* 0.1 | 5.9e-8 | 9.5e-7 | 1.5e-5 | 1.2e-4
|
||||
* 1.0 | 0 | 9.5e-7 | 7.6e-6 | 1.8e-4
|
||||
*
|
||||
*
|
||||
* Choosing the *far* plane distance
|
||||
* =================================
|
||||
*
|
||||
* The far plane distance is always set internally to infinity for rendering, however it is used for
|
||||
* culling and shadowing calculations. It is important to keep a reasonable ratio between
|
||||
* the near and far plane distances. Typically a ratio in the range 1:100 to 1:100000 is
|
||||
* commanded. Larger values may causes rendering artifacts or trigger assertions in debug builds.
|
||||
*
|
||||
*
|
||||
* Exposure
|
||||
* ========
|
||||
*
|
||||
* The Camera is also used to set the scene's exposure, just like with a real camera. The lights
|
||||
* intensity and the Camera exposure interact to produce the final scene's brightness.
|
||||
*
|
||||
*
|
||||
*
|
||||
* \see Frustum, View
|
||||
*/
|
||||
class UTILS_PUBLIC Camera : public FilamentAPI {
|
||||
public:
|
||||
//! Denotes the projection type used by this camera. \see setProjection
|
||||
enum class Projection : int {
|
||||
PERSPECTIVE, //!< perspective projection, objects get smaller as they are farther
|
||||
ORTHO //!< orthonormal projection, preserves distances
|
||||
};
|
||||
|
||||
//! Denotes a field-of-view direction. \see setProjection
|
||||
enum class Fov : int {
|
||||
VERTICAL, //!< the field-of-view angle is defined on the vertical axis
|
||||
HORIZONTAL //!< the field-of-view angle is defined on the horizontal axis
|
||||
};
|
||||
|
||||
/** Sets the projection matrix from a frustum defined by six planes.
|
||||
*
|
||||
* @param projection type of #Projection to use.
|
||||
*
|
||||
* @param left distance in world units from the camera to the left plane,
|
||||
* at the near plane.
|
||||
* Precondition: \p left != \p right.
|
||||
*
|
||||
* @param right distance in world units from the camera to the right plane,
|
||||
* at the near plane.
|
||||
* Precondition: \p left != \p right.
|
||||
*
|
||||
* @param bottom distance in world units from the camera to the bottom plane,
|
||||
* at the near plane.
|
||||
* Precondition: \p bottom != \p top.
|
||||
*
|
||||
* @param top distance in world units from the camera to the top plane,
|
||||
* at the near plane.
|
||||
* Precondition: \p left != \p right.
|
||||
*
|
||||
* @param near distance in world units from the camera to the near plane. The near plane's
|
||||
* position in view space is z = -\p near.
|
||||
* Precondition: \p near > 0 for PROJECTION::PERSPECTIVE or
|
||||
* \p near != far for PROJECTION::ORTHO
|
||||
*
|
||||
* @param far distance in world units from the camera to the far plane. The far plane's
|
||||
* position in view space is z = -\p far.
|
||||
* Precondition: \p far > near for PROJECTION::PERSPECTIVE or
|
||||
* \p far != near for PROJECTION::ORTHO
|
||||
*
|
||||
* @see Projection, Frustum
|
||||
*/
|
||||
void setProjection(Projection projection,
|
||||
double left, double right,
|
||||
double bottom, double top,
|
||||
double near, double far);
|
||||
|
||||
/** Sets the projection matrix from the field-of-view.
|
||||
*
|
||||
* @param fovInDegrees full field-of-view in degrees. 0 < \p fov < 180.
|
||||
* @param aspect aspect ratio \f$ \frac{width}{height} \f$. \p aspect > 0.
|
||||
* @param near distance in world units from the camera to the near plane. \p near > 0.
|
||||
* @param far distance in world units from the camera to the far plane. \p far > \p near.
|
||||
* @param direction direction of the \p fovInDegrees parameter.
|
||||
*
|
||||
* @see Fov.
|
||||
*/
|
||||
void setProjection(double fovInDegrees, double aspect, double near, double far,
|
||||
Fov direction = Fov::VERTICAL);
|
||||
|
||||
/** Sets the projection matrix from the focal length.
|
||||
*
|
||||
* @param focalLengthInMillimeters lens's focal length in millimeters. \p focalLength > 0.
|
||||
* @param aspect aspect ratio \f$ \frac{width}{height} \f$. \p aspect > 0.
|
||||
* @param near distance in world units from the camera to the near plane. \p near > 0.
|
||||
* @param far distance in world units from the camera to the far plane. \p far > \p near.
|
||||
*/
|
||||
void setLensProjection(double focalLengthInMillimeters,
|
||||
double aspect, double near, double far);
|
||||
|
||||
/** Sets a custom projection matrix.
|
||||
*
|
||||
* The projection matrix must be of one of the following form:
|
||||
* a 0 tx 0 a 0 0 tx
|
||||
* 0 b ty 0 0 b 0 ty
|
||||
* 0 0 tz c 0 0 c tz
|
||||
* 0 0 -1 0 0 0 0 1
|
||||
*
|
||||
* The projection matrix must define an NDC system that must match the OpenGL convention,
|
||||
* that is all 3 axis are mapped to [-1, 1].
|
||||
*
|
||||
* @param projection custom projection matrix used for rendering and culling
|
||||
* @param near distance in world units from the camera to the near plane. \p near > 0.
|
||||
* @param far distance in world units from the camera to the far plane. \p far > \p near.
|
||||
*/
|
||||
void setCustomProjection(math::mat4 const& projection, double near, double far) noexcept;
|
||||
|
||||
/** Sets the projection matrix.
|
||||
*
|
||||
* The projection matrices must be of one of the following form:
|
||||
* a 0 tx 0 a 0 0 tx
|
||||
* 0 b ty 0 0 b 0 ty
|
||||
* 0 0 tz c 0 0 c tz
|
||||
* 0 0 -1 0 0 0 0 1
|
||||
*
|
||||
* The projection matrices must define an NDC system that must match the OpenGL convention,
|
||||
* that is all 3 axis are mapped to [-1, 1].
|
||||
*
|
||||
* @param projection custom projection matrix used for rendering
|
||||
* @param projectionForCulling custom projection matrix used for culling
|
||||
* @param near distance in world units from the camera to the near plane. \p near > 0.
|
||||
* @param far distance in world units from the camera to the far plane. \p far > \p near.
|
||||
*/
|
||||
void setCustomProjection(math::mat4 const& projection, math::mat4 const& projectionForCulling,
|
||||
double near, double far) noexcept;
|
||||
|
||||
/** Sets an additional matrix that scales the projection matrix.
|
||||
*
|
||||
* This is useful to adjust the aspect ratio of the camera independent from its projection.
|
||||
* First, pass an aspect of 1.0 to setProjection. Then set the scaling with the desired aspect
|
||||
* ratio:
|
||||
*
|
||||
* const double aspect = width / height;
|
||||
*
|
||||
* // with Fov::HORIZONTAL passed to setProjection:
|
||||
* camera->setScaling(double4 {1.0, aspect});
|
||||
*
|
||||
* // with Fov::VERTICAL passed to setProjection:
|
||||
* camera->setScaling(double4 {1.0 / aspect, 1.0});
|
||||
*
|
||||
*
|
||||
* By default, this is an identity matrix.
|
||||
*
|
||||
* @param scaling diagonal of the 2x2 scaling matrix to be applied after the projection matrix.
|
||||
*
|
||||
* @see setProjection, setLensProjection, setCustomProjection
|
||||
*/
|
||||
void setScaling(math::double2 scaling) noexcept;
|
||||
|
||||
/**
|
||||
* Sets an additional matrix that shifts the projection matrix.
|
||||
* By default, this is an identity matrix.
|
||||
*
|
||||
* @param shift x and y translation added to the projection matrix, specified in NDC
|
||||
* coordinates, that is, if the translation must be specified in pixels,
|
||||
* shift must be scaled by 1.0 / { viewport.width, viewport.height }.
|
||||
*
|
||||
* @see setProjection, setLensProjection, setCustomProjection
|
||||
*/
|
||||
void setShift(math::double2 shift) noexcept;
|
||||
|
||||
/** Returns the scaling amount used to scale the projection matrix.
|
||||
*
|
||||
* @return the diagonal of the scaling matrix applied after the projection matrix.
|
||||
*
|
||||
* @see setScaling
|
||||
*/
|
||||
math::double4 getScaling() const noexcept;
|
||||
|
||||
/** Returns the shift amount used to translate the projection matrix.
|
||||
*
|
||||
* @return the 2D translation x and y offsets applied after the projection matrix.
|
||||
*
|
||||
* @see setShift
|
||||
*/
|
||||
math::double2 getShift() const noexcept;
|
||||
|
||||
/** Returns the projection matrix used for rendering.
|
||||
*
|
||||
* The projection matrix used for rendering always has its far plane set to infinity. This
|
||||
* is why it may differ from the matrix set through setProjection() or setLensProjection().
|
||||
*
|
||||
* @return The projection matrix used for rendering
|
||||
*
|
||||
* @see setProjection, setLensProjection, setCustomProjection, getCullingProjectionMatrix
|
||||
*/
|
||||
math::mat4 getProjectionMatrix() const noexcept;
|
||||
|
||||
|
||||
/** Returns the projection matrix used for culling (far plane is finite).
|
||||
*
|
||||
* @return The projection matrix set by setProjection or setLensProjection.
|
||||
*
|
||||
* @see setProjection, setLensProjection, getProjectionMatrix
|
||||
*/
|
||||
math::mat4 getCullingProjectionMatrix() const noexcept;
|
||||
|
||||
|
||||
//! Returns the frustum's near plane
|
||||
double getNear() const noexcept;
|
||||
|
||||
//! Returns the frustum's far plane used for culling
|
||||
double getCullingFar() const noexcept;
|
||||
|
||||
/** Sets the camera's model matrix.
|
||||
*
|
||||
* Helper method to set the camera's entity transform component.
|
||||
* It has the same effect as calling:
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* engine.getTransformManager().setTransform(
|
||||
* engine.getTransformManager().getInstance(camera->getEntity()), model);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
* @param model The camera position and orientation provided as a rigid transform matrix.
|
||||
*
|
||||
* @note The Camera "looks" towards its -z axis
|
||||
*
|
||||
* @warning \p model must be a rigid transform
|
||||
*/
|
||||
void setModelMatrix(const math::mat4& model) noexcept;
|
||||
void setModelMatrix(const math::mat4f& model) noexcept; //!< @overload
|
||||
|
||||
/** Sets the camera's model matrix
|
||||
*
|
||||
* @param eye The position of the camera in world space.
|
||||
* @param center The point in world space the camera is looking at.
|
||||
* @param up A unit vector denoting the camera's "up" direction.
|
||||
*/
|
||||
void lookAt(math::double3 const& eye,
|
||||
math::double3 const& center,
|
||||
math::double3 const& up = math::double3{0, 1, 0}) noexcept;
|
||||
|
||||
/** Returns the camera's model matrix
|
||||
*
|
||||
* Helper method to return the camera's entity transform component.
|
||||
* It has the same effect as calling:
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* engine.getTransformManager().getWorldTransform(
|
||||
* engine.getTransformManager().getInstance(camera->getEntity()));
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
* @return The camera's pose in world space as a rigid transform. Parent transforms, if any,
|
||||
* are taken into account.
|
||||
*/
|
||||
math::mat4 getModelMatrix() const noexcept;
|
||||
|
||||
//! Returns the camera's view matrix (inverse of the model matrix)
|
||||
math::mat4 getViewMatrix() const noexcept;
|
||||
|
||||
//! Returns the camera's position in world space
|
||||
math::double3 getPosition() const noexcept;
|
||||
|
||||
//! Returns the camera's normalized left vector
|
||||
math::float3 getLeftVector() const noexcept;
|
||||
|
||||
//! Returns the camera's normalized up vector
|
||||
math::float3 getUpVector() const noexcept;
|
||||
|
||||
//! Returns the camera's forward vector
|
||||
math::float3 getForwardVector() const noexcept;
|
||||
|
||||
//! Returns the camera's field of view in degrees
|
||||
float getFieldOfViewInDegrees(Fov direction) const noexcept;
|
||||
|
||||
//! Returns the camera's culling Frustum in world space
|
||||
class Frustum getFrustum() const noexcept;
|
||||
|
||||
//! Returns the entity representing this camera
|
||||
utils::Entity getEntity() const noexcept;
|
||||
|
||||
/** Sets this camera's exposure (default is f/16, 1/125s, 100 ISO)
|
||||
*
|
||||
* The exposure ultimately controls the scene's brightness, just like with a real camera.
|
||||
* The default values provide adequate exposure for a camera placed outdoors on a sunny day
|
||||
* with the sun at the zenith.
|
||||
*
|
||||
* @param aperture Aperture in f-stops, clamped between 0.5 and 64.
|
||||
* A lower \p aperture value *increases* the exposure, leading to
|
||||
* a brighter scene. Realistic values are between 0.95 and 32.
|
||||
*
|
||||
* @param shutterSpeed Shutter speed in seconds, clamped between 1/25,000 and 60.
|
||||
* A lower shutter speed increases the exposure. Realistic values are
|
||||
* between 1/8000 and 30.
|
||||
*
|
||||
* @param sensitivity Sensitivity in ISO, clamped between 10 and 204,800.
|
||||
* A higher \p sensitivity increases the exposure. Realistic values are
|
||||
* between 50 and 25600.
|
||||
*
|
||||
* @note
|
||||
* With the default parameters, the scene must contain at least one Light of intensity
|
||||
* similar to the sun (e.g.: a 100,000 lux directional light).
|
||||
*
|
||||
* @see LightManager, Exposure
|
||||
*/
|
||||
void setExposure(float aperture, float shutterSpeed, float sensitivity) noexcept;
|
||||
|
||||
/** Sets this camera's exposure directly. Calling this method will set the aperture
|
||||
* to 1.0, the shutter speed to 1.2 and the sensitivity will be computed to match
|
||||
* the requested exposure (for a desired exposure of 1.0, the sensitivity will be
|
||||
* set to 100 ISO).
|
||||
*
|
||||
* This method is useful when trying to match the lighting of other engines or tools.
|
||||
* Many engines/tools use unit-less light intensities, which can be matched by setting
|
||||
* the exposure manually. This can be typically achieved by setting the exposure to
|
||||
* 1.0.
|
||||
*/
|
||||
void setExposure(float exposure) noexcept {
|
||||
setExposure(1.0f, 1.2f, 100.0f * (1.0f / exposure));
|
||||
}
|
||||
|
||||
//! returns this camera's aperture in f-stops
|
||||
float getAperture() const noexcept;
|
||||
|
||||
//! returns this camera's shutter speed in seconds
|
||||
float getShutterSpeed() const noexcept;
|
||||
|
||||
//! returns this camera's sensitivity in ISO
|
||||
float getSensitivity() const noexcept;
|
||||
|
||||
//! returns the focal length in meters [m] for a 35mm camera
|
||||
double getFocalLength() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the camera focus distance. This is used by the Depth-of-field PostProcessing effect.
|
||||
* @param distance Distance from the camera to the plane of focus in world units.
|
||||
* Must be positive and larger than the near clipping plane.
|
||||
*/
|
||||
void setFocusDistance(float distance) noexcept;
|
||||
|
||||
//! Returns the focus distance in world units
|
||||
float getFocusDistance() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the inverse of a projection matrix.
|
||||
*
|
||||
* \param p the projection matrix to inverse
|
||||
* \returns the inverse of the projection matrix \p p
|
||||
*
|
||||
* \warning the projection matrix to invert must have one of the form below:
|
||||
* - perspective projection
|
||||
*
|
||||
* \f$
|
||||
* \left(
|
||||
* \begin{array}{cccc}
|
||||
* a & 0 & tx & 0 \\
|
||||
* 0 & b & ty & 0 \\
|
||||
* 0 & 0 & tz & c \\
|
||||
* 0 & 0 & -1 & 0 \\
|
||||
* \end{array}
|
||||
* \right)
|
||||
* \f$
|
||||
*
|
||||
* - orthographic projection
|
||||
*
|
||||
* \f$
|
||||
* \left(
|
||||
* \begin{array}{cccc}
|
||||
* a & 0 & 0 & tx \\
|
||||
* 0 & b & 0 & ty \\
|
||||
* 0 & 0 & c & tz \\
|
||||
* 0 & 0 & 0 & 1 \\
|
||||
* \end{array}
|
||||
* \right)
|
||||
* \f$
|
||||
*/
|
||||
static math::mat4 inverseProjection(const math::mat4& p) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the inverse of a projection matrix.
|
||||
* @see inverseProjection(const math::mat4&)
|
||||
*/
|
||||
static math::mat4f inverseProjection(const math::mat4f& p) noexcept;
|
||||
|
||||
/**
|
||||
* Helper to compute the effective focal length taking into account the focus distance
|
||||
*
|
||||
* @param focalLength focal length in any unit (e.g. [m] or [mm])
|
||||
* @param focusDistance focus distance in same unit as focalLength
|
||||
* @return the effective focal length in same unit as focalLength
|
||||
*/
|
||||
static double computeEffectiveFocalLength(double focalLength, double focusDistance) noexcept;
|
||||
|
||||
/**
|
||||
* Helper to compute the effective field-of-view taking into account the focus distance
|
||||
*
|
||||
* @param fovInDegrees full field of view in degrees
|
||||
* @param focusDistance focus distance in meters [m]
|
||||
* @return effective full field of view in degrees
|
||||
*/
|
||||
static double computeEffectiveFov(double fovInDegrees, double focusDistance) noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_CAMERA_H
|
||||
214
flutter_filament/windows/include/filament/filament/Color.h
Normal file
214
flutter_filament/windows/include/filament/filament/Color.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_COLOR_H
|
||||
#define TNT_FILAMENT_COLOR_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/vec3.h>
|
||||
#include <math/vec4.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
//! RGB color in linear space
|
||||
using LinearColor = math::float3;
|
||||
|
||||
//! RGB color in sRGB space
|
||||
using sRGBColor = math::float3;
|
||||
|
||||
//! RGBA color in linear space, with alpha
|
||||
using LinearColorA = math::float4;
|
||||
|
||||
//! RGBA color in sRGB space, with alpha
|
||||
using sRGBColorA = math::float4;
|
||||
|
||||
//! types of RGB colors
|
||||
enum class RgbType : uint8_t {
|
||||
sRGB, //!< the color is defined in Rec.709-sRGB-D65 (sRGB) space
|
||||
LINEAR, //!< the color is defined in Rec.709-Linear-D65 ("linear sRGB") space
|
||||
};
|
||||
|
||||
//! types of RGBA colors
|
||||
enum class RgbaType : uint8_t {
|
||||
/**
|
||||
* the color is defined in Rec.709-sRGB-D65 (sRGB) space and the RGB values
|
||||
* have not been pre-multiplied by the alpha (for instance, a 50%
|
||||
* transparent red is <1,0,0,0.5>)
|
||||
*/
|
||||
sRGB,
|
||||
/**
|
||||
* the color is defined in Rec.709-Linear-D65 ("linear sRGB") space and the
|
||||
* RGB values have not been pre-multiplied by the alpha (for instance, a 50%
|
||||
* transparent red is <1,0,0,0.5>)
|
||||
*/
|
||||
LINEAR,
|
||||
/**
|
||||
* the color is defined in Rec.709-sRGB-D65 (sRGB) space and the RGB values
|
||||
* have been pre-multiplied by the alpha (for instance, a 50%
|
||||
* transparent red is <0.5,0,0,0.5>)
|
||||
*/
|
||||
PREMULTIPLIED_sRGB,
|
||||
/**
|
||||
* the color is defined in Rec.709-Linear-D65 ("linear sRGB") space and the
|
||||
* RGB values have been pre-multiplied by the alpha (for instance, a 50%
|
||||
* transparent red is <0.5,0,0,0.5>)
|
||||
*/
|
||||
PREMULTIPLIED_LINEAR
|
||||
};
|
||||
|
||||
//! type of color conversion to use when converting to/from sRGB and linear spaces
|
||||
enum ColorConversion {
|
||||
ACCURATE, //!< accurate conversion using the sRGB standard
|
||||
FAST //!< fast conversion using a simple gamma 2.2 curve
|
||||
};
|
||||
|
||||
/**
|
||||
* Utilities to manipulate and convert colors
|
||||
*/
|
||||
class UTILS_PUBLIC Color {
|
||||
public:
|
||||
//! converts an RGB color to linear space, the conversion depends on the specified type
|
||||
static LinearColor toLinear(RgbType type, math::float3 color);
|
||||
|
||||
//! converts an RGBA color to linear space, the conversion depends on the specified type
|
||||
static LinearColorA toLinear(RgbaType type, math::float4 color);
|
||||
|
||||
//! converts an RGB color in sRGB space to an RGB color in linear space
|
||||
template<ColorConversion = ACCURATE>
|
||||
static LinearColor toLinear(sRGBColor const& color);
|
||||
|
||||
/**
|
||||
* Converts an RGB color in Rec.709-Linear-D65 ("linear sRGB") space to an
|
||||
* RGB color in Rec.709-sRGB-D65 (sRGB) space.
|
||||
*/
|
||||
template<ColorConversion = ACCURATE>
|
||||
static sRGBColor toSRGB(LinearColor const& color);
|
||||
|
||||
/**
|
||||
* Converts an RGBA color in Rec.709-sRGB-D65 (sRGB) space to an RGBA color in
|
||||
* Rec.709-Linear-D65 ("linear sRGB") space the alpha component is left unmodified.
|
||||
*/
|
||||
template<ColorConversion = ACCURATE>
|
||||
static LinearColorA toLinear(sRGBColorA const& color);
|
||||
|
||||
/**
|
||||
* Converts an RGBA color in Rec.709-Linear-D65 ("linear sRGB") space to
|
||||
* an RGBA color in Rec.709-sRGB-D65 (sRGB) space the alpha component is
|
||||
* left unmodified.
|
||||
*/
|
||||
template<ColorConversion = ACCURATE>
|
||||
static sRGBColorA toSRGB(LinearColorA const& color);
|
||||
|
||||
/**
|
||||
* Converts a correlated color temperature to a linear RGB color in sRGB
|
||||
* space the temperature must be expressed in kelvin and must be in the
|
||||
* range 1,000K to 15,000K.
|
||||
*/
|
||||
static LinearColor cct(float K);
|
||||
|
||||
/**
|
||||
* Converts a CIE standard illuminant series D to a linear RGB color in
|
||||
* sRGB space the temperature must be expressed in kelvin and must be in
|
||||
* the range 4,000K to 25,000K
|
||||
*/
|
||||
static LinearColor illuminantD(float K);
|
||||
|
||||
/**
|
||||
* Computes the Beer-Lambert absorption coefficients from the specified
|
||||
* transmittance color and distance. The computed absorption will guarantee
|
||||
* the white light will become the specified color at the specified distance.
|
||||
* The output of this function can be used as the absorption parameter of
|
||||
* materials that use refraction.
|
||||
*
|
||||
* @param color the desired linear RGB color in sRGB space
|
||||
* @param distance the distance at which white light should become the specified color
|
||||
*
|
||||
* @return absorption coefficients for the Beer-Lambert law
|
||||
*/
|
||||
static math::float3 absorptionAtDistance(LinearColor const& color, float distance);
|
||||
|
||||
private:
|
||||
static math::float3 sRGBToLinear(math::float3 color) noexcept;
|
||||
static math::float3 linearToSRGB(math::float3 color) noexcept;
|
||||
};
|
||||
|
||||
// Use the default implementation from the header
|
||||
template<>
|
||||
inline LinearColor Color::toLinear<FAST>(sRGBColor const& color) {
|
||||
return pow(color, 2.2f);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline LinearColorA Color::toLinear<FAST>(sRGBColorA const& color) {
|
||||
return LinearColorA{pow(color.rgb, 2.2f), color.a};
|
||||
}
|
||||
|
||||
template<>
|
||||
inline LinearColor Color::toLinear<ACCURATE>(sRGBColor const& color) {
|
||||
return sRGBToLinear(color);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline LinearColorA Color::toLinear<ACCURATE>(sRGBColorA const& color) {
|
||||
return LinearColorA{sRGBToLinear(color.rgb), color.a};
|
||||
}
|
||||
|
||||
// Use the default implementation from the header
|
||||
template<>
|
||||
inline sRGBColor Color::toSRGB<FAST>(LinearColor const& color) {
|
||||
return pow(color, 1.0f / 2.2f);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline sRGBColorA Color::toSRGB<FAST>(LinearColorA const& color) {
|
||||
return sRGBColorA{pow(color.rgb, 1.0f / 2.2f), color.a};
|
||||
}
|
||||
|
||||
template<>
|
||||
inline sRGBColor Color::toSRGB<ACCURATE>(LinearColor const& color) {
|
||||
return linearToSRGB(color);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline sRGBColorA Color::toSRGB<ACCURATE>(LinearColorA const& color) {
|
||||
return sRGBColorA{linearToSRGB(color.rgb), color.a};
|
||||
}
|
||||
|
||||
inline LinearColor Color::toLinear(RgbType type, math::float3 color) {
|
||||
return (type == RgbType::LINEAR) ? color : Color::toLinear<ACCURATE>(color);
|
||||
}
|
||||
|
||||
// converts an RGBA color to linear space
|
||||
// the conversion depends on the specified type
|
||||
inline LinearColorA Color::toLinear(RgbaType type, math::float4 color) {
|
||||
switch (type) {
|
||||
case RgbaType::sRGB:
|
||||
return Color::toLinear<ACCURATE>(color) * math::float4{color.a, color.a, color.a, 1.0f};
|
||||
case RgbaType::LINEAR:
|
||||
return color * math::float4{color.a, color.a, color.a, 1.0f};
|
||||
case RgbaType::PREMULTIPLIED_sRGB:
|
||||
return Color::toLinear<ACCURATE>(color);
|
||||
case RgbaType::PREMULTIPLIED_LINEAR:
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_COLOR_H
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_COLORGRADING_H
|
||||
#define TNT_FILAMENT_COLORGRADING_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/ToneMapper.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Engine;
|
||||
class FColorGrading;
|
||||
|
||||
namespace color {
|
||||
class ColorSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* ColorGrading is used to transform (either to modify or correct) the colors of the HDR buffer
|
||||
* rendered by Filament. Color grading transforms are applied after lighting, and after any lens
|
||||
* effects (bloom for instance), and include tone mapping.
|
||||
*
|
||||
* Creation, usage and destruction
|
||||
* ===============================
|
||||
*
|
||||
* A ColorGrading object is created using the ColorGrading::Builder and destroyed by calling
|
||||
* Engine::destroy(const ColorGrading*). A ColorGrading object is meant to be set on a View.
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
*
|
||||
* filament::ColorGrading* colorGrading = filament::ColorGrading::Builder()
|
||||
* .toneMapping(filament::ColorGrading::ToneMapping::ACES)
|
||||
* .build(*engine);
|
||||
*
|
||||
* myView->setColorGrading(colorGrading);
|
||||
*
|
||||
* engine->destroy(colorGrading);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
* Performance
|
||||
* ===========
|
||||
*
|
||||
* Creating a new ColorGrading object may be more expensive than other Filament objects as a
|
||||
* 3D LUT may need to be generated. The generation of a 3D LUT, if necessary, may happen on
|
||||
* the CPU.
|
||||
*
|
||||
* Ordering
|
||||
* ========
|
||||
*
|
||||
* The various transforms held by ColorGrading are applied in the following order:
|
||||
* - Exposure
|
||||
* - Night adaptation
|
||||
* - White balance
|
||||
* - Channel mixer
|
||||
* - Shadows/mid-tones/highlights
|
||||
* - Slope/offset/power (CDL)
|
||||
* - Contrast
|
||||
* - Vibrance
|
||||
* - Saturation
|
||||
* - Curves
|
||||
* - Tone mapping
|
||||
* - Luminance scaling
|
||||
* - Gamut mapping
|
||||
*
|
||||
* Defaults
|
||||
* ========
|
||||
*
|
||||
* Here are the default color grading options:
|
||||
* - Exposure: 0.0
|
||||
* - Night adaptation: 0.0
|
||||
* - White balance: temperature 0, and tint 0
|
||||
* - Channel mixer: red {1,0,0}, green {0,1,0}, blue {0,0,1}
|
||||
* - Shadows/mid-tones/highlights: shadows {1,1,1,0}, mid-tones {1,1,1,0}, highlights {1,1,1,0},
|
||||
* ranges {0,0.333,0.550,1}
|
||||
* - Slope/offset/power: slope 1.0, offset 0.0, and power 1.0
|
||||
* - Contrast: 1.0
|
||||
* - Vibrance: 1.0
|
||||
* - Saturation: 1.0
|
||||
* - Curves: gamma {1,1,1}, midPoint {1,1,1}, and scale {1,1,1}
|
||||
* - Tone mapping: ACESLegacyToneMapper
|
||||
* - Luminance scaling: false
|
||||
* - Gamut mapping: false
|
||||
* - Output color space: Rec709-sRGB-D65
|
||||
*
|
||||
* @see View
|
||||
*/
|
||||
class UTILS_PUBLIC ColorGrading : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
public:
|
||||
|
||||
enum class QualityLevel : uint8_t {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
ULTRA
|
||||
};
|
||||
|
||||
enum class LutFormat : uint8_t {
|
||||
INTEGER, //!< 10 bits per component
|
||||
FLOAT, //!< 16 bits per component (10 bits mantissa precision)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* List of available tone-mapping operators.
|
||||
*
|
||||
* @deprecated Use Builder::toneMapper(ToneMapper*) instead
|
||||
*/
|
||||
enum class UTILS_DEPRECATED ToneMapping : uint8_t {
|
||||
LINEAR = 0, //!< Linear tone mapping (i.e. no tone mapping)
|
||||
ACES_LEGACY = 1, //!< ACES tone mapping, with a brightness modifier to match Filament's legacy tone mapper
|
||||
ACES = 2, //!< ACES tone mapping
|
||||
FILMIC = 3, //!< Filmic tone mapping, modelled after ACES but applied in sRGB space
|
||||
DISPLAY_RANGE = 4, //!< Tone mapping used to validate/debug scene exposure
|
||||
};
|
||||
|
||||
//! Use Builder to construct a ColorGrading object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the quality level of the color grading. When color grading is implemented using
|
||||
* a 3D LUT, the quality level may impact the resolution and bit depth of the backing
|
||||
* 3D texture. For instance, a low quality level will use a 16x16x16 10 bit LUT, a medium
|
||||
* quality level will use a 32x32x32 10 bit LUT, a high quality will use a 32x32x32 16 bit
|
||||
* LUT, and a ultra quality will use a 64x64x64 16 bit LUT.
|
||||
* This overrides the values set by format() and dimensions().
|
||||
*
|
||||
* The default quality is medium.
|
||||
*
|
||||
* @param qualityLevel The desired quality of the color grading process
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& quality(QualityLevel qualityLevel) noexcept;
|
||||
|
||||
/**
|
||||
* When color grading is implemented using a 3D LUT, this sets the texture format of
|
||||
* of the LUT. This overrides the value set by quality().
|
||||
*
|
||||
* The default is INTEGER
|
||||
*
|
||||
* @param format The desired format of the 3D LUT.
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& format(LutFormat format) noexcept;
|
||||
|
||||
/**
|
||||
* When color grading is implemented using a 3D LUT, this sets the dimension of the LUT.
|
||||
* This overrides the value set by quality().
|
||||
*
|
||||
* The default is 32
|
||||
*
|
||||
* @param dim The desired dimension of the LUT. Between 16 and 64.
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& dimensions(uint8_t dim) noexcept;
|
||||
|
||||
/**
|
||||
* Selects the tone mapping operator to apply to the HDR color buffer as the last
|
||||
* operation of the color grading post-processing step.
|
||||
*
|
||||
* The default tone mapping operator is ACESLegacyToneMapper.
|
||||
*
|
||||
* The specified tone mapper must have a lifecycle that exceeds the lifetime of
|
||||
* this builder. Since the build(Engine&) method is synchronous, it is safe to
|
||||
* delete the tone mapper object after that finishes executing.
|
||||
*
|
||||
* @param toneMapper The tone mapping operator to apply to the HDR color buffer
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& toneMapper(const ToneMapper* toneMapper) noexcept;
|
||||
|
||||
/**
|
||||
* Selects the tone mapping operator to apply to the HDR color buffer as the last
|
||||
* operation of the color grading post-processing step.
|
||||
*
|
||||
* The default tone mapping operator is ACES_LEGACY.
|
||||
*
|
||||
* @param toneMapping The tone mapping operator to apply to the HDR color buffer
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*
|
||||
* @deprecated Use toneMapper(ToneMapper*) instead
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& toneMapping(ToneMapping toneMapping) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables the luminance scaling component (LICH) from the exposure value
|
||||
* invariant luminance system (EVILS). When this setting is enabled, pixels with high
|
||||
* chromatic values will roll-off to white to offer a more natural rendering. This step
|
||||
* also helps avoid undesirable hue skews caused by out of gamut colors clipped
|
||||
* to the destination color gamut.
|
||||
*
|
||||
* When luminance scaling is enabled, tone mapping is performed on the luminance of each
|
||||
* pixel instead of per-channel.
|
||||
*
|
||||
* @param luminanceScaling Enables or disables luminance scaling post-tone mapping
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& luminanceScaling(bool luminanceScaling) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables gamut mapping to the destination color space's gamut. When gamut
|
||||
* mapping is turned off, out-of-gamut colors are clipped to the destination's gamut,
|
||||
* which may produce hue skews (blue skewing to purple, green to yellow, etc.). When
|
||||
* gamut mapping is enabled, out-of-gamut colors are brought back in gamut by trying to
|
||||
* preserve the perceived chroma and lightness of the original values.
|
||||
*
|
||||
* @param gamutMapping Enables or disables gamut mapping
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& gamutMapping(bool gamutMapping) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the exposure of this image. The exposure is specified in stops:
|
||||
* each stop brightens (positive values) or darkens (negative values) the image by
|
||||
* a factor of 2. This means that an exposure of 3 will brighten the image 8 times
|
||||
* more than an exposure of 0 (2^3 = 8 and 2^0 = 1). Contrary to the camera's exposure,
|
||||
* this setting is applied after all post-processing (bloom, etc.) are applied.
|
||||
*
|
||||
* @param exposure Value in EV stops. Can be negative, 0, or positive.
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& exposure(float exposure) noexcept;
|
||||
|
||||
/**
|
||||
* Controls the amount of night adaptation to replicate a more natural representation of
|
||||
* low-light conditions as perceived by the human vision system. In low-light conditions,
|
||||
* peak luminance sensitivity of the eye shifts toward the blue end of the color spectrum:
|
||||
* darker tones appear brighter, reducing contrast, and colors are blue shifted (the darker
|
||||
* the more intense the effect).
|
||||
*
|
||||
* @param adaptation Amount of adaptation, between 0 (no adaptation) and 1 (full adaptation).
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& nightAdaptation(float adaptation) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the while balance of the image. This can be used to remove color casts
|
||||
* and correct the appearance of the white point in the scene, or to alter the
|
||||
* overall chromaticity of the image for artistic reasons (to make the image appear
|
||||
* cooler or warmer for instance).
|
||||
*
|
||||
* The while balance adjustment is defined with two values:
|
||||
* - Temperature, to modify the color temperature. This value will modify the colors
|
||||
* on a blue/yellow axis. Lower values apply a cool color temperature, and higher
|
||||
* values apply a warm color temperature. The lowest value, -1.0f, is equivalent to
|
||||
* a temperature of 50,000K. The highest value, 1.0f, is equivalent to a temperature
|
||||
* of 2,000K.
|
||||
* - Tint, to modify the colors on a green/magenta axis. The lowest value, -1.0f, will
|
||||
* apply a strong green cast, and the highest value, 1.0f, will apply a strong magenta
|
||||
* cast.
|
||||
*
|
||||
* Both values are expected to be in the range [-1.0..+1.0]. Values outside of that
|
||||
* range will be clipped to that range.
|
||||
*
|
||||
* @param temperature Modification on the blue/yellow axis, as a value between -1.0 and +1.0.
|
||||
* @param tint Modification on the green/magenta axis, as a value between -1.0 and +1.0.
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& whiteBalance(float temperature, float tint) noexcept;
|
||||
|
||||
/**
|
||||
* The channel mixer adjustment modifies each output color channel using the specified
|
||||
* mix of the source color channels.
|
||||
*
|
||||
* By default each output color channel is set to use 100% of the corresponding source
|
||||
* channel and 0% of the other channels. For instance, the output red channel is set to
|
||||
* {1.0, 0.0, 1.0} or 100% red, 0% green and 0% blue.
|
||||
*
|
||||
* Each output channel can add or subtract data from the source channel by using values
|
||||
* in the range [-2.0..+2.0]. Values outside of that range will be clipped to that range.
|
||||
*
|
||||
* Using the channel mixer adjustment you can for instance create a monochrome output
|
||||
* by setting all 3 output channels to the same mix. For instance: {0.4, 0.4, 0.2} for
|
||||
* all 3 output channels(40% red, 40% green and 20% blue).
|
||||
*
|
||||
* More complex mixes can be used to create more complex effects. For instance, here is
|
||||
* a mix that creates a sepia tone effect:
|
||||
* - outRed = {0.255, 0.858, 0.087}
|
||||
* - outGreen = {0.213, 0.715, 0.072}
|
||||
* - outBlue = {0.170, 0.572, 0.058}
|
||||
*
|
||||
* @param outRed The mix of source RGB for the output red channel, between -2.0 and +2.0
|
||||
* @param outGreen The mix of source RGB for the output green channel, between -2.0 and +2.0
|
||||
* @param outBlue The mix of source RGB for the output blue channel, between -2.0 and +2.0
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& channelMixer(
|
||||
math::float3 outRed, math::float3 outGreen, math::float3 outBlue) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the colors separately in 3 distinct tonal ranges or zones: shadows, mid-tones,
|
||||
* and highlights.
|
||||
*
|
||||
* The tonal zones are by the ranges parameter: the x and y components define the beginning
|
||||
* and end of the transition from shadows to mid-tones, and the z and w components define
|
||||
* the beginning and end of the transition from mid-tones to highlights.
|
||||
*
|
||||
* A smooth transition is applied between the zones which means for instance that the
|
||||
* correction color of the shadows range will partially apply to the mid-tones, and the
|
||||
* other way around. This ensure smooth visual transitions in the final image.
|
||||
*
|
||||
* Each correction color is defined as a linear RGB color and a weight. The weight is a
|
||||
* value (which may be positive or negative) that is added to the linear RGB color before
|
||||
* mixing. This can be used to darken or brighten the selected tonal range.
|
||||
*
|
||||
* Shadows/mid-tones/highlights adjustment are performed linear space.
|
||||
*
|
||||
* @param shadows Linear RGB color (.rgb) and weight (.w) to apply to the shadows
|
||||
* @param midtones Linear RGB color (.rgb) and weight (.w) to apply to the mid-tones
|
||||
* @param highlights Linear RGB color (.rgb) and weight (.w) to apply to the highlights
|
||||
* @param ranges Range of the shadows (x and y), and range of the highlights (z and w)
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& shadowsMidtonesHighlights(
|
||||
math::float4 shadows, math::float4 midtones, math::float4 highlights,
|
||||
math::float4 ranges) noexcept;
|
||||
|
||||
/**
|
||||
* Applies a slope, offset, and power, as defined by the ASC CDL (American Society of
|
||||
* Cinematographers Color Decision List) to the image. The CDL can be used to adjust the
|
||||
* colors of different tonal ranges in the image.
|
||||
*
|
||||
* The ASC CDL is similar to the lift/gamma/gain controls found in many color grading tools.
|
||||
* Lift is equivalent to a combination of offset and slope, gain is equivalent to slope,
|
||||
* and gamma is equivalent to power.
|
||||
*
|
||||
* The slope and power values must be strictly positive. Values less than or equal to 0 will
|
||||
* be clamped to a small positive value, offset can be any positive or negative value.
|
||||
*
|
||||
* Version 1.2 of the ASC CDL adds saturation control, which is here provided as a separate
|
||||
* API. See the saturation() method for more information.
|
||||
*
|
||||
* Slope/offset/power adjustments are performed in log space.
|
||||
*
|
||||
* @param slope Multiplier of the input color, must be a strictly positive number
|
||||
* @param offset Added to the input color, can be a negative or positive number, including 0
|
||||
* @param power Power exponent of the input color, must be a strictly positive number
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& slopeOffsetPower(math::float3 slope, math::float3 offset, math::float3 power) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the contrast of the image. Lower values decrease the contrast of the image
|
||||
* (the tonal range is narrowed), and higher values increase the contrast of the image
|
||||
* (the tonal range is widened). A value of 1.0 has no effect.
|
||||
*
|
||||
* The contrast is defined as a value in the range [0.0...2.0]. Values outside of that
|
||||
* range will be clipped to that range.
|
||||
*
|
||||
* Contrast adjustment is performed in log space.
|
||||
*
|
||||
* @param contrast Contrast expansion, between 0.0 and 2.0. 1.0 leaves contrast unaffected
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& contrast(float contrast) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the saturation of the image based on the input color's saturation level.
|
||||
* Colors with a high level of saturation are less affected than colors with low saturation
|
||||
* levels.
|
||||
*
|
||||
* Lower vibrance values decrease intensity of the colors present in the image, and
|
||||
* higher values increase the intensity of the colors in the image. A value of 1.0 has
|
||||
* no effect.
|
||||
*
|
||||
* The vibrance is defined as a value in the range [0.0...2.0]. Values outside of that
|
||||
* range will be clipped to that range.
|
||||
*
|
||||
* Vibrance adjustment is performed in linear space.
|
||||
*
|
||||
* @param vibrance Vibrance, between 0.0 and 2.0. 1.0 leaves vibrance unaffected
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& vibrance(float vibrance) noexcept;
|
||||
|
||||
/**
|
||||
* Adjusts the saturation of the image. Lower values decrease intensity of the colors
|
||||
* present in the image, and higher values increase the intensity of the colors in the
|
||||
* image. A value of 1.0 has no effect.
|
||||
*
|
||||
* The saturation is defined as a value in the range [0.0...2.0]. Values outside of that
|
||||
* range will be clipped to that range.
|
||||
*
|
||||
* Saturation adjustment is performed in linear space.
|
||||
*
|
||||
* @param saturation Saturation, between 0.0 and 2.0. 1.0 leaves saturation unaffected
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& saturation(float saturation) noexcept;
|
||||
|
||||
/**
|
||||
* Applies a curve to each RGB channel of the image. Each curve is defined by 3 values:
|
||||
* a gamma value applied to the shadows only, a mid-point indicating where shadows stop
|
||||
* and highlights start, and a scale factor for the highlights.
|
||||
*
|
||||
* The gamma and mid-point must be strictly positive values. If they are not, they will be
|
||||
* clamped to a small positive value. The scale can be any negative of positive value.
|
||||
*
|
||||
* Curves are applied in linear space.
|
||||
*
|
||||
* @param shadowGamma Power value to apply to the shadows, must be strictly positive
|
||||
* @param midPoint Mid-point defining where shadows stop and highlights start, must be strictly positive
|
||||
* @param highlightScale Scale factor for the highlights, can be any negative or positive value
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& curves(math::float3 shadowGamma, math::float3 midPoint, math::float3 highlightScale) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the output color space for this ColorGrading object. After all color grading steps
|
||||
* have been applied, the final color will be converted in the desired color space.
|
||||
*
|
||||
* NOTE: Currently the output color space must be one of Rec709-sRGB-D65 or
|
||||
* Rec709-Linear-D65. Only the transfer function is taken into account.
|
||||
*
|
||||
* @param colorSpace The output color space.
|
||||
*
|
||||
* @return This Builder, for chaining calls
|
||||
*/
|
||||
Builder& outputColorSpace(const color::ColorSpace& colorSpace) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the ColorGrading object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this ColorGrading with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*/
|
||||
ColorGrading* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FColorGrading;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_COLORGRADING_H
|
||||
256
flutter_filament/windows/include/filament/filament/ColorSpace.h
Normal file
256
flutter_filament/windows/include/filament/filament/ColorSpace.h
Normal file
@@ -0,0 +1,256 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_COLOR_SPACE_H
|
||||
#define TNT_FILAMENT_COLOR_SPACE_H
|
||||
|
||||
#include <math/vec2.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
namespace filament::color {
|
||||
|
||||
using namespace math;
|
||||
|
||||
/**
|
||||
* Holds the chromaticities of a color space's primaries as xy coordinates
|
||||
* in xyY (Y is assumed to be 1).
|
||||
*/
|
||||
struct Primaries {
|
||||
float2 r;
|
||||
float2 g;
|
||||
float2 b;
|
||||
|
||||
bool operator==(const Primaries& rhs) const noexcept {
|
||||
return r == rhs.r && b == rhs.b && g == rhs.g;
|
||||
}
|
||||
};
|
||||
|
||||
//! Reference white for a color space, defined as the xy coordinates in the xyY space.
|
||||
using WhitePoint = float2;
|
||||
|
||||
/**
|
||||
* <p>Defines the parameters for the ICC parametric curve type 4, as
|
||||
* defined in ICC.1:2004-10, section 10.15.</p>
|
||||
*
|
||||
* <p>The EOTF is of the form:</p>
|
||||
*
|
||||
* \(\begin{equation}
|
||||
* Y = \begin{cases}c X + f & X \lt d \\\
|
||||
* \left( a X + b \right) ^{g} + e & X \ge d \end{cases}
|
||||
* \end{equation}\)
|
||||
*
|
||||
* <p>The corresponding OETF is simply the inverse function.</p>
|
||||
*
|
||||
* <p>The parameters defined by this class form a valid transfer
|
||||
* function only if all the following conditions are met:</p>
|
||||
* <ul>
|
||||
* <li>No parameter is a NaN</li>
|
||||
* <li>\(d\) is in the range \([0..1]\)</li>
|
||||
* <li>The function is not constant</li>
|
||||
* <li>The function is positive and increasing</li>
|
||||
* </ul>
|
||||
*/
|
||||
struct TransferFunction {
|
||||
/**
|
||||
* <p>Defines the parameters for the ICC parametric curve type 3, as
|
||||
* defined in ICC.1:2004-10, section 10.15.</p>
|
||||
*
|
||||
* <p>The EOTF is of the form:</p>
|
||||
*
|
||||
* \(\begin{equation}
|
||||
* Y = \begin{cases}c X & X \lt d \\\
|
||||
* \left( a X + b \right) ^{g} & X \ge d \end{cases}
|
||||
* \end{equation}\)
|
||||
*
|
||||
* <p>This constructor is equivalent to setting \(e\) and \(f\) to 0.</p>
|
||||
*
|
||||
* @param a The value of \(a\) in the equation of the EOTF described above
|
||||
* @param b The value of \(b\) in the equation of the EOTF described above
|
||||
* @param c The value of \(c\) in the equation of the EOTF described above
|
||||
* @param d The value of \(d\) in the equation of the EOTF described above
|
||||
* @param g The value of \(g\) in the equation of the EOTF described above
|
||||
*/
|
||||
constexpr TransferFunction(
|
||||
double a,
|
||||
double b,
|
||||
double c,
|
||||
double d,
|
||||
double e,
|
||||
double f,
|
||||
double g
|
||||
) : a(a),
|
||||
b(b),
|
||||
c(c),
|
||||
d(d),
|
||||
e(e),
|
||||
f(f),
|
||||
g(g) {
|
||||
}
|
||||
|
||||
constexpr TransferFunction(
|
||||
double a,
|
||||
double b,
|
||||
double c,
|
||||
double d,
|
||||
double g
|
||||
) : TransferFunction(a, b, c, d, 0.0, 0.0, g) {
|
||||
}
|
||||
|
||||
bool operator==(const TransferFunction& rhs) const noexcept {
|
||||
return
|
||||
a == rhs.a &&
|
||||
b == rhs.b &&
|
||||
c == rhs.c &&
|
||||
d == rhs.d &&
|
||||
e == rhs.e &&
|
||||
f == rhs.f &&
|
||||
g == rhs.g;
|
||||
}
|
||||
|
||||
double a;
|
||||
double b;
|
||||
double c;
|
||||
double d;
|
||||
double e;
|
||||
double f;
|
||||
double g;
|
||||
};
|
||||
|
||||
/**
|
||||
* <p>A color space in Filament is always an RGB color space. A specific RGB color space
|
||||
* is defined by the following properties:</p>
|
||||
* <ul>
|
||||
* <li>Three chromaticities of the red, green and blue primaries, which
|
||||
* define the gamut of the color space.</li>
|
||||
* <li>A white point chromaticity that defines the stimulus to which
|
||||
* color space values are normalized (also just called "white").</li>
|
||||
* <li>An opto-electronic transfer function, also called opto-electronic
|
||||
* conversion function or often, and approximately, gamma function.</li>
|
||||
* <li>An electro-optical transfer function, also called electo-optical
|
||||
* conversion function or often, and approximately, gamma function.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <h3>Primaries and white point chromaticities</h3>
|
||||
* <p>In this implementation, the chromaticity of the primaries and the white
|
||||
* point of an RGB color space is defined in the CIE xyY color space. This
|
||||
* color space separates the chromaticity of a color, the x and y components,
|
||||
* and its luminance, the Y component. Since the primaries and the white
|
||||
* point have full brightness, the Y component is assumed to be 1 and only
|
||||
* the x and y components are needed to encode them.</p>
|
||||
*
|
||||
* <h3>Transfer functions</h3>
|
||||
* <p>A transfer function is a color component conversion function, defined as
|
||||
* a single variable, monotonic mathematical function. It is applied to each
|
||||
* individual component of a color. They are used to perform the mapping
|
||||
* between linear tristimulus values and non-linear electronic signal value.</p>
|
||||
* <p>The <em>opto-electronic transfer function</em> (OETF or OECF) encodes
|
||||
* tristimulus values in a scene to a non-linear electronic signal value.</p>
|
||||
*/
|
||||
class ColorSpace {
|
||||
public:
|
||||
constexpr ColorSpace(
|
||||
const Primaries primaries,
|
||||
const TransferFunction transferFunction,
|
||||
const WhitePoint whitePoint
|
||||
) : mPrimaries(primaries),
|
||||
mTransferFunction(transferFunction),
|
||||
mWhitePoint(whitePoint) {
|
||||
}
|
||||
|
||||
bool operator==(const ColorSpace& rhs) const noexcept {
|
||||
return mPrimaries == rhs.mPrimaries &&
|
||||
mTransferFunction == rhs.mTransferFunction &&
|
||||
mWhitePoint == rhs.mWhitePoint;
|
||||
}
|
||||
|
||||
constexpr const Primaries& getPrimaries() const { return mPrimaries; }
|
||||
constexpr const TransferFunction& getTransferFunction() const { return mTransferFunction; }
|
||||
constexpr const WhitePoint& getWhitePoint() const { return mWhitePoint; }
|
||||
|
||||
private:
|
||||
Primaries mPrimaries;
|
||||
TransferFunction mTransferFunction;
|
||||
WhitePoint mWhitePoint;
|
||||
};
|
||||
|
||||
/**
|
||||
* Intermediate class used when building a color space using the "-" syntax:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* // Declares a "linear sRGB" color space.
|
||||
* ColorSpace myColorSpace = Rec709-Linear-sRGB;
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
class PartialColorSpace {
|
||||
public:
|
||||
constexpr ColorSpace operator-(const WhitePoint& whitePoint) const {
|
||||
return { mPrimaries, mTransferFunction, whitePoint };
|
||||
}
|
||||
|
||||
private:
|
||||
constexpr PartialColorSpace(
|
||||
const Primaries primaries,
|
||||
const TransferFunction transferFunction
|
||||
) : mPrimaries(primaries),
|
||||
mTransferFunction(transferFunction) {
|
||||
}
|
||||
|
||||
Primaries mPrimaries;
|
||||
TransferFunction mTransferFunction;
|
||||
|
||||
friend class Gamut;
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines the chromaticities of the primaries for a color space. The chromaticities
|
||||
* are expressed as three pairs of xy coordinates (in xyY) for the red, green, and blue
|
||||
* chromaticities.
|
||||
*/
|
||||
class Gamut {
|
||||
public:
|
||||
constexpr explicit Gamut(const Primaries primaries) : mPrimaries(primaries) {
|
||||
}
|
||||
|
||||
constexpr Gamut(float2 r, float2 g, float2 b) : Gamut(Primaries{ r, g, b }) {
|
||||
}
|
||||
|
||||
constexpr PartialColorSpace operator-(const TransferFunction& transferFunction) const {
|
||||
return { mPrimaries, transferFunction };
|
||||
}
|
||||
|
||||
constexpr const Primaries& getPrimaries() const { return mPrimaries; }
|
||||
|
||||
private:
|
||||
Primaries mPrimaries;
|
||||
};
|
||||
|
||||
//! Rec.709 color gamut, used in the sRGB and DisplayP3 color spaces.
|
||||
constexpr Gamut Rec709 = {{ 0.640f, 0.330f },
|
||||
{ 0.300f, 0.600f },
|
||||
{ 0.150f, 0.060f }};
|
||||
|
||||
//! Linear transfer function.
|
||||
constexpr TransferFunction Linear = { 1.0, 0.0, 0.0, 0.0, 1.0 };
|
||||
|
||||
//! sRGB transfer function.
|
||||
constexpr TransferFunction sRGB = { 1.0 / 1.055, 0.055 / 1.055, 1.0 / 12.92, 0.04045, 2.4 };
|
||||
|
||||
//! Standard CIE 1931 2° illuminant D65. This illuminant has a color temperature of 6504K.
|
||||
constexpr WhitePoint D65 = { 0.31271f, 0.32902f };
|
||||
|
||||
} // namespace filament::color
|
||||
|
||||
#endif // TNT_FILAMENT_COLOR_SPACE_H
|
||||
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_DEBUGREGISTRY_H
|
||||
#define TNT_FILAMENT_DEBUGREGISTRY_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* A registry of runtime properties used exclusively for debugging
|
||||
*
|
||||
* Filament exposes a few properties that can be queried and set, which control certain debugging
|
||||
* features of the engine. These properties can be set at runtime at anytime.
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC DebugRegistry : public FilamentAPI {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Type of a property
|
||||
*/
|
||||
enum Type {
|
||||
BOOL, INT, FLOAT, FLOAT2, FLOAT3, FLOAT4
|
||||
};
|
||||
|
||||
/**
|
||||
* Information about a property
|
||||
*/
|
||||
struct Property {
|
||||
const char* name; //!< property name
|
||||
Type type; //!< property type
|
||||
};
|
||||
|
||||
/**
|
||||
* Queries whether a property exists
|
||||
* @param name The name of the property to query
|
||||
* @return true if the property exists, false otherwise
|
||||
*/
|
||||
bool hasProperty(const char* name) const noexcept;
|
||||
|
||||
/**
|
||||
* Queries the address of a property's data from its name
|
||||
* @param name Name of the property we want the data address of
|
||||
* @return Address of the data of the \p name property
|
||||
* @{
|
||||
*/
|
||||
void* getPropertyAddress(const char* name) noexcept;
|
||||
|
||||
template<typename T>
|
||||
inline T* getPropertyAddress(const char* name) noexcept {
|
||||
return static_cast<T*>(getPropertyAddress(name));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline bool getPropertyAddress(const char* name, T** p) noexcept {
|
||||
*p = getPropertyAddress<T>(name);
|
||||
return *p != nullptr;
|
||||
}
|
||||
/** @}*/
|
||||
|
||||
/**
|
||||
* Set the value of a property
|
||||
* @param name Name of the property to set the value of
|
||||
* @param v Value to set
|
||||
* @return true if the operation was successful, false otherwise.
|
||||
* @{
|
||||
*/
|
||||
bool setProperty(const char* name, bool v) noexcept;
|
||||
bool setProperty(const char* name, int v) noexcept;
|
||||
bool setProperty(const char* name, float v) noexcept;
|
||||
bool setProperty(const char* name, math::float2 v) noexcept;
|
||||
bool setProperty(const char* name, math::float3 v) noexcept;
|
||||
bool setProperty(const char* name, math::float4 v) noexcept;
|
||||
/** @}*/
|
||||
|
||||
/**
|
||||
* Get the value of a property
|
||||
* @param name Name of the property to get the value of
|
||||
* @param v A pointer to a variable which will hold the result
|
||||
* @return true if the call was successful and \p v was updated
|
||||
* @{
|
||||
*/
|
||||
bool getProperty(const char* name, bool* v) const noexcept;
|
||||
bool getProperty(const char* name, int* v) const noexcept;
|
||||
bool getProperty(const char* name, float* v) const noexcept;
|
||||
bool getProperty(const char* name, math::float2* v) const noexcept;
|
||||
bool getProperty(const char* name, math::float3* v) const noexcept;
|
||||
bool getProperty(const char* name, math::float4* v) const noexcept;
|
||||
/** @}*/
|
||||
|
||||
struct DataSource {
|
||||
void const* data;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
DataSource getDataSource(const char* name) const noexcept;
|
||||
|
||||
struct FrameHistory {
|
||||
using duration_ms = float;
|
||||
duration_ms target{};
|
||||
duration_ms targetWithHeadroom{};
|
||||
duration_ms frameTime{};
|
||||
duration_ms frameTimeDenoised{};
|
||||
float scale = 1.0f;
|
||||
float pid_e = 0.0f;
|
||||
float pid_i = 0.0f;
|
||||
float pid_d = 0.0f;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif /* TNT_FILAMENT_DEBUGREGISTRY_H */
|
||||
761
flutter_filament/windows/include/filament/filament/Engine.h
Normal file
761
flutter_filament/windows/include/filament/filament/Engine.h
Normal file
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_ENGINE_H
|
||||
#define TNT_FILAMENT_ENGINE_H
|
||||
|
||||
#include <backend/Platform.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
class EntityManager;
|
||||
class JobSystem;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class BufferObject;
|
||||
class Camera;
|
||||
class ColorGrading;
|
||||
class DebugRegistry;
|
||||
class Fence;
|
||||
class IndexBuffer;
|
||||
class SkinningBuffer;
|
||||
class IndirectLight;
|
||||
class Material;
|
||||
class MaterialInstance;
|
||||
class MorphTargetBuffer;
|
||||
class Renderer;
|
||||
class RenderTarget;
|
||||
class Scene;
|
||||
class Skybox;
|
||||
class Stream;
|
||||
class SwapChain;
|
||||
class Texture;
|
||||
class VertexBuffer;
|
||||
class View;
|
||||
|
||||
class LightManager;
|
||||
class RenderableManager;
|
||||
class TransformManager;
|
||||
|
||||
#ifndef FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB
|
||||
# define FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB 3
|
||||
#endif
|
||||
|
||||
#ifndef FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB
|
||||
# define FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB 2
|
||||
#endif
|
||||
|
||||
#ifndef FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB
|
||||
# define FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB 1
|
||||
#endif
|
||||
|
||||
#ifndef FILAMENT_COMMAND_BUFFER_SIZE_IN_MB
|
||||
# define FILAMENT_COMMAND_BUFFER_SIZE_IN_MB (FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB * 3)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Engine is filament's main entry-point.
|
||||
*
|
||||
* An Engine instance main function is to keep track of all resources created by the user and
|
||||
* manage the rendering thread as well as the hardware renderer.
|
||||
*
|
||||
* To use filament, an Engine instance must be created first:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Engine essentially represents (or is associated to) a hardware context
|
||||
* (e.g. an OpenGL ES context).
|
||||
*
|
||||
* Rendering typically happens in an operating system's window (which can be full screen), such
|
||||
* window is managed by a filament.Renderer.
|
||||
*
|
||||
* A typical filament render loop looks like this:
|
||||
*
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Engine.h>
|
||||
* #include <filament/Renderer.h>
|
||||
* #include <filament/Scene.h>
|
||||
* #include <filament/View.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
* SwapChain* swapChain = engine->createSwapChain(nativeWindow);
|
||||
* Renderer* renderer = engine->createRenderer();
|
||||
* Scene* scene = engine->createScene();
|
||||
* View* view = engine->createView();
|
||||
*
|
||||
* view->setScene(scene);
|
||||
*
|
||||
* do {
|
||||
* // typically we wait for VSYNC and user input events
|
||||
* if (renderer->beginFrame(swapChain)) {
|
||||
* renderer->render(view);
|
||||
* renderer->endFrame();
|
||||
* }
|
||||
* } while (!quit);
|
||||
*
|
||||
* engine->destroy(view);
|
||||
* engine->destroy(scene);
|
||||
* engine->destroy(renderer);
|
||||
* engine->destroy(swapChain);
|
||||
* Engine::destroy(&engine); // clears engine*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Resource Tracking
|
||||
* =================
|
||||
*
|
||||
* Each Engine instance keeps track of all objects created by the user, such as vertex and index
|
||||
* buffers, lights, cameras, etc...
|
||||
* The user is expected to free those resources, however, leaked resources are freed when the
|
||||
* engine instance is destroyed and a warning is emitted in the console.
|
||||
*
|
||||
* Thread safety
|
||||
* =============
|
||||
*
|
||||
* An Engine instance is not thread-safe. The implementation makes no attempt to synchronize
|
||||
* calls to an Engine instance methods.
|
||||
* If multi-threading is needed, synchronization must be external.
|
||||
*
|
||||
* Multi-threading
|
||||
* ===============
|
||||
*
|
||||
* When created, the Engine instance starts a render thread as well as multiple worker threads,
|
||||
* these threads have an elevated priority appropriate for rendering, based on the platform's
|
||||
* best practices. The number of worker threads depends on the platform and is automatically
|
||||
* chosen for best performance.
|
||||
*
|
||||
* On platforms with asymmetric cores (e.g. ARM's Big.Little), Engine makes some educated guesses
|
||||
* as to which cores to use for the render thread and worker threads. For example, it'll try to
|
||||
* keep an OpenGL ES thread on a Big core.
|
||||
*
|
||||
* Swap Chains
|
||||
* ===========
|
||||
*
|
||||
* A swap chain represents an Operating System's *native* renderable surface. Typically it's a window
|
||||
* or a view. Because a SwapChain is initialized from a native object, it is given to filament
|
||||
* as a `void*`, which must be of the proper type for each platform filament is running on.
|
||||
*
|
||||
* @see SwapChain
|
||||
*
|
||||
*
|
||||
* @see Renderer
|
||||
*/
|
||||
class UTILS_PUBLIC Engine {
|
||||
public:
|
||||
using Platform = backend::Platform;
|
||||
using Backend = backend::Backend;
|
||||
using DriverConfig = backend::Platform::DriverConfig;
|
||||
|
||||
/**
|
||||
* Config is used to define the memory footprint used by the engine, such as the
|
||||
* command buffer size. Config can be used to customize engine requirements based
|
||||
* on the applications needs.
|
||||
*
|
||||
* .perRenderPassArenaSizeMB (default: 3 MiB)
|
||||
* +--------------------------+
|
||||
* | |
|
||||
* | .perFrameCommandsSizeMB |
|
||||
* | (default 2 MiB) |
|
||||
* | |
|
||||
* +--------------------------+
|
||||
* | (froxel, etc...) |
|
||||
* +--------------------------+
|
||||
*
|
||||
*
|
||||
* .commandBufferSizeMB (default 3MiB)
|
||||
* +--------------------------+
|
||||
* | .minCommandBufferSizeMB |
|
||||
* +--------------------------+
|
||||
* | .minCommandBufferSizeMB |
|
||||
* +--------------------------+
|
||||
* | .minCommandBufferSizeMB |
|
||||
* +--------------------------+
|
||||
* : :
|
||||
* : :
|
||||
*
|
||||
*/
|
||||
struct Config {
|
||||
/**
|
||||
* Size in MiB of the low-level command buffer arena.
|
||||
*
|
||||
* Each new command buffer is allocated from here. If this buffer is too small the program
|
||||
* might terminate or rendering errors might occur.
|
||||
*
|
||||
* This is typically set to minCommandBufferSizeMB * 3, so that up to 3 frames can be
|
||||
* batched-up at once.
|
||||
*
|
||||
* This value affects the application's memory usage.
|
||||
*/
|
||||
uint32_t commandBufferSizeMB = FILAMENT_COMMAND_BUFFER_SIZE_IN_MB;
|
||||
|
||||
|
||||
/**
|
||||
* Size in MiB of the per-frame data arena.
|
||||
*
|
||||
* This is the main arena used for allocations when preparing a frame.
|
||||
* e.g.: Froxel data and high-level commands are allocated from this arena.
|
||||
*
|
||||
* If this size is too small, the program will abort on debug builds and have undefined
|
||||
* behavior otherwise.
|
||||
*
|
||||
* This value affects the application's memory usage.
|
||||
*/
|
||||
uint32_t perRenderPassArenaSizeMB = FILAMENT_PER_RENDER_PASS_ARENA_SIZE_IN_MB;
|
||||
|
||||
|
||||
/**
|
||||
* Size in MiB of the backend's handle arena.
|
||||
*
|
||||
* Backends will fallback to slower heap-based allocations when running out of space and
|
||||
* log this condition.
|
||||
*
|
||||
* If 0, then the default value for the given platform is used
|
||||
*
|
||||
* This value affects the application's memory usage.
|
||||
*/
|
||||
uint32_t driverHandleArenaSizeMB = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Minimum size in MiB of a low-level command buffer.
|
||||
*
|
||||
* This is how much space is guaranteed to be available for low-level commands when a new
|
||||
* buffer is allocated. If this is too small, the engine might have to stall to wait for
|
||||
* more space to become available, this situation is logged.
|
||||
*
|
||||
* This value does not affect the application's memory usage.
|
||||
*/
|
||||
uint32_t minCommandBufferSizeMB = FILAMENT_MIN_COMMAND_BUFFERS_SIZE_IN_MB;
|
||||
|
||||
|
||||
/**
|
||||
* Size in MiB of the per-frame high level command buffer.
|
||||
*
|
||||
* This buffer is related to the number of draw calls achievable within a frame, if it is
|
||||
* too small, the program will abort on debug builds and have undefined behavior otherwise.
|
||||
*
|
||||
* It is allocated from the 'per-render-pass arena' above. Make sure that at least 1 MiB is
|
||||
* left in the per-render-pass arena when deciding the size of this buffer.
|
||||
*
|
||||
* This value does not affect the application's memory usage.
|
||||
*/
|
||||
uint32_t perFrameCommandsSizeMB = FILAMENT_PER_FRAME_COMMANDS_SIZE_IN_MB;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an instance of Engine
|
||||
*
|
||||
* @param backend Which driver backend to use.
|
||||
*
|
||||
* @param platform A pointer to an object that implements Platform. If this is
|
||||
* provided, then this object is used to create the hardware context
|
||||
* and expose platform features to it.
|
||||
*
|
||||
* If not provided (or nullptr is used), an appropriate Platform
|
||||
* is created automatically.
|
||||
*
|
||||
* All methods of this interface are called from filament's
|
||||
* render thread, which is different from the main thread.
|
||||
*
|
||||
* The lifetime of \p platform must exceed the lifetime of
|
||||
* the Engine object.
|
||||
*
|
||||
* @param sharedGLContext A platform-dependant OpenGL context used as a shared context
|
||||
* when creating filament's internal context.
|
||||
* Setting this parameter will force filament to use the OpenGL
|
||||
* implementation (instead of Vulkan for instance).
|
||||
*
|
||||
* @param config A pointer to optional parameters to specify memory size
|
||||
* configuration options. If nullptr, then defaults used.
|
||||
*
|
||||
* @return A pointer to the newly created Engine, or nullptr if the Engine couldn't be created.
|
||||
*
|
||||
* nullptr if the GPU driver couldn't be initialized, for instance if it doesn't
|
||||
* support the right version of OpenGL or OpenGL ES.
|
||||
*
|
||||
* @exception utils::PostConditionPanic can be thrown if there isn't enough memory to
|
||||
* allocate the command buffer. If exceptions are disabled, this condition if fatal and
|
||||
* this function will abort.
|
||||
*
|
||||
* \remark
|
||||
* This method is thread-safe.
|
||||
*/
|
||||
static Engine* create(Backend backend = Backend::DEFAULT,
|
||||
Platform* platform = nullptr, void* sharedGLContext = nullptr,
|
||||
const Config* config = nullptr);
|
||||
|
||||
#if UTILS_HAS_THREADING
|
||||
/**
|
||||
* A callback used with Engine::createAsync() called once the engine is initialized and it is
|
||||
* safe to call Engine::getEngine(token). This callback is invoked from an arbitrary worker
|
||||
* thread. Engine::getEngine() CANNOT be called from that thread, instead it must be called
|
||||
* from the same thread than Engine::createAsync() was called from.
|
||||
*
|
||||
* @param user User provided parameter given in createAsync().
|
||||
*
|
||||
* @param token An opaque token used to call Engine::getEngine().
|
||||
*/
|
||||
using CreateCallback = void(void* user, void* token);
|
||||
|
||||
/**
|
||||
* Creates an instance of Engine asynchronously
|
||||
*
|
||||
* @param callback Callback called once the engine is initialized and it is safe to
|
||||
* call Engine::getEngine.
|
||||
*
|
||||
* @param user A user provided pointer that is given back to callback unmodified.
|
||||
*
|
||||
* @param backend Which driver backend to use.
|
||||
*
|
||||
* @param platform A pointer to an object that implements Platform. If this is
|
||||
* provided, then this object is used to create the hardware context
|
||||
* and expose platform features to it.
|
||||
*
|
||||
* If not provided (or nullptr is used), an appropriate Platform
|
||||
* is created automatically.
|
||||
*
|
||||
* All methods of this interface are called from filament's
|
||||
* render thread, which is different from the main thread.
|
||||
*
|
||||
* The lifetime of \p platform must exceed the lifetime of
|
||||
* the Engine object.
|
||||
*
|
||||
* @param sharedGLContext A platform-dependant OpenGL context used as a shared context
|
||||
* when creating filament's internal context.
|
||||
* Setting this parameter will force filament to use the OpenGL
|
||||
* implementation (instead of Vulkan for instance).
|
||||
*
|
||||
* @param config A pointer to optional parameters to specify memory size
|
||||
* configuration options
|
||||
*/
|
||||
static void createAsync(CreateCallback callback, void* user,
|
||||
Backend backend = Backend::DEFAULT,
|
||||
Platform* platform = nullptr, void* sharedGLContext = nullptr,
|
||||
const Config* config = nullptr);
|
||||
|
||||
/**
|
||||
* Retrieve an Engine* from createAsync(). This must be called from the same thread than
|
||||
* Engine::createAsync() was called from.
|
||||
*
|
||||
* @param token An opaque token given in the createAsync() callback function.
|
||||
*
|
||||
* @return A pointer to the newly created Engine, or nullptr if the Engine couldn't be created.
|
||||
*
|
||||
* @exception utils::PostConditionPanic can be thrown if there isn't enough memory to
|
||||
* allocate the command buffer. If exceptions are disabled, this condition if fatal and
|
||||
* this function will abort.
|
||||
*/
|
||||
static Engine* getEngine(void* token);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Destroy the Engine instance and all associated resources.
|
||||
*
|
||||
* Engine.destroy() should be called last and after all other resources have been destroyed,
|
||||
* it ensures all filament resources are freed.
|
||||
*
|
||||
* Destroy performs the following tasks:
|
||||
* 1. Destroy all internal software and hardware resources.
|
||||
* 2. Free all user allocated resources that are not already destroyed and logs a warning.
|
||||
* This indicates a "leak" in the user's code.
|
||||
* 3. Terminate the rendering engine's thread.
|
||||
*
|
||||
* @param engine A pointer to the filament.Engine* to be destroyed.
|
||||
* \p engine is cleared upon return.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
* Engine::destroy(&engine); // clears engine*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* \remark
|
||||
* This method is thread-safe.
|
||||
*/
|
||||
static void destroy(Engine** engine);
|
||||
|
||||
/**
|
||||
* Destroy the Engine instance and all associated resources.
|
||||
*
|
||||
* Engine.destroy() should be called last and after all other resources have been destroyed,
|
||||
* it ensures all filament resources are freed.
|
||||
*
|
||||
* Destroy performs the following tasks:
|
||||
* 1. Destroy all internal software and hardware resources.
|
||||
* 2. Free all user allocated resources that are not already destroyed and logs a warning.
|
||||
* This indicates a "leak" in the user's code.
|
||||
* 3. Terminate the rendering engine's thread.
|
||||
*
|
||||
* @param engine A pointer to the filament.Engine to be destroyed.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
* Engine::destroy(engine);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* \remark
|
||||
* This method is thread-safe.
|
||||
*/
|
||||
static void destroy(Engine* engine);
|
||||
|
||||
using FeatureLevel = backend::FeatureLevel;
|
||||
|
||||
|
||||
/**
|
||||
* Query the feature level supported by the selected backend.
|
||||
*
|
||||
* A specific feature level needs to be set before the corresponding features can be used.
|
||||
*
|
||||
* @return FeatureLevel supported the selected backend.
|
||||
* @see setActiveFeatureLevel
|
||||
*/
|
||||
FeatureLevel getSupportedFeatureLevel() const noexcept;
|
||||
|
||||
/**
|
||||
* Activate all features of a given feature level. By default FeatureLevel::FEATURE_LEVEL_1 is
|
||||
* active. The selected feature level must not be higher than the value returned by
|
||||
* getActiveFeatureLevel() and it's not possible lower the active feature level.
|
||||
*
|
||||
* @param featureLevel the feature level to activate. If featureLevel is lower than
|
||||
* getActiveFeatureLevel(), the current (higher) feature level is kept.
|
||||
* If featureLevel is higher than getSupportedFeatureLevel(), an exception
|
||||
* is thrown, or the program is terminated if exceptions are disabled.
|
||||
*
|
||||
* @return the active feature level.
|
||||
*
|
||||
* @see getSupportedFeatureLevel
|
||||
* @see getActiveFeatureLevel
|
||||
*/
|
||||
FeatureLevel setActiveFeatureLevel(FeatureLevel featureLevel);
|
||||
|
||||
/**
|
||||
* Returns the currently active feature level.
|
||||
* @return currently active feature level
|
||||
* @see getSupportedFeatureLevel
|
||||
* @see setActiveFeatureLevel
|
||||
*/
|
||||
FeatureLevel getActiveFeatureLevel() const noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* @return EntityManager used by filament
|
||||
*/
|
||||
utils::EntityManager& getEntityManager() noexcept;
|
||||
|
||||
/**
|
||||
* @return RenderableManager reference
|
||||
*/
|
||||
RenderableManager& getRenderableManager() noexcept;
|
||||
|
||||
/**
|
||||
* @return LightManager reference
|
||||
*/
|
||||
LightManager& getLightManager() noexcept;
|
||||
|
||||
/**
|
||||
* @return TransformManager reference
|
||||
*/
|
||||
TransformManager& getTransformManager() noexcept;
|
||||
|
||||
/**
|
||||
* Helper to enable accurate translations.
|
||||
* If you need this Engine to handle a very large world space, one way to achieve this
|
||||
* automatically is to enable accurate translations in the TransformManager. This helper
|
||||
* provides a convenient way of doing that.
|
||||
* This is typically called once just after creating the Engine.
|
||||
*/
|
||||
void enableAccurateTranslations() noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables automatic instancing of render primitives. Instancing of render
|
||||
* primitives can greatly reduce CPU overhead but requires the instanced primitives to be
|
||||
* identical (i.e. use the same geometry) and use the same MaterialInstance. If it is known
|
||||
* that the scene doesn't contain any identical primitives, automatic instancing can have some
|
||||
* overhead and it is then best to disable it.
|
||||
*
|
||||
* Disabled by default.
|
||||
*
|
||||
* @param enable true to enable, false to disable automatic instancing.
|
||||
*
|
||||
* @see RenderableManager
|
||||
* @see MaterialInstance
|
||||
*/
|
||||
void setAutomaticInstancingEnabled(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* @return true if automatic instancing is enabled, false otherwise.
|
||||
* @see setAutomaticInstancingEnabled
|
||||
*/
|
||||
bool isAutomaticInstancingEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Creates a SwapChain from the given Operating System's native window handle.
|
||||
*
|
||||
* @param nativeWindow An opaque native window handle. e.g.: on Android this is an
|
||||
* `ANativeWindow*`.
|
||||
* @param flags One or more configuration flags as defined in `SwapChain`.
|
||||
*
|
||||
* @return A pointer to the newly created SwapChain or nullptr if it couldn't be created.
|
||||
*
|
||||
* @see Renderer.beginFrame()
|
||||
*/
|
||||
SwapChain* createSwapChain(void* nativeWindow, uint64_t flags = 0) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a headless SwapChain.
|
||||
*
|
||||
* @param width Width of the drawing buffer in pixels.
|
||||
* @param height Height of the drawing buffer in pixels.
|
||||
* @param flags One or more configuration flags as defined in `SwapChain`.
|
||||
*
|
||||
* @return A pointer to the newly created SwapChain or nullptr if it couldn't be created.
|
||||
*
|
||||
* @see Renderer.beginFrame()
|
||||
*/
|
||||
SwapChain* createSwapChain(uint32_t width, uint32_t height, uint64_t flags = 0) noexcept;
|
||||
|
||||
/**
|
||||
* Creates a renderer associated to this engine.
|
||||
*
|
||||
* A Renderer is intended to map to a *window* on screen.
|
||||
*
|
||||
* @return A pointer to the newly created Renderer or nullptr if it couldn't be created.
|
||||
*/
|
||||
Renderer* createRenderer() noexcept;
|
||||
|
||||
/**
|
||||
* Creates a View.
|
||||
*
|
||||
* @return A pointer to the newly created View or nullptr if it couldn't be created.
|
||||
*/
|
||||
View* createView() noexcept;
|
||||
|
||||
/**
|
||||
* Creates a Scene.
|
||||
*
|
||||
* @return A pointer to the newly created Scene or nullptr if it couldn't be created.
|
||||
*/
|
||||
Scene* createScene() noexcept;
|
||||
|
||||
/**
|
||||
* Creates a Camera component.
|
||||
*
|
||||
* @param entity Entity to add the camera component to.
|
||||
* @return A pointer to the newly created Camera or nullptr if it couldn't be created.
|
||||
*/
|
||||
Camera* createCamera(utils::Entity entity) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Camera component of the given entity.
|
||||
*
|
||||
* @param entity An entity.
|
||||
* @return A pointer to the Camera component for this entity or nullptr if the entity didn't
|
||||
* have a Camera component. The pointer is valid until destroyCameraComponent()
|
||||
* is called or the entity itself is destroyed.
|
||||
*/
|
||||
Camera* getCameraComponent(utils::Entity entity) noexcept;
|
||||
|
||||
/**
|
||||
* Destroys the Camera component associated with the given entity.
|
||||
*
|
||||
* @param entity An entity.
|
||||
*/
|
||||
void destroyCameraComponent(utils::Entity entity) noexcept;
|
||||
|
||||
/**
|
||||
* Creates a Fence.
|
||||
*
|
||||
* @return A pointer to the newly created Fence or nullptr if it couldn't be created.
|
||||
*/
|
||||
Fence* createFence() noexcept;
|
||||
|
||||
bool destroy(const BufferObject* p); //!< Destroys a BufferObject object.
|
||||
bool destroy(const VertexBuffer* p); //!< Destroys an VertexBuffer object.
|
||||
bool destroy(const Fence* p); //!< Destroys a Fence object.
|
||||
bool destroy(const IndexBuffer* p); //!< Destroys an IndexBuffer object.
|
||||
bool destroy(const SkinningBuffer* p); //!< Destroys a SkinningBuffer object.
|
||||
bool destroy(const MorphTargetBuffer* p); //!< Destroys a MorphTargetBuffer object.
|
||||
bool destroy(const IndirectLight* p); //!< Destroys an IndirectLight object.
|
||||
|
||||
/**
|
||||
* Destroys a Material object
|
||||
* @param p the material object to destroy
|
||||
* @attention All MaterialInstance of the specified material must be destroyed before
|
||||
* destroying it.
|
||||
* @exception utils::PreConditionPanic is thrown if some MaterialInstances remain.
|
||||
* no-op if exceptions are disabled and some MaterialInstances remain.
|
||||
*/
|
||||
bool destroy(const Material* p);
|
||||
bool destroy(const MaterialInstance* p); //!< Destroys a MaterialInstance object.
|
||||
bool destroy(const Renderer* p); //!< Destroys a Renderer object.
|
||||
bool destroy(const Scene* p); //!< Destroys a Scene object.
|
||||
bool destroy(const Skybox* p); //!< Destroys a SkyBox object.
|
||||
bool destroy(const ColorGrading* p); //!< Destroys a ColorGrading object.
|
||||
bool destroy(const SwapChain* p); //!< Destroys a SwapChain object.
|
||||
bool destroy(const Stream* p); //!< Destroys a Stream object.
|
||||
bool destroy(const Texture* p); //!< Destroys a Texture object.
|
||||
bool destroy(const RenderTarget* p); //!< Destroys a RenderTarget object.
|
||||
bool destroy(const View* p); //!< Destroys a View object.
|
||||
void destroy(utils::Entity e); //!< Destroys all filament-known components from this entity
|
||||
|
||||
/**
|
||||
* Kicks the hardware thread (e.g. the OpenGL, Vulkan or Metal thread) and blocks until
|
||||
* all commands to this point are executed. Note that does guarantee that the
|
||||
* hardware is actually finished.
|
||||
*
|
||||
* <p>This is typically used right after destroying the <code>SwapChain</code>,
|
||||
* in cases where a guarantee about the <code>SwapChain</code> destruction is needed in a
|
||||
* timely fashion, such as when responding to Android's
|
||||
* <code>android.view.SurfaceHolder.Callback.surfaceDestroyed</code></p>
|
||||
*/
|
||||
void flushAndWait();
|
||||
|
||||
/**
|
||||
* Kicks the hardware thread (e.g. the OpenGL, Vulkan or Metal thread) but does not wait
|
||||
* for commands to be either executed or the hardware finished.
|
||||
*
|
||||
* <p>This is typically used after creating a lot of objects to start draining the command
|
||||
* queue which has a limited size.</p>
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/**
|
||||
* Drains the user callback message queue and immediately execute all pending callbacks.
|
||||
*
|
||||
* <p> Typically this should be called once per frame right after the application's vsync tick,
|
||||
* and typically just before computing parameters (e.g. object positions) for the next frame.
|
||||
* This is useful because otherwise callbacks will be executed by filament at a later time,
|
||||
* which may increase latency in certain applications.</p>
|
||||
*/
|
||||
void pumpMessageQueues();
|
||||
|
||||
/**
|
||||
* Returns the default Material.
|
||||
*
|
||||
* The default material is 80% white and uses the Material.Shading.LIT shading.
|
||||
*
|
||||
* @return A pointer to the default Material instance (a singleton).
|
||||
*/
|
||||
const Material* getDefaultMaterial() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the resolved backend.
|
||||
*/
|
||||
Backend getBackend() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Platform object that belongs to this Engine.
|
||||
*
|
||||
* When Engine::create is called with no platform argument, Filament creates an appropriate
|
||||
* Platform subclass automatically. The specific subclass created depends on the backend and
|
||||
* OS. For example, when the OpenGL backend is used, the Platform object will be a descendant of
|
||||
* OpenGLPlatform.
|
||||
*
|
||||
* dynamic_cast should be used to cast the returned Platform object into a specific subclass.
|
||||
* Note that RTTI must be available to use dynamic_cast.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Platform* platform = engine->getPlatform();
|
||||
* // static_cast also works, but more dangerous.
|
||||
* SpecificPlatform* specificPlatform = dynamic_cast<SpecificPlatform*>(platform);
|
||||
* specificPlatform->platformSpecificMethod();
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* When a custom Platform is passed to Engine::create, Filament will use it instead, and this
|
||||
* method will return it.
|
||||
*
|
||||
* @return A pointer to the Platform object that was provided to Engine::create, or the
|
||||
* Filament-created one.
|
||||
*/
|
||||
Platform* getPlatform() const noexcept;
|
||||
|
||||
/**
|
||||
* Allocate a small amount of memory directly in the command stream. The allocated memory is
|
||||
* guaranteed to be preserved until the current command buffer is executed
|
||||
*
|
||||
* @param size size to allocate in bytes. This should be small (e.g. < 1 KB)
|
||||
* @param alignment alignment requested
|
||||
* @return a pointer to the allocated buffer or nullptr if no memory was available.
|
||||
*
|
||||
* @note there is no need to destroy this buffer, it will be freed automatically when
|
||||
* the current command buffer is executed.
|
||||
*/
|
||||
void* streamAlloc(size_t size, size_t alignment = alignof(double)) noexcept;
|
||||
|
||||
/**
|
||||
* Invokes one iteration of the render loop, used only on single-threaded platforms.
|
||||
*
|
||||
* This should be called every time the windowing system needs to paint (e.g. at 60 Hz).
|
||||
*/
|
||||
void execute();
|
||||
|
||||
/**
|
||||
* Retrieves the job system that the Engine has ownership over.
|
||||
*
|
||||
* @return JobSystem used by filament
|
||||
*/
|
||||
utils::JobSystem& getJobSystem() noexcept;
|
||||
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
/**
|
||||
* WebGL only: Tells the driver to reset any internal state tracking if necessary.
|
||||
*
|
||||
* This is only useful when integrating an external renderer into Filament on platforms
|
||||
* like WebGL, where share contexts do not exist. Filament keeps track of the GL
|
||||
* state it has set (like which texture is bound), and does not re-set that state if
|
||||
* it does not think it needs to. However, if an external renderer has set different
|
||||
* state in the mean time, Filament will use that new state unknowingly.
|
||||
*
|
||||
* If you are in this situation, call this function - ideally only once per frame,
|
||||
* immediately after calling Engine::execute().
|
||||
*/
|
||||
void resetBackendState() noexcept;
|
||||
#endif
|
||||
|
||||
DebugRegistry& getDebugRegistry() noexcept;
|
||||
|
||||
protected:
|
||||
//! \privatesection
|
||||
Engine() noexcept = default;
|
||||
~Engine() = default;
|
||||
|
||||
public:
|
||||
//! \privatesection
|
||||
Engine(Engine const&) = delete;
|
||||
Engine(Engine&&) = delete;
|
||||
Engine& operator=(Engine const&) = delete;
|
||||
Engine& operator=(Engine&&) = delete;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_ENGINE_H
|
||||
129
flutter_filament/windows/include/filament/filament/Exposure.h
Normal file
129
flutter_filament/windows/include/filament/filament/Exposure.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_EXPOSURE_H
|
||||
#define TNT_FILAMENT_EXPOSURE_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Camera;
|
||||
|
||||
/**
|
||||
* A series of utilities to compute exposure, exposure value at ISO 100 (EV100),
|
||||
* luminance and illuminance using a physically-based camera model.
|
||||
*/
|
||||
namespace Exposure {
|
||||
|
||||
/**
|
||||
* Returns the exposure value (EV at ISO 100) of the specified camera.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float ev100(const Camera& camera) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the exposure value (EV at ISO 100) of the specified exposure parameters.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float ev100(float aperture, float shutterSpeed, float sensitivity) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the exposure value (EV at ISO 100) for the given average luminance (in @f$ \frac{cd}{m^2} @f$).
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float ev100FromLuminance(float luminance) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the exposure value (EV at ISO 100) for the given illuminance (in lux).
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float ev100FromIlluminance(float illuminance) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the photometric exposure for the specified camera.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float exposure(const Camera& camera) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the photometric exposure for the specified exposure parameters.
|
||||
* This function is equivalent to calling `exposure(ev100(aperture, shutterSpeed, sensitivity))`
|
||||
* but is slightly faster and offers higher precision.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float exposure(float aperture, float shutterSpeed, float sensitivity) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the photometric exposure for the given EV100.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float exposure(float ev100) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the incident luminance in @f$ \frac{cd}{m^2} @f$ for the specified camera acting as a spot meter.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float luminance(const Camera& camera) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the incident luminance in @f$ \frac{cd}{m^2} @f$ for the specified exposure parameters of
|
||||
* a camera acting as a spot meter.
|
||||
* This function is equivalent to calling `luminance(ev100(aperture, shutterSpeed, sensitivity))`
|
||||
* but is slightly faster and offers higher precision.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float luminance(float aperture, float shutterSpeed, float sensitivity) noexcept;
|
||||
|
||||
/**
|
||||
* Converts the specified EV100 to luminance in @f$ \frac{cd}{m^2} @f$.
|
||||
* EV100 is not a measure of luminance, but an EV100 can be used to denote a
|
||||
* luminance for which a camera would use said EV100 to obtain the nominally
|
||||
* correct exposure
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float luminance(float ev100) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the illuminance in lux for the specified camera acting as an incident light meter.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float illuminance(const Camera& camera) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the illuminance in lux for the specified exposure parameters of
|
||||
* a camera acting as an incident light meter.
|
||||
* This function is equivalent to calling `illuminance(ev100(aperture, shutterSpeed, sensitivity))`
|
||||
* but is slightly faster and offers higher precision.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float illuminance(float aperture, float shutterSpeed, float sensitivity) noexcept;
|
||||
|
||||
/**
|
||||
* Converts the specified EV100 to illuminance in lux.
|
||||
* EV100 is not a measure of illuminance, but an EV100 can be used to denote an
|
||||
* illuminance for which a camera would use said EV100 to obtain the nominally
|
||||
* correct exposure.
|
||||
*/
|
||||
UTILS_PUBLIC
|
||||
float illuminance(float ev100) noexcept;
|
||||
|
||||
} // namespace exposure
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_EXPOSURE_H
|
||||
86
flutter_filament/windows/include/filament/filament/Fence.h
Normal file
86
flutter_filament/windows/include/filament/filament/Fence.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_FENCE_H
|
||||
#define TNT_FILAMENT_FENCE_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Fence is used to synchronize rendering operations together, with the CPU or with compute.
|
||||
*
|
||||
* \note
|
||||
* Currently Fence only provide client-side synchronization.
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC Fence : public FilamentAPI {
|
||||
public:
|
||||
//! Special \p timeout value to disable wait()'s timeout.
|
||||
static constexpr uint64_t FENCE_WAIT_FOR_EVER = backend::FENCE_WAIT_FOR_EVER;
|
||||
|
||||
//! Error codes for Fence::wait()
|
||||
using FenceStatus = backend::FenceStatus;
|
||||
|
||||
/** Mode controls the behavior of the command stream when calling wait()
|
||||
*
|
||||
* @attention
|
||||
* It would be unwise to call `wait(..., Mode::DONT_FLUSH)` from the same thread
|
||||
* the Fence was created, as it would most certainly create a dead-lock.
|
||||
*/
|
||||
enum class Mode : uint8_t {
|
||||
FLUSH, //!< The command stream is flushed
|
||||
DONT_FLUSH //!< The command stream is not flushed
|
||||
};
|
||||
|
||||
/**
|
||||
* Client-side wait on the Fence.
|
||||
*
|
||||
* Blocks the current thread until the Fence signals.
|
||||
*
|
||||
* @param mode Whether the command stream is flushed before waiting or not.
|
||||
* @param timeout Wait time out. Using a \p timeout of 0 is a way to query the state of the fence.
|
||||
* A \p timeout value of FENCE_WAIT_FOR_EVER is used to disable the timeout.
|
||||
* @return FenceStatus::CONDITION_SATISFIED on success,
|
||||
* FenceStatus::TIMEOUT_EXPIRED if the time out expired or
|
||||
* FenceStatus::ERROR in other cases.
|
||||
* @see #Mode
|
||||
*/
|
||||
FenceStatus wait(Mode mode = Mode::FLUSH, uint64_t timeout = FENCE_WAIT_FOR_EVER);
|
||||
|
||||
/**
|
||||
* Client-side wait on a Fence and destroy the Fence.
|
||||
*
|
||||
* @param fence Fence object to wait on.
|
||||
*
|
||||
* @param mode Whether the command stream is flushed before waiting or not.
|
||||
*
|
||||
* @return FenceStatus::CONDITION_SATISFIED on success,
|
||||
* FenceStatus::ERROR otherwise.
|
||||
*/
|
||||
static FenceStatus waitAndDestroy(Fence* fence, Mode mode = Mode::FLUSH);
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_FENCE_H
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_FILAMENTAPI_H
|
||||
#define TNT_FILAMENT_FILAMENTAPI_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/PrivateImplementation.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* \privatesection
|
||||
* FilamentAPI is used to define an API in filament.
|
||||
* It ensures the class defining the API can't be created, destroyed
|
||||
* or copied by the caller.
|
||||
*/
|
||||
class UTILS_PUBLIC FilamentAPI {
|
||||
protected:
|
||||
// disallow creation on the stack
|
||||
FilamentAPI() noexcept = default;
|
||||
~FilamentAPI() = default;
|
||||
|
||||
public:
|
||||
// disallow copy and assignment
|
||||
FilamentAPI(FilamentAPI const&) = delete;
|
||||
FilamentAPI(FilamentAPI&&) = delete;
|
||||
FilamentAPI& operator=(FilamentAPI const&) = delete;
|
||||
FilamentAPI& operator=(FilamentAPI&&) = delete;
|
||||
|
||||
// allow placement-new allocation, don't use "noexcept", to avoid compiler null check
|
||||
static void *operator new (size_t, void* p) { return p; }
|
||||
|
||||
// prevent heap allocation
|
||||
static void *operator new (size_t) = delete;
|
||||
static void *operator new[] (size_t) = delete;
|
||||
static void operator delete (void*) = delete;
|
||||
static void operator delete[](void*) = delete;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using BuilderBase = utils::PrivateImplementation<T>;
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_FILAMENTAPI_H
|
||||
127
flutter_filament/windows/include/filament/filament/Frustum.h
Normal file
127
flutter_filament/windows/include/filament/filament/Frustum.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_FRUSTUM_H
|
||||
#define TNT_FILAMENT_FRUSTUM_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mat4.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
#include <utils/unwindows.h> // Because we define NEAR and FAR in the Plane enum.
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Box;
|
||||
class Culler;
|
||||
|
||||
/**
|
||||
* A frustum defined by six planes
|
||||
*/
|
||||
class UTILS_PUBLIC Frustum {
|
||||
public:
|
||||
enum class Plane : uint8_t {
|
||||
LEFT,
|
||||
RIGHT,
|
||||
BOTTOM,
|
||||
TOP,
|
||||
FAR,
|
||||
NEAR
|
||||
};
|
||||
|
||||
Frustum() = default;
|
||||
Frustum(const Frustum& rhs) = default;
|
||||
Frustum(Frustum&& rhs) noexcept = default;
|
||||
Frustum& operator=(const Frustum& rhs) = default;
|
||||
Frustum& operator=(Frustum&& rhs) noexcept = default;
|
||||
|
||||
/**
|
||||
* Creates a frustum from a projection matrix in GL convention
|
||||
* (usually the projection * view matrix)
|
||||
* @param pv a 4x4 projection matrix in GL convention
|
||||
*/
|
||||
explicit Frustum(const math::mat4f& pv);
|
||||
|
||||
/**
|
||||
* Sets the frustum from the given projection matrix
|
||||
* @param pv a 4x4 projection matrix
|
||||
*/
|
||||
void setProjection(const math::mat4f& pv);
|
||||
|
||||
/**
|
||||
* Returns the plane equation parameters with normalized normals
|
||||
* @param plane Identifier of the plane to retrieve the equation of
|
||||
* @return A plane equation encoded a float4 R such as R.x*x + R.y*y + R.z*z + R.w = 0
|
||||
*/
|
||||
math::float4 getNormalizedPlane(Plane plane) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns a copy of all six frustum planes in left, right, bottom, top, far, near order
|
||||
* @param planes six plane equations encoded as in getNormalizedPlane() in
|
||||
* left, right, bottom, top, far, near order
|
||||
*/
|
||||
void getNormalizedPlanes(math::float4 planes[6]) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns all six frustum planes in left, right, bottom, top, far, near order
|
||||
* @return six plane equations encoded as in getNormalizedPlane() in
|
||||
* left, right, bottom, top, far, near order
|
||||
*/
|
||||
math::float4 const* getNormalizedPlanes() const noexcept { return mPlanes; }
|
||||
|
||||
/**
|
||||
* Returns whether a box intersects the frustum (i.e. is visible)
|
||||
* @param box The box to test against the frustum
|
||||
* @return true if the box may intersects the frustum, false otherwise. In some situations
|
||||
* a box that doesn't intersect the frustum might be reported as though it does. However,
|
||||
* a box that does intersect the frustum is always reported correctly (true).
|
||||
*/
|
||||
bool intersects(const Box& box) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether a sphere intersects the frustum (i.e. is visible)
|
||||
* @param sphere A sphere encoded as a center + radius.
|
||||
* @return true if the sphere may intersects the frustum, false otherwise. In some situations
|
||||
* a sphere that doesn't intersect the frustum might be reported as though it does. However,
|
||||
* a sphere that does intersect the frustum is always reported correctly (true).
|
||||
*/
|
||||
bool intersects(const math::float4& sphere) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether the frustum contains a given point.
|
||||
* @param p the point to test
|
||||
* @return the maximum signed distance to the frustum. Negative if p is inside.
|
||||
*/
|
||||
float contains(math::float3 p) const noexcept;
|
||||
|
||||
private:
|
||||
friend class Culler;
|
||||
math::float4 mPlanes[6];
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
namespace utils::io {
|
||||
class ostream;
|
||||
} // namespace utils::io
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, filament::Frustum const& frustum);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_FRUSTUM_H
|
||||
125
flutter_filament/windows/include/filament/filament/IndexBuffer.h
Normal file
125
flutter_filament/windows/include/filament/filament/IndexBuffer.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_INDEXBUFFER_H
|
||||
#define TNT_FILAMENT_INDEXBUFFER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <backend/BufferDescriptor.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FIndexBuffer;
|
||||
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* A buffer containing vertex indices into a VertexBuffer. Indices can be 16 or 32 bit.
|
||||
* The buffer itself is a GPU resource, therefore mutating the data can be relatively slow.
|
||||
* Typically these buffers are constant.
|
||||
*
|
||||
* It is possible, and even encouraged, to use a single index buffer for several Renderables.
|
||||
*
|
||||
* @see VertexBuffer, RenderableManager
|
||||
*/
|
||||
class UTILS_PUBLIC IndexBuffer : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using BufferDescriptor = backend::BufferDescriptor;
|
||||
|
||||
/**
|
||||
* Type of the index buffer
|
||||
*/
|
||||
enum class IndexType : uint8_t {
|
||||
USHORT = uint8_t(backend::ElementType::USHORT), //!< 16-bit indices
|
||||
UINT = uint8_t(backend::ElementType::UINT), //!< 32-bit indices
|
||||
};
|
||||
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Size of the index buffer in elements.
|
||||
* @param indexCount Number of indices the IndexBuffer can hold.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& indexCount(uint32_t indexCount) noexcept;
|
||||
|
||||
/**
|
||||
* Type of the index buffer, 16-bit or 32-bit.
|
||||
* @param indexType Type of indices stored in the IndexBuffer.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& bufferType(IndexType indexType) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the IndexBuffer object and returns a pointer to it. After creation, the index
|
||||
* buffer is uninitialized. Use IndexBuffer::setBuffer() to initialize the IndexBuffer.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this IndexBuffer with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*
|
||||
* @see IndexBuffer::setBuffer
|
||||
*/
|
||||
IndexBuffer* build(Engine& engine);
|
||||
private:
|
||||
friend class FIndexBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Asynchronously copy-initializes a region of this IndexBuffer from the data provided.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this IndexBuffer with.
|
||||
* @param buffer A BufferDescriptor representing the data used to initialize the IndexBuffer.
|
||||
* BufferDescriptor points to raw, untyped data that will be interpreted as
|
||||
* either 16-bit or 32-bits indices based on the Type of this IndexBuffer.
|
||||
* @param byteOffset Offset in *bytes* into the IndexBuffer
|
||||
*/
|
||||
void setBuffer(Engine& engine, BufferDescriptor&& buffer, uint32_t byteOffset = 0);
|
||||
|
||||
/**
|
||||
* Returns the size of this IndexBuffer in elements.
|
||||
* @return The number of indices the IndexBuffer holds.
|
||||
*/
|
||||
size_t getIndexCount() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_INDEXBUFFER_H
|
||||
@@ -0,0 +1,349 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_INDIRECTLIGHT_H
|
||||
#define TNT_FILAMENT_INDIRECTLIGHT_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Engine;
|
||||
class Texture;
|
||||
|
||||
class FIndirectLight;
|
||||
|
||||
/**
|
||||
* IndirectLight is used to simulate environment lighting, a form of global illumination.
|
||||
*
|
||||
* Environment lighting has a two components:
|
||||
* 1. irradiance
|
||||
* 2. reflections (specular component)
|
||||
*
|
||||
* Environments are usually captured as high-resolution HDR equirectangular images and processed
|
||||
* by the **cmgen** tool to generate the data needed by IndirectLight.
|
||||
*
|
||||
* @note
|
||||
* Currently IndirectLight is intended to be used for "distant probes", that is, to represent
|
||||
* global illumination from a distant (i.e. at infinity) environment, such as the sky or distant
|
||||
* mountains. Only a single IndirectLight can be used in a Scene. This limitation will be lifted
|
||||
* in the future.
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* An IndirectLight object is created using the IndirectLight::Builder and destroyed by calling
|
||||
* Engine::destroy(const IndirectLight*).
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
*
|
||||
* filament::IndirectLight* environment = filament::IndirectLight::Builder()
|
||||
* .reflections(cubemap)
|
||||
* .build(*engine);
|
||||
*
|
||||
* engine->destroy(environment);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
*
|
||||
* Irradiance
|
||||
* ==========
|
||||
*
|
||||
* The irradiance represents the light that comes from the environment and shines an
|
||||
* object's surface.
|
||||
*
|
||||
* The irradiance is calculated automatically from the Reflections (see below), and generally
|
||||
* doesn't need to be provided explicitly. However, it can be provided separately from the
|
||||
* Reflections as
|
||||
* [spherical harmonics](https://en.wikipedia.org/wiki/Spherical_harmonics) (SH) of 1, 2 or
|
||||
* 3 bands, respectively 1, 4 or 9 coefficients.
|
||||
*
|
||||
* @note
|
||||
* Use the **cmgen** tool to generate the `SH` for a given environment.
|
||||
*
|
||||
* Reflections
|
||||
* ===========
|
||||
*
|
||||
* The reflections on object surfaces (specular component) is calculated from a specially
|
||||
* filtered cubemap pyramid generated by the **cmgen** tool.
|
||||
*
|
||||
*
|
||||
* @see Scene, Light, Texture, Skybox
|
||||
*/
|
||||
class UTILS_PUBLIC IndirectLight : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
|
||||
//! Use Builder to construct an IndirectLight object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Set the reflections cubemap mipmap chain.
|
||||
*
|
||||
* @param cubemap A mip-mapped cubemap generated by **cmgen**. Each cubemap level
|
||||
* encodes a the irradiance for a roughness level.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
*/
|
||||
Builder& reflections(Texture const* cubemap) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the irradiance as Spherical Harmonics.
|
||||
*
|
||||
* The irradiance must be pre-convolved by \f$ \langle n \cdot l \rangle \f$ and
|
||||
* pre-multiplied by the Lambertian diffuse BRDF \f$ \frac{1}{\pi} \f$ and
|
||||
* specified as Spherical Harmonics coefficients.
|
||||
*
|
||||
* Additionally, these Spherical Harmonics coefficients must be pre-scaled by the
|
||||
* reconstruction factors \f$ A_{l}^{m} \f$ below.
|
||||
*
|
||||
* The final coefficients can be generated using the `cmgen` tool.
|
||||
*
|
||||
* The index in the \p sh array is given by:
|
||||
*
|
||||
* `index(l, m) = l * (l + 1) + m`
|
||||
*
|
||||
* \f$ sh[index(l,m)] = L_{l}^{m} \frac{1}{\pi} A_{l}^{m} \hat{C_{l}} \f$
|
||||
*
|
||||
* index | l | m | \f$ A_{l}^{m} \f$ | \f$ \hat{C_{l}} \f$ | \f$ \frac{1}{\pi} A_{l}^{m}\hat{C_{l}} \f$ |
|
||||
* :-----:|:---:|:---:|:------------------:|:---------------------:|:--------------------------------------------:
|
||||
* 0 | 0 | 0 | 0.282095 | 3.1415926 | 0.282095
|
||||
* 1 | 1 | -1 | -0.488602 | 2.0943951 | -0.325735
|
||||
* 2 | ^ | 0 | 0.488602 | ^ | 0.325735
|
||||
* 3 | ^ | 1 | -0.488602 | ^ | -0.325735
|
||||
* 4 | 2 | -2 | 1.092548 | 0.785398 | 0.273137
|
||||
* 5 | ^ | -1 | -1.092548 | ^ | -0.273137
|
||||
* 6 | ^ | 0 | 0.315392 | ^ | 0.078848
|
||||
* 7 | ^ | 1 | -1.092548 | ^ | -0.273137
|
||||
* 8 | ^ | 2 | 0.546274 | ^ | 0.136569
|
||||
*
|
||||
*
|
||||
* Only 1, 2 or 3 bands are allowed.
|
||||
*
|
||||
* @param bands Number of spherical harmonics bands. Must be 1, 2 or 3.
|
||||
* @param sh Array containing the spherical harmonics coefficients.
|
||||
* The size of the array must be \f$ bands^{2} \f$.
|
||||
* (i.e. 1, 4 or 9 coefficients respectively).
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* Because the coefficients are pre-scaled, `sh[0]` is the environment's
|
||||
* average irradiance.
|
||||
*/
|
||||
Builder& irradiance(uint8_t bands, math::float3 const* sh) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the irradiance from the radiance expressed as Spherical Harmonics.
|
||||
*
|
||||
* The radiance must be specified as Spherical Harmonics coefficients \f$ L_{l}^{m} \f$
|
||||
*
|
||||
* The index in the \p sh array is given by:
|
||||
*
|
||||
* `index(l, m) = l * (l + 1) + m`
|
||||
*
|
||||
* \f$ sh[index(l,m)] = L_{l}^{m} \f$
|
||||
*
|
||||
* index | l | m
|
||||
* :-----:|:---:|:---:
|
||||
* 0 | 0 | 0
|
||||
* 1 | 1 | -1
|
||||
* 2 | ^ | 0
|
||||
* 3 | ^ | 1
|
||||
* 4 | 2 | -2
|
||||
* 5 | ^ | -1
|
||||
* 6 | ^ | 0
|
||||
* 7 | ^ | 1
|
||||
* 8 | ^ | 2
|
||||
*
|
||||
* @param bands Number of spherical harmonics bands. Must be 1, 2 or 3.
|
||||
* @param sh Array containing the spherical harmonics coefficients.
|
||||
* The size of the array must be \f$ bands^{2} \f$.
|
||||
* (i.e. 1, 4 or 9 coefficients respectively).
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& radiance(uint8_t bands, math::float3 const* sh) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the irradiance as a cubemap.
|
||||
*
|
||||
* The irradiance can alternatively be specified as a cubemap instead of Spherical
|
||||
* Harmonics coefficients. It may or may not be more efficient, depending on your
|
||||
* hardware (essentially, it's trading ALU for bandwidth).
|
||||
*
|
||||
* @param cubemap Cubemap representing the Irradiance pre-convolved by
|
||||
* \f$ \langle n \cdot l \rangle \f$.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* This irradiance cubemap can be generated with the **cmgen** tool.
|
||||
*
|
||||
* @see irradiance(uint8_t bands, math::float3 const* sh)
|
||||
*/
|
||||
Builder& irradiance(Texture const* cubemap) noexcept;
|
||||
|
||||
/**
|
||||
* (optional) Environment intensity.
|
||||
*
|
||||
* Because the environment is encoded usually relative to some reference, the
|
||||
* range can be adjusted with this method.
|
||||
*
|
||||
* @param envIntensity Scale factor applied to the environment and irradiance such that
|
||||
* the result is in lux, or lumen/m^2 (default = 30000)
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& intensity(float envIntensity) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the rigid-body transformation to apply to the IBL.
|
||||
*
|
||||
* @param rotation 3x3 rotation matrix. Must be a rigid-body transform.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& rotation(math::mat3f const& rotation) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the IndirectLight object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this IndirectLight with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
IndirectLight* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FIndirectLight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the environment's intensity.
|
||||
*
|
||||
* Because the environment is encoded usually relative to some reference, the
|
||||
* range can be adjusted with this method.
|
||||
*
|
||||
* @param intensity Scale factor applied to the environment and irradiance such that
|
||||
* the result is in lux, or <i>lumen/m^2</i> (default = 30000)
|
||||
*/
|
||||
void setIntensity(float intensity) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the environment's intensity in <i>lux</i>, or <i>lumen/m^2</i>.
|
||||
*/
|
||||
float getIntensity() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the rigid-body transformation to apply to the IBL.
|
||||
*
|
||||
* @param rotation 3x3 rotation matrix. Must be a rigid-body transform.
|
||||
*/
|
||||
void setRotation(math::mat3f const& rotation) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the rigid-body transformation applied to the IBL.
|
||||
*/
|
||||
const math::mat3f& getRotation() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the associated reflection map, or null if it does not exist.
|
||||
*/
|
||||
Texture const* getReflectionsTexture() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the associated irradiance map, or null if it does not exist.
|
||||
*/
|
||||
Texture const* getIrradianceTexture() const noexcept;
|
||||
|
||||
/**
|
||||
* Helper to estimate the direction of the dominant light in the environment represented by
|
||||
* spherical harmonics.
|
||||
*
|
||||
* This assumes that there is only a single dominant light (such as the sun in outdoors
|
||||
* environments), if it's not the case the direction returned will be an average of the
|
||||
* various lights based on their intensity.
|
||||
*
|
||||
* If there are no clear dominant light, as is often the case with low dynamic range (LDR)
|
||||
* environments, this method may return a wrong or unexpected direction.
|
||||
*
|
||||
* The dominant light direction can be used to set a directional light's direction,
|
||||
* for instance to produce shadows that match the environment.
|
||||
*
|
||||
* @param sh 3-band spherical harmonics
|
||||
*
|
||||
* @return A unit vector representing the direction of the dominant light
|
||||
*
|
||||
* @see LightManager::Builder::direction()
|
||||
* @see getColorEstimate()
|
||||
*/
|
||||
static math::float3 getDirectionEstimate(const math::float3 sh[9]) noexcept;
|
||||
|
||||
/**
|
||||
* Helper to estimate the color and relative intensity of the environment represented by
|
||||
* spherical harmonics in a given direction.
|
||||
*
|
||||
* This can be used to set the color and intensity of a directional light. In this case
|
||||
* make sure to multiply this relative intensity by the the intensity of this indirect light.
|
||||
*
|
||||
* @param sh 3-band spherical harmonics
|
||||
* @param direction a unit vector representing the direction of the light to estimate the
|
||||
* color of. Typically this the value returned by getDirectionEstimate().
|
||||
*
|
||||
* @return A vector of 4 floats where the first 3 components represent the linear color and
|
||||
* the 4th component represents the intensity of the dominant light
|
||||
*
|
||||
* @see LightManager::Builder::color()
|
||||
* @see LightManager::Builder::intensity()
|
||||
* @see getDirectionEstimate, getIntensity, setIntensity
|
||||
*/
|
||||
static math::float4 getColorEstimate(const math::float3 sh[9], math::float3 direction) noexcept;
|
||||
|
||||
|
||||
/** @deprecated use static versions instead */
|
||||
UTILS_DEPRECATED
|
||||
math::float3 getDirectionEstimate() const noexcept;
|
||||
|
||||
/** @deprecated use static versions instead */
|
||||
UTILS_DEPRECATED
|
||||
math::float4 getColorEstimate(math::float3 direction) const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_INDIRECTLIGHT_H
|
||||
@@ -0,0 +1,964 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_LIGHTMANAGER_H
|
||||
#define TNT_FILAMENT_LIGHTMANAGER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/Color.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Entity.h>
|
||||
#include <utils/EntityInstance.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Engine;
|
||||
class FEngine;
|
||||
class FLightManager;
|
||||
|
||||
/**
|
||||
* LightManager allows to create a light source in the scene, such as a sun or street lights.
|
||||
*
|
||||
* At least one light must be added to a scene in order to see anything
|
||||
* (unless the Material.Shading.UNLIT is used).
|
||||
*
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* A Light component is created using the LightManager::Builder and destroyed by calling
|
||||
* LightManager::destroy(utils::Entity).
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
* utils::Entity sun = utils::EntityManager.get().create();
|
||||
*
|
||||
* filament::LightManager::Builder(Type::SUN)
|
||||
* .castShadows(true)
|
||||
* .build(*engine, sun);
|
||||
*
|
||||
* engine->getLightManager().destroy(sun);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
*
|
||||
* Light types
|
||||
* ===========
|
||||
*
|
||||
* Lights come in three flavors:
|
||||
* - directional lights
|
||||
* - point lights
|
||||
* - spot lights
|
||||
*
|
||||
*
|
||||
* Directional lights
|
||||
* ------------------
|
||||
*
|
||||
* Directional lights have a direction, but don't have a position. All light rays are
|
||||
* parallel and come from infinitely far away and from everywhere. Typically a directional light
|
||||
* is used to simulate the sun.
|
||||
*
|
||||
* Directional lights and spot lights are able to cast shadows.
|
||||
*
|
||||
* To create a directional light use Type.DIRECTIONAL or Type.SUN, both are similar, but the later
|
||||
* also draws a sun's disk in the sky and its reflection on glossy objects.
|
||||
*
|
||||
* @warning Currently, only a single directional light is supported. If several directional lights
|
||||
* are added to the scene, the dominant one will be used.
|
||||
*
|
||||
* @see Builder.direction(), Builder.sunAngularRadius()
|
||||
*
|
||||
* Point lights
|
||||
* ------------
|
||||
*
|
||||
* Unlike directional lights, point lights have a position but emit light in all directions.
|
||||
* The intensity of the light diminishes with the inverse square of the distance to the light.
|
||||
* Builder.falloff() controls distance beyond which the light has no more influence.
|
||||
*
|
||||
* A scene can have multiple point lights.
|
||||
*
|
||||
* @see Builder.position(), Builder.falloff()
|
||||
*
|
||||
* Spot lights
|
||||
* -----------
|
||||
*
|
||||
* Spot lights are similar to point lights but the light it emits is limited to a cone defined by
|
||||
* Builder.spotLightCone() and the light's direction.
|
||||
*
|
||||
* A spot light is therefore defined by a position, a direction and inner and outer cones. The
|
||||
* spot light's influence is limited to inside the outer cone. The inner cone defines the light's
|
||||
* falloff attenuation.
|
||||
*
|
||||
* A physically correct spot light is a little difficult to use because changing the outer angle
|
||||
* of the cone changes the illumination levels, as the same amount of light is spread over a
|
||||
* changing volume. The coupling of illumination and the outer cone means that an artist cannot
|
||||
* tweak the influence cone of a spot light without also changing the perceived illumination.
|
||||
* It therefore makes sense to provide artists with a parameter to disable this coupling. This
|
||||
* is the difference between Type.FOCUSED_SPOT and Type.SPOT.
|
||||
*
|
||||
* @see Builder.position(), Builder.direction(), Builder.falloff(), Builder.spotLightCone()
|
||||
*
|
||||
* Performance considerations
|
||||
* ==========================
|
||||
*
|
||||
* Generally, adding lights to the scene hurts performance, however filament is designed to be
|
||||
* able to handle hundreds of lights in a scene under certain conditions. Here are some tips
|
||||
* to keep performances high.
|
||||
*
|
||||
* 1. Prefer spot lights to point lights and use the smallest outer cone angle possible.
|
||||
*
|
||||
* 2. Use the smallest possible falloff distance for point and spot lights.
|
||||
* Performance is very sensitive to overlapping lights. The falloff distance essentially
|
||||
* defines a sphere of influence for the light, so try to position point and spot lights
|
||||
* such that they don't overlap too much.
|
||||
*
|
||||
* On the other hand, a scene can contain hundreds of non overlapping lights without
|
||||
* incurring a significant overhead.
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC LightManager : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using Instance = utils::EntityInstance<LightManager>;
|
||||
|
||||
/**
|
||||
* Returns the number of component in the LightManager, not that component are not
|
||||
* guaranteed to be active. Use the EntityManager::isAlive() before use if needed.
|
||||
*
|
||||
* @return number of component in the LightManager
|
||||
*/
|
||||
size_t getComponentCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the list of Entity for all components. Use getComponentCount() to know the size
|
||||
* of the list.
|
||||
* @return a pointer to Entity
|
||||
*/
|
||||
utils::Entity const* getEntities() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether a particular Entity is associated with a component of this LightManager
|
||||
* @param e An Entity.
|
||||
* @return true if this Entity has a component associated with this manager.
|
||||
*/
|
||||
bool hasComponent(utils::Entity e) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets an Instance representing the Light component associated with the given Entity.
|
||||
* @param e An Entity.
|
||||
* @return An Instance object, which represents the Light component associated with the Entity e.
|
||||
* @note Use Instance::isValid() to make sure the component exists.
|
||||
* @see hasComponent()
|
||||
*/
|
||||
Instance getInstance(utils::Entity e) const noexcept;
|
||||
|
||||
// destroys this component from the given entity
|
||||
void destroy(utils::Entity e) noexcept;
|
||||
|
||||
|
||||
//! Denotes the type of the light being created.
|
||||
enum class Type : uint8_t {
|
||||
SUN, //!< Directional light that also draws a sun's disk in the sky.
|
||||
DIRECTIONAL, //!< Directional light, emits light in a given direction.
|
||||
POINT, //!< Point light, emits light from a position, in all directions.
|
||||
FOCUSED_SPOT, //!< Physically correct spot light.
|
||||
SPOT, //!< Spot light with coupling of outer cone and illumination disabled.
|
||||
};
|
||||
|
||||
/**
|
||||
* Control the quality / performance of the shadow map associated to this light
|
||||
*/
|
||||
struct ShadowOptions {
|
||||
/** Size of the shadow map in texels. Must be a power-of-two and larger or equal to 8. */
|
||||
uint32_t mapSize = 1024;
|
||||
|
||||
/**
|
||||
* Number of shadow cascades to use for this light. Must be between 1 and 4 (inclusive).
|
||||
* A value greater than 1 turns on cascaded shadow mapping (CSM).
|
||||
* Only applicable to Type.SUN or Type.DIRECTIONAL lights.
|
||||
*
|
||||
* When using shadow cascades, cascadeSplitPositions must also be set.
|
||||
*
|
||||
* @see ShadowOptions::cascadeSplitPositions
|
||||
*/
|
||||
uint8_t shadowCascades = 1;
|
||||
|
||||
/**
|
||||
* The split positions for shadow cascades.
|
||||
*
|
||||
* Cascaded shadow mapping (CSM) partitions the camera frustum into cascades. These values
|
||||
* determine the planes along the camera's Z axis to split the frustum. The camera near
|
||||
* plane is represented by 0.0f and the far plane represented by 1.0f.
|
||||
*
|
||||
* For example, if using 4 cascades, these values would set a uniform split scheme:
|
||||
* { 0.25f, 0.50f, 0.75f }
|
||||
*
|
||||
* For N cascades, N - 1 split positions will be read from this array.
|
||||
*
|
||||
* Filament provides utility methods inside LightManager::ShadowCascades to help set these
|
||||
* values. For example, to use a uniform split scheme:
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* LightManager::ShadowCascades::computeUniformSplits(options.splitPositions, 4);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
* @see ShadowCascades::computeUniformSplits
|
||||
* @see ShadowCascades::computeLogSplits
|
||||
* @see ShadowCascades::computePracticalSplits
|
||||
*/
|
||||
float cascadeSplitPositions[3] = { 0.125f, 0.25f, 0.50f };
|
||||
|
||||
/** Constant bias in world units (e.g. meters) by which shadows are moved away from the
|
||||
* light. 1mm by default.
|
||||
* This is ignored when the View's ShadowType is set to VSM.
|
||||
*/
|
||||
float constantBias = 0.001f;
|
||||
|
||||
/** Amount by which the maximum sampling error is scaled. The resulting value is used
|
||||
* to move the shadow away from the fragment normal. Should be 1.0.
|
||||
* This is ignored when the View's ShadowType is set to VSM.
|
||||
*/
|
||||
float normalBias = 1.0f;
|
||||
|
||||
/** Distance from the camera after which shadows are clipped. This is used to clip
|
||||
* shadows that are too far and wouldn't contribute to the scene much, improving
|
||||
* performance and quality. This value is always positive.
|
||||
* Use 0.0f to use the camera far distance.
|
||||
*/
|
||||
float shadowFar = 0.0f;
|
||||
|
||||
/** Optimize the quality of shadows from this distance from the camera. Shadows will
|
||||
* be rendered in front of this distance, but the quality may not be optimal.
|
||||
* This value is always positive. Use 0.0f to use the camera near distance.
|
||||
* The default of 1m works well with many scenes. The quality of shadows may drop
|
||||
* rapidly when this value decreases.
|
||||
*/
|
||||
float shadowNearHint = 1.0f;
|
||||
|
||||
/** Optimize the quality of shadows in front of this distance from the camera. Shadows
|
||||
* will be rendered behind this distance, but the quality may not be optimal.
|
||||
* This value is always positive. Use std::numerical_limits<float>::infinity() to
|
||||
* use the camera far distance.
|
||||
*/
|
||||
float shadowFarHint = 100.0f;
|
||||
|
||||
/**
|
||||
* Controls whether the shadow map should be optimized for resolution or stability.
|
||||
* When set to true, all resolution enhancing features that can affect stability are
|
||||
* disabling, resulting in significantly lower resolution shadows, albeit stable ones.
|
||||
*
|
||||
* Setting this flag to true always disables LiSPSM (see below).
|
||||
*
|
||||
* @see lispsm
|
||||
*/
|
||||
bool stable = false;
|
||||
|
||||
/**
|
||||
* LiSPSM, or light-space perspective shadow-mapping is a technique allowing to better
|
||||
* optimize the use of the shadow-map texture. When enabled the effective resolution of
|
||||
* shadows is greatly improved and yields result similar to using cascades without the
|
||||
* extra cost. LiSPSM comes with some drawbacks however, in particular it is incompatible
|
||||
* with blurring because it effectively affects the blur kernel size.
|
||||
*
|
||||
* Blurring is only an issue when using ShadowType::VSM with a large blur or with
|
||||
* ShadowType::PCSS however.
|
||||
*
|
||||
* If these blurring artifacts become problematic, this flag can be used to disable LiSPSM.
|
||||
*
|
||||
* @see stable
|
||||
*/
|
||||
bool lispsm = true;
|
||||
|
||||
/**
|
||||
* Constant bias in depth-resolution units by which shadows are moved away from the
|
||||
* light. The default value of 0.5 is used to round depth values up.
|
||||
* Generally this value shouldn't be changed or at least be small and positive.
|
||||
* This is ignored when the View's ShadowType is set to VSM.
|
||||
*/
|
||||
float polygonOffsetConstant = 0.5f;
|
||||
|
||||
/**
|
||||
* Bias based on the change in depth in depth-resolution units by which shadows are moved
|
||||
* away from the light. The default value of 2.0 works well with SHADOW_SAMPLING_PCF_LOW.
|
||||
* Generally this value is between 0.5 and the size in texel of the PCF filter.
|
||||
* Setting this value correctly is essential for LISPSM shadow-maps.
|
||||
* This is ignored when the View's ShadowType is set to VSM.
|
||||
*/
|
||||
float polygonOffsetSlope = 2.0f;
|
||||
|
||||
/**
|
||||
* Whether screen-space contact shadows are used. This applies regardless of whether a
|
||||
* Renderable is a shadow caster.
|
||||
* Screen-space contact shadows are typically useful in large scenes.
|
||||
* (off by default)
|
||||
*/
|
||||
bool screenSpaceContactShadows = false;
|
||||
|
||||
/**
|
||||
* Number of ray-marching steps for screen-space contact shadows (8 by default).
|
||||
*
|
||||
* CAUTION: this parameter is ignored for all lights except the directional/sun light,
|
||||
* all other lights use the same value set for the directional/sun light.
|
||||
*
|
||||
*/
|
||||
uint8_t stepCount = 8;
|
||||
|
||||
/**
|
||||
* Maximum shadow-occluder distance for screen-space contact shadows (world units).
|
||||
* (30 cm by default)
|
||||
*
|
||||
* CAUTION: this parameter is ignored for all lights except the directional/sun light,
|
||||
* all other lights use the same value set for the directional/sun light.
|
||||
*
|
||||
*/
|
||||
float maxShadowDistance = 0.3f;
|
||||
|
||||
/**
|
||||
* Options available when the View's ShadowType is set to VSM.
|
||||
*
|
||||
* @warning This API is still experimental and subject to change.
|
||||
* @see View::setShadowType
|
||||
*/
|
||||
struct Vsm {
|
||||
/**
|
||||
* When elvsm is set to true, "Exponential Layered VSM without Layers" are used. It is
|
||||
* an improvement to the default EVSM which suffers important light leaks. Enabling
|
||||
* ELVSM for a single shadowmap doubles the memory usage of all shadow maps.
|
||||
* ELVSM is mostly useful when large blurs are used.
|
||||
*/
|
||||
bool elvsm = false;
|
||||
|
||||
/**
|
||||
* Blur width for the VSM blur. Zero do disable.
|
||||
* The maximum value is 125.
|
||||
*/
|
||||
float blurWidth = 0.0f;
|
||||
} vsm;
|
||||
|
||||
/**
|
||||
* Light bulb radius used for soft shadows. Currently this is only used when DPCF or PCSS is
|
||||
* enabled. (2cm by default).
|
||||
*/
|
||||
float shadowBulbRadius = 0.02f;
|
||||
};
|
||||
|
||||
struct ShadowCascades {
|
||||
/**
|
||||
* Utility method to compute ShadowOptions::cascadeSplitPositions according to a uniform
|
||||
* split scheme.
|
||||
*
|
||||
* @param splitPositions a float array of at least size (cascades - 1) to write the split
|
||||
* positions into
|
||||
* @param cascades the number of shadow cascades, at most 4
|
||||
*/
|
||||
static void computeUniformSplits(float* splitPositions, uint8_t cascades);
|
||||
|
||||
/**
|
||||
* Utility method to compute ShadowOptions::cascadeSplitPositions according to a logarithmic
|
||||
* split scheme.
|
||||
*
|
||||
* @param splitPositions a float array of at least size (cascades - 1) to write the split
|
||||
* positions into
|
||||
* @param cascades the number of shadow cascades, at most 4
|
||||
* @param near the camera near plane
|
||||
* @param far the camera far plane
|
||||
*/
|
||||
static void computeLogSplits(float* splitPositions, uint8_t cascades,
|
||||
float near, float far);
|
||||
|
||||
/**
|
||||
* Utility method to compute ShadowOptions::cascadeSplitPositions according to a practical
|
||||
* split scheme.
|
||||
*
|
||||
* The practical split scheme uses uses a lambda value to interpolate between the logarithmic
|
||||
* and uniform split schemes. Start with a lambda value of 0.5f and adjust for your scene.
|
||||
*
|
||||
* See: Zhang et al 2006, "Parallel-split shadow maps for large-scale virtual environments"
|
||||
*
|
||||
* @param splitPositions a float array of at least size (cascades - 1) to write the split
|
||||
* positions into
|
||||
* @param cascades the number of shadow cascades, at most 4
|
||||
* @param near the camera near plane
|
||||
* @param far the camera far plane
|
||||
* @param lambda a float in the range [0, 1] that interpolates between log and
|
||||
* uniform split schemes
|
||||
*/
|
||||
static void computePracticalSplits(float* splitPositions, uint8_t cascades,
|
||||
float near, float far, float lambda);
|
||||
};
|
||||
|
||||
//! Use Builder to construct a Light object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
/**
|
||||
* Creates a light builder and set the light's #Type.
|
||||
*
|
||||
* @param type #Type of Light object to create.
|
||||
*/
|
||||
explicit Builder(Type type) noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables a light channel. Light channel 0 is enabled by default.
|
||||
*
|
||||
* @param channel Light channel to enable or disable, between 0 and 7.
|
||||
* @param enable Whether to enable or disable the light channel.
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& lightChannel(unsigned int channel, bool enable = true) noexcept;
|
||||
|
||||
/**
|
||||
* Whether this Light casts shadows (disabled by default)
|
||||
*
|
||||
* @param enable Enables or disables casting shadows from this Light.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& castShadows(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the shadow-map options for this light.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& shadowOptions(const ShadowOptions& options) noexcept;
|
||||
|
||||
/**
|
||||
* Whether this light casts light (enabled by default)
|
||||
*
|
||||
* @param enable Enables or disables lighting from this Light.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* In some situations it can be useful to have a light in the scene that doesn't
|
||||
* actually emit light, but does cast shadows.
|
||||
*/
|
||||
Builder& castLight(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial position of the light in world space.
|
||||
*
|
||||
* @param position Light's position in world space. The default is at the origin.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* The Light's position is ignored for directional lights (Type.DIRECTIONAL or Type.SUN)
|
||||
*/
|
||||
Builder& position(const math::float3& position) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial direction of a light in world space.
|
||||
*
|
||||
* @param direction Light's direction in world space. Should be a unit vector.
|
||||
* The default is {0,-1,0}.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* The Light's direction is ignored for Type.POINT lights.
|
||||
*/
|
||||
Builder& direction(const math::float3& direction) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial color of a light.
|
||||
*
|
||||
* @param color Color of the light specified in the linear sRGB color-space.
|
||||
* The default is white {1,1,1}.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& color(const LinearColor& color) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial intensity of a light.
|
||||
* @param intensity This parameter depends on the Light.Type:
|
||||
* - For directional lights, it specifies the illuminance in *lux*
|
||||
* (or *lumen/m^2*).
|
||||
* - For point lights and spot lights, it specifies the luminous power
|
||||
* in *lumen*.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* For example, the sun's illuminance is about 100,000 lux.
|
||||
*
|
||||
* This method overrides any prior calls to intensity or intensityCandela.
|
||||
*
|
||||
*/
|
||||
Builder& intensity(float intensity) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial intensity of a spot or point light in candela.
|
||||
*
|
||||
* @param intensity Luminous intensity in *candela*.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* This method is equivalent to calling intensity(float intensity) for directional lights
|
||||
* (Type.DIRECTIONAL or Type.SUN).
|
||||
*
|
||||
* This method overrides any prior calls to intensity or intensityCandela.
|
||||
*/
|
||||
Builder& intensityCandela(float intensity) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the initial intensity of a light in watts.
|
||||
*
|
||||
* @param watts Energy consumed by a lightbulb. It is related to the energy produced
|
||||
* and ultimately the brightness by the \p efficiency parameter.
|
||||
* This value is often available on the packaging of commercial
|
||||
* lightbulbs.
|
||||
*
|
||||
* @param efficiency Efficiency in percent. This depends on the type of lightbulb used.
|
||||
*
|
||||
* Lightbulb type | Efficiency
|
||||
* ----------------:|-----------:
|
||||
* Incandescent | 2.2%
|
||||
* Halogen | 7.0%
|
||||
* LED | 8.7%
|
||||
* Fluorescent | 10.7%
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
*
|
||||
* @note
|
||||
* This call is equivalent to `Builder::intensity(efficiency * 683 * watts);`
|
||||
*
|
||||
* This method overrides any prior calls to intensity or intensityCandela.
|
||||
*/
|
||||
Builder& intensity(float watts, float efficiency) noexcept;
|
||||
|
||||
/**
|
||||
* Set the falloff distance for point lights and spot lights.
|
||||
*
|
||||
* At the falloff distance, the light has no more effect on objects.
|
||||
*
|
||||
* The falloff distance essentially defines a *sphere of influence* around the light, and
|
||||
* therefore has an impact on performance. Larger falloffs might reduce performance
|
||||
* significantly, especially when many lights are used.
|
||||
*
|
||||
* Try to avoid having a large number of light's spheres of influence overlap.
|
||||
*
|
||||
* @param radius Falloff distance in world units. Default is 1 meter.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* The Light's falloff is ignored for directional lights (Type.DIRECTIONAL or Type.SUN)
|
||||
*/
|
||||
Builder& falloff(float radius) noexcept;
|
||||
|
||||
/**
|
||||
* Defines a spot light'st angular falloff attenuation.
|
||||
*
|
||||
* A spot light is defined by a position, a direction and two cones, \p inner and \p outer.
|
||||
* These two cones are used to define the angular falloff attenuation of the spot light
|
||||
* and are defined by the angle from the center axis to where the falloff begins (i.e.
|
||||
* cones are defined by their half-angle).
|
||||
*
|
||||
* Both inner and outer are silently clamped to a minimum value of 0.5 degrees
|
||||
* (~0.00873 radians) to avoid floating-point precision issues during rendering.
|
||||
*
|
||||
* @param inner inner cone angle in *radians* between 0.00873 and \p outer
|
||||
* @param outer outer cone angle in *radians* between 0.00873 inner and @f$ \pi/2 @f$
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @note
|
||||
* The spot light cone is ignored for directional and point lights.
|
||||
*
|
||||
* @see Type.SPOT, Type.FOCUSED_SPOT
|
||||
*/
|
||||
Builder& spotLightCone(float inner, float outer) noexcept;
|
||||
|
||||
/**
|
||||
* Defines the angular radius of the sun, in degrees, between 0.25° and 20.0°
|
||||
*
|
||||
* The Sun as seen from Earth has an angular size of 0.526° to 0.545°
|
||||
*
|
||||
* @param angularRadius sun's radius in degree. Default is 0.545°.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& sunAngularRadius(float angularRadius) noexcept;
|
||||
|
||||
/**
|
||||
* Defines the halo radius of the sun. The radius of the halo is defined as a
|
||||
* multiplier of the sun angular radius.
|
||||
*
|
||||
* @param haloSize radius multiplier. Default is 10.0.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& sunHaloSize(float haloSize) noexcept;
|
||||
|
||||
/**
|
||||
* Defines the halo falloff of the sun. The falloff is a dimensionless number
|
||||
* used as an exponent.
|
||||
*
|
||||
* @param haloFalloff halo falloff. Default is 80.0.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& sunHaloFalloff(float haloFalloff) noexcept;
|
||||
|
||||
enum Result { Error = -1, Success = 0 };
|
||||
|
||||
/**
|
||||
* Adds the Light component to an entity.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this light with.
|
||||
* @param entity Entity to add the light component to.
|
||||
* @return Success if the component was created successfully, Error otherwise.
|
||||
*
|
||||
* If exceptions are disabled and an error occurs, this function is a no-op.
|
||||
* Success can be checked by looking at the return value.
|
||||
*
|
||||
* If this component already exists on the given entity, it is first destroyed as if
|
||||
* destroy(utils::Entity e) was called.
|
||||
*
|
||||
* @warning
|
||||
* Currently, only 2048 lights can be created on a given Engine.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
Result build(Engine& engine, utils::Entity entity);
|
||||
|
||||
private:
|
||||
friend class FEngine;
|
||||
friend class FLightManager;
|
||||
};
|
||||
|
||||
static constexpr float EFFICIENCY_INCANDESCENT = 0.0220f; //!< Typical efficiency of an incandescent light bulb (2.2%)
|
||||
static constexpr float EFFICIENCY_HALOGEN = 0.0707f; //!< Typical efficiency of an halogen light bulb (7.0%)
|
||||
static constexpr float EFFICIENCY_FLUORESCENT = 0.0878f; //!< Typical efficiency of a fluorescent light bulb (8.7%)
|
||||
static constexpr float EFFICIENCY_LED = 0.1171f; //!< Typical efficiency of a LED light bulb (11.7%)
|
||||
|
||||
Type getType(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Helper function that returns if a light is a directional light
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return true is this light is a type of directional light
|
||||
*/
|
||||
inline bool isDirectional(Instance i) const noexcept {
|
||||
Type type = getType(i);
|
||||
return type == Type::DIRECTIONAL || type == Type::SUN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that returns if a light is a point light
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return true is this light is a type of point light
|
||||
*/
|
||||
inline bool isPointLight(Instance i) const noexcept {
|
||||
return getType(i) == Type::POINT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function that returns if a light is a spot light
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return true is this light is a type of spot light
|
||||
*/
|
||||
inline bool isSpotLight(Instance i) const noexcept {
|
||||
Type type = getType(i);
|
||||
return type == Type::SPOT || type == Type::FOCUSED_SPOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables a light channel. Light channel 0 is enabled by default.
|
||||
* @param channel light channel to enable or disable, between 0 and 7.
|
||||
* @param enable whether to enable (true) or disable (false) the specified light channel.
|
||||
*/
|
||||
void setLightChannel(Instance i, unsigned int channel, bool enable = true) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether a light channel is enabled on a specified light.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param channel Light channel to query
|
||||
* @return true if the light channel is enabled, false otherwise
|
||||
*/
|
||||
bool getLightChannel(Instance i, unsigned int channel) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's position.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param position Light's position in world space. The default is at the origin.
|
||||
*
|
||||
* @see Builder.position()
|
||||
*/
|
||||
void setPosition(Instance i, const math::float3& position) noexcept;
|
||||
|
||||
//! returns the light's position in world space
|
||||
const math::float3& getPosition(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's direction
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param direction Light's direction in world space. Should be a unit vector.
|
||||
* The default is {0,-1,0}.
|
||||
*
|
||||
* @see Builder.direction()
|
||||
*/
|
||||
void setDirection(Instance i, const math::float3& direction) noexcept;
|
||||
|
||||
//! returns the light's direction in world space
|
||||
const math::float3& getDirection(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's hue as linear sRGB
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param color Color of the light specified in the linear sRGB color-space.
|
||||
* The default is white {1,1,1}.
|
||||
*
|
||||
* @see Builder.color(), getInstance()
|
||||
*/
|
||||
void setColor(Instance i, const LinearColor& color) noexcept;
|
||||
|
||||
/**
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the light's color in linear sRGB
|
||||
*/
|
||||
const math::float3& getColor(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's intensity. The intensity can be negative.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param intensity This parameter depends on the Light.Type:
|
||||
* - For directional lights, it specifies the illuminance in *lux*
|
||||
* (or *lumen/m^2*).
|
||||
* - For point lights and spot lights, it specifies the luminous power
|
||||
* in *lumen*.
|
||||
*
|
||||
* @see Builder.intensity()
|
||||
*/
|
||||
void setIntensity(Instance i, float intensity) noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's intensity. The intensity can be negative.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param watts Energy consumed by a lightbulb. It is related to the energy produced
|
||||
* and ultimately the brightness by the \p efficiency parameter.
|
||||
* This value is often available on the packaging of commercial
|
||||
* lightbulbs.
|
||||
* @param efficiency Efficiency in percent. This depends on the type of lightbulb used.
|
||||
*
|
||||
* Lightbulb type | Efficiency
|
||||
* ----------------:|-----------:
|
||||
* Incandescent | 2.2%
|
||||
* Halogen | 7.0%
|
||||
* LED | 8.7%
|
||||
* Fluorescent | 10.7%
|
||||
*
|
||||
* @see Builder.intensity(float watts, float efficiency)
|
||||
*/
|
||||
void setIntensity(Instance i, float watts, float efficiency) noexcept {
|
||||
setIntensity(i, watts * 683.0f * efficiency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically updates the light's intensity in candela. The intensity can be negative.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param intensity Luminous intensity in *candela*.
|
||||
*
|
||||
* @note
|
||||
* This method is equivalent to calling setIntensity(float intensity) for directional lights
|
||||
* (Type.DIRECTIONAL or Type.SUN).
|
||||
*
|
||||
* @see Builder.intensityCandela(float intensity)
|
||||
*/
|
||||
void setIntensityCandela(Instance i, float intensity) noexcept;
|
||||
|
||||
/**
|
||||
* returns the light's luminous intensity in candela.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
*
|
||||
* @note for Type.FOCUSED_SPOT lights, the returned value depends on the \p outer cone angle.
|
||||
*
|
||||
* @return luminous intensity in candela.
|
||||
*/
|
||||
float getIntensity(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Set the falloff distance for point lights and spot lights.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param radius falloff distance in world units. Default is 1 meter.
|
||||
*
|
||||
* @see Builder.falloff()
|
||||
*/
|
||||
void setFalloff(Instance i, float radius) noexcept;
|
||||
|
||||
/**
|
||||
* returns the falloff distance of this light.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the falloff distance of this light.
|
||||
*/
|
||||
float getFalloff(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates a spot light's cone as angles
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param inner inner cone angle in *radians* between 0.00873 and outer
|
||||
* @param outer outer cone angle in *radians* between 0.00873 and pi/2
|
||||
*
|
||||
* @see Builder.spotLightCone()
|
||||
*/
|
||||
void setSpotLightCone(Instance i, float inner, float outer) noexcept;
|
||||
|
||||
/**
|
||||
* returns the outer cone angle in *radians* between inner and pi/2.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the outer cone angle of this light.
|
||||
*/
|
||||
float getSpotLightOuterCone(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* returns the inner cone angle in *radians* between 0 and pi/2.
|
||||
*
|
||||
* The value is recomputed from the initial values, thus is not precisely
|
||||
* the same as the one passed to setSpotLightCone() or Builder.spotLightCone().
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the inner cone angle of this light.
|
||||
*/
|
||||
float getSpotLightInnerCone(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the angular radius of a Type.SUN light
|
||||
*
|
||||
* The Sun as seen from Earth has an angular size of 0.526° to 0.545°
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param angularRadius sun's radius in degrees. Default is 0.545°.
|
||||
*/
|
||||
void setSunAngularRadius(Instance i, float angularRadius) noexcept;
|
||||
|
||||
/**
|
||||
* returns the angular radius if the sun in degrees.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the angular radius if the sun in degrees.
|
||||
*/
|
||||
float getSunAngularRadius(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the halo radius of a Type.SUN light. The radius
|
||||
* of the halo is defined as a multiplier of the sun angular radius.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param haloSize radius multiplier. Default is 10.0.
|
||||
*/
|
||||
void setSunHaloSize(Instance i, float haloSize) noexcept;
|
||||
|
||||
/**
|
||||
* returns the halo size of a Type.SUN light as a multiplier of the
|
||||
* sun angular radius.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the halo size
|
||||
*/
|
||||
float getSunHaloSize(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Dynamically updates the halo falloff of a Type.SUN light. The falloff
|
||||
* is a dimensionless number used as an exponent.
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param haloFalloff halo falloff. Default is 80.0.
|
||||
*/
|
||||
void setSunHaloFalloff(Instance i, float haloFalloff) noexcept;
|
||||
|
||||
/**
|
||||
* returns the halo falloff of a Type.SUN light as a dimensionless value.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return the halo falloff
|
||||
*/
|
||||
float getSunHaloFalloff(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* returns the shadow-map options for a given light
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @return A ShadowOption structure
|
||||
*/
|
||||
ShadowOptions const& getShadowOptions(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* sets the shadow-map options for a given light
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param options A ShadowOption structure
|
||||
*/
|
||||
void setShadowOptions(Instance i, ShadowOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Whether this Light casts shadows (disabled by default)
|
||||
*
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
* @param shadowCaster Enables or disables casting shadows from this Light.
|
||||
*
|
||||
* @warning
|
||||
* - Only a Type.DIRECTIONAL, Type.SUN, Type.SPOT, or Type.FOCUSED_SPOT light can cast shadows
|
||||
*/
|
||||
void setShadowCaster(Instance i, bool shadowCaster) noexcept;
|
||||
|
||||
/**
|
||||
* returns whether this light casts shadows.
|
||||
* @param i Instance of the component obtained from getInstance().
|
||||
*/
|
||||
bool isShadowCaster(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Helper to process all components with a given function
|
||||
* @tparam F a void(Entity entity, Instance instance)
|
||||
* @param func a function of type F
|
||||
*/
|
||||
template<typename F>
|
||||
void forEachComponent(F func) noexcept {
|
||||
utils::Entity const* const pEntity = getEntities();
|
||||
for (size_t i = 0, c = getComponentCount(); i < c; i++) {
|
||||
// Instance 0 is the invalid instance
|
||||
func(pEntity[i], Instance(i + 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_LIGHTMANAGER_H
|
||||
318
flutter_filament/windows/include/filament/filament/Material.h
Normal file
318
flutter_filament/windows/include/filament/filament/Material.h
Normal file
@@ -0,0 +1,318 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_MATERIAL_H
|
||||
#define TNT_FILAMENT_MATERIAL_H
|
||||
|
||||
#include <filament/Color.h>
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/MaterialEnums.h>
|
||||
#include <filament/MaterialInstance.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace utils {
|
||||
class CString;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Texture;
|
||||
class TextureSampler;
|
||||
|
||||
class FEngine;
|
||||
class FMaterial;
|
||||
|
||||
class Engine;
|
||||
|
||||
class UTILS_PUBLIC Material : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using BlendingMode = BlendingMode;
|
||||
using Shading = Shading;
|
||||
using Interpolation = Interpolation;
|
||||
using VertexDomain = VertexDomain;
|
||||
using TransparencyMode = TransparencyMode;
|
||||
|
||||
using ParameterType = backend::UniformType;
|
||||
using Precision = backend::Precision;
|
||||
using SamplerType = backend::SamplerType;
|
||||
using SamplerFormat = backend::SamplerFormat;
|
||||
using CullingMode = backend::CullingMode;
|
||||
using ShaderModel = backend::ShaderModel;
|
||||
using SubpassType = backend::SubpassType;
|
||||
|
||||
/**
|
||||
* Holds information about a material parameter.
|
||||
*/
|
||||
struct ParameterInfo {
|
||||
//! Name of the parameter.
|
||||
const char* name;
|
||||
//! Whether the parameter is a sampler (texture).
|
||||
bool isSampler;
|
||||
//! Whether the parameter is a subpass type.
|
||||
bool isSubpass;
|
||||
union {
|
||||
//! Type of the parameter if the parameter is not a sampler.
|
||||
ParameterType type;
|
||||
//! Type of the parameter if the parameter is a sampler.
|
||||
SamplerType samplerType;
|
||||
//! Type of the parameter if the parameter is a subpass.
|
||||
SubpassType subpassType;
|
||||
};
|
||||
//! Size of the parameter when the parameter is an array.
|
||||
uint32_t count;
|
||||
//! Requested precision of the parameter.
|
||||
Precision precision;
|
||||
};
|
||||
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the material data. The material data is a binary blob produced by
|
||||
* libfilamat or by matc.
|
||||
*
|
||||
* @param payload Pointer to the material data, must stay valid until build() is called.
|
||||
* @param size Size of the material data pointed to by "payload" in bytes.
|
||||
*/
|
||||
Builder& package(const void* payload, size_t size);
|
||||
|
||||
template<typename T>
|
||||
using is_supported_constant_parameter_t = typename std::enable_if<
|
||||
std::is_same<int32_t, T>::value ||
|
||||
std::is_same<float, T>::value ||
|
||||
std::is_same<bool, T>::value>::type;
|
||||
|
||||
/**
|
||||
* Specialize a constant parameter specified in the material definition with a concrete
|
||||
* value for this material. Once build() is called, this constant cannot be changed.
|
||||
* Will throw an exception if the name does not match a constant specified in the
|
||||
* material definition or if the type provided does not match.
|
||||
*
|
||||
* @tparam T The type of constant parameter, either int32_t, float, or bool.
|
||||
* @param name The name of the constant parameter specified in the material definition, such
|
||||
* as "myConstant".
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param value The value to use for the constant parameter, must match the type specified
|
||||
* in the material definition.
|
||||
*/
|
||||
template<typename T, typename = is_supported_constant_parameter_t<T>>
|
||||
Builder& constant(const char* name, size_t nameLength, T value);
|
||||
|
||||
/** inline helper to provide the constant name as a null-terminated C string */
|
||||
template<typename T, typename = is_supported_constant_parameter_t<T>>
|
||||
inline Builder& constant(const char* name, T value) {
|
||||
return constant(name, strlen(name), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Material object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this Material with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
Material* build(Engine& engine);
|
||||
private:
|
||||
friend class FMaterial;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a new instance of this material. Material instances should be freed using
|
||||
* Engine::destroy(const MaterialInstance*).
|
||||
*
|
||||
* @param name Optional name to associate with the given material instance. If this is null,
|
||||
* then the instance inherits the material's name.
|
||||
*
|
||||
* @return A pointer to the new instance.
|
||||
*/
|
||||
MaterialInstance* createInstance(const char* name = nullptr) const noexcept;
|
||||
|
||||
//! Returns the name of this material as a null-terminated string.
|
||||
const char* getName() const noexcept;
|
||||
|
||||
//! Returns the shading model of this material.
|
||||
Shading getShading() const noexcept;
|
||||
|
||||
//! Returns the interpolation mode of this material. This affects how variables are interpolated.
|
||||
Interpolation getInterpolation() const noexcept;
|
||||
|
||||
//! Returns the blending mode of this material.
|
||||
BlendingMode getBlendingMode() const noexcept;
|
||||
|
||||
//! Returns the vertex domain of this material.
|
||||
VertexDomain getVertexDomain() const noexcept;
|
||||
|
||||
//! Returns the material domain of this material.
|
||||
//! The material domain determines how the material is used.
|
||||
MaterialDomain getMaterialDomain() const noexcept;
|
||||
|
||||
//! Returns the default culling mode of this material.
|
||||
CullingMode getCullingMode() const noexcept;
|
||||
|
||||
//! Returns the transparency mode of this material.
|
||||
//! This value only makes sense when the blending mode is transparent or fade.
|
||||
TransparencyMode getTransparencyMode() const noexcept;
|
||||
|
||||
//! Indicates whether instances of this material will, by default, write to the color buffer.
|
||||
bool isColorWriteEnabled() const noexcept;
|
||||
|
||||
//! Indicates whether instances of this material will, by default, write to the depth buffer.
|
||||
bool isDepthWriteEnabled() const noexcept;
|
||||
|
||||
//! Indicates whether instances of this material will, by default, use depth testing.
|
||||
bool isDepthCullingEnabled() const noexcept;
|
||||
|
||||
//! Indicates whether this material is double-sided.
|
||||
bool isDoubleSided() const noexcept;
|
||||
|
||||
//! Indicates whether this material uses alpha to coverage.
|
||||
bool isAlphaToCoverageEnabled() const noexcept;
|
||||
|
||||
//! Returns the alpha mask threshold used when the blending mode is set to masked.
|
||||
float getMaskThreshold() const noexcept;
|
||||
|
||||
//! Indicates whether this material uses the shadowing factor as a color multiplier.
|
||||
//! This values only makes sense when the shading mode is unlit.
|
||||
bool hasShadowMultiplier() const noexcept;
|
||||
|
||||
//! Indicates whether this material has specular anti-aliasing enabled
|
||||
bool hasSpecularAntiAliasing() const noexcept;
|
||||
|
||||
//! Returns the screen-space variance for specular-antialiasing, this value is between 0 and 1.
|
||||
float getSpecularAntiAliasingVariance() const noexcept;
|
||||
|
||||
//! Returns the clamping threshold for specular-antialiasing, this value is between 0 and 1.
|
||||
float getSpecularAntiAliasingThreshold() const noexcept;
|
||||
|
||||
//! Returns the list of vertex attributes required by this material.
|
||||
AttributeBitset getRequiredAttributes() const noexcept;
|
||||
|
||||
//! Returns the refraction mode used by this material.
|
||||
RefractionMode getRefractionMode() const noexcept;
|
||||
|
||||
//! Return the refraction type used by this material.
|
||||
RefractionType getRefractionType() const noexcept;
|
||||
|
||||
//! Returns the reflection mode used by this material.
|
||||
ReflectionMode getReflectionMode() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the number of parameters declared by this material.
|
||||
* The returned value can be 0.
|
||||
*/
|
||||
size_t getParameterCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Gets information about this material's parameters.
|
||||
*
|
||||
* @param parameters A pointer to a list of ParameterInfo.
|
||||
* The list must be at least "count" large
|
||||
* @param count The number of parameters to retrieve. Must be >= 0 and can be > count.
|
||||
*
|
||||
* @return The number of parameters written to the parameters pointer.
|
||||
*/
|
||||
size_t getParameters(ParameterInfo* parameters, size_t count) const noexcept;
|
||||
|
||||
//! Indicates whether a parameter of the given name exists on this material.
|
||||
bool hasParameter(const char* name) const noexcept;
|
||||
|
||||
//! Indicates whether an existing parameter is a sampler or not.
|
||||
bool isSampler(const char* name) const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the value of the given parameter on this material's default instance.
|
||||
*
|
||||
* @param name The name of the material parameter
|
||||
* @param value The value of the material parameter
|
||||
*
|
||||
* @see getDefaultInstance()
|
||||
*/
|
||||
template <typename T>
|
||||
void setDefaultParameter(const char* name, T value) noexcept {
|
||||
getDefaultInstance()->setParameter(name, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a texture and sampler parameters on this material's default instance.
|
||||
*
|
||||
* @param name The name of the material texture parameter
|
||||
* @param texture The texture to set as parameter
|
||||
* @param sampler The sampler to be used with this texture
|
||||
*
|
||||
* @see getDefaultInstance()
|
||||
*/
|
||||
void setDefaultParameter(const char* name, Texture const* texture,
|
||||
TextureSampler const& sampler) noexcept {
|
||||
getDefaultInstance()->setParameter(name, texture, sampler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color of the given parameter on this material's default instance.
|
||||
*
|
||||
* @param name The name of the material color parameter
|
||||
* @param type Whether the color is specified in the linear or sRGB space
|
||||
* @param color The color as a floating point red, green, blue tuple
|
||||
*
|
||||
* @see getDefaultInstance()
|
||||
*/
|
||||
void setDefaultParameter(const char* name, RgbType type, math::float3 color) noexcept {
|
||||
getDefaultInstance()->setParameter(name, type, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the color of the given parameter on this material's default instance.
|
||||
*
|
||||
* @param name The name of the material color parameter
|
||||
* @param type Whether the color is specified in the linear or sRGB space
|
||||
* @param color The color as a floating point red, green, blue, alpha tuple
|
||||
*
|
||||
* @see getDefaultInstance()
|
||||
*/
|
||||
void setDefaultParameter(const char* name, RgbaType type, math::float4 color) noexcept {
|
||||
getDefaultInstance()->setParameter(name, type, color);
|
||||
}
|
||||
|
||||
//! Returns this material's default instance.
|
||||
MaterialInstance* getDefaultInstance() noexcept;
|
||||
|
||||
//! Returns this material's default instance.
|
||||
MaterialInstance const* getDefaultInstance() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_MATERIAL_H
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H
|
||||
#define TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filamat {
|
||||
|
||||
// Pack an eight character string into a 64 bit integer.
|
||||
constexpr inline uint64_t charTo64bitNum(const char str[9]) noexcept {
|
||||
return
|
||||
( (static_cast<uint64_t >(str[0]) << 56))
|
||||
| ((static_cast<uint64_t >(str[1]) << 48) & 0x00FF000000000000U)
|
||||
| ((static_cast<uint64_t >(str[2]) << 40) & 0x0000FF0000000000U)
|
||||
| ((static_cast<uint64_t >(str[3]) << 32) & 0x000000FF00000000U)
|
||||
| ((static_cast<uint64_t >(str[4]) << 24) & 0x00000000FF000000U)
|
||||
| ((static_cast<uint64_t >(str[5]) << 16) & 0x0000000000FF0000U)
|
||||
| ((static_cast<uint64_t >(str[6]) << 8) & 0x000000000000FF00U)
|
||||
| ( static_cast<uint64_t >(str[7]) & 0x00000000000000FFU);
|
||||
}
|
||||
|
||||
enum UTILS_PUBLIC ChunkType : uint64_t {
|
||||
Unknown = charTo64bitNum("UNKNOWN "),
|
||||
MaterialUib = charTo64bitNum("MAT_UIB "),
|
||||
MaterialSib = charTo64bitNum("MAT_SIB "),
|
||||
MaterialSubpass = charTo64bitNum("MAT_SUB "),
|
||||
MaterialGlsl = charTo64bitNum("MAT_GLSL"),
|
||||
MaterialSpirv = charTo64bitNum("MAT_SPIR"),
|
||||
MaterialMetal = charTo64bitNum("MAT_METL"),
|
||||
MaterialShaderModels = charTo64bitNum("MAT_SMDL"),
|
||||
MaterialSamplerBindings = charTo64bitNum("MAT_SAMP"),
|
||||
MaterialUniformBindings = charTo64bitNum("MAT_UNIF"),
|
||||
MaterialProperties = charTo64bitNum("MAT_PROP"),
|
||||
MaterialConstants = charTo64bitNum("MAT_CONS"),
|
||||
|
||||
MaterialName = charTo64bitNum("MAT_NAME"),
|
||||
MaterialVersion = charTo64bitNum("MAT_VERS"),
|
||||
MaterialFeatureLevel = charTo64bitNum("MAT_FEAT"),
|
||||
MaterialShading = charTo64bitNum("MAT_SHAD"),
|
||||
MaterialBlendingMode = charTo64bitNum("MAT_BLEN"),
|
||||
MaterialTransparencyMode = charTo64bitNum("MAT_TRMD"),
|
||||
MaterialMaskThreshold = charTo64bitNum("MAT_THRS"),
|
||||
MaterialShadowMultiplier = charTo64bitNum("MAT_SHML"),
|
||||
MaterialSpecularAntiAliasing = charTo64bitNum("MAT_SPAA"),
|
||||
MaterialSpecularAntiAliasingVariance = charTo64bitNum("MAT_SVAR"),
|
||||
MaterialSpecularAntiAliasingThreshold = charTo64bitNum("MAT_STHR"),
|
||||
MaterialClearCoatIorChange = charTo64bitNum("MAT_CIOR"),
|
||||
MaterialDomain = charTo64bitNum("MAT_DOMN"),
|
||||
MaterialRefraction = charTo64bitNum("MAT_REFM"),
|
||||
MaterialRefractionType = charTo64bitNum("MAT_REFT"),
|
||||
MaterialReflectionMode = charTo64bitNum("MAT_REFL"),
|
||||
|
||||
MaterialRequiredAttributes = charTo64bitNum("MAT_REQA"),
|
||||
MaterialDoubleSidedSet = charTo64bitNum("MAT_DOSS"),
|
||||
MaterialDoubleSided = charTo64bitNum("MAT_DOSI"),
|
||||
|
||||
MaterialColorWrite = charTo64bitNum("MAT_CWRIT"),
|
||||
MaterialDepthWriteSet = charTo64bitNum("MAT_DEWS"),
|
||||
MaterialDepthWrite = charTo64bitNum("MAT_DWRIT"),
|
||||
MaterialDepthTest = charTo64bitNum("MAT_DTEST"),
|
||||
MaterialInstanced = charTo64bitNum("MAT_INSTA"),
|
||||
MaterialCullingMode = charTo64bitNum("MAT_CUMO"),
|
||||
MaterialAlphaToCoverageSet = charTo64bitNum("MAT_A2CS"),
|
||||
MaterialAlphaToCoverage = charTo64bitNum("MAT_A2CO"),
|
||||
|
||||
MaterialHasCustomDepthShader =charTo64bitNum("MAT_CSDP"),
|
||||
|
||||
MaterialVertexDomain = charTo64bitNum("MAT_VEDO"),
|
||||
MaterialInterpolation = charTo64bitNum("MAT_INTR"),
|
||||
|
||||
DictionaryText = charTo64bitNum("DIC_TEXT"),
|
||||
DictionarySpirv = charTo64bitNum("DIC_SPIR"),
|
||||
};
|
||||
|
||||
} // namespace filamat
|
||||
|
||||
#endif // TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_MATERIAL_ENUM_H
|
||||
#define TNT_FILAMENT_MATERIAL_ENUM_H
|
||||
|
||||
#include <utils/bitset.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
// update this when a new version of filament wouldn't work with older materials
|
||||
static constexpr size_t MATERIAL_VERSION = 32;
|
||||
|
||||
/**
|
||||
* Supported shading models
|
||||
*/
|
||||
enum class Shading : uint8_t {
|
||||
UNLIT, //!< no lighting applied, emissive possible
|
||||
LIT, //!< default, standard lighting
|
||||
SUBSURFACE, //!< subsurface lighting model
|
||||
CLOTH, //!< cloth lighting model
|
||||
SPECULAR_GLOSSINESS, //!< legacy lighting model
|
||||
};
|
||||
|
||||
/**
|
||||
* Attribute interpolation types in the fragment shader
|
||||
*/
|
||||
enum class Interpolation : uint8_t {
|
||||
SMOOTH, //!< default, smooth interpolation
|
||||
FLAT //!< flat interpolation
|
||||
};
|
||||
|
||||
/**
|
||||
* Shader quality, affect some global quality parameters
|
||||
*/
|
||||
enum class ShaderQuality : int8_t {
|
||||
DEFAULT = -1, // LOW on mobile, HIGH on desktop
|
||||
LOW = 0, // enable optimizations that can slightly affect correctness
|
||||
NORMAL = 1, // normal quality, correctness honored
|
||||
HIGH = 2 // higher quality (e.g. better upscaling, etc...)
|
||||
};
|
||||
|
||||
/**
|
||||
* Supported blending modes
|
||||
*/
|
||||
enum class BlendingMode : uint8_t {
|
||||
//! material is opaque
|
||||
OPAQUE,
|
||||
//! material is transparent and color is alpha-pre-multiplied, affects diffuse lighting only
|
||||
TRANSPARENT,
|
||||
//! material is additive (e.g.: hologram)
|
||||
ADD,
|
||||
//! material is masked (i.e. alpha tested)
|
||||
MASKED,
|
||||
/**
|
||||
* material is transparent and color is alpha-pre-multiplied, affects specular lighting
|
||||
* when adding more entries, change the size of FRenderer::CommandKey::blending
|
||||
*/
|
||||
FADE,
|
||||
//! material darkens what's behind it
|
||||
MULTIPLY,
|
||||
//! material brightens what's behind it
|
||||
SCREEN,
|
||||
};
|
||||
|
||||
/**
|
||||
* How transparent objects are handled
|
||||
*/
|
||||
enum class TransparencyMode : uint8_t {
|
||||
//! the transparent object is drawn honoring the raster state
|
||||
DEFAULT,
|
||||
/**
|
||||
* the transparent object is first drawn in the depth buffer,
|
||||
* then in the color buffer, honoring the culling mode, but ignoring the depth test function
|
||||
*/
|
||||
TWO_PASSES_ONE_SIDE,
|
||||
|
||||
/**
|
||||
* the transparent object is drawn twice in the color buffer,
|
||||
* first with back faces only, then with front faces; the culling
|
||||
* mode is ignored. Can be combined with two-sided lighting
|
||||
*/
|
||||
TWO_PASSES_TWO_SIDES
|
||||
};
|
||||
|
||||
/**
|
||||
* Supported types of vertex domains.
|
||||
*/
|
||||
enum class VertexDomain : uint8_t {
|
||||
OBJECT, //!< vertices are in object space, default
|
||||
WORLD, //!< vertices are in world space
|
||||
VIEW, //!< vertices are in view space
|
||||
DEVICE //!< vertices are in normalized device space
|
||||
// when adding more entries, make sure to update VERTEX_DOMAIN_COUNT
|
||||
};
|
||||
|
||||
/**
|
||||
* Vertex attribute types
|
||||
*/
|
||||
enum VertexAttribute : uint8_t {
|
||||
// Update hasIntegerTarget() in VertexBuffer when adding an attribute that will
|
||||
// be read as integers in the shaders
|
||||
|
||||
POSITION = 0, //!< XYZ position (float3)
|
||||
TANGENTS = 1, //!< tangent, bitangent and normal, encoded as a quaternion (float4)
|
||||
COLOR = 2, //!< vertex color (float4)
|
||||
UV0 = 3, //!< texture coordinates (float2)
|
||||
UV1 = 4, //!< texture coordinates (float2)
|
||||
BONE_INDICES = 5, //!< indices of 4 bones, as unsigned integers (uvec4)
|
||||
BONE_WEIGHTS = 6, //!< weights of the 4 bones (normalized float4)
|
||||
// -- we have 1 unused slot here --
|
||||
CUSTOM0 = 8,
|
||||
CUSTOM1 = 9,
|
||||
CUSTOM2 = 10,
|
||||
CUSTOM3 = 11,
|
||||
CUSTOM4 = 12,
|
||||
CUSTOM5 = 13,
|
||||
CUSTOM6 = 14,
|
||||
CUSTOM7 = 15,
|
||||
|
||||
// Aliases for legacy vertex morphing.
|
||||
// See RenderableManager::Builder::morphing().
|
||||
MORPH_POSITION_0 = CUSTOM0,
|
||||
MORPH_POSITION_1 = CUSTOM1,
|
||||
MORPH_POSITION_2 = CUSTOM2,
|
||||
MORPH_POSITION_3 = CUSTOM3,
|
||||
MORPH_TANGENTS_0 = CUSTOM4,
|
||||
MORPH_TANGENTS_1 = CUSTOM5,
|
||||
MORPH_TANGENTS_2 = CUSTOM6,
|
||||
MORPH_TANGENTS_3 = CUSTOM7,
|
||||
|
||||
// this is limited by driver::MAX_VERTEX_ATTRIBUTE_COUNT
|
||||
};
|
||||
|
||||
static constexpr size_t MAX_LEGACY_MORPH_TARGETS = 4;
|
||||
static constexpr size_t MAX_MORPH_TARGETS = 256; // this is limited by filament::CONFIG_MAX_MORPH_TARGET_COUNT
|
||||
static constexpr size_t MAX_CUSTOM_ATTRIBUTES = 8;
|
||||
|
||||
/**
|
||||
* Material domains
|
||||
*/
|
||||
enum class MaterialDomain : uint8_t {
|
||||
SURFACE = 0, //!< shaders applied to renderables
|
||||
POST_PROCESS = 1, //!< shaders applied to rendered buffers
|
||||
COMPUTE = 2, //!< compute shader
|
||||
};
|
||||
|
||||
/**
|
||||
* Specular occlusion
|
||||
*/
|
||||
enum class SpecularAmbientOcclusion : uint8_t {
|
||||
NONE = 0, //!< no specular occlusion
|
||||
SIMPLE = 1, //!< simple specular occlusion
|
||||
BENT_NORMALS = 2, //!< more accurate specular occlusion, requires bent normals
|
||||
};
|
||||
|
||||
/**
|
||||
* Refraction
|
||||
*/
|
||||
enum class RefractionMode : uint8_t {
|
||||
NONE = 0, //!< no refraction
|
||||
CUBEMAP = 1, //!< refracted rays go to the ibl cubemap
|
||||
SCREEN_SPACE = 2, //!< refracted rays go to screen space
|
||||
};
|
||||
|
||||
/**
|
||||
* Refraction type
|
||||
*/
|
||||
enum class RefractionType : uint8_t {
|
||||
SOLID = 0, //!< refraction through solid objects (e.g. a sphere)
|
||||
THIN = 1, //!< refraction through thin objects (e.g. window)
|
||||
};
|
||||
|
||||
/**
|
||||
* Reflection mode
|
||||
*/
|
||||
enum class ReflectionMode : uint8_t {
|
||||
DEFAULT = 0, //! reflections sample from the scene's IBL only
|
||||
SCREEN_SPACE = 1, //! reflections sample from screen space, and fallback to the scene's IBL
|
||||
};
|
||||
|
||||
// can't really use std::underlying_type<AttributeIndex>::type because the driver takes a uint32_t
|
||||
using AttributeBitset = utils::bitset32;
|
||||
|
||||
static constexpr size_t MATERIAL_PROPERTIES_COUNT = 26;
|
||||
enum class Property : uint8_t {
|
||||
BASE_COLOR, //!< float4, all shading models
|
||||
ROUGHNESS, //!< float, lit shading models only
|
||||
METALLIC, //!< float, all shading models, except unlit and cloth
|
||||
REFLECTANCE, //!< float, all shading models, except unlit and cloth
|
||||
AMBIENT_OCCLUSION, //!< float, lit shading models only, except subsurface and cloth
|
||||
CLEAR_COAT, //!< float, lit shading models only, except subsurface and cloth
|
||||
CLEAR_COAT_ROUGHNESS, //!< float, lit shading models only, except subsurface and cloth
|
||||
CLEAR_COAT_NORMAL, //!< float, lit shading models only, except subsurface and cloth
|
||||
ANISOTROPY, //!< float, lit shading models only, except subsurface and cloth
|
||||
ANISOTROPY_DIRECTION, //!< float3, lit shading models only, except subsurface and cloth
|
||||
THICKNESS, //!< float, subsurface shading model only
|
||||
SUBSURFACE_POWER, //!< float, subsurface shading model only
|
||||
SUBSURFACE_COLOR, //!< float3, subsurface and cloth shading models only
|
||||
SHEEN_COLOR, //!< float3, lit shading models only, except subsurface
|
||||
SHEEN_ROUGHNESS, //!< float3, lit shading models only, except subsurface and cloth
|
||||
SPECULAR_COLOR, //!< float3, specular-glossiness shading model only
|
||||
GLOSSINESS, //!< float, specular-glossiness shading model only
|
||||
EMISSIVE, //!< float4, all shading models
|
||||
NORMAL, //!< float3, all shading models only, except unlit
|
||||
POST_LIGHTING_COLOR, //!< float4, all shading models
|
||||
CLIP_SPACE_TRANSFORM, //!< mat4, vertex shader only
|
||||
ABSORPTION, //!< float3, how much light is absorbed by the material
|
||||
TRANSMISSION, //!< float, how much light is refracted through the material
|
||||
IOR, //!< float, material's index of refraction
|
||||
MICRO_THICKNESS, //!< float, thickness of the thin layer
|
||||
BENT_NORMAL, //!< float3, all shading models only, except unlit
|
||||
|
||||
// when adding new Properties, make sure to update MATERIAL_PROPERTIES_COUNT
|
||||
};
|
||||
|
||||
enum class UserVariantFilterBit : uint32_t {
|
||||
DIRECTIONAL_LIGHTING = 0x01,
|
||||
DYNAMIC_LIGHTING = 0x02,
|
||||
SHADOW_RECEIVER = 0x04,
|
||||
SKINNING = 0x08,
|
||||
FOG = 0x10,
|
||||
VSM = 0x20,
|
||||
SSR = 0x40,
|
||||
};
|
||||
|
||||
using UserVariantFilterMask = uint32_t;
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,475 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_MATERIALINSTANCE_H
|
||||
#define TNT_FILAMENT_MATERIALINSTANCE_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/Color.h>
|
||||
|
||||
#include <filament/MaterialEnums.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Material;
|
||||
class Texture;
|
||||
class TextureSampler;
|
||||
class UniformBuffer;
|
||||
class BufferInterfaceBlock;
|
||||
|
||||
class UTILS_PUBLIC MaterialInstance : public FilamentAPI {
|
||||
template<size_t N>
|
||||
using StringLiteralHelper = const char[N];
|
||||
|
||||
struct StringLiteral {
|
||||
const char* data;
|
||||
size_t size;
|
||||
template<size_t N>
|
||||
StringLiteral(StringLiteralHelper<N> const& s) noexcept // NOLINT(google-explicit-constructor)
|
||||
: data(s), size(N - 1) {
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
using CullingMode = filament::backend::CullingMode;
|
||||
using TransparencyMode = filament::TransparencyMode;
|
||||
using StencilCompareFunc = filament::backend::SamplerCompareFunc;
|
||||
using StencilOperation = filament::backend::StencilOperation;
|
||||
using StencilFace = filament::backend::StencilFace;
|
||||
|
||||
template<typename T>
|
||||
using is_supported_parameter_t = typename std::enable_if<
|
||||
std::is_same<float, T>::value ||
|
||||
std::is_same<int32_t, T>::value ||
|
||||
std::is_same<uint32_t, T>::value ||
|
||||
std::is_same<math::int2, T>::value ||
|
||||
std::is_same<math::int3, T>::value ||
|
||||
std::is_same<math::int4, T>::value ||
|
||||
std::is_same<math::uint2, T>::value ||
|
||||
std::is_same<math::uint3, T>::value ||
|
||||
std::is_same<math::uint4, T>::value ||
|
||||
std::is_same<math::float2, T>::value ||
|
||||
std::is_same<math::float3, T>::value ||
|
||||
std::is_same<math::float4, T>::value ||
|
||||
std::is_same<math::mat4f, T>::value ||
|
||||
// these types are slower as they need a layout conversion
|
||||
std::is_same<bool, T>::value ||
|
||||
std::is_same<math::bool2, T>::value ||
|
||||
std::is_same<math::bool3, T>::value ||
|
||||
std::is_same<math::bool4, T>::value ||
|
||||
std::is_same<math::mat3f, T>::value
|
||||
>::type;
|
||||
|
||||
/**
|
||||
* Creates a new MaterialInstance using another MaterialInstance as a template for initialization.
|
||||
* The new MaterialInstance is an instance of the same Material of the template instance and
|
||||
* must be destroyed just like any other MaterialInstance.
|
||||
*
|
||||
* @param other A MaterialInstance to use as a template for initializing a new instance
|
||||
* @param name A name for the new MaterialInstance or nullptr to use the template's name
|
||||
* @return A new MaterialInstance
|
||||
*/
|
||||
static MaterialInstance* duplicate(MaterialInstance const* other, const char* name = nullptr) noexcept;
|
||||
|
||||
/**
|
||||
* @return the Material associated with this instance
|
||||
*/
|
||||
Material const* getMaterial() const noexcept;
|
||||
|
||||
/**
|
||||
* @return the name associated with this instance
|
||||
*/
|
||||
const char* getName() const noexcept;
|
||||
|
||||
/**
|
||||
* Set a uniform by name
|
||||
*
|
||||
* @param name Name of the parameter as defined by Material. Cannot be nullptr.
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param value Value of the parameter to set.
|
||||
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
|
||||
*/
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
void setParameter(const char* name, size_t nameLength, T const& value);
|
||||
|
||||
/** inline helper to provide the name as a null-terminated string literal */
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
inline void setParameter(StringLiteral name, T const& value) {
|
||||
setParameter<T>(name.data, name.size, value);
|
||||
}
|
||||
|
||||
/** inline helper to provide the name as a null-terminated C string */
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
inline void setParameter(const char* name, T const& value) {
|
||||
setParameter<T>(name, strlen(name), value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a uniform array by name
|
||||
*
|
||||
* @param name Name of the parameter array as defined by Material. Cannot be nullptr.
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param values Array of values to set to the named parameter array.
|
||||
* @param count Size of the array to set.
|
||||
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
|
||||
*/
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
void setParameter(const char* name, size_t nameLength, const T* values, size_t count);
|
||||
|
||||
/** inline helper to provide the name as a null-terminated string literal */
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
inline void setParameter(StringLiteral name, const T* values, size_t count) {
|
||||
setParameter<T>(name.data, name.size, values, count);
|
||||
}
|
||||
|
||||
/** inline helper to provide the name as a null-terminated C string */
|
||||
template<typename T, typename = is_supported_parameter_t<T>>
|
||||
inline void setParameter(const char* name, const T* values, size_t count) {
|
||||
setParameter<T>(name, strlen(name), values, count);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a texture as the named parameter
|
||||
*
|
||||
* Note: Depth textures can't be sampled with a linear filter unless the comparison mode is set
|
||||
* to COMPARE_TO_TEXTURE.
|
||||
*
|
||||
* @param name Name of the parameter as defined by Material. Cannot be nullptr.
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param texture Non nullptr Texture object pointer.
|
||||
* @param sampler Sampler parameters.
|
||||
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
|
||||
*/
|
||||
void setParameter(const char* name, size_t nameLength,
|
||||
Texture const* texture, TextureSampler const& sampler);
|
||||
|
||||
/** inline helper to provide the name as a null-terminated string literal */
|
||||
inline void setParameter(StringLiteral name,
|
||||
Texture const* texture, TextureSampler const& sampler) {
|
||||
setParameter(name.data, name.size, texture, sampler);
|
||||
}
|
||||
|
||||
/** inline helper to provide the name as a null-terminated C string */
|
||||
inline void setParameter(const char* name,
|
||||
Texture const* texture, TextureSampler const& sampler) {
|
||||
setParameter(name, strlen(name), texture, sampler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set an RGB color as the named parameter.
|
||||
* A conversion might occur depending on the specified type
|
||||
*
|
||||
* @param name Name of the parameter as defined by Material. Cannot be nullptr.
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param type Whether the color value is encoded as Linear or sRGB.
|
||||
* @param color Array of read, green, blue channels values.
|
||||
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
|
||||
*/
|
||||
void setParameter(const char* name, size_t nameLength, RgbType type, math::float3 color);
|
||||
|
||||
/** inline helper to provide the name as a null-terminated string literal */
|
||||
inline void setParameter(StringLiteral name, RgbType type, math::float3 color) {
|
||||
setParameter(name.data, name.size, type, color);
|
||||
}
|
||||
|
||||
/** inline helper to provide the name as a null-terminated C string */
|
||||
inline void setParameter(const char* name, RgbType type, math::float3 color) {
|
||||
setParameter(name, strlen(name), type, color);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set an RGBA color as the named parameter.
|
||||
* A conversion might occur depending on the specified type
|
||||
*
|
||||
* @param name Name of the parameter as defined by Material. Cannot be nullptr.
|
||||
* @param nameLength Length in `char` of the name parameter.
|
||||
* @param type Whether the color value is encoded as Linear or sRGB/A.
|
||||
* @param color Array of read, green, blue and alpha channels values.
|
||||
* @throws utils::PreConditionPanic if name doesn't exist or no-op if exceptions are disabled.
|
||||
*/
|
||||
void setParameter(const char* name, size_t nameLength, RgbaType type, math::float4 color);
|
||||
|
||||
/** inline helper to provide the name as a null-terminated string literal */
|
||||
inline void setParameter(StringLiteral name, RgbaType type, math::float4 color) {
|
||||
setParameter(name.data, name.size, type, color);
|
||||
}
|
||||
|
||||
/** inline helper to provide the name as a null-terminated C string */
|
||||
inline void setParameter(const char* name, RgbaType type, math::float4 color) {
|
||||
setParameter(name, strlen(name), type, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set-up a custom scissor rectangle; by default it is disabled.
|
||||
*
|
||||
* The scissor rectangle gets clipped by the View's viewport, in other words, the scissor
|
||||
* cannot affect fragments outside of the View's Viewport.
|
||||
*
|
||||
* Currently the scissor is not compatible with dynamic resolution and should always be
|
||||
* disabled when dynamic resolution is used.
|
||||
*
|
||||
* @param left left coordinate of the scissor box relative to the viewport
|
||||
* @param bottom bottom coordinate of the scissor box relative to the viewport
|
||||
* @param width width of the scissor box
|
||||
* @param height height of the scissor box
|
||||
*
|
||||
* @see unsetScissor
|
||||
* @see View::setViewport
|
||||
* @see View::setDynamicResolutionOptions
|
||||
*/
|
||||
void setScissor(uint32_t left, uint32_t bottom, uint32_t width, uint32_t height) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the scissor rectangle to its default disabled setting.
|
||||
*
|
||||
* Currently the scissor is not compatible with dynamic resolution and should always be
|
||||
* disabled when dynamic resolution is used.
|
||||
*
|
||||
* @see View::setDynamicResolutionOptions
|
||||
*/
|
||||
void unsetScissor() noexcept;
|
||||
|
||||
/**
|
||||
* Sets a polygon offset that will be applied to all renderables drawn with this material
|
||||
* instance.
|
||||
*
|
||||
* The value of the offset is scale * dz + r * constant, where dz is the change in depth
|
||||
* relative to the screen area of the triangle, and r is the smallest value that is guaranteed
|
||||
* to produce a resolvable offset for a given implementation. This offset is added before the
|
||||
* depth test.
|
||||
*
|
||||
* @warning using a polygon offset other than zero has a significant negative performance
|
||||
* impact, as most implementations have to disable early depth culling. DO NOT USE unless
|
||||
* absolutely necessary.
|
||||
*
|
||||
* @param scale scale factor used to create a variable depth offset for each triangle
|
||||
* @param constant scale factor used to create a constant depth offset for each triangle
|
||||
*/
|
||||
void setPolygonOffset(float scale, float constant) noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the minimum alpha value a fragment must have to not be discarded when the blend
|
||||
* mode is MASKED. Defaults to 0.4 if it has not been set in the parent Material. The specified
|
||||
* value should be between 0 and 1 and will be clamped if necessary.
|
||||
*/
|
||||
void setMaskThreshold(float threshold) noexcept;
|
||||
|
||||
/**
|
||||
* Gets the minimum alpha value a fragment must have to not be discarded when the blend
|
||||
* mode is MASKED
|
||||
*/
|
||||
float getMaskThreshold() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the screen space variance of the filter kernel used when applying specular
|
||||
* anti-aliasing. The default value is set to 0.15. The specified value should be between
|
||||
* 0 and 1 and will be clamped if necessary.
|
||||
*/
|
||||
void setSpecularAntiAliasingVariance(float variance) noexcept;
|
||||
|
||||
/**
|
||||
* Gets the screen space variance of the filter kernel used when applying specular
|
||||
* anti-aliasing.
|
||||
*/
|
||||
float getSpecularAntiAliasingVariance() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the clamping threshold used to suppress estimation errors when applying specular
|
||||
* anti-aliasing. The default value is set to 0.2. The specified value should be between 0
|
||||
* and 1 and will be clamped if necessary.
|
||||
*/
|
||||
void setSpecularAntiAliasingThreshold(float threshold) noexcept;
|
||||
|
||||
/**
|
||||
* Gets the clamping threshold used to suppress estimation errors when applying specular
|
||||
* anti-aliasing.
|
||||
*/
|
||||
float getSpecularAntiAliasingThreshold() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables double-sided lighting if the parent Material has double-sided capability,
|
||||
* otherwise prints a warning. If double-sided lighting is enabled, backface culling is
|
||||
* automatically disabled.
|
||||
*/
|
||||
void setDoubleSided(bool doubleSided) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether double-sided lighting is enabled when the parent Material has double-sided
|
||||
* capability.
|
||||
*/
|
||||
bool isDoubleSided() const noexcept;
|
||||
|
||||
/**
|
||||
* Specifies how transparent objects should be rendered (default is DEFAULT).
|
||||
*/
|
||||
void setTransparencyMode(TransparencyMode mode) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the transparency mode.
|
||||
*/
|
||||
TransparencyMode getTransparencyMode() const noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the default triangle culling state that was set on the material.
|
||||
*/
|
||||
void setCullingMode(CullingMode culling) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the face culling mode.
|
||||
*/
|
||||
CullingMode getCullingMode() const noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the default color-buffer write state that was set on the material.
|
||||
*/
|
||||
void setColorWrite(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether color write is enabled.
|
||||
*/
|
||||
bool isColorWriteEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the default depth-buffer write state that was set on the material.
|
||||
*/
|
||||
void setDepthWrite(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether depth write is enabled.
|
||||
*/
|
||||
bool isDepthWriteEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the default depth testing state that was set on the material.
|
||||
*/
|
||||
void setDepthCulling(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether depth culling is enabled.
|
||||
*/
|
||||
bool isDepthCullingEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Overrides the default stencil-buffer write state that was set on the material.
|
||||
*/
|
||||
void setStencilWrite(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether stencil write is enabled.
|
||||
*/
|
||||
bool isStencilWriteEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stencil comparison function (default is StencilCompareFunc::A).
|
||||
*
|
||||
* It's possible to set separate stencil comparison functions; one for front-facing polygons,
|
||||
* and one for back-facing polygons. The face parameter determines the comparison function(s)
|
||||
* updated by this call.
|
||||
*/
|
||||
void setStencilCompareFunction(StencilCompareFunc func,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stencil fail operation (default is StencilOperation::KEEP).
|
||||
*
|
||||
* The stencil fail operation is performed to update values in the stencil buffer when the
|
||||
* stencil test fails.
|
||||
*
|
||||
* It's possible to set separate stencil fail operations; one for front-facing polygons, and one
|
||||
* for back-facing polygons. The face parameter determines the stencil fail operation(s) updated
|
||||
* by this call.
|
||||
*/
|
||||
void setStencilOpStencilFail(StencilOperation op,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the depth fail operation (default is StencilOperation::KEEP).
|
||||
*
|
||||
* The depth fail operation is performed to update values in the stencil buffer when the depth
|
||||
* test fails.
|
||||
*
|
||||
* It's possible to set separate depth fail operations; one for front-facing polygons, and one
|
||||
* for back-facing polygons. The face parameter determines the depth fail operation(s) updated
|
||||
* by this call.
|
||||
*/
|
||||
void setStencilOpDepthFail(StencilOperation op,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the depth-stencil pass operation (default is StencilOperation::KEEP).
|
||||
*
|
||||
* The depth-stencil pass operation is performed to update values in the stencil buffer when
|
||||
* both the stencil test and depth test pass.
|
||||
*
|
||||
* It's possible to set separate depth-stencil pass operations; one for front-facing polygons,
|
||||
* and one for back-facing polygons. The face parameter determines the depth-stencil pass
|
||||
* operation(s) updated by this call.
|
||||
*/
|
||||
void setStencilOpDepthStencilPass(StencilOperation op,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stencil reference value (default is 0).
|
||||
*
|
||||
* The stencil reference value is the left-hand side for stencil comparison tests. It's also
|
||||
* used as the replacement stencil value when StencilOperation is REPLACE.
|
||||
*
|
||||
* It's possible to set separate stencil reference values; one for front-facing polygons, and
|
||||
* one for back-facing polygons. The face parameter determines the reference value(s) updated by
|
||||
* this call.
|
||||
*/
|
||||
void setStencilReferenceValue(uint8_t value,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stencil read mask (default is 0xFF).
|
||||
*
|
||||
* The stencil read mask masks the bits of the values participating in the stencil comparison
|
||||
* test- both the value read from the stencil buffer and the reference value.
|
||||
*
|
||||
* It's possible to set separate stencil read masks; one for front-facing polygons, and one for
|
||||
* back-facing polygons. The face parameter determines the stencil read mask(s) updated by this
|
||||
* call.
|
||||
*/
|
||||
void setStencilReadMask(uint8_t readMask,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the stencil write mask (default is 0xFF).
|
||||
*
|
||||
* The stencil write mask masks the bits in the stencil buffer updated by stencil operations.
|
||||
*
|
||||
* It's possible to set separate stencil write masks; one for front-facing polygons, and one for
|
||||
* back-facing polygons. The face parameter determines the stencil write mask(s) updated by this
|
||||
* call.
|
||||
*/
|
||||
void setStencilWriteMask(uint8_t writeMask,
|
||||
StencilFace face = StencilFace::FRONT_AND_BACK) noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_MATERIALINSTANCE_H
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_MORPHTARGETBUFFER_H
|
||||
#define TNT_FILAMENT_MORPHTARGETBUFFER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <filament/Engine.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* MorphTargetBuffer is used to hold morphing data (positions and tangents).
|
||||
*
|
||||
* Both positions and tangents are required.
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC MorphTargetBuffer : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Size of the morph targets in vertex counts.
|
||||
* @param vertexCount Number of vertex counts the morph targets can hold.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& vertexCount(size_t vertexCount) noexcept;
|
||||
|
||||
/**
|
||||
* Size of the morph targets in targets.
|
||||
* @param count Number of targets the morph targets can hold.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& count(size_t count) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the MorphTargetBuffer object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this MorphTargetBuffer with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
MorphTargetBuffer* build(Engine& engine);
|
||||
private:
|
||||
friend class FMorphTargetBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates positions for the given morph target.
|
||||
*
|
||||
* This is equivalent to the float4 method, but uses 1.0 for the 4th component.
|
||||
*
|
||||
* Both positions and tangents must be provided.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
|
||||
* @param targetIndex the index of morph target to be updated.
|
||||
* @param positions pointer to at least "count" positions
|
||||
* @param count number of float3 vectors in positions
|
||||
* @param offset offset into the target buffer, expressed as a number of float4 vectors
|
||||
* @see setTangentsAt
|
||||
*/
|
||||
void setPositionsAt(Engine& engine, size_t targetIndex,
|
||||
math::float3 const* positions, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Updates positions for the given morph target.
|
||||
*
|
||||
* Both positions and tangents must be provided.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
|
||||
* @param targetIndex the index of morph target to be updated.
|
||||
* @param positions pointer to at least "count" positions
|
||||
* @param count number of float4 vectors in positions
|
||||
* @param offset offset into the target buffer, expressed as a number of float4 vectors
|
||||
* @see setTangentsAt
|
||||
*/
|
||||
void setPositionsAt(Engine& engine, size_t targetIndex,
|
||||
math::float4 const* positions, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Updates tangents for the given morph target.
|
||||
*
|
||||
* These quaternions must be represented as signed shorts, where real numbers in the [-1,+1]
|
||||
* range multiplied by 32767.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine associated with this MorphTargetBuffer.
|
||||
* @param targetIndex the index of morph target to be updated.
|
||||
* @param tangents pointer to at least "count" tangents
|
||||
* @param count number of short4 quaternions in tangents
|
||||
* @param offset offset into the target buffer, expressed as a number of short4 vectors
|
||||
* @see setPositionsAt
|
||||
*/
|
||||
void setTangentsAt(Engine& engine, size_t targetIndex,
|
||||
math::short4 const* tangents, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Returns the vertex count of this MorphTargetBuffer.
|
||||
* @return The number of vertices the MorphTargetBuffer holds.
|
||||
*/
|
||||
size_t getVertexCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the target count of this MorphTargetBuffer.
|
||||
* @return The number of targets the MorphTargetBuffer holds.
|
||||
*/
|
||||
size_t getCount() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif //TNT_FILAMENT_MORPHTARGETBUFFER_H
|
||||
524
flutter_filament/windows/include/filament/filament/Options.h
Normal file
524
flutter_filament/windows/include/filament/filament/Options.h
Normal file
@@ -0,0 +1,524 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_OPTIONS_H
|
||||
#define TNT_FILAMENT_OPTIONS_H
|
||||
|
||||
#include <filament/Color.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Texture;
|
||||
|
||||
/**
|
||||
* Generic quality level.
|
||||
*/
|
||||
enum class QualityLevel : uint8_t {
|
||||
LOW,
|
||||
MEDIUM,
|
||||
HIGH,
|
||||
ULTRA
|
||||
};
|
||||
|
||||
enum class BlendMode : uint8_t {
|
||||
OPAQUE,
|
||||
TRANSLUCENT
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamic resolution can be used to either reach a desired target frame rate
|
||||
* by lowering the resolution of a View, or to increase the quality when the
|
||||
* rendering is faster than the target frame rate.
|
||||
*
|
||||
* This structure can be used to specify the minimum scale factor used when
|
||||
* lowering the resolution of a View, and the maximum scale factor used when
|
||||
* increasing the resolution for higher quality rendering. The scale factors
|
||||
* can be controlled on each X and Y axis independently. By default, all scale
|
||||
* factors are set to 1.0.
|
||||
*
|
||||
* enabled: enable or disables dynamic resolution on a View
|
||||
*
|
||||
* homogeneousScaling: by default the system scales the major axis first. Set this to true
|
||||
* to force homogeneous scaling.
|
||||
*
|
||||
* minScale: the minimum scale in X and Y this View should use
|
||||
*
|
||||
* maxScale: the maximum scale in X and Y this View should use
|
||||
*
|
||||
* quality: upscaling quality.
|
||||
* LOW: 1 bilinear tap, Medium: 4 bilinear taps, High: 9 bilinear taps (tent)
|
||||
*
|
||||
* \note
|
||||
* Dynamic resolution is only supported on platforms where the time to render
|
||||
* a frame can be measured accurately. Dynamic resolution is currently only
|
||||
* supported on Android.
|
||||
*
|
||||
* @see Renderer::FrameRateOptions
|
||||
*
|
||||
*/
|
||||
struct DynamicResolutionOptions {
|
||||
math::float2 minScale = {0.5f, 0.5f}; //!< minimum scale factors in x and y %codegen_java_float%
|
||||
math::float2 maxScale = {1.0f, 1.0f}; //!< maximum scale factors in x and y %codegen_java_float%
|
||||
float sharpness = 0.9f; //!< sharpness when QualityLevel::MEDIUM or higher is used [0 (disabled), 1 (sharpest)]
|
||||
bool enabled = false; //!< enable or disable dynamic resolution
|
||||
bool homogeneousScaling = false; //!< set to true to force homogeneous scaling
|
||||
|
||||
/**
|
||||
* Upscaling quality
|
||||
* LOW: bilinear filtered blit. Fastest, poor quality
|
||||
* MEDIUM: AMD FidelityFX FSR1 w/ mobile optimizations
|
||||
* HIGH: AMD FidelityFX FSR1 w/ mobile optimizations
|
||||
* ULTRA: AMD FidelityFX FSR1
|
||||
* FSR1 require a well anti-aliased (MSAA or TAA), noise free scene.
|
||||
*
|
||||
* The default upscaling quality is set to LOW.
|
||||
*/
|
||||
QualityLevel quality = QualityLevel::LOW;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options to control the bloom effect
|
||||
*
|
||||
* enabled: Enable or disable the bloom post-processing effect. Disabled by default.
|
||||
*
|
||||
* levels: Number of successive blurs to achieve the blur effect, the minimum is 3 and the
|
||||
* maximum is 12. This value together with resolution influences the spread of the
|
||||
* blur effect. This value can be silently reduced to accommodate the original
|
||||
* image size.
|
||||
*
|
||||
* resolution: Resolution of bloom's minor axis. The minimum value is 2^levels and the
|
||||
* the maximum is lower of the original resolution and 4096. This parameter is
|
||||
* silently clamped to the minimum and maximum.
|
||||
* It is highly recommended that this value be smaller than the target resolution
|
||||
* after dynamic resolution is applied (horizontally and vertically).
|
||||
*
|
||||
* strength: how much of the bloom is added to the original image. Between 0 and 1.
|
||||
*
|
||||
* blendMode: Whether the bloom effect is purely additive (false) or mixed with the original
|
||||
* image (true).
|
||||
*
|
||||
* anamorphism: Bloom's aspect ratio (x/y), for artistic purposes.
|
||||
*
|
||||
* threshold: When enabled, a threshold at 1.0 is applied on the source image, this is
|
||||
* useful for artistic reasons and is usually needed when a dirt texture is used.
|
||||
*
|
||||
* dirt: A dirt/scratch/smudges texture (that can be RGB), which gets added to the
|
||||
* bloom effect. Smudges are visible where bloom occurs. Threshold must be
|
||||
* enabled for the dirt effect to work properly.
|
||||
*
|
||||
* dirtStrength: Strength of the dirt texture.
|
||||
*/
|
||||
struct BloomOptions {
|
||||
enum class BlendMode : uint8_t {
|
||||
ADD, //!< Bloom is modulated by the strength parameter and added to the scene
|
||||
INTERPOLATE //!< Bloom is interpolated with the scene using the strength parameter
|
||||
};
|
||||
Texture* dirt = nullptr; //!< user provided dirt texture %codegen_skip_json% %codegen_skip_javascript%
|
||||
float dirtStrength = 0.2f; //!< strength of the dirt texture %codegen_skip_json% %codegen_skip_javascript%
|
||||
float strength = 0.10f; //!< bloom's strength between 0.0 and 1.0
|
||||
uint32_t resolution = 360; //!< resolution of vertical axis (2^levels to 2048)
|
||||
float anamorphism = 1.0f; //!< bloom x/y aspect-ratio (1/32 to 32)
|
||||
uint8_t levels = 6; //!< number of blur levels (3 to 11)
|
||||
BlendMode blendMode = BlendMode::ADD; //!< how the bloom effect is applied
|
||||
bool threshold = true; //!< whether to threshold the source
|
||||
bool enabled = false; //!< enable or disable bloom
|
||||
float highlight = 1000.0f; //!< limit highlights to this value before bloom [10, +inf]
|
||||
|
||||
bool lensFlare = false; //!< enable screen-space lens flare
|
||||
bool starburst = true; //!< enable starburst effect on lens flare
|
||||
float chromaticAberration = 0.005f; //!< amount of chromatic aberration
|
||||
uint8_t ghostCount = 4; //!< number of flare "ghosts"
|
||||
float ghostSpacing = 0.6f; //!< spacing of the ghost in screen units [0, 1[
|
||||
float ghostThreshold = 10.0f; //!< hdr threshold for the ghosts
|
||||
float haloThickness = 0.1f; //!< thickness of halo in vertical screen units, 0 to disable
|
||||
float haloRadius = 0.4f; //!< radius of halo in vertical screen units [0, 0.5]
|
||||
float haloThreshold = 10.0f; //!< hdr threshold for the halo
|
||||
};
|
||||
|
||||
/**
|
||||
* Options to control large-scale fog in the scene
|
||||
*/
|
||||
struct FogOptions {
|
||||
/**
|
||||
* Distance in world units [m] from the camera to where the fog starts ( >= 0.0 )
|
||||
*/
|
||||
float distance = 0.0f;
|
||||
|
||||
/**
|
||||
* Distance in world units [m] after which the fog calculation is disabled.
|
||||
* This can be used to exclude the skybox, which is desirable if it already contains clouds or
|
||||
* fog. The default value is +infinity which applies the fog to everything.
|
||||
*
|
||||
* Note: The SkyBox is typically at a distance of 1e19 in world space (depending on the near
|
||||
* plane distance and projection used though).
|
||||
*/
|
||||
float cutOffDistance = INFINITY;
|
||||
|
||||
/**
|
||||
* fog's maximum opacity between 0 and 1
|
||||
*/
|
||||
float maximumOpacity = 1.0f;
|
||||
|
||||
/**
|
||||
* Fog's floor in world units [m]. This sets the "sea level".
|
||||
*/
|
||||
float height = 0.0f;
|
||||
|
||||
/**
|
||||
* How fast the fog dissipates with altitude. heightFalloff has a unit of [1/m].
|
||||
* It can be expressed as 1/H, where H is the altitude change in world units [m] that causes a
|
||||
* factor 2.78 (e) change in fog density.
|
||||
*
|
||||
* A falloff of 0 means the fog density is constant everywhere and may result is slightly
|
||||
* faster computations.
|
||||
*/
|
||||
float heightFalloff = 1.0f;
|
||||
|
||||
/**
|
||||
* Fog's color is used for ambient light in-scattering, a good value is
|
||||
* to use the average of the ambient light, possibly tinted towards blue
|
||||
* for outdoors environments. Color component's values should be between 0 and 1, values
|
||||
* above one are allowed but could create a non energy-conservative fog (this is dependant
|
||||
* on the IBL's intensity as well).
|
||||
*
|
||||
* We assume that our fog has no absorption and therefore all the light it scatters out
|
||||
* becomes ambient light in-scattering and has lost all directionality, i.e.: scattering is
|
||||
* isotropic. This somewhat simulates Rayleigh scattering.
|
||||
*
|
||||
* This value is used as a tint instead, when fogColorFromIbl is enabled.
|
||||
*
|
||||
* @see fogColorFromIbl
|
||||
*/
|
||||
LinearColor color = { 1.0f, 1.0f, 1.0f };
|
||||
|
||||
/**
|
||||
* Extinction factor in [1/m] at altitude 'height'. The extinction factor controls how much
|
||||
* light is absorbed and out-scattered per unit of distance. Each unit of extinction reduces
|
||||
* the incoming light to 37% of its original value.
|
||||
*
|
||||
* Note: The extinction factor is related to the fog density, it's usually some constant K times
|
||||
* the density at sea level (more specifically at fog height). The constant K depends on
|
||||
* the composition of the fog/atmosphere.
|
||||
*
|
||||
* For historical reason this parameter is called `density`.
|
||||
*/
|
||||
float density = 0.1f;
|
||||
|
||||
/**
|
||||
* Distance in world units [m] from the camera where the Sun in-scattering starts.
|
||||
*/
|
||||
float inScatteringStart = 0.0f;
|
||||
|
||||
/**
|
||||
* Very inaccurately simulates the Sun's in-scattering. That is, the light from the sun that
|
||||
* is scattered (by the fog) towards the camera.
|
||||
* Size of the Sun in-scattering (>0 to activate). Good values are >> 1 (e.g. ~10 - 100).
|
||||
* Smaller values result is a larger scattering size.
|
||||
*/
|
||||
float inScatteringSize = -1.0f;
|
||||
|
||||
/**
|
||||
* The fog color will be sampled from the IBL in the view direction and tinted by `color`.
|
||||
* Depending on the scene this can produce very convincing results.
|
||||
* This simulate a more anisotropic phase-function.
|
||||
*/
|
||||
bool fogColorFromIbl = false;
|
||||
|
||||
/**
|
||||
* Enable or disable large-scale fog
|
||||
*/
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options to control Depth of Field (DoF) effect in the scene.
|
||||
*
|
||||
* cocScale can be used to set the depth of field blur independently from the camera
|
||||
* aperture, e.g. for artistic reasons. This can be achieved by setting:
|
||||
* cocScale = cameraAperture / desiredDoFAperture
|
||||
*
|
||||
* @see Camera
|
||||
*/
|
||||
struct DepthOfFieldOptions {
|
||||
enum class Filter : uint8_t {
|
||||
NONE,
|
||||
UNUSED,
|
||||
MEDIAN
|
||||
};
|
||||
float cocScale = 1.0f; //!< circle of confusion scale factor (amount of blur)
|
||||
float maxApertureDiameter = 0.01f; //!< maximum aperture diameter in meters (zero to disable rotation)
|
||||
bool enabled = false; //!< enable or disable depth of field effect
|
||||
Filter filter = Filter::MEDIAN; //!< filter to use for filling gaps in the kernel
|
||||
bool nativeResolution = false; //!< perform DoF processing at native resolution
|
||||
/**
|
||||
* Number of of rings used by the gather kernels. The number of rings affects quality
|
||||
* and performance. The actual number of sample per pixel is defined
|
||||
* as (ringCount * 2 - 1)^2. Here are a few commonly used values:
|
||||
* 3 rings : 25 ( 5x 5 grid)
|
||||
* 4 rings : 49 ( 7x 7 grid)
|
||||
* 5 rings : 81 ( 9x 9 grid)
|
||||
* 17 rings : 1089 (33x33 grid)
|
||||
*
|
||||
* With a maximum circle-of-confusion of 32, it is never necessary to use more than 17 rings.
|
||||
*
|
||||
* Usually all three settings below are set to the same value, however, it is often
|
||||
* acceptable to use a lower ring count for the "fast tiles", which improves performance.
|
||||
* Fast tiles are regions of the screen where every pixels have a similar
|
||||
* circle-of-confusion radius.
|
||||
*
|
||||
* A value of 0 means default, which is 5 on desktop and 3 on mobile.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
uint8_t foregroundRingCount = 0; //!< number of kernel rings for foreground tiles
|
||||
uint8_t backgroundRingCount = 0; //!< number of kernel rings for background tiles
|
||||
uint8_t fastGatherRingCount = 0; //!< number of kernel rings for fast tiles
|
||||
/** @}*/
|
||||
|
||||
/**
|
||||
* maximum circle-of-confusion in pixels for the foreground, must be in [0, 32] range.
|
||||
* A value of 0 means default, which is 32 on desktop and 24 on mobile.
|
||||
*/
|
||||
uint16_t maxForegroundCOC = 0;
|
||||
|
||||
/**
|
||||
* maximum circle-of-confusion in pixels for the background, must be in [0, 32] range.
|
||||
* A value of 0 means default, which is 32 on desktop and 24 on mobile.
|
||||
*/
|
||||
uint16_t maxBackgroundCOC = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options to control the vignetting effect.
|
||||
*/
|
||||
struct VignetteOptions {
|
||||
float midPoint = 0.5f; //!< high values restrict the vignette closer to the corners, between 0 and 1
|
||||
float roundness = 0.5f; //!< controls the shape of the vignette, from a rounded rectangle (0.0), to an oval (0.5), to a circle (1.0)
|
||||
float feather = 0.5f; //!< softening amount of the vignette effect, between 0 and 1
|
||||
LinearColorA color = {0.0f, 0.0f, 0.0f, 1.0f}; //!< color of the vignette effect, alpha is currently ignored
|
||||
bool enabled = false; //!< enables or disables the vignette effect
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure used to set the precision of the color buffer and related quality settings.
|
||||
*
|
||||
* @see setRenderQuality, getRenderQuality
|
||||
*/
|
||||
struct RenderQuality {
|
||||
/**
|
||||
* Sets the quality of the HDR color buffer.
|
||||
*
|
||||
* A quality of HIGH or ULTRA means using an RGB16F or RGBA16F color buffer. This means
|
||||
* colors in the LDR range (0..1) have a 10 bit precision. A quality of LOW or MEDIUM means
|
||||
* using an R11G11B10F opaque color buffer or an RGBA16F transparent color buffer. With
|
||||
* R11G11B10F colors in the LDR range have a precision of either 6 bits (red and green
|
||||
* channels) or 5 bits (blue channel).
|
||||
*/
|
||||
QualityLevel hdrColorBuffer = QualityLevel::HIGH;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for screen space Ambient Occlusion (SSAO) and Screen Space Cone Tracing (SSCT)
|
||||
* @see setAmbientOcclusionOptions()
|
||||
*/
|
||||
struct AmbientOcclusionOptions {
|
||||
float radius = 0.3f; //!< Ambient Occlusion radius in meters, between 0 and ~10.
|
||||
float power = 1.0f; //!< Controls ambient occlusion's contrast. Must be positive.
|
||||
float bias = 0.0005f; //!< Self-occlusion bias in meters. Use to avoid self-occlusion. Between 0 and a few mm.
|
||||
float resolution = 0.5f;//!< How each dimension of the AO buffer is scaled. Must be either 0.5 or 1.0.
|
||||
float intensity = 1.0f; //!< Strength of the Ambient Occlusion effect.
|
||||
float bilateralThreshold = 0.05f; //!< depth distance that constitute an edge for filtering
|
||||
QualityLevel quality = QualityLevel::LOW; //!< affects # of samples used for AO.
|
||||
QualityLevel lowPassFilter = QualityLevel::MEDIUM; //!< affects AO smoothness
|
||||
QualityLevel upsampling = QualityLevel::LOW; //!< affects AO buffer upsampling quality
|
||||
bool enabled = false; //!< enables or disables screen-space ambient occlusion
|
||||
bool bentNormals = false; //!< enables bent normals computation from AO, and specular AO
|
||||
float minHorizonAngleRad = 0.0f; //!< min angle in radian to consider
|
||||
/**
|
||||
* Screen Space Cone Tracing (SSCT) options
|
||||
* Ambient shadows from dominant light
|
||||
*/
|
||||
struct Ssct {
|
||||
float lightConeRad = 1.0f; //!< full cone angle in radian, between 0 and pi/2
|
||||
float shadowDistance = 0.3f; //!< how far shadows can be cast
|
||||
float contactDistanceMax = 1.0f; //!< max distance for contact
|
||||
float intensity = 0.8f; //!< intensity
|
||||
math::float3 lightDirection = { 0, -1, 0 }; //!< light direction
|
||||
float depthBias = 0.01f; //!< depth bias in world units (mitigate self shadowing)
|
||||
float depthSlopeBias = 0.01f; //!< depth slope bias (mitigate self shadowing)
|
||||
uint8_t sampleCount = 4; //!< tracing sample count, between 1 and 255
|
||||
uint8_t rayCount = 1; //!< # of rays to trace, between 1 and 255
|
||||
bool enabled = false; //!< enables or disables SSCT
|
||||
};
|
||||
Ssct ssct; // %codegen_skip_javascript% %codegen_java_flatten%
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for Temporal Multi-Sample Anti-aliasing (MSAA)
|
||||
* @see setMultiSampleAntiAliasingOptions()
|
||||
*/
|
||||
struct MultiSampleAntiAliasingOptions {
|
||||
bool enabled = false; //!< enables or disables msaa
|
||||
|
||||
/**
|
||||
* sampleCount number of samples to use for multi-sampled anti-aliasing.\n
|
||||
* 0: treated as 1
|
||||
* 1: no anti-aliasing
|
||||
* n: sample count. Effective sample could be different depending on the
|
||||
* GPU capabilities.
|
||||
*/
|
||||
uint8_t sampleCount = 4;
|
||||
|
||||
/**
|
||||
* custom resolve improves quality for HDR scenes, but may impact performance.
|
||||
*/
|
||||
bool customResolve = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for Temporal Anti-aliasing (TAA)
|
||||
* @see setTemporalAntiAliasingOptions()
|
||||
*/
|
||||
struct TemporalAntiAliasingOptions {
|
||||
float filterWidth = 1.0f; //!< reconstruction filter width typically between 0 (sharper, aliased) and 1 (smoother)
|
||||
float feedback = 0.04f; //!< history feedback, between 0 (maximum temporal AA) and 1 (no temporal AA).
|
||||
bool enabled = false; //!< enables or disables temporal anti-aliasing
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for Screen-space Reflections.
|
||||
* @see setScreenSpaceReflectionsOptions()
|
||||
*/
|
||||
struct ScreenSpaceReflectionsOptions {
|
||||
float thickness = 0.1f; //!< ray thickness, in world units
|
||||
float bias = 0.01f; //!< bias, in world units, to prevent self-intersections
|
||||
float maxDistance = 3.0f; //!< maximum distance, in world units, to raycast
|
||||
float stride = 2.0f; //!< stride, in texels, for samples along the ray.
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options for the screen-space guard band.
|
||||
* A guard band can be enabled to avoid some artifacts towards the edge of the screen when
|
||||
* using screen-space effects such as SSAO. Enabling the guard band reduces performance slightly.
|
||||
* Currently the guard band can only be enabled or disabled.
|
||||
*/
|
||||
struct GuardBandOptions {
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* List of available post-processing anti-aliasing techniques.
|
||||
* @see setAntiAliasing, getAntiAliasing, setSampleCount
|
||||
*/
|
||||
enum class AntiAliasing : uint8_t {
|
||||
NONE, //!< no anti aliasing performed as part of post-processing
|
||||
FXAA //!< FXAA is a low-quality but very efficient type of anti-aliasing. (default).
|
||||
};
|
||||
|
||||
/**
|
||||
* List of available post-processing dithering techniques.
|
||||
*/
|
||||
enum class Dithering : uint8_t {
|
||||
NONE, //!< No dithering
|
||||
TEMPORAL //!< Temporal dithering (default)
|
||||
};
|
||||
|
||||
/**
|
||||
* List of available shadow mapping techniques.
|
||||
* @see setShadowType
|
||||
*/
|
||||
enum class ShadowType : uint8_t {
|
||||
PCF, //!< percentage-closer filtered shadows (default)
|
||||
VSM, //!< variance shadows
|
||||
DPCF, //!< PCF with contact hardening simulation
|
||||
PCSS //!< PCF with soft shadows and contact hardening
|
||||
};
|
||||
|
||||
/**
|
||||
* View-level options for VSM Shadowing.
|
||||
* @see setVsmShadowOptions()
|
||||
* @warning This API is still experimental and subject to change.
|
||||
*/
|
||||
struct VsmShadowOptions {
|
||||
/**
|
||||
* Sets the number of anisotropic samples to use when sampling a VSM shadow map. If greater
|
||||
* than 0, mipmaps will automatically be generated each frame for all lights.
|
||||
*
|
||||
* The number of anisotropic samples = 2 ^ vsmAnisotropy.
|
||||
*/
|
||||
uint8_t anisotropy = 0;
|
||||
|
||||
/**
|
||||
* Whether to generate mipmaps for all VSM shadow maps.
|
||||
*/
|
||||
bool mipmapping = false;
|
||||
|
||||
/**
|
||||
* The number of MSAA samples to use when rendering VSM shadow maps.
|
||||
* Must be a power-of-two and greater than or equal to 1. A value of 1 effectively turns
|
||||
* off MSAA.
|
||||
* Higher values may not be available depending on the underlying hardware.
|
||||
*/
|
||||
uint8_t msaaSamples = 1;
|
||||
|
||||
/**
|
||||
* Whether to use a 32-bits or 16-bits texture format for VSM shadow maps. 32-bits
|
||||
* precision is rarely needed, but it does reduces light leaks as well as "fading"
|
||||
* of the shadows in some situations. Setting highPrecision to true for a single
|
||||
* shadow map will double the memory usage of all shadow maps.
|
||||
*/
|
||||
bool highPrecision = false;
|
||||
|
||||
/**
|
||||
* VSM minimum variance scale, must be positive.
|
||||
*/
|
||||
float minVarianceScale = 0.5f;
|
||||
|
||||
/**
|
||||
* VSM light bleeding reduction amount, between 0 and 1.
|
||||
*/
|
||||
float lightBleedReduction = 0.15f;
|
||||
};
|
||||
|
||||
/**
|
||||
* View-level options for DPCF and PCSS Shadowing.
|
||||
* @see setSoftShadowOptions()
|
||||
* @warning This API is still experimental and subject to change.
|
||||
*/
|
||||
struct SoftShadowOptions {
|
||||
/**
|
||||
* Globally scales the penumbra of all DPCF and PCSS shadows
|
||||
* Acceptable values are greater than 0
|
||||
*/
|
||||
float penumbraScale = 1.0f;
|
||||
|
||||
/**
|
||||
* Globally scales the computed penumbra ratio of all DPCF and PCSS shadows.
|
||||
* This effectively controls the strength of contact hardening effect and is useful for
|
||||
* artistic purposes. Higher values make the shadows become softer faster.
|
||||
* Acceptable values are equal to or greater than 1.
|
||||
*/
|
||||
float penumbraRatioScale = 1.0f;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif //TNT_FILAMENT_OPTIONS_H
|
||||
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_RENDERTARGET_H
|
||||
#define TNT_FILAMENT_RENDERTARGET_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/TargetBufferInfo.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FRenderTarget;
|
||||
|
||||
class Engine;
|
||||
class Texture;
|
||||
|
||||
/**
|
||||
* An offscreen render target that can be associated with a View and contains
|
||||
* weak references to a set of attached Texture objects.
|
||||
*
|
||||
* RenderTarget is intended to be used with the View's post-processing disabled for the most part.
|
||||
* especially when a DEPTH attachment is also used (see Builder::texture()).
|
||||
*
|
||||
* Custom RenderTarget are ultimately intended to render into textures that might be used during
|
||||
* the main render pass.
|
||||
*
|
||||
* Clients are responsible for the lifetime of all associated Texture attachments.
|
||||
*
|
||||
* @see View
|
||||
*/
|
||||
class UTILS_PUBLIC RenderTarget : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using CubemapFace = backend::TextureCubemapFace;
|
||||
|
||||
/** Minimum number of color attachment supported */
|
||||
static constexpr uint8_t MIN_SUPPORTED_COLOR_ATTACHMENTS_COUNT =
|
||||
backend::MRT::MIN_SUPPORTED_RENDER_TARGET_COUNT;
|
||||
|
||||
/** Maximum number of color attachment supported */
|
||||
static constexpr uint8_t MAX_SUPPORTED_COLOR_ATTACHMENTS_COUNT =
|
||||
backend::MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT;
|
||||
|
||||
/**
|
||||
* Attachment identifiers
|
||||
*/
|
||||
enum class AttachmentPoint : uint8_t {
|
||||
COLOR0 = 0, //!< identifies the 1st color attachment
|
||||
COLOR1 = 1, //!< identifies the 2nd color attachment
|
||||
COLOR2 = 2, //!< identifies the 3rd color attachment
|
||||
COLOR3 = 3, //!< identifies the 4th color attachment
|
||||
COLOR4 = 4, //!< identifies the 5th color attachment
|
||||
COLOR5 = 5, //!< identifies the 6th color attachment
|
||||
COLOR6 = 6, //!< identifies the 7th color attachment
|
||||
COLOR7 = 7, //!< identifies the 8th color attachment
|
||||
DEPTH = MAX_SUPPORTED_COLOR_ATTACHMENTS_COUNT, //!< identifies the depth attachment
|
||||
COLOR = COLOR0, //!< identifies the 1st color attachment
|
||||
};
|
||||
|
||||
//! Use Builder to construct a RenderTarget object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Sets a texture to a given attachment point.
|
||||
*
|
||||
* All RenderTargets must have a non-null COLOR attachment.
|
||||
*
|
||||
* When using a DEPTH attachment, it is important to always disable post-processing
|
||||
* in the View. Failing to do so will cause the DEPTH attachment to be ignored in most
|
||||
* cases.
|
||||
*
|
||||
* When the intention is to keep the content of the DEPTH attachment after rendering,
|
||||
* Usage::SAMPLEABLE must be set on the DEPTH attachment, otherwise the content of the
|
||||
* DEPTH buffer may be discarded.
|
||||
*
|
||||
* @param attachment The attachment point of the texture.
|
||||
* @param texture The associated texture object.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& texture(AttachmentPoint attachment, Texture* texture) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the mipmap level for a given attachment point.
|
||||
*
|
||||
* @param attachment The attachment point of the texture.
|
||||
* @param level The associated mipmap level, 0 by default.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& mipLevel(AttachmentPoint attachment, uint8_t level) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the cubemap face for a given attachment point.
|
||||
*
|
||||
* @param attachment The attachment point.
|
||||
* @param face The associated cubemap face.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& face(AttachmentPoint attachment, CubemapFace face) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the layer for a given attachment point (for 3D textures).
|
||||
*
|
||||
* @param attachment The attachment point.
|
||||
* @param layer The associated cubemap layer.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& layer(AttachmentPoint attachment, uint32_t layer) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the RenderTarget object and returns a pointer to it.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*/
|
||||
RenderTarget* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FRenderTarget;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the texture set on the given attachment point
|
||||
* @param attachment Attachment point
|
||||
* @return A Texture object or nullptr if no texture is set for this attachment point
|
||||
*/
|
||||
Texture* getTexture(AttachmentPoint attachment) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the mipmap level set on the given attachment point
|
||||
* @param attachment Attachment point
|
||||
* @return the mipmap level set on the given attachment point
|
||||
*/
|
||||
uint8_t getMipLevel(AttachmentPoint attachment) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the face of a cubemap set on the given attachment point
|
||||
* @param attachment Attachment point
|
||||
* @return A cubemap face identifier. This is only relevant if the attachment's texture is
|
||||
* a cubemap.
|
||||
*/
|
||||
CubemapFace getFace(AttachmentPoint attachment) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the texture-layer set on the given attachment point
|
||||
* @param attachment Attachment point
|
||||
* @return A texture layer. This is only relevant if the attachment's texture is a 3D texture.
|
||||
*/
|
||||
uint32_t getLayer(AttachmentPoint attachment) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the number of color attachments usable by this instance of Engine. This method is
|
||||
* guaranteed to return at least MIN_SUPPORTED_COLOR_ATTACHMENTS_COUNT and at most
|
||||
* MAX_SUPPORTED_COLOR_ATTACHMENTS_COUNT.
|
||||
* @return Number of color attachments usable in a render target.
|
||||
*/
|
||||
uint8_t getSupportedColorAttachmentsCount() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_RENDERTARGET_H
|
||||
@@ -0,0 +1,763 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_RENDERABLEMANAGER_H
|
||||
#define TNT_FILAMENT_RENDERABLEMANAGER_H
|
||||
|
||||
#include <filament/Box.h>
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/MaterialEnums.h>
|
||||
#include <filament/MorphTargetBuffer.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/EntityInstance.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class BufferObject;
|
||||
class Engine;
|
||||
class IndexBuffer;
|
||||
class MaterialInstance;
|
||||
class Renderer;
|
||||
class SkinningBuffer;
|
||||
class VertexBuffer;
|
||||
class Texture;
|
||||
|
||||
class FEngine;
|
||||
class FRenderPrimitive;
|
||||
class FRenderableManager;
|
||||
|
||||
/**
|
||||
* Factory and manager for \em renderables, which are entities that can be drawn.
|
||||
*
|
||||
* Renderables are bundles of \em primitives, each of which has its own geometry and material. All
|
||||
* primitives in a particular renderable share a set of rendering attributes, such as whether they
|
||||
* cast shadows or use vertex skinning.
|
||||
*
|
||||
* Usage example:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* auto renderable = utils::EntityManager::get().create();
|
||||
*
|
||||
* RenderableManager::Builder(1)
|
||||
* .boundingBox({{ -1, -1, -1 }, { 1, 1, 1 }})
|
||||
* .material(0, matInstance)
|
||||
* .geometry(0, RenderableManager::PrimitiveType::TRIANGLES, vertBuffer, indBuffer, 0, 3)
|
||||
* .receiveShadows(false)
|
||||
* .build(engine, renderable);
|
||||
*
|
||||
* scene->addEntity(renderable);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* To modify the state of an existing renderable, clients should first use RenderableManager
|
||||
* to get a temporary handle called an \em instance. The instance can then be used to get or set
|
||||
* the renderable's state. Please note that instances are ephemeral; clients should store entities,
|
||||
* not instances.
|
||||
*
|
||||
* - For details about constructing renderables, see RenderableManager::Builder.
|
||||
* - To associate a 4x4 transform with an entity, see TransformManager.
|
||||
* - To associate a human-readable label with an entity, see utils::NameComponentManager.
|
||||
*/
|
||||
class UTILS_PUBLIC RenderableManager : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using Instance = utils::EntityInstance<RenderableManager>;
|
||||
using PrimitiveType = backend::PrimitiveType;
|
||||
|
||||
/**
|
||||
* Checks if the given entity already has a renderable component.
|
||||
*/
|
||||
bool hasComponent(utils::Entity e) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets a temporary handle that can be used to access the renderable state.
|
||||
*
|
||||
* @return Non-zero handle if the entity has a renderable component, 0 otherwise.
|
||||
*/
|
||||
Instance getInstance(utils::Entity e) const noexcept;
|
||||
|
||||
/**
|
||||
* The transformation associated with a skinning joint.
|
||||
*
|
||||
* Clients can specify bones either using this quat-vec3 pair, or by using 4x4 matrices.
|
||||
*/
|
||||
struct Bone {
|
||||
math::quatf unitQuaternion = { 1.f, 0.f, 0.f, 0.f };
|
||||
math::float3 translation = { 0.f, 0.f, 0.f };
|
||||
float reserved = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds renderable components to entities using a builder pattern.
|
||||
*/
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
enum Result { Error = -1, Success = 0 };
|
||||
|
||||
/**
|
||||
* Default render channel
|
||||
* @see Builder::channel()
|
||||
*/
|
||||
static constexpr uint8_t DEFAULT_CHANNEL = 2u;
|
||||
|
||||
/**
|
||||
* Creates a builder for renderable components.
|
||||
*
|
||||
* @param count the number of primitives that will be supplied to the builder
|
||||
*
|
||||
* Note that builders typically do not have a long lifetime since clients should discard
|
||||
* them after calling build(). For a usage example, see RenderableManager.
|
||||
*/
|
||||
explicit Builder(size_t count) noexcept;
|
||||
|
||||
/*! \cond PRIVATE */
|
||||
Builder(Builder const& rhs) = delete;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder& rhs) = delete;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
/*! \endcond */
|
||||
|
||||
/**
|
||||
* Specifies the geometry data for a primitive.
|
||||
*
|
||||
* Filament primitives must have an associated VertexBuffer and IndexBuffer. Typically, each
|
||||
* primitive is specified with a pair of daisy-chained calls: \c geometry(...) and \c
|
||||
* material(...).
|
||||
*
|
||||
* @param index zero-based index of the primitive, must be less than the count passed to Builder constructor
|
||||
* @param type specifies the topology of the primitive (e.g., \c RenderableManager::PrimitiveType::TRIANGLES)
|
||||
* @param vertices specifies the vertex buffer, which in turn specifies a set of attributes
|
||||
* @param indices specifies the index buffer (either u16 or u32)
|
||||
* @param offset specifies where in the index buffer to start reading (expressed as a number of indices)
|
||||
* @param minIndex specifies the minimum index contained in the index buffer
|
||||
* @param maxIndex specifies the maximum index contained in the index buffer
|
||||
* @param count number of indices to read (for triangles, this should be a multiple of 3)
|
||||
*/
|
||||
Builder& geometry(size_t index, PrimitiveType type, VertexBuffer* vertices, IndexBuffer* indices, size_t offset, size_t minIndex, size_t maxIndex, size_t count) noexcept;
|
||||
Builder& geometry(size_t index, PrimitiveType type, VertexBuffer* vertices, IndexBuffer* indices, size_t offset, size_t count) noexcept; //!< \overload
|
||||
Builder& geometry(size_t index, PrimitiveType type, VertexBuffer* vertices, IndexBuffer* indices) noexcept; //!< \overload
|
||||
|
||||
/**
|
||||
* Binds a material instance to the specified primitive.
|
||||
*
|
||||
* If no material is specified for a given primitive, Filament will fall back to a basic
|
||||
* default material.
|
||||
*
|
||||
* The MaterialInstance's material must have a feature level equal or lower to the engine's
|
||||
* selected feature level.
|
||||
*
|
||||
* @param index zero-based index of the primitive, must be less than the count passed to
|
||||
* Builder constructor
|
||||
* @param materialInstance the material to bind
|
||||
*
|
||||
* @see Engine::setActiveFeatureLevel
|
||||
*/
|
||||
Builder& material(size_t index, MaterialInstance const* materialInstance) noexcept;
|
||||
|
||||
/**
|
||||
* The axis-aligned bounding box of the renderable.
|
||||
*
|
||||
* This is an object-space AABB used for frustum culling. For skinning and morphing, this
|
||||
* should encompass all possible vertex positions. It is mandatory unless culling is
|
||||
* disabled for the renderable.
|
||||
*
|
||||
* \see computeAABB()
|
||||
*/
|
||||
Builder& boundingBox(const Box& axisAlignedBoundingBox) noexcept;
|
||||
|
||||
/**
|
||||
* Sets bits in a visibility mask. By default, this is 0x1.
|
||||
*
|
||||
* This feature provides a simple mechanism for hiding and showing groups of renderables
|
||||
* in a Scene. See View::setVisibleLayers().
|
||||
*
|
||||
* For example, to set bit 1 and reset bits 0 and 2 while leaving all other bits unaffected,
|
||||
* do: `builder.layerMask(7, 2)`.
|
||||
*
|
||||
* To change this at run time, see RenderableManager::setLayerMask.
|
||||
*
|
||||
* @param select the set of bits to affect
|
||||
* @param values the replacement values for the affected bits
|
||||
*/
|
||||
Builder& layerMask(uint8_t select, uint8_t values) noexcept;
|
||||
|
||||
/**
|
||||
* Provides coarse-grained control over draw order.
|
||||
*
|
||||
* In general Filament reserves the right to re-order renderables to allow for efficient
|
||||
* rendering. However clients can control ordering at a coarse level using \em priority.
|
||||
* The priority is applied separately for opaque and translucent objects, that is, opaque
|
||||
* objects are always drawn before translucent objects regardless of the priority.
|
||||
*
|
||||
* For example, this could be used to draw a semitransparent HUD on top of everything,
|
||||
* without using a separate View. Note that priority is completely orthogonal to
|
||||
* Builder::layerMask, which merely controls visibility.
|
||||
*
|
||||
* The Skybox always using the lowest priority, so it's drawn last, which may improve
|
||||
* performance.
|
||||
*
|
||||
* @param priority clamped to the range [0..7], defaults to 4; 7 is lowest priority
|
||||
* (rendered last).
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see Builder::blendOrder()
|
||||
* @see Builder::channel()
|
||||
* @see RenderableManager::setPriority()
|
||||
* @see RenderableManager::setBlendOrderAt()
|
||||
*/
|
||||
Builder& priority(uint8_t priority) noexcept;
|
||||
|
||||
/**
|
||||
* Set the channel this renderable is associated to. There can be 4 channels.
|
||||
* All renderables in a given channel are rendered together, regardless of anything else.
|
||||
* They are sorted as usual within a channel.
|
||||
* Channels work similarly to priorities, except that they enforce the strongest ordering.
|
||||
*
|
||||
* Channels 0 and 1 may not have render primitives using a material with `refractionType`
|
||||
* set to `screenspace`.
|
||||
*
|
||||
* @param channel clamped to the range [0..3], defaults to 2.
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see Builder::blendOrder()
|
||||
* @see Builder::priority()
|
||||
* @see RenderableManager::setBlendOrderAt()
|
||||
*/
|
||||
Builder& channel(uint8_t channel) noexcept;
|
||||
|
||||
/**
|
||||
* Controls frustum culling, true by default.
|
||||
*
|
||||
* \note Do not confuse frustum culling with backface culling. The latter is controlled via
|
||||
* the material.
|
||||
*/
|
||||
Builder& culling(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables a light channel. Light channel 0 is enabled by default.
|
||||
*
|
||||
* @param channel Light channel to enable or disable, between 0 and 7.
|
||||
* @param enable Whether to enable or disable the light channel.
|
||||
*/
|
||||
Builder& lightChannel(unsigned int channel, bool enable = true) noexcept;
|
||||
|
||||
/**
|
||||
* Controls if this renderable casts shadows, false by default.
|
||||
*
|
||||
* If the View's shadow type is set to ShadowType::VSM, castShadows should only be disabled
|
||||
* if either is true:
|
||||
* - receiveShadows is also disabled
|
||||
* - the object is guaranteed to not cast shadows on itself or other objects (for example,
|
||||
* a ground plane)
|
||||
*/
|
||||
Builder& castShadows(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Controls if this renderable receives shadows, true by default.
|
||||
*/
|
||||
Builder& receiveShadows(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Controls if this renderable uses screen-space contact shadows. This is more
|
||||
* expensive but can improve the quality of shadows, especially in large scenes.
|
||||
* (off by default).
|
||||
*/
|
||||
Builder& screenSpaceContactShadows(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Allows bones to be swapped out and shared using SkinningBuffer.
|
||||
*
|
||||
* If skinning buffer mode is enabled, clients must call setSkinningBuffer() rather than
|
||||
* setBones(). This allows sharing of data between renderables.
|
||||
*
|
||||
* @param enabled If true, enables buffer object mode. False by default.
|
||||
*/
|
||||
Builder& enableSkinningBuffers(bool enabled = true) noexcept;
|
||||
|
||||
/**
|
||||
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
|
||||
*
|
||||
* Skinning Buffer mode must be enabled.
|
||||
*
|
||||
* Each vertex can be affected by up to 4 bones simultaneously. The attached
|
||||
* VertexBuffer must provide data in the \c BONE_INDICES slot (uvec4) and the
|
||||
* \c BONE_WEIGHTS slot (float4).
|
||||
*
|
||||
* See also RenderableManager::setSkinningBuffer() or SkinningBuffer::setBones(),
|
||||
* which can be called on a per-frame basis to advance the animation.
|
||||
*
|
||||
* @param skinningBuffer nullptr to disable, otherwise the SkinningBuffer to use
|
||||
* @param count 0 to disable, otherwise the number of bone transforms (up to 255)
|
||||
* @param offset offset in the SkinningBuffer
|
||||
*/
|
||||
Builder& skinning(SkinningBuffer* skinningBuffer, size_t count, size_t offset) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* Enables GPU vertex skinning for up to 255 bones, 0 by default.
|
||||
*
|
||||
* Skinning Buffer mode must be disabled.
|
||||
*
|
||||
* Each vertex can be affected by up to 4 bones simultaneously. The attached
|
||||
* VertexBuffer must provide data in the \c BONE_INDICES slot (uvec4) and the
|
||||
* \c BONE_WEIGHTS slot (float4).
|
||||
*
|
||||
* See also RenderableManager::setBones(), which can be called on a per-frame basis
|
||||
* to advance the animation.
|
||||
*
|
||||
* @param boneCount 0 to disable, otherwise the number of bone transforms (up to 255)
|
||||
* @param transforms the initial set of transforms (one for each bone)
|
||||
*/
|
||||
Builder& skinning(size_t boneCount, math::mat4f const* transforms) noexcept;
|
||||
Builder& skinning(size_t boneCount, Bone const* bones) noexcept; //!< \overload
|
||||
Builder& skinning(size_t boneCount) noexcept; //!< \overload
|
||||
|
||||
/**
|
||||
* Controls if the renderable has vertex morphing targets, zero by default. This is
|
||||
* required to enable GPU morphing.
|
||||
*
|
||||
* Filament supports two morphing modes: standard (default) and legacy.
|
||||
*
|
||||
* For standard morphing, A MorphTargetBuffer must be created and provided via
|
||||
* RenderableManager::setMorphTargetBufferAt(). Standard morphing supports up to
|
||||
* \c CONFIG_MAX_MORPH_TARGET_COUNT morph targets.
|
||||
*
|
||||
* For legacy morphing, the attached VertexBuffer must provide data in the
|
||||
* appropriate VertexAttribute slots (\c MORPH_POSITION_0 etc). Legacy morphing only
|
||||
* supports up to 4 morph targets and will be deprecated in the future. Legacy morphing must
|
||||
* be enabled on the material definition: either via the legacyMorphing material attribute
|
||||
* or by calling filamat::MaterialBuilder::useLegacyMorphing().
|
||||
*
|
||||
* See also RenderableManager::setMorphWeights(), which can be called on a per-frame basis
|
||||
* to advance the animation.
|
||||
*/
|
||||
Builder& morphing(size_t targetCount) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the morph target buffer for a primitive.
|
||||
*
|
||||
* The morph target buffer must have an associated renderable and geometry. Two conditions
|
||||
* must be met:
|
||||
* 1. The number of morph targets in the buffer must equal the renderable's morph target
|
||||
* count.
|
||||
* 2. The vertex count of each morph target must equal the geometry's vertex count.
|
||||
*
|
||||
* @param level the level of detail (lod), only 0 can be specified
|
||||
* @param primitiveIndex zero-based index of the primitive, must be less than the count passed to Builder constructor
|
||||
* @param morphTargetBuffer specifies the morph target buffer
|
||||
* @param offset specifies where in the morph target buffer to start reading (expressed as a number of vertices)
|
||||
* @param count number of vertices in the morph target buffer to read, must equal the geometry's count (for triangles, this should be a multiple of 3)
|
||||
*/
|
||||
Builder& morphing(uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer, size_t offset, size_t count) noexcept;
|
||||
|
||||
inline Builder& morphing(uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the drawing order for blended primitives. The drawing order is either global or
|
||||
* local (default) to this Renderable. In either case, the Renderable priority takes
|
||||
* precedence.
|
||||
*
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param order draw order number (0 by default). Only the lowest 15 bits are used.
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see globalBlendOrderEnabled
|
||||
*/
|
||||
Builder& blendOrder(size_t primitiveIndex, uint16_t order) noexcept;
|
||||
|
||||
/**
|
||||
* Sets whether the blend order is global or local to this Renderable (by default).
|
||||
*
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param enabled true for global, false for local blend ordering.
|
||||
*
|
||||
* @return Builder reference for chaining calls.
|
||||
*
|
||||
* @see blendOrder
|
||||
*/
|
||||
Builder& globalBlendOrderEnabled(size_t primitiveIndex, bool enabled) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* Specifies the number of draw instance of this renderable. The default is 1 instance and
|
||||
* the maximum number of instances allowed is 32767. 0 is invalid.
|
||||
* All instances are culled using the same bounding box, so care must be taken to make
|
||||
* sure all instances render inside the specified bounding box.
|
||||
* The material must set its `instanced` parameter to `true` in order to use
|
||||
* getInstanceIndex() in the vertex or fragment shader to get the instance index and
|
||||
* possibly adjust the position or transform.
|
||||
* It generally doesn't make sense to use VERTEX_DOMAIN_OBJECT in the material, since it
|
||||
* would pull the same transform for all instances.
|
||||
*
|
||||
* @param instanceCount the number of instances silently clamped between 1 and 32767.
|
||||
*/
|
||||
Builder& instances(size_t instanceCount) noexcept;
|
||||
|
||||
/**
|
||||
* Adds the Renderable component to an entity.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this Renderable with.
|
||||
* @param entity Entity to add the Renderable component to.
|
||||
* @return Success if the component was created successfully, Error otherwise.
|
||||
*
|
||||
* If exceptions are disabled and an error occurs, this function is a no-op.
|
||||
* Success can be checked by looking at the return value.
|
||||
*
|
||||
* If this component already exists on the given entity and the construction is successful,
|
||||
* it is first destroyed as if destroy(utils::Entity e) was called. In case of error,
|
||||
* the existing component is unmodified.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
Result build(Engine& engine, utils::Entity entity);
|
||||
|
||||
private:
|
||||
friend class FEngine;
|
||||
friend class FRenderPrimitive;
|
||||
friend class FRenderableManager;
|
||||
struct Entry {
|
||||
VertexBuffer* vertices = nullptr;
|
||||
IndexBuffer* indices = nullptr;
|
||||
size_t offset = 0;
|
||||
size_t minIndex = 0;
|
||||
size_t maxIndex = 0;
|
||||
size_t count = 0;
|
||||
MaterialInstance const* materialInstance = nullptr;
|
||||
PrimitiveType type = PrimitiveType::TRIANGLES;
|
||||
uint16_t blendOrder = 0;
|
||||
bool globalBlendOrderEnabled = false;
|
||||
struct {
|
||||
MorphTargetBuffer* buffer = nullptr;
|
||||
size_t offset = 0;
|
||||
size_t count = 0;
|
||||
} morphing;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys the renderable component in the given entity.
|
||||
*/
|
||||
void destroy(utils::Entity e) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the bounding box used for frustum culling.
|
||||
*
|
||||
* \see Builder::boundingBox()
|
||||
* \see RenderableManager::getAxisAlignedBoundingBox()
|
||||
*/
|
||||
void setAxisAlignedBoundingBox(Instance instance, const Box& aabb) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the visibility bits.
|
||||
*
|
||||
* \see Builder::layerMask()
|
||||
* \see View::setVisibleLayers().
|
||||
* \see RenderableManager::getLayerMask()
|
||||
*/
|
||||
void setLayerMask(Instance instance, uint8_t select, uint8_t values) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the coarse-level draw ordering.
|
||||
*
|
||||
* \see Builder::priority().
|
||||
*/
|
||||
void setPriority(Instance instance, uint8_t priority) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the channel a renderable is associated to.
|
||||
*
|
||||
* \see Builder::channel().
|
||||
*/
|
||||
void setChannel(Instance instance, uint8_t channel) noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether or not frustum culling is on.
|
||||
*
|
||||
* \see Builder::culling()
|
||||
*/
|
||||
void setCulling(Instance instance, bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables a light channel.
|
||||
* Light channel 0 is enabled by default.
|
||||
*
|
||||
* \see Builder::lightChannel()
|
||||
*/
|
||||
void setLightChannel(Instance instance, unsigned int channel, bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether a light channel is enabled on a specified renderable.
|
||||
* @param instance Instance of the component obtained from getInstance().
|
||||
* @param channel Light channel to query
|
||||
* @return true if the light channel is enabled, false otherwise
|
||||
*/
|
||||
bool getLightChannel(Instance instance, unsigned int channel) const noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether or not the renderable casts shadows.
|
||||
*
|
||||
* \see Builder::castShadows()
|
||||
*/
|
||||
void setCastShadows(Instance instance, bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether or not the renderable can receive shadows.
|
||||
*
|
||||
* \see Builder::receiveShadows()
|
||||
*/
|
||||
void setReceiveShadows(Instance instance, bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether or not the renderable can use screen-space contact shadows.
|
||||
*
|
||||
* \see Builder::screenSpaceContactShadows()
|
||||
*/
|
||||
void setScreenSpaceContactShadows(Instance instance, bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Checks if the renderable can cast shadows.
|
||||
*
|
||||
* \see Builder::castShadows().
|
||||
*/
|
||||
bool isShadowCaster(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Checks if the renderable can receive shadows.
|
||||
*
|
||||
* \see Builder::receiveShadows().
|
||||
*/
|
||||
bool isShadowReceiver(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Updates the bone transforms in the range [offset, offset + boneCount).
|
||||
* The bones must be pre-allocated using Builder::skinning().
|
||||
*/
|
||||
void setBones(Instance instance, Bone const* transforms, size_t boneCount = 1, size_t offset = 0);
|
||||
void setBones(Instance instance, math::mat4f const* transforms, size_t boneCount = 1, size_t offset = 0); //!< \overload
|
||||
|
||||
/**
|
||||
* Associates a region of a SkinningBuffer to a renderable instance
|
||||
*
|
||||
* Note: due to hardware limitations offset + 256 must be smaller or equal to
|
||||
* skinningBuffer->getBoneCount()
|
||||
*
|
||||
* @param instance Instance of the component obtained from getInstance().
|
||||
* @param skinningBuffer skinning buffer to associate to the instance
|
||||
* @param count Size of the region in bones, must be smaller or equal to 256.
|
||||
* @param offset Start offset of the region in bones
|
||||
*/
|
||||
void setSkinningBuffer(Instance instance, SkinningBuffer* skinningBuffer,
|
||||
size_t count, size_t offset);
|
||||
|
||||
/**
|
||||
* Updates the vertex morphing weights on a renderable, all zeroes by default.
|
||||
*
|
||||
* The renderable must be built with morphing enabled, see Builder::morphing(). In legacy
|
||||
* morphing mode, only the first 4 weights are considered.
|
||||
*
|
||||
* @param instance Instance of the component obtained from getInstance().
|
||||
* @param weights Pointer to morph target weights to be update.
|
||||
* @param count Number of morph target weights.
|
||||
* @param offset Index of the first morph target weight to set at instance.
|
||||
*/
|
||||
void setMorphWeights(Instance instance,
|
||||
float const* weights, size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Associates a MorphTargetBuffer to the given primitive.
|
||||
*/
|
||||
void setMorphTargetBufferAt(Instance instance, uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer, size_t offset, size_t count);
|
||||
|
||||
/**
|
||||
* Utility method to change a MorphTargetBuffer to the given primitive
|
||||
*/
|
||||
inline void setMorphTargetBufferAt(Instance instance, uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer);
|
||||
|
||||
/**
|
||||
* Get a MorphTargetBuffer to the given primitive or null if it doesn't exist.
|
||||
*/
|
||||
MorphTargetBuffer* getMorphTargetBufferAt(Instance instance, uint8_t level, size_t primitiveIndex) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets the number of morphing in the given entity.
|
||||
*/
|
||||
size_t getMorphTargetCount(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets the bounding box used for frustum culling.
|
||||
*
|
||||
* \see Builder::boundingBox()
|
||||
* \see RenderableManager::setAxisAlignedBoundingBox()
|
||||
*/
|
||||
const Box& getAxisAlignedBoundingBox(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Get the visibility bits.
|
||||
*
|
||||
* \see Builder::layerMask()
|
||||
* \see View::setVisibleLayers().
|
||||
* \see RenderableManager::getLayerMask()
|
||||
*/
|
||||
uint8_t getLayerMask(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets the immutable number of primitives in the given renderable.
|
||||
*/
|
||||
size_t getPrimitiveCount(Instance instance) const noexcept;
|
||||
|
||||
/**
|
||||
* Changes the material instance binding for the given primitive.
|
||||
*
|
||||
* The MaterialInstance's material must have a feature level equal or lower to the engine's
|
||||
* selected feature level.
|
||||
*
|
||||
* @exception utils::PreConditionPanic if the engine doesn't support the material's
|
||||
* feature level.
|
||||
*
|
||||
* @see Builder::material()
|
||||
* @see Engine::setActiveFeatureLevel
|
||||
*/
|
||||
void setMaterialInstanceAt(Instance instance,
|
||||
size_t primitiveIndex, MaterialInstance const* materialInstance);
|
||||
|
||||
/**
|
||||
* Retrieves the material instance that is bound to the given primitive.
|
||||
*/
|
||||
MaterialInstance* getMaterialInstanceAt(Instance instance, size_t primitiveIndex) const noexcept;
|
||||
|
||||
/**
|
||||
* Changes the geometry for the given primitive.
|
||||
*
|
||||
* \see Builder::geometry()
|
||||
*/
|
||||
void setGeometryAt(Instance instance, size_t primitiveIndex,
|
||||
PrimitiveType type, VertexBuffer* vertices, IndexBuffer* indices,
|
||||
size_t offset, size_t count) noexcept;
|
||||
|
||||
/**
|
||||
* Changes the drawing order for blended primitives. The drawing order is either global or
|
||||
* local (default) to this Renderable. In either case, the Renderable priority takes precedence.
|
||||
*
|
||||
* @param instance the renderable of interest
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param order draw order number (0 by default). Only the lowest 15 bits are used.
|
||||
*
|
||||
* @see Builder::blendOrder(), setGlobalBlendOrderEnabledAt()
|
||||
*/
|
||||
void setBlendOrderAt(Instance instance, size_t primitiveIndex, uint16_t order) noexcept;
|
||||
|
||||
/**
|
||||
* Changes whether the blend order is global or local to this Renderable (by default).
|
||||
*
|
||||
* @param instance the renderable of interest
|
||||
* @param primitiveIndex the primitive of interest
|
||||
* @param enabled true for global, false for local blend ordering.
|
||||
*
|
||||
* @see Builder::globalBlendOrderEnabled(), setBlendOrderAt()
|
||||
*/
|
||||
void setGlobalBlendOrderEnabledAt(Instance instance, size_t primitiveIndex, bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* Retrieves the set of enabled attribute slots in the given primitive's VertexBuffer.
|
||||
*/
|
||||
AttributeBitset getEnabledAttributesAt(Instance instance, size_t primitiveIndex) const noexcept;
|
||||
|
||||
/*! \cond PRIVATE */
|
||||
template<typename T>
|
||||
struct is_supported_vector_type {
|
||||
using type = typename std::enable_if<
|
||||
std::is_same<math::float4, T>::value ||
|
||||
std::is_same<math::half4, T>::value ||
|
||||
std::is_same<math::float3, T>::value ||
|
||||
std::is_same<math::half3, T>::value
|
||||
>::type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_supported_index_type {
|
||||
using type = typename std::enable_if<
|
||||
std::is_same<uint16_t, T>::value ||
|
||||
std::is_same<uint32_t, T>::value
|
||||
>::type;
|
||||
};
|
||||
/*! \endcond */
|
||||
|
||||
/**
|
||||
* Utility method that computes the axis-aligned bounding box from a set of vertices.
|
||||
*
|
||||
* - The index type must be \c uint16_t or \c uint32_t.
|
||||
* - The vertex type must be \c float4, \c half4, \c float3, or \c half3.
|
||||
* - For 4-component vertices, the w component is ignored (implicitly replaced with 1.0).
|
||||
*/
|
||||
template<typename VECTOR, typename INDEX,
|
||||
typename = typename is_supported_vector_type<VECTOR>::type,
|
||||
typename = typename is_supported_index_type<INDEX>::type>
|
||||
static Box computeAABB(VECTOR const* vertices, INDEX const* indices, size_t count,
|
||||
size_t stride = sizeof(VECTOR)) noexcept;
|
||||
};
|
||||
|
||||
RenderableManager::Builder& RenderableManager::Builder::morphing(uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer) noexcept {
|
||||
return morphing(level, primitiveIndex, morphTargetBuffer, 0,
|
||||
morphTargetBuffer->getVertexCount());
|
||||
}
|
||||
|
||||
void RenderableManager::setMorphTargetBufferAt(Instance instance, uint8_t level, size_t primitiveIndex,
|
||||
MorphTargetBuffer* morphTargetBuffer) {
|
||||
setMorphTargetBufferAt(instance, level, primitiveIndex, morphTargetBuffer, 0,
|
||||
morphTargetBuffer->getVertexCount());
|
||||
}
|
||||
|
||||
template<typename VECTOR, typename INDEX, typename, typename>
|
||||
Box RenderableManager::computeAABB(VECTOR const* vertices, INDEX const* indices, size_t count,
|
||||
size_t stride) noexcept {
|
||||
math::float3 bmin(std::numeric_limits<float>::max());
|
||||
math::float3 bmax(std::numeric_limits<float>::lowest());
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
VECTOR const* p = reinterpret_cast<VECTOR const*>(
|
||||
(char const*)vertices + indices[i] * stride);
|
||||
const math::float3 v(p->x, p->y, p->z);
|
||||
bmin = min(bmin, v);
|
||||
bmax = max(bmax, v);
|
||||
}
|
||||
return Box().set(bmin, bmax);
|
||||
}
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_RENDERABLEMANAGER_H
|
||||
580
flutter_filament/windows/include/filament/filament/Renderer.h
Normal file
580
flutter_filament/windows/include/filament/filament/Renderer.h
Normal file
@@ -0,0 +1,580 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_RENDERER_H
|
||||
#define TNT_FILAMENT_RENDERER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <backend/PresentCallable.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <math/vec4.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Engine;
|
||||
class RenderTarget;
|
||||
class SwapChain;
|
||||
class View;
|
||||
class Viewport;
|
||||
|
||||
namespace backend {
|
||||
class PixelBufferDescriptor;
|
||||
} // namespace backend
|
||||
|
||||
/**
|
||||
* A Renderer instance represents an operating system's window.
|
||||
*
|
||||
* Typically, applications create a Renderer per window. The Renderer generates drawing commands
|
||||
* for the render thread and manages frame latency.
|
||||
*
|
||||
* A Renderer generates drawing commands from a View, itself containing a Scene description.
|
||||
*
|
||||
* Creation and Destruction
|
||||
* ========================
|
||||
*
|
||||
* A Renderer is created using Engine.createRenderer() and destroyed using
|
||||
* Engine.destroy(const Renderer*).
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Renderer.h>
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
*
|
||||
* Renderer* renderer = engine->createRenderer();
|
||||
* engine->destroy(&renderer);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @see Engine, View
|
||||
*/
|
||||
class UTILS_PUBLIC Renderer : public FilamentAPI {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Use DisplayInfo to set important Display properties. This is used to achieve correct
|
||||
* frame pacing and dynamic resolution scaling.
|
||||
*/
|
||||
struct DisplayInfo {
|
||||
// refresh-rate of the display in Hz. set to 0 for offscreen or turn off frame-pacing.
|
||||
float refreshRate = 60.0f;
|
||||
|
||||
UTILS_DEPRECATED uint64_t presentationDeadlineNanos = 0;
|
||||
UTILS_DEPRECATED uint64_t vsyncOffsetNanos = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Use FrameRateOptions to set the desired frame rate and control how quickly the system
|
||||
* reacts to GPU load changes.
|
||||
*
|
||||
* interval: desired frame interval in multiple of the refresh period, set in DisplayInfo
|
||||
* (as 1 / DisplayInfo::refreshRate)
|
||||
*
|
||||
* The parameters below are relevant when some Views are using dynamic resolution scaling:
|
||||
*
|
||||
* headRoomRatio: additional headroom for the GPU as a ratio of the targetFrameTime.
|
||||
* Useful for taking into account constant costs like post-processing or
|
||||
* GPU drivers on different platforms.
|
||||
* history: History size. higher values, tend to filter more (clamped to 31)
|
||||
* scaleRate: rate at which the gpu load is adjusted to reach the target frame rate
|
||||
* This value can be computed as 1 / N, where N is the number of frames
|
||||
* needed to reach 64% of the target scale factor.
|
||||
* Higher values make the dynamic resolution react faster.
|
||||
*
|
||||
* @see View::DynamicResolutionOptions
|
||||
* @see Renderer::DisplayInfo
|
||||
*
|
||||
*/
|
||||
struct FrameRateOptions {
|
||||
float headRoomRatio = 0.0f; //!< additional headroom for the GPU
|
||||
float scaleRate = 1.0f / 8.0f; //!< rate at which the system reacts to load changes
|
||||
uint8_t history = 15; //!< history size
|
||||
uint8_t interval = 1; //!< desired frame interval in unit of 1.0 / DisplayInfo::refreshRate
|
||||
};
|
||||
|
||||
/**
|
||||
* ClearOptions are used at the beginning of a frame to clear or retain the SwapChain content.
|
||||
*/
|
||||
struct ClearOptions {
|
||||
/**
|
||||
* Color (sRGB linear) to use to clear the RenderTarget (typically the SwapChain).
|
||||
*
|
||||
* The RenderTarget is cleared using this color, which won't be tone-mapped since
|
||||
* tone-mapping is part of View rendering (this is not).
|
||||
*
|
||||
* When a View is rendered, there are 3 scenarios to consider:
|
||||
* - Pixels rendered by the View replace the clear color (or blend with it in
|
||||
* `BlendMode::TRANSLUCENT` mode).
|
||||
*
|
||||
* - With blending mode set to `BlendMode::TRANSLUCENT`, Pixels untouched by the View
|
||||
* are considered fulling transparent and let the clear color show through.
|
||||
*
|
||||
* - With blending mode set to `BlendMode::OPAQUE`, Pixels untouched by the View
|
||||
* are set to the clear color. However, because it is now used in the context of a View,
|
||||
* it will go through the post-processing stage, which includes tone-mapping.
|
||||
*
|
||||
* For consistency, it is recommended to always use a Skybox to clear an opaque View's
|
||||
* background, or to use black or fully-transparent (i.e. {0,0,0,0}) as the clear color.
|
||||
*/
|
||||
math::float4 clearColor = {};
|
||||
|
||||
/** Value to clear the stencil buffer */
|
||||
uint8_t clearStencil = 0u;
|
||||
|
||||
/**
|
||||
* Whether the SwapChain should be cleared using the clearColor. Use this if translucent
|
||||
* View will be drawn, for instance.
|
||||
*/
|
||||
bool clear = false;
|
||||
|
||||
/**
|
||||
* Whether the SwapChain content should be discarded. clear implies discard. Set this
|
||||
* to false (along with clear to false as well) if the SwapChain already has content that
|
||||
* needs to be preserved
|
||||
*/
|
||||
bool discard = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Information about the display this Renderer is associated to. This information is needed
|
||||
* to accurately compute dynamic-resolution scaling and for frame-pacing.
|
||||
*/
|
||||
void setDisplayInfo(const DisplayInfo& info) noexcept;
|
||||
|
||||
/**
|
||||
* Set options controlling the desired frame-rate.
|
||||
*/
|
||||
void setFrameRateOptions(FrameRateOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Set ClearOptions which are used at the beginning of a frame to clear or retain the
|
||||
* SwapChain content.
|
||||
*/
|
||||
void setClearOptions(const ClearOptions& options);
|
||||
|
||||
/**
|
||||
* Get the Engine that created this Renderer.
|
||||
*
|
||||
* @return A pointer to the Engine instance this Renderer is associated to.
|
||||
*/
|
||||
Engine* getEngine() noexcept;
|
||||
|
||||
/**
|
||||
* Get the Engine that created this Renderer.
|
||||
*
|
||||
* @return A constant pointer to the Engine instance this Renderer is associated to.
|
||||
*/
|
||||
inline Engine const* getEngine() const noexcept {
|
||||
return const_cast<Renderer *>(this)->getEngine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flags used to configure the behavior of copyFrame().
|
||||
*
|
||||
* @see
|
||||
* copyFrame()
|
||||
*/
|
||||
using CopyFrameFlag = uint32_t;
|
||||
|
||||
/**
|
||||
* Indicates that the dstSwapChain passed into copyFrame() should be
|
||||
* committed after the frame has been copied.
|
||||
*
|
||||
* @see
|
||||
* copyFrame()
|
||||
*/
|
||||
static constexpr CopyFrameFlag COMMIT = 0x1;
|
||||
/**
|
||||
* Indicates that the presentation time should be set on the dstSwapChain
|
||||
* passed into copyFrame to the monotonic clock time when the frame is
|
||||
* copied.
|
||||
*
|
||||
* @see
|
||||
* copyFrame()
|
||||
*/
|
||||
static constexpr CopyFrameFlag SET_PRESENTATION_TIME = 0x2;
|
||||
/**
|
||||
* Indicates that the dstSwapChain passed into copyFrame() should be
|
||||
* cleared to black before the frame is copied into the specified viewport.
|
||||
*
|
||||
* @see
|
||||
* copyFrame()
|
||||
*/
|
||||
static constexpr CopyFrameFlag CLEAR = 0x4;
|
||||
|
||||
|
||||
/**
|
||||
* Set-up a frame for this Renderer.
|
||||
*
|
||||
* beginFrame() manages frame pacing, and returns whether or not a frame should be drawn. The
|
||||
* goal of this is to skip frames when the GPU falls behind in order to keep the frame
|
||||
* latency low.
|
||||
*
|
||||
* If a given frame takes too much time in the GPU, the CPU will get ahead of the GPU. The
|
||||
* display will draw the same frame twice producing a stutter. At this point, the CPU is
|
||||
* ahead of the GPU and depending on how many frames are buffered, latency increases.
|
||||
*
|
||||
* beginFrame() attempts to detect this situation and returns false in that case, indicating
|
||||
* to the caller to skip the current frame.
|
||||
*
|
||||
* When beginFrame() returns true, it is mandatory to render the frame and call endFrame().
|
||||
* However, when beginFrame() returns false, the caller has the choice to either skip the
|
||||
* frame and not call endFrame(), or proceed as though true was returned.
|
||||
*
|
||||
* @param vsyncSteadyClockTimeNano The time in nanosecond of when the current frame started,
|
||||
* or 0 if unknown. This value should be the timestamp of
|
||||
* the last h/w vsync. It is expressed in the
|
||||
* std::chrono::steady_clock time base.
|
||||
* @param swapChain A pointer to the SwapChain instance to use.
|
||||
*
|
||||
* @return
|
||||
* *false* the current frame should be skipped,
|
||||
* *true* the current frame must be drawn and endFrame() must be called.
|
||||
*
|
||||
* @remark
|
||||
* When skipping a frame, the whole frame is canceled, and endFrame() must not be called.
|
||||
*
|
||||
* @note
|
||||
* All calls to render() must happen *after* beginFrame().
|
||||
*
|
||||
* @see
|
||||
* endFrame()
|
||||
*/
|
||||
bool beginFrame(SwapChain* swapChain,
|
||||
uint64_t vsyncSteadyClockTimeNano = 0u);
|
||||
|
||||
/**
|
||||
* Set the time at which the frame must be presented to the display.
|
||||
*
|
||||
* This must be called between beginFrame() and endFrame().
|
||||
*
|
||||
* @param monotonic_clock_ns the time in nanoseconds corresponding to the system monotonic up-time clock.
|
||||
* the presentation time is typically set in the middle of the period
|
||||
* of interest. The presentation time cannot be too far in the
|
||||
* future because it is limited by how many buffers are available in
|
||||
* the display sub-system. Typically it is set to 1 or 2 vsync periods
|
||||
* away.
|
||||
*/
|
||||
void setPresentationTime(int64_t monotonic_clock_ns);
|
||||
|
||||
/**
|
||||
* Render a View into this renderer's window.
|
||||
*
|
||||
* This is filament main rendering method, most of the CPU-side heavy lifting is performed
|
||||
* here. render() main function is to generate render commands which are asynchronously
|
||||
* executed by the Engine's render thread.
|
||||
*
|
||||
* render() generates commands for each of the following stages:
|
||||
*
|
||||
* 1. Shadow map passes, if needed.
|
||||
* 2. Depth pre-pass.
|
||||
* 3. Color pass.
|
||||
* 4. Post-processing pass.
|
||||
*
|
||||
* A typical render loop looks like this:
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Renderer.h>
|
||||
* #include <filament/View.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* void renderLoop(Renderer* renderer, SwapChain* swapChain) {
|
||||
* do {
|
||||
* // typically we wait for VSYNC and user input events
|
||||
* if (renderer->beginFrame(swapChain)) {
|
||||
* renderer->render(mView);
|
||||
* renderer->endFrame();
|
||||
* }
|
||||
* } while (!quit());
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
*
|
||||
* @param view A pointer to the view to render.
|
||||
*
|
||||
* @attention
|
||||
* render() must be called *after* beginFrame() and *before* endFrame().
|
||||
*
|
||||
* @note
|
||||
* render() must be called from the Engine's main thread (or external synchronization
|
||||
* must be provided). In particular, calls to render() on different Renderer instances
|
||||
* **must** be synchronized.
|
||||
*
|
||||
* @remark
|
||||
* render() perform potentially heavy computations and cannot be multi-threaded. However,
|
||||
* internally, render() is highly multi-threaded to both improve performance in mitigate
|
||||
* the call's latency.
|
||||
*
|
||||
* @remark
|
||||
* render() is typically called once per frame (but not necessarily).
|
||||
*
|
||||
* @see
|
||||
* beginFrame(), endFrame(), View
|
||||
*
|
||||
*/
|
||||
void render(View const* view);
|
||||
|
||||
/**
|
||||
* Copy the currently rendered view to the indicated swap chain, using the
|
||||
* indicated source and destination rectangle.
|
||||
*
|
||||
* @param dstSwapChain The swap chain into which the frame should be copied.
|
||||
* @param dstViewport The destination rectangle in which to draw the view.
|
||||
* @param srcViewport The source rectangle to be copied.
|
||||
* @param flags One or more CopyFrameFlag behavior configuration flags.
|
||||
*
|
||||
* @remark
|
||||
* copyFrame() should be called after a frame is rendered using render()
|
||||
* but before endFrame() is called.
|
||||
*/
|
||||
void copyFrame(SwapChain* dstSwapChain, Viewport const& dstViewport,
|
||||
Viewport const& srcViewport, uint32_t flags = 0);
|
||||
|
||||
/**
|
||||
* Reads back the content of the SwapChain associated with this Renderer.
|
||||
*
|
||||
* @param xoffset Left offset of the sub-region to read back.
|
||||
* @param yoffset Bottom offset of the sub-region to read back.
|
||||
* @param width Width of the sub-region to read back.
|
||||
* @param height Height of the sub-region to read back.
|
||||
* @param buffer Client-side buffer where the read-back will be written.
|
||||
*
|
||||
* The following formats are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA_INTEGER
|
||||
*
|
||||
* The following types are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataType::UBYTE
|
||||
* - PixelBufferDescriptor::PixelDataType::UINT
|
||||
* - PixelBufferDescriptor::PixelDataType::INT
|
||||
* - PixelBufferDescriptor::PixelDataType::FLOAT
|
||||
*
|
||||
* Other combinations of format/type may be supported. If a combination is
|
||||
* not supported, this operation may fail silently. Use a DEBUG build
|
||||
* to get some logs about the failure.
|
||||
*
|
||||
*
|
||||
* Framebuffer as seen on User buffer (PixelBufferDescriptor&)
|
||||
* screen
|
||||
*
|
||||
* +--------------------+
|
||||
* | | .stride .alignment
|
||||
* | | ----------------------->-->
|
||||
* | | O----------------------+--+ low addresses
|
||||
* | | | | | |
|
||||
* | w | | | .top | |
|
||||
* | <---------> | | V | |
|
||||
* | +---------+ | | +---------+ | |
|
||||
* | | ^ | | ======> | | | | |
|
||||
* | x | h| | | |.left| | | |
|
||||
* +------>| v | | +---->| | | |
|
||||
* | +.........+ | | +.........+ | |
|
||||
* | ^ | | | |
|
||||
* | y | | +----------------------+--+ high addresses
|
||||
* O------------+-------+
|
||||
*
|
||||
*
|
||||
* readPixels() must be called within a frame, meaning after beginFrame() and before endFrame().
|
||||
* Typically, readPixels() will be called after render().
|
||||
*
|
||||
* After issuing this method, the callback associated with `buffer` will be invoked on the
|
||||
* main thread, indicating that the read-back has completed. Typically, this will happen
|
||||
* after multiple calls to beginFrame(), render(), endFrame().
|
||||
*
|
||||
* It is also possible to use a Fence to wait for the read-back.
|
||||
*
|
||||
* @remark
|
||||
* readPixels() is intended for debugging and testing. It will impact performance significantly.
|
||||
*
|
||||
*/
|
||||
void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height,
|
||||
backend::PixelBufferDescriptor&& buffer);
|
||||
|
||||
/**
|
||||
* Finishes the current frame and schedules it for display.
|
||||
*
|
||||
* endFrame() schedules the current frame to be displayed on the Renderer's window.
|
||||
*
|
||||
* @note
|
||||
* All calls to render() must happen *before* endFrame(). endFrame() must be called if
|
||||
* beginFrame() returned true, otherwise, endFrame() must not be called unless the caller
|
||||
* ignored beginFrame()'s return value.
|
||||
*
|
||||
* @see
|
||||
* beginFrame()
|
||||
*/
|
||||
void endFrame();
|
||||
|
||||
|
||||
/**
|
||||
* Reads back the content of the provided RenderTarget.
|
||||
*
|
||||
* @param renderTarget RenderTarget to read back from.
|
||||
* @param xoffset Left offset of the sub-region to read back.
|
||||
* @param yoffset Bottom offset of the sub-region to read back.
|
||||
* @param width Width of the sub-region to read back.
|
||||
* @param height Height of the sub-region to read back.
|
||||
* @param buffer Client-side buffer where the read-back will be written.
|
||||
*
|
||||
* The following formats are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA
|
||||
* - PixelBufferDescriptor::PixelDataFormat::RGBA_INTEGER
|
||||
*
|
||||
* The following types are always supported:
|
||||
* - PixelBufferDescriptor::PixelDataType::UBYTE
|
||||
* - PixelBufferDescriptor::PixelDataType::UINT
|
||||
* - PixelBufferDescriptor::PixelDataType::INT
|
||||
* - PixelBufferDescriptor::PixelDataType::FLOAT
|
||||
*
|
||||
* Other combinations of format/type may be supported. If a combination is
|
||||
* not supported, this operation may fail silently. Use a DEBUG build
|
||||
* to get some logs about the failure.
|
||||
*
|
||||
*
|
||||
* Framebuffer as seen on User buffer (PixelBufferDescriptor&)
|
||||
* screen
|
||||
*
|
||||
* +--------------------+
|
||||
* | | .stride .alignment
|
||||
* | | ----------------------->-->
|
||||
* | | O----------------------+--+ low addresses
|
||||
* | | | | | |
|
||||
* | w | | | .top | |
|
||||
* | <---------> | | V | |
|
||||
* | +---------+ | | +---------+ | |
|
||||
* | | ^ | | ======> | | | | |
|
||||
* | x | h| | | |.left| | | |
|
||||
* +------>| v | | +---->| | | |
|
||||
* | +.........+ | | +.........+ | |
|
||||
* | ^ | | | |
|
||||
* | y | | +----------------------+--+ high addresses
|
||||
* O------------+-------+
|
||||
*
|
||||
*
|
||||
* Typically readPixels() will be called after render() and before endFrame().
|
||||
*
|
||||
* After issuing this method, the callback associated with `buffer` will be invoked on the
|
||||
* main thread, indicating that the read-back has completed. Typically, this will happen
|
||||
* after multiple calls to beginFrame(), render(), endFrame().
|
||||
*
|
||||
* It is also possible to use a Fence to wait for the read-back.
|
||||
*
|
||||
* OpenGL only: if issuing a readPixels on a RenderTarget backed by a Texture that had data
|
||||
* uploaded to it via setImage, the data returned from readPixels will be y-flipped with respect
|
||||
* to the setImage call.
|
||||
*
|
||||
* @remark
|
||||
* readPixels() is intended for debugging and testing. It will impact performance significantly.
|
||||
*
|
||||
*/
|
||||
void readPixels(RenderTarget* renderTarget,
|
||||
uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height,
|
||||
backend::PixelBufferDescriptor&& buffer);
|
||||
|
||||
/**
|
||||
* Render a standalone View into its associated RenderTarget
|
||||
*
|
||||
* This call is mostly equivalent to calling render(View*) inside a
|
||||
* beginFrame / endFrame block, but incurs less overhead. It can be used
|
||||
* as a poor man's compute API.
|
||||
*
|
||||
* @param view A pointer to the view to render. This View must have a RenderTarget associated
|
||||
* to it.
|
||||
*
|
||||
* @attention
|
||||
* renderStandaloneView() must be called outside of beginFrame() / endFrame().
|
||||
*
|
||||
* @note
|
||||
* renderStandaloneView() must be called from the Engine's main thread
|
||||
* (or external synchronization must be provided). In particular, calls to
|
||||
* renderStandaloneView() on different Renderer instances **must** be synchronized.
|
||||
*
|
||||
* @remark
|
||||
* renderStandaloneView() perform potentially heavy computations and cannot be multi-threaded.
|
||||
* However, internally, renderStandaloneView() is highly multi-threaded to both improve
|
||||
* performance in mitigate the call's latency.
|
||||
*/
|
||||
void renderStandaloneView(View const* view);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the time in second of the last call to beginFrame(). This value is constant for all
|
||||
* views rendered during a frame. The epoch is set with resetUserTime().
|
||||
*
|
||||
* In materials, this value can be queried using `vec4 getUserTime()`. The value returned
|
||||
* is a highp vec4 encoded as follows:
|
||||
*
|
||||
* time.x = (float)Renderer.getUserTime();
|
||||
* time.y = Renderer.getUserTime() - time.x;
|
||||
*
|
||||
* It follows that the following invariants are true:
|
||||
*
|
||||
* (double)time.x + (double)time.y == Renderer.getUserTime()
|
||||
* time.x == (float)Renderer.getUserTime()
|
||||
*
|
||||
* This encoding allows the shader code to perform high precision (i.e. double) time
|
||||
* calculations when needed despite the lack of double precision in the shader, for e.g.:
|
||||
*
|
||||
* To compute (double)time * vertex in the material, use the following construct:
|
||||
*
|
||||
* vec3 result = time.x * vertex + time.y * vertex;
|
||||
*
|
||||
*
|
||||
* Most of the time, high precision computations are not required, but be aware that the
|
||||
* precision of time.x rapidly diminishes as time passes:
|
||||
*
|
||||
* time | precision
|
||||
* --------+----------
|
||||
* 16.7s | us
|
||||
* 4h39 | ms
|
||||
* 77h | 1/60s
|
||||
*
|
||||
*
|
||||
* In other words, it only possible to get microsecond accuracy for about 16s or millisecond
|
||||
* accuracy for just under 5h.
|
||||
*
|
||||
* This problem can be mitigated by calling resetUserTime(), or using high precision time as
|
||||
* described above.
|
||||
*
|
||||
* @return The time is seconds since resetUserTime() was last called.
|
||||
*
|
||||
* @see
|
||||
* resetUserTime()
|
||||
*/
|
||||
double getUserTime() const;
|
||||
|
||||
/**
|
||||
* Sets the user time epoch to now, i.e. resets the user time to zero.
|
||||
*
|
||||
* Use this method used to keep the precision of time high in materials, in practice it should
|
||||
* be called at least when the application is paused, e.g. Activity.onPause() in Android.
|
||||
*
|
||||
* @see
|
||||
* getUserTime()
|
||||
*/
|
||||
void resetUserTime();
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_RENDERER_H
|
||||
175
flutter_filament/windows/include/filament/filament/Scene.h
Normal file
175
flutter_filament/windows/include/filament/filament/Scene.h
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_SCENE_H
|
||||
#define TNT_FILAMENT_SCENE_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Invocable.h>
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class IndirectLight;
|
||||
class Skybox;
|
||||
|
||||
/**
|
||||
* A Scene is a flat container of Renderable and Light instances.
|
||||
*
|
||||
* A Scene doesn't provide a hierarchy of Renderable objects, i.e.: it's not a scene-graph.
|
||||
* However, it manages the list of objects to render and the list of lights. Renderable
|
||||
* and Light objects can be added or removed from a Scene at any time.
|
||||
*
|
||||
* A Renderable *must* be added to a Scene in order to be rendered, and the Scene must be
|
||||
* provided to a View.
|
||||
*
|
||||
*
|
||||
* Creation and Destruction
|
||||
* ========================
|
||||
*
|
||||
* A Scene is created using Engine.createScene() and destroyed using
|
||||
* Engine.destroy(const Scene*).
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <filament/Scene.h>
|
||||
* #include <filament/Engine.h>
|
||||
* using namespace filament;
|
||||
*
|
||||
* Engine* engine = Engine::create();
|
||||
*
|
||||
* Scene* scene = engine->createScene();
|
||||
* engine->destroy(&scene);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @see View, Renderable, Light
|
||||
*/
|
||||
class UTILS_PUBLIC Scene : public FilamentAPI {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Sets the Skybox.
|
||||
*
|
||||
* The Skybox is drawn last and covers all pixels not touched by geometry.
|
||||
*
|
||||
* @param skybox The Skybox to use to fill untouched pixels, or nullptr to unset the Skybox.
|
||||
*/
|
||||
void setSkybox(Skybox* skybox) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Skybox associated with the Scene.
|
||||
*
|
||||
* @return The associated Skybox, or nullptr if there is none.
|
||||
*/
|
||||
Skybox* getSkybox() const noexcept;
|
||||
|
||||
/**
|
||||
* Set the IndirectLight to use when rendering the Scene.
|
||||
*
|
||||
* Currently, a Scene may only have a single IndirectLight. This call replaces the current
|
||||
* IndirectLight.
|
||||
*
|
||||
* @param ibl The IndirectLight to use when rendering the Scene or nullptr to unset.
|
||||
* @see getIndirectLight
|
||||
*/
|
||||
void setIndirectLight(IndirectLight* ibl) noexcept;
|
||||
|
||||
/**
|
||||
* Get the IndirectLight or nullptr if none is set.
|
||||
*
|
||||
* @return the the IndirectLight or nullptr if none is set
|
||||
* @see setIndirectLight
|
||||
*/
|
||||
IndirectLight* getIndirectLight() const noexcept;
|
||||
|
||||
/**
|
||||
* Adds an Entity to the Scene.
|
||||
*
|
||||
* @param entity The entity is ignored if it doesn't have a Renderable or Light component.
|
||||
*
|
||||
* \attention
|
||||
* A given Entity object can only be added once to a Scene.
|
||||
*
|
||||
*/
|
||||
void addEntity(utils::Entity entity);
|
||||
|
||||
/**
|
||||
* Adds a list of entities to the Scene.
|
||||
*
|
||||
* @param entities Array containing entities to add to the scene.
|
||||
* @param count Size of the entity array.
|
||||
*/
|
||||
void addEntities(const utils::Entity* entities, size_t count);
|
||||
|
||||
/**
|
||||
* Removes the Renderable from the Scene.
|
||||
*
|
||||
* @param entity The Entity to remove from the Scene. If the specified
|
||||
* \p entity doesn't exist, this call is ignored.
|
||||
*/
|
||||
void remove(utils::Entity entity);
|
||||
|
||||
/**
|
||||
* Removes a list of entities to the Scene.
|
||||
*
|
||||
* This is equivalent to calling remove in a loop.
|
||||
* If any of the specified entities do not exist in the scene, they are skipped.
|
||||
*
|
||||
* @param entities Array containing entities to remove from the scene.
|
||||
* @param count Size of the entity array.
|
||||
*/
|
||||
void removeEntities(const utils::Entity* entities, size_t count);
|
||||
|
||||
/**
|
||||
* Returns the number of Renderable objects in the Scene.
|
||||
*
|
||||
* @return number of Renderable objects in the Scene.
|
||||
*/
|
||||
size_t getRenderableCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the total number of Light objects in the Scene.
|
||||
*
|
||||
* @return The total number of Light objects in the Scene.
|
||||
*/
|
||||
size_t getLightCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns true if the given entity is in the Scene.
|
||||
*
|
||||
* @return Whether the given entity is in the Scene.
|
||||
*/
|
||||
bool hasEntity(utils::Entity entity) const noexcept;
|
||||
|
||||
/**
|
||||
* Invokes user functor on each entity in the scene.
|
||||
*
|
||||
* It is not allowed to add or remove an entity from the scene within the functor.
|
||||
*
|
||||
* @param functor User provided functor called for each entity in the scene
|
||||
*/
|
||||
void forEach(utils::Invocable<void(utils::Entity entity)>&& functor) const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_SCENE_H
|
||||
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_SKINNINGBUFFER_H
|
||||
#define TNT_FILAMENT_SKINNINGBUFFER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <filament/RenderableManager.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* SkinningBuffer is used to hold skinning data (bones). It is a simple wraper around
|
||||
* a structured UBO.
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
class UTILS_PUBLIC SkinningBuffer : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Size of the skinning buffer in bones.
|
||||
*
|
||||
* Due to limitation in the GLSL, the SkinningBuffer must always by a multiple of
|
||||
* 256, this adjustment is done automatically, but can cause
|
||||
* some memory overhead. This memory overhead can be mitigated by using the same
|
||||
* SkinningBuffer to store the bone information for multiple RenderPrimitives.
|
||||
*
|
||||
* @param boneCount Number of bones the skinning buffer can hold.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& boneCount(uint32_t boneCount) noexcept;
|
||||
|
||||
/**
|
||||
* The new buffer is created with identity bones
|
||||
* @param initialize true to initializing the buffer, false to not.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& initialize(bool initialize = true) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the SkinningBuffer object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this SkinningBuffer with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*
|
||||
* @see SkinningBuffer::setBones
|
||||
*/
|
||||
SkinningBuffer* build(Engine& engine);
|
||||
private:
|
||||
friend class FSkinningBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates the bone transforms in the range [offset, offset + count).
|
||||
* @param engine Reference to the filament::Engine to associate this SkinningBuffer with.
|
||||
* @param transforms pointer to at least count Bone
|
||||
* @param count number of Bone elements in transforms
|
||||
* @param offset offset in elements (not bytes) in the SkinningBuffer (not in transforms)
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
void setBones(Engine& engine, RenderableManager::Bone const* transforms,
|
||||
size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Updates the bone transforms in the range [offset, offset + count).
|
||||
* @param engine Reference to the filament::Engine to associate this SkinningBuffer with.
|
||||
* @param transforms pointer to at least count mat4f
|
||||
* @param count number of mat4f elements in transforms
|
||||
* @param offset offset in elements (not bytes) in the SkinningBuffer (not in transforms)
|
||||
* @see RenderableManager::setSkinningBuffer
|
||||
*/
|
||||
void setBones(Engine& engine, math::mat4f const* transforms,
|
||||
size_t count, size_t offset = 0);
|
||||
|
||||
/**
|
||||
* Returns the size of this SkinningBuffer in elements.
|
||||
* @return The number of bones the SkinningBuffer holds.
|
||||
*/
|
||||
size_t getBoneCount() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif //TNT_FILAMENT_SKINNINGBUFFER_H
|
||||
181
flutter_filament/windows/include/filament/filament/Skybox.h
Normal file
181
flutter_filament/windows/include/filament/filament/Skybox.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_SKYBOX_H
|
||||
#define TNT_FILAMENT_SKYBOX_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FSkybox;
|
||||
|
||||
class Engine;
|
||||
class Texture;
|
||||
|
||||
/**
|
||||
* Skybox
|
||||
*
|
||||
* When added to a Scene, the Skybox fills all untouched pixels.
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* A Skybox object is created using the Skybox::Builder and destroyed by calling
|
||||
* Engine::destroy(const Skybox*).
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
*
|
||||
* filament::IndirectLight* skybox = filament::Skybox::Builder()
|
||||
* .environment(cubemap)
|
||||
* .build(*engine);
|
||||
*
|
||||
* engine->destroy(skybox);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
*
|
||||
* @note
|
||||
* Currently only Texture based sky boxes are supported.
|
||||
*
|
||||
* @see Scene, IndirectLight
|
||||
*/
|
||||
class UTILS_PUBLIC Skybox : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
//! Use Builder to construct an Skybox object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Set the environment map (i.e. the skybox content).
|
||||
*
|
||||
* The Skybox is rendered as though it were an infinitely large cube with the camera
|
||||
* inside it. This means that the cubemap which is mapped onto the cube's exterior
|
||||
* will appear mirrored. This follows the OpenGL conventions.
|
||||
*
|
||||
* The cmgen tool generates reflection maps by default which are therefore ideal to use
|
||||
* as skyboxes.
|
||||
*
|
||||
* @param cubemap This Texture must be a cube map.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @see Texture
|
||||
*/
|
||||
Builder& environment(Texture* cubemap) noexcept;
|
||||
|
||||
/**
|
||||
* Indicates whether the sun should be rendered. The sun can only be
|
||||
* rendered if there is at least one light of type SUN in the scene.
|
||||
* The default value is false.
|
||||
*
|
||||
* @param show True if the sun should be rendered, false otherwise
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& showSun(bool show) noexcept;
|
||||
|
||||
/**
|
||||
* Skybox intensity when no IndirectLight is set on the Scene.
|
||||
*
|
||||
* This call is ignored when an IndirectLight is set on the Scene, and the intensity
|
||||
* of the IndirectLight is used instead.
|
||||
*
|
||||
* @param envIntensity Scale factor applied to the skybox texel values such that
|
||||
* the result is in lux, or lumen/m^2 (default = 30000)
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*
|
||||
* @see IndirectLight::Builder::intensity
|
||||
*/
|
||||
Builder& intensity(float envIntensity) noexcept;
|
||||
|
||||
/**
|
||||
* Sets the skybox to a constant color. Default is opaque black.
|
||||
*
|
||||
* Ignored if an environment is set.
|
||||
*
|
||||
* @param color the constant color
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& color(math::float4 color) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the Skybox object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this Skybox with.
|
||||
*
|
||||
* @return pointer to the newly created object, or nullptr if the light couldn't be created.
|
||||
*/
|
||||
Skybox* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FSkybox;
|
||||
};
|
||||
|
||||
void setColor(math::float4 color) noexcept;
|
||||
|
||||
/**
|
||||
* Sets bits in a visibility mask. By default, this is 0x1.
|
||||
*
|
||||
* This provides a simple mechanism for hiding or showing this Skybox in a Scene.
|
||||
*
|
||||
* @see View::setVisibleLayers().
|
||||
*
|
||||
* For example, to set bit 1 and reset bits 0 and 2 while leaving all other bits unaffected,
|
||||
* call: `setLayerMask(7, 2)`.
|
||||
*
|
||||
* @param select the set of bits to affect
|
||||
* @param values the replacement values for the affected bits
|
||||
*/
|
||||
void setLayerMask(uint8_t select, uint8_t values) noexcept;
|
||||
|
||||
/**
|
||||
* @return the visibility mask bits
|
||||
*/
|
||||
uint8_t getLayerMask() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the skybox's intensity in lux, or lumen/m^2.
|
||||
*/
|
||||
float getIntensity() const noexcept;
|
||||
|
||||
/**
|
||||
* @return the associated texture, or null if it does not exist
|
||||
*/
|
||||
Texture const* getTexture() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_SKYBOX_H
|
||||
214
flutter_filament/windows/include/filament/filament/Stream.h
Normal file
214
flutter_filament/windows/include/filament/filament/Stream.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_STREAM_H
|
||||
#define TNT_FILAMENT_STREAM_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <backend/PixelBufferDescriptor.h>
|
||||
#include <backend/CallbackHandler.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FStream;
|
||||
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* Stream is used to attach a video stream to a Filament `Texture`.
|
||||
*
|
||||
* Note that the `Stream` class is fairly Android centric. It supports two different
|
||||
* configurations:
|
||||
*
|
||||
* - ACQUIRED.....connects to an Android AHardwareBuffer
|
||||
* - NATIVE.......connects to an Android SurfaceTexture
|
||||
*
|
||||
* Before explaining these different configurations, let's review the high-level structure of an AR
|
||||
* or video application that uses Filament:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* while (true) {
|
||||
*
|
||||
* // Misc application work occurs here, such as:
|
||||
* // - Writing the image data for a video frame into a Stream
|
||||
* // - Moving the Filament Camera
|
||||
*
|
||||
* if (renderer->beginFrame(swapChain)) {
|
||||
* renderer->render(view);
|
||||
* renderer->endFrame();
|
||||
* }
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Let's say that the video image data at the time of a particular invocation of `beginFrame`
|
||||
* becomes visible to users at time A. The 3D scene state (including the camera) at the time of
|
||||
* that same invocation becomes apparent to users at time B.
|
||||
*
|
||||
* - If time A matches time B, we say that the stream is \em{synchronized}.
|
||||
* - Filament invokes low-level graphics commands on the \em{driver thread}.
|
||||
* - The thread that calls `beginFrame` is called the \em{main thread}.
|
||||
*
|
||||
* For ACQUIRED streams, there is no need to perform the copy because Filament explictly acquires
|
||||
* the stream, then releases it later via a callback function. This configuration is especially
|
||||
* useful when the Vulkan backend is enabled.
|
||||
*
|
||||
* For NATIVE streams, Filament does not make any synchronization guarantee. However they are simple
|
||||
* to use and do not incur a copy. These are often appropriate in video applications.
|
||||
*
|
||||
* Please see `sample-stream-test` and `sample-hello-camera` for usage examples.
|
||||
*
|
||||
* @see backend::StreamType
|
||||
* @see Texture#setExternalStream
|
||||
* @see Engine#destroyStream
|
||||
*/
|
||||
class UTILS_PUBLIC Stream : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using Callback = backend::StreamCallback;
|
||||
using StreamType = backend::StreamType;
|
||||
|
||||
/**
|
||||
* Constructs a Stream object instance.
|
||||
*
|
||||
* By default, Stream objects are ACQUIRED and must have external images pushed to them via
|
||||
* <pre>Stream::setAcquiredImage</pre>.
|
||||
*
|
||||
* To create a NATIVE stream, call the <pre>stream</pre> method on the builder.
|
||||
*/
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Creates a NATIVE stream. Native streams can sample data directly from an
|
||||
* opaque platform object such as a SurfaceTexture on Android.
|
||||
*
|
||||
* @param stream An opaque native stream handle. e.g.: on Android this is an
|
||||
* `android/graphics/SurfaceTexture` JNI jobject. The wrap mode must
|
||||
* be CLAMP_TO_EDGE.
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& stream(void* stream) noexcept;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param width initial width of the incoming stream. Whether this value is used is
|
||||
* stream dependent. On Android, it must be set when using
|
||||
* Builder::stream(long externalTextureId).
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& width(uint32_t width) noexcept;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param height initial height of the incoming stream. Whether this value is used is
|
||||
* stream dependent. On Android, it must be set when using
|
||||
* Builder::stream(long externalTextureId).
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& height(uint32_t height) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the Stream object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this Stream with.
|
||||
*
|
||||
* @return pointer to the newly created object, or nullptr if the stream couldn't be created.
|
||||
*/
|
||||
Stream* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FStream;
|
||||
};
|
||||
|
||||
/**
|
||||
* Indicates whether this stream is a NATIVE stream or ACQUIRED stream.
|
||||
*/
|
||||
StreamType getStreamType() const noexcept;
|
||||
|
||||
/**
|
||||
* Updates an ACQUIRED stream with an image that is guaranteed to be used in the next frame.
|
||||
*
|
||||
* This method tells Filament to immediately "acquire" the image and trigger a callback
|
||||
* when it is done with it. This should be called by the user outside of beginFrame / endFrame,
|
||||
* and should be called only once per frame. If the user pushes images to the same stream
|
||||
* multiple times in a single frame, only the final image is honored, but all callbacks are
|
||||
* invoked.
|
||||
*
|
||||
* This method should be called on the same thread that calls Renderer::beginFrame, which is
|
||||
* also where the callback is invoked. This method can only be used for streams that were
|
||||
* constructed without calling the `stream` method on the builder.
|
||||
*
|
||||
* @see Stream for more information about NATIVE and ACQUIRED configurations.
|
||||
*
|
||||
* @param image Pointer to AHardwareBuffer, casted to void* since this is a public header.
|
||||
* @param callback This is triggered by Filament when it wishes to release the image.
|
||||
* It callback tales two arguments: the AHardwareBuffer and the userdata.
|
||||
* @param userdata Optional closure data. Filament will pass this into the callback when it
|
||||
* releases the image.
|
||||
*/
|
||||
void setAcquiredImage(void* image, Callback callback, void* userdata) noexcept;
|
||||
|
||||
/**
|
||||
* @see setAcquiredImage(void*, Callback, void*)
|
||||
*
|
||||
* @param image Pointer to AHardwareBuffer, casted to void* since this is a public header.
|
||||
* @param handler Handler to dispatch the AcquiredImage or nullptr for the default handler.
|
||||
* @param callback This is triggered by Filament when it wishes to release the image.
|
||||
* It callback tales two arguments: the AHardwareBuffer and the userdata.
|
||||
* @param userdata Optional closure data. Filament will pass this into the callback when it
|
||||
* releases the image.
|
||||
*/
|
||||
void setAcquiredImage(void* image, backend::CallbackHandler* handler, Callback callback, void* userdata) noexcept;
|
||||
|
||||
/**
|
||||
* Updates the size of the incoming stream. Whether this value is used is
|
||||
* stream dependent. On Android, it must be set when using
|
||||
* Builder::stream(long externalTextureId).
|
||||
*
|
||||
* @param width new width of the incoming stream
|
||||
* @param height new height of the incoming stream
|
||||
*/
|
||||
void setDimensions(uint32_t width, uint32_t height) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the presentation time of the currently displayed frame in nanosecond.
|
||||
*
|
||||
* This value can change at any time.
|
||||
*
|
||||
* @return timestamp in nanosecond.
|
||||
*/
|
||||
int64_t getTimestamp() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_STREAM_H
|
||||
259
flutter_filament/windows/include/filament/filament/SwapChain.h
Normal file
259
flutter_filament/windows/include/filament/filament/SwapChain.h
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_SWAPCHAIN_H
|
||||
#define TNT_FILAMENT_SWAPCHAIN_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/PresentCallable.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* A swap chain represents an Operating System's *native* renderable surface.
|
||||
*
|
||||
* Typically it's a native window or a view. Because a SwapChain is initialized from a
|
||||
* native object, it is given to filament as a `void *`, which must be of the proper type
|
||||
* for each platform filament is running on.
|
||||
*
|
||||
* \code
|
||||
* SwapChain* swapChain = engine->createSwapChain(nativeWindow);
|
||||
* \endcode
|
||||
*
|
||||
* When Engine::create() is used without specifying a Platform, the `nativeWindow`
|
||||
* parameter above must be of type:
|
||||
*
|
||||
* Platform | nativeWindow type
|
||||
* :---------------|:----------------------------:
|
||||
* Android | ANativeWindow*
|
||||
* macOS - OpenGL | NSView*
|
||||
* macOS - Metal | CAMetalLayer*
|
||||
* iOS - OpenGL | CAEAGLLayer*
|
||||
* iOS - Metal | CAMetalLayer*
|
||||
* X11 | Window
|
||||
* Windows | HWND
|
||||
*
|
||||
* Otherwise, the `nativeWindow` is defined by the concrete implementation of Platform.
|
||||
*
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* Android
|
||||
* -------
|
||||
*
|
||||
* On Android, an `ANativeWindow*` can be obtained from a Java `Surface` object using:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* #include <android/native_window_jni.h>
|
||||
* // parameters
|
||||
* // env: JNIEnv*
|
||||
* // surface: jobject
|
||||
* ANativeWindow* win = ANativeWindow_fromSurface(env, surface);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* \warning
|
||||
* Don't use reflection to access the `mNativeObject` field, it won't work.
|
||||
*
|
||||
* A `Surface` can be retrieved from a `SurfaceView` or `SurfaceHolder` easily using
|
||||
* `SurfaceHolder.getSurface()` and/or `SurfaceView.getHolder()`.
|
||||
*
|
||||
* \note
|
||||
* To use a `TextureView` as a SwapChain, it is necessary to first get its `SurfaceTexture`,
|
||||
* for instance using `TextureView.SurfaceTextureListener` and then create a `Surface`:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.java}
|
||||
* // using a TextureView.SurfaceTextureListener:
|
||||
* public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) {
|
||||
* mSurface = new Surface(surfaceTexture);
|
||||
* // mSurface can now be used in JNI to create an ANativeWindow.
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Linux
|
||||
* -----
|
||||
*
|
||||
* Example using SDL:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* SDL_SysWMinfo wmi;
|
||||
* SDL_VERSION(&wmi.version);
|
||||
* SDL_GetWindowWMInfo(sdlWindow, &wmi);
|
||||
* Window nativeWindow = (Window) wmi.info.x11.window;
|
||||
*
|
||||
* using namespace filament;
|
||||
* Engine* engine = Engine::create();
|
||||
* SwapChain* swapChain = engine->createSwapChain((void*) nativeWindow);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* Windows
|
||||
* -------
|
||||
*
|
||||
* Example using SDL:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* SDL_SysWMinfo wmi;
|
||||
* SDL_VERSION(&wmi.version);
|
||||
* ASSERT_POSTCONDITION(SDL_GetWindowWMInfo(sdlWindow, &wmi), "SDL version unsupported!");
|
||||
* HDC nativeWindow = (HDC) wmi.info.win.hdc;
|
||||
*
|
||||
* using namespace filament;
|
||||
* Engine* engine = Engine::create();
|
||||
* SwapChain* swapChain = engine->createSwapChain((void*) nativeWindow);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* OSX
|
||||
* ---
|
||||
*
|
||||
* On OSX, any `NSView` can be used *directly* as a `nativeWindow` with createSwapChain().
|
||||
*
|
||||
* Example using SDL/Objective-C:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.mm}
|
||||
* #include <filament/Engine.h>
|
||||
*
|
||||
* #include <Cocoa/Cocoa.h>
|
||||
* #include <SDL_syswm.h>
|
||||
*
|
||||
* SDL_SysWMinfo wmi;
|
||||
* SDL_VERSION(&wmi.version);
|
||||
* NSWindow* win = (NSWindow*) wmi.info.cocoa.window;
|
||||
* NSView* view = [win contentView];
|
||||
* void* nativeWindow = view;
|
||||
*
|
||||
* using namespace filament;
|
||||
* Engine* engine = Engine::create();
|
||||
* SwapChain* swapChain = engine->createSwapChain(nativeWindow);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @see Engine
|
||||
*/
|
||||
class UTILS_PUBLIC SwapChain : public FilamentAPI {
|
||||
public:
|
||||
using FrameScheduledCallback = backend::FrameScheduledCallback;
|
||||
using FrameCompletedCallback = backend::FrameCompletedCallback;
|
||||
|
||||
/**
|
||||
* Requests a SwapChain with an alpha channel.
|
||||
*/
|
||||
static const uint64_t CONFIG_TRANSPARENT = backend::SWAP_CHAIN_CONFIG_TRANSPARENT;
|
||||
|
||||
/**
|
||||
* This flag indicates that the swap chain may be used as a source surface
|
||||
* for reading back render results. This config must be set when creating
|
||||
* any swap chain that will be used as the source for a blit operation.
|
||||
*
|
||||
* @see
|
||||
* Renderer.copyFrame()
|
||||
*/
|
||||
static const uint64_t CONFIG_READABLE = backend::SWAP_CHAIN_CONFIG_READABLE;
|
||||
|
||||
/**
|
||||
* Indicates that the native X11 window is an XCB window rather than an XLIB window.
|
||||
* This is ignored on non-Linux platforms and in builds that support only one X11 API.
|
||||
*/
|
||||
static const uint64_t CONFIG_ENABLE_XCB = backend::SWAP_CHAIN_CONFIG_ENABLE_XCB;
|
||||
|
||||
/**
|
||||
* Indicates that the native window is a CVPixelBufferRef.
|
||||
*
|
||||
* This is only supported by the Metal backend. The CVPixelBuffer must be in the
|
||||
* kCVPixelFormatType_32BGRA format.
|
||||
*
|
||||
* It is not necessary to add an additional retain call before passing the pixel buffer to
|
||||
* Filament. Filament will call CVPixelBufferRetain during Engine::createSwapChain, and
|
||||
* CVPixelBufferRelease when the swap chain is destroyed.
|
||||
*/
|
||||
static const uint64_t CONFIG_APPLE_CVPIXELBUFFER =
|
||||
backend::SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER;
|
||||
|
||||
/**
|
||||
* Indicates that the SwapChain must automatically perform linear to sRGB encoding.
|
||||
*
|
||||
* This flag is ignored if isSRGBSwapChainSupported() is false.
|
||||
*
|
||||
* When using this flag, the output colorspace in ColorGrading should be set to
|
||||
* Rec709-Linear-D65, or post-processing should be disabled.
|
||||
*
|
||||
* @see isSRGBSwapChainSupported()
|
||||
* @see ColorGrading.outputColorSpace()
|
||||
* @see View.setPostProcessingEnabled()
|
||||
*/
|
||||
static constexpr uint64_t CONFIG_SRGB_COLORSPACE = backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE;
|
||||
|
||||
/**
|
||||
* Return whether createSwapChain supports the SWAP_CHAIN_CONFIG_SRGB_COLORSPACE flag.
|
||||
* The default implementation returns false.
|
||||
*
|
||||
* @param engine A pointer to the filament Engine
|
||||
* @return true if SWAP_CHAIN_CONFIG_SRGB_COLORSPACE is supported, false otherwise.
|
||||
*/
|
||||
static bool isSRGBSwapChainSupported(Engine& engine) noexcept;
|
||||
|
||||
void* getNativeWindow() const noexcept;
|
||||
|
||||
/**
|
||||
* FrameScheduledCallback is a callback function that notifies an application when Filament has
|
||||
* completed processing a frame and that frame is ready to be scheduled for presentation.
|
||||
*
|
||||
* Typically, Filament is responsible for scheduling the frame's presentation to the SwapChain.
|
||||
* If a SwapChain::FrameScheduledCallback is set, however, the application bares the
|
||||
* responsibility of scheduling a frame for presentation by calling the backend::PresentCallable
|
||||
* passed to the callback function. Currently this functionality is only supported by the Metal
|
||||
* backend.
|
||||
*
|
||||
* A FrameScheduledCallback can be set on an individual SwapChain through
|
||||
* SwapChain::setFrameScheduledCallback. If the callback is set, then the SwapChain will *not*
|
||||
* automatically schedule itself for presentation. Instead, the application must call the
|
||||
* PresentCallable passed to the FrameScheduledCallback.
|
||||
*
|
||||
* @param callback A callback, or nullptr to unset.
|
||||
* @param user An optional pointer to user data passed to the callback function.
|
||||
*
|
||||
* @remark Only Filament's Metal backend supports PresentCallables and frame callbacks. Other
|
||||
* backends ignore the callback (which will never be called) and proceed normally.
|
||||
*
|
||||
* @remark The SwapChain::FrameScheduledCallback is called on an arbitrary thread.
|
||||
*
|
||||
* @see PresentCallable
|
||||
*/
|
||||
void setFrameScheduledCallback(FrameScheduledCallback callback, void* user = nullptr);
|
||||
|
||||
/**
|
||||
* FrameCompletedCallback is a callback function that notifies an application when a frame's
|
||||
* contents have completed rendering on the GPU.
|
||||
*
|
||||
* Use SwapChain::setFrameCompletedCallback to set a callback on an individual SwapChain. Each
|
||||
* time a frame completes GPU rendering, the callback will be called with optional user data.
|
||||
*
|
||||
* The FrameCompletedCallback is guaranteed to be called on the main Filament thread.
|
||||
*
|
||||
* @param callback A callback, or nullptr to unset.
|
||||
* @param user An optional pointer to user data passed to the callback function.
|
||||
*
|
||||
* @remark Only Filament's Metal backend supports frame callbacks. Other backends ignore the
|
||||
* callback (which will never be called) and proceed normally.
|
||||
*/
|
||||
void setFrameCompletedCallback(FrameCompletedCallback callback, void* user = nullptr);
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_SWAPCHAIN_H
|
||||
548
flutter_filament/windows/include/filament/filament/Texture.h
Normal file
548
flutter_filament/windows/include/filament/filament/Texture.h
Normal file
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_TEXTURE_H
|
||||
#define TNT_FILAMENT_TEXTURE_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/PixelBufferDescriptor.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FTexture;
|
||||
|
||||
class Engine;
|
||||
class Stream;
|
||||
|
||||
/**
|
||||
* Texture
|
||||
*
|
||||
* The Texture class supports:
|
||||
* - 2D textures
|
||||
* - 3D textures
|
||||
* - Cube maps
|
||||
* - mip mapping
|
||||
*
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* A Texture object is created using the Texture::Builder and destroyed by calling
|
||||
* Engine::destroy(const Texture*).
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
*
|
||||
* filament::Texture* texture = filament::Texture::Builder()
|
||||
* .width(64)
|
||||
* .height(64)
|
||||
* .build(*engine);
|
||||
*
|
||||
* engine->destroy(texture);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC Texture : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
static constexpr const size_t BASE_LEVEL = 0;
|
||||
|
||||
//! Face offsets for all faces of a cubemap
|
||||
struct FaceOffsets;
|
||||
|
||||
using PixelBufferDescriptor = backend::PixelBufferDescriptor; //!< Geometry of a pixel buffer
|
||||
using Sampler = backend::SamplerType; //!< Type of sampler
|
||||
using InternalFormat = backend::TextureFormat; //!< Internal texel format
|
||||
using CubemapFace = backend::TextureCubemapFace; //!< Cube map faces
|
||||
using Format = backend::PixelDataFormat; //!< Pixel color format
|
||||
using Type = backend::PixelDataType; //!< Pixel data format
|
||||
using CompressedType = backend::CompressedPixelDataType; //!< Compressed pixel data format
|
||||
using Usage = backend::TextureUsage; //!< Usage affects texel layout
|
||||
using Swizzle = backend::TextureSwizzle; //!< Texture swizzle
|
||||
|
||||
/** @return whether a backend supports a particular format. */
|
||||
static bool isTextureFormatSupported(Engine& engine, InternalFormat format) noexcept;
|
||||
|
||||
/** @return whether a backend supports texture swizzling. */
|
||||
static bool isTextureSwizzleSupported(Engine& engine) noexcept;
|
||||
|
||||
static size_t computeTextureDataSize(Texture::Format format, Texture::Type type,
|
||||
size_t stride, size_t height, size_t alignment) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* Options for environment prefiltering into reflection map
|
||||
*
|
||||
* @see generatePrefilterMipmap()
|
||||
*/
|
||||
struct PrefilterOptions {
|
||||
uint16_t sampleCount = 8; //!< sample count used for filtering
|
||||
bool mirror = true; //!< whether the environment must be mirrored
|
||||
private:
|
||||
UTILS_UNUSED uintptr_t reserved[3] = {};
|
||||
};
|
||||
|
||||
|
||||
//! Use Builder to construct a Texture object instance
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the width in texels of the texture. Doesn't need to be a power-of-two.
|
||||
* @param width Width of the texture in texels (default: 1).
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& width(uint32_t width) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the height in texels of the texture. Doesn't need to be a power-of-two.
|
||||
* @param height Height of the texture in texels (default: 1).
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& height(uint32_t height) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the depth in texels of the texture. Doesn't need to be a power-of-two.
|
||||
* The depth controls the number of layers in a 2D array texture. Values greater than 1
|
||||
* effectively create a 3D texture.
|
||||
* @param depth Depth of the texture in texels (default: 1).
|
||||
* @return This Builder, for chaining calls.
|
||||
* @attention This Texture instance must use Sampler::SAMPLER_3D or
|
||||
* Sampler::SAMPLER_2D_ARRAY or it has no effect.
|
||||
*/
|
||||
Builder& depth(uint32_t depth) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the numbers of mip map levels.
|
||||
* This creates a mip-map pyramid. The maximum number of levels a texture can have is
|
||||
* such that max(width, height, level) / 2^MAX_LEVELS = 1
|
||||
* @param levels Number of mipmap levels for this texture.
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& levels(uint8_t levels) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the type of sampler to use.
|
||||
* @param target Sampler type
|
||||
* @return This Builder, for chaining calls.
|
||||
* @see Sampler
|
||||
*/
|
||||
Builder& sampler(Sampler target) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies the *internal* format of this texture.
|
||||
*
|
||||
* The internal format specifies how texels are stored (which may be different from how
|
||||
* they're specified in setImage()). InternalFormat specifies both the color components
|
||||
* and the data type used.
|
||||
*
|
||||
* @param format Format of the texture's texel.
|
||||
* @return This Builder, for chaining calls.
|
||||
* @see InternalFormat, setImage
|
||||
*/
|
||||
Builder& format(InternalFormat format) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies if the texture will be used as a render target attachment.
|
||||
*
|
||||
* If the texture is potentially rendered into, it may require a different memory layout,
|
||||
* which needs to be known during construction.
|
||||
*
|
||||
* @param usage Defaults to Texture::Usage::DEFAULT; c.f. Texture::Usage::COLOR_ATTACHMENT.
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& usage(Usage usage) noexcept;
|
||||
|
||||
/**
|
||||
* Specifies how a texture's channels map to color components
|
||||
*
|
||||
* Texture Swizzle is only supported if isTextureSwizzleSupported() returns true.
|
||||
*
|
||||
* @param r texture channel for red component
|
||||
* @param g texture channel for green component
|
||||
* @param b texture channel for blue component
|
||||
* @param a texture channel for alpha component
|
||||
* @return This Builder, for chaining calls.
|
||||
* @see Texture::isTextureSwizzleSupported()
|
||||
*/
|
||||
Builder& swizzle(Swizzle r, Swizzle g, Swizzle b, Swizzle a) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the Texture object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this Texture with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
Texture* build(Engine& engine);
|
||||
|
||||
/* no user serviceable parts below */
|
||||
|
||||
/**
|
||||
* Specify a native texture to import as a Filament texture.
|
||||
*
|
||||
* The texture id is backend-specific:
|
||||
* - OpenGL: GLuint texture ID
|
||||
* - Metal: id<MTLTexture>
|
||||
*
|
||||
* With Metal, the id<MTLTexture> object should be cast to an intptr_t using
|
||||
* CFBridgingRetain to transfer ownership to Filament. Filament will release ownership of
|
||||
* the texture object when the Filament texture is destroyed.
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
|
||||
* id <MTLTexture> metalTexture = ...
|
||||
* filamentTexture->import((intptr_t) CFBridgingRetain(metalTexture));
|
||||
* // free to release metalTexture
|
||||
*
|
||||
* // after using texture:
|
||||
* engine->destroy(filamentTexture); // metalTexture is released
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* @warning This method should be used as a last resort. This API is subject to change or
|
||||
* removal.
|
||||
*
|
||||
* @param id a backend specific texture identifier
|
||||
*
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& import(intptr_t id) noexcept;
|
||||
|
||||
private:
|
||||
friend class FTexture;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the width of a 2D or 3D texture level
|
||||
* @param level texture level.
|
||||
* @return Width in texel of the specified \p level, clamped to 1.
|
||||
* @attention If this texture is using Sampler::SAMPLER_EXTERNAL, the dimension
|
||||
* of the texture are unknown and this method always returns whatever was set on the Builder.
|
||||
*/
|
||||
size_t getWidth(size_t level = BASE_LEVEL) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the height of a 2D or 3D texture level
|
||||
* @param level texture level.
|
||||
* @return Height in texel of the specified \p level, clamped to 1.
|
||||
* @attention If this texture is using Sampler::SAMPLER_EXTERNAL, the dimension
|
||||
* of the texture are unknown and this method always returns whatever was set on the Builder.
|
||||
*/
|
||||
size_t getHeight(size_t level = BASE_LEVEL) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the depth of a 3D texture level
|
||||
* @param level texture level.
|
||||
* @return Depth in texel of the specified \p level, clamped to 1.
|
||||
* @attention If this texture is using Sampler::SAMPLER_EXTERNAL, the dimension
|
||||
* of the texture are unknown and this method always returns whatever was set on the Builder.
|
||||
*/
|
||||
size_t getDepth(size_t level = BASE_LEVEL) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the maximum number of levels this texture can have.
|
||||
* @return maximum number of levels this texture can have.
|
||||
* @attention If this texture is using Sampler::SAMPLER_EXTERNAL, the dimension
|
||||
* of the texture are unknown and this method always returns whatever was set on the Builder.
|
||||
*/
|
||||
size_t getLevels() const noexcept;
|
||||
|
||||
/**
|
||||
* Return this texture Sampler as set by Builder::sampler().
|
||||
* @return this texture Sampler as set by Builder::sampler()
|
||||
*/
|
||||
Sampler getTarget() const noexcept;
|
||||
|
||||
/**
|
||||
* Return this texture InternalFormat as set by Builder::format().
|
||||
* @return this texture InternalFormat as set by Builder::format().
|
||||
*/
|
||||
InternalFormat getFormat() const noexcept;
|
||||
|
||||
/**
|
||||
* Updates a sub-image of a 3D texture or 2D texture array for a level. Cubemaps are treated
|
||||
* like a 2D array of six layers.
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
* @param level Level to set the image for.
|
||||
* @param xoffset Left offset of the sub-region to update.
|
||||
* @param yoffset Bottom offset of the sub-region to update.
|
||||
* @param zoffset Depth offset of the sub-region to update.
|
||||
* @param width Width of the sub-region to update.
|
||||
* @param height Height of the sub-region to update.
|
||||
* @param depth Depth of the sub-region to update.
|
||||
* @param buffer Client-side buffer containing the image to set.
|
||||
*
|
||||
* @attention \p engine must be the instance passed to Builder::build()
|
||||
* @attention \p level must be less than getLevels().
|
||||
* @attention \p buffer's Texture::Format must match that of getFormat().
|
||||
* @attention This Texture instance must use Sampler::SAMPLER_3D, Sampler::SAMPLER_2D_ARRAY
|
||||
* or Sampler::SAMPLER_CUBEMAP.
|
||||
*
|
||||
* @see Builder::sampler()
|
||||
*/
|
||||
void setImage(Engine& engine, size_t level,
|
||||
uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
|
||||
uint32_t width, uint32_t height, uint32_t depth,
|
||||
PixelBufferDescriptor&& buffer) const;
|
||||
|
||||
/**
|
||||
* inline helper to update a 2D texture
|
||||
*
|
||||
* @see setImage(Engine& engine, size_t level,
|
||||
* uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
|
||||
* uint32_t width, uint32_t height, uint32_t depth,
|
||||
* PixelBufferDescriptor&& buffer)
|
||||
*/
|
||||
inline void setImage(Engine& engine, size_t level, PixelBufferDescriptor&& buffer) const {
|
||||
setImage(engine, level, 0, 0, 0,
|
||||
uint32_t(getWidth(level)), uint32_t(getHeight(level)), 1, std::move(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* inline helper to update a 2D texture
|
||||
*
|
||||
* @see setImage(Engine& engine, size_t level,
|
||||
* uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
|
||||
* uint32_t width, uint32_t height, uint32_t depth,
|
||||
* PixelBufferDescriptor&& buffer)
|
||||
*/
|
||||
inline void setImage(Engine& engine, size_t level,
|
||||
uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height,
|
||||
PixelBufferDescriptor&& buffer) const {
|
||||
setImage(engine, level, xoffset, yoffset, 0, width, height, 1, std::move(buffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify all six images of a cube map level.
|
||||
*
|
||||
* This method follows exactly the OpenGL conventions.
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
* @param level Level to set the image for.
|
||||
* @param buffer Client-side buffer containing the images to set.
|
||||
* @param faceOffsets Offsets in bytes into \p buffer for all six images. The offsets
|
||||
* are specified in the following order: +x, -x, +y, -y, +z, -z
|
||||
*
|
||||
* @attention \p engine must be the instance passed to Builder::build()
|
||||
* @attention \p level must be less than getLevels().
|
||||
* @attention \p buffer's Texture::Format must match that of getFormat().
|
||||
* @attention This Texture instance must use Sampler::SAMPLER_CUBEMAP or it has no effect
|
||||
*
|
||||
* @see Texture::CubemapFace, Builder::sampler()
|
||||
*
|
||||
* @deprecated Instead, use setImage(Engine& engine, size_t level,
|
||||
* uint32_t xoffset, uint32_t yoffset, uint32_t zoffset,
|
||||
* uint32_t width, uint32_t height, uint32_t depth,
|
||||
* PixelBufferDescriptor&& buffer)
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
void setImage(Engine& engine, size_t level,
|
||||
PixelBufferDescriptor&& buffer, const FaceOffsets& faceOffsets) const;
|
||||
|
||||
|
||||
/**
|
||||
* Specify the external image to associate with this Texture. Typically the external
|
||||
* image is OS specific, and can be a video or camera frame.
|
||||
* There are many restrictions when using an external image as a texture, such as:
|
||||
* - only the level of detail (lod) 0 can be specified
|
||||
* - only nearest or linear filtering is supported
|
||||
* - the size and format of the texture is defined by the external image
|
||||
* - only the CLAMP_TO_EDGE wrap mode is supported
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
* @param image An opaque handle to a platform specific image. Supported types are
|
||||
* eglImageOES on Android and CVPixelBufferRef on iOS.
|
||||
*
|
||||
* On iOS the following pixel formats are supported:
|
||||
* - kCVPixelFormatType_32BGRA
|
||||
* - kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
|
||||
*
|
||||
* @attention \p engine must be the instance passed to Builder::build()
|
||||
* @attention This Texture instance must use Sampler::SAMPLER_EXTERNAL or it has no effect
|
||||
*
|
||||
* @see Builder::sampler()
|
||||
*
|
||||
*/
|
||||
void setExternalImage(Engine& engine, void* image) noexcept;
|
||||
|
||||
/**
|
||||
* Specify the external image and plane to associate with this Texture. Typically the external
|
||||
* image is OS specific, and can be a video or camera frame. When using this method, the
|
||||
* external image must be a planar type (such as a YUV camera frame). The plane parameter
|
||||
* selects which image plane is bound to this texture.
|
||||
*
|
||||
* A single external image can be bound to different Filament textures, with each texture
|
||||
* associated with a separate plane:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* textureA->setExternalImage(engine, image, 0);
|
||||
* textureB->setExternalImage(engine, image, 1);
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* There are many restrictions when using an external image as a texture, such as:
|
||||
* - only the level of detail (lod) 0 can be specified
|
||||
* - only nearest or linear filtering is supported
|
||||
* - the size and format of the texture is defined by the external image
|
||||
* - only the CLAMP_TO_EDGE wrap mode is supported
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
* @param image An opaque handle to a platform specific image. Supported types are
|
||||
* eglImageOES on Android and CVPixelBufferRef on iOS.
|
||||
* @param plane The plane index of the external image to associate with this texture.
|
||||
*
|
||||
* This method is only meaningful on iOS with
|
||||
* kCVPixelFormatType_420YpCbCr8BiPlanarFullRange images. On platforms
|
||||
* other than iOS, this method is a no-op.
|
||||
*/
|
||||
void setExternalImage(Engine& engine, void* image, size_t plane) noexcept;
|
||||
|
||||
/**
|
||||
* Specify the external stream to associate with this Texture. Typically the external
|
||||
* stream is OS specific, and can be a video or camera stream.
|
||||
* There are many restrictions when using an external stream as a texture, such as:
|
||||
* - only the level of detail (lod) 0 can be specified
|
||||
* - only nearest or linear filtering is supported
|
||||
* - the size and format of the texture is defined by the external stream
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
* @param stream A Stream object
|
||||
*
|
||||
* @attention \p engine must be the instance passed to Builder::build()
|
||||
* @attention This Texture instance must use Sampler::SAMPLER_EXTERNAL or it has no effect
|
||||
*
|
||||
* @see Builder::sampler(), Stream
|
||||
*
|
||||
*/
|
||||
void setExternalStream(Engine& engine, Stream* stream) noexcept;
|
||||
|
||||
/**
|
||||
* Generates all the mipmap levels automatically. This requires the texture to have a
|
||||
* color-renderable format.
|
||||
*
|
||||
* @param engine Engine this texture is associated to.
|
||||
*
|
||||
* @attention \p engine must be the instance passed to Builder::build()
|
||||
* @attention This Texture instance must NOT use Sampler::SAMPLER_CUBEMAP or it has no effect
|
||||
*/
|
||||
void generateMipmaps(Engine& engine) const noexcept;
|
||||
|
||||
/**
|
||||
* Creates a reflection map from an environment map.
|
||||
*
|
||||
* This is a utility function that replaces calls to Texture::setImage().
|
||||
* The provided environment map is processed and all mipmap levels are populated. The
|
||||
* processing is similar to the offline tool `cmgen` as a lower quality setting.
|
||||
*
|
||||
* This function is intended to be used when the environment cannot be processed offline,
|
||||
* for instance if it's generated at runtime.
|
||||
*
|
||||
* The source data must obey to some constraints:
|
||||
* - the data type must be PixelDataFormat::RGB
|
||||
* - the data format must be one of
|
||||
* - PixelDataType::FLOAT
|
||||
* - PixelDataType::HALF
|
||||
*
|
||||
* The current texture must be a cubemap
|
||||
*
|
||||
* The reflections cubemap's internal format cannot be a compressed format.
|
||||
*
|
||||
* The reflections cubemap's dimension must be a power-of-two.
|
||||
*
|
||||
* @warning This operation is computationally intensive, especially with large environments and
|
||||
* is currently synchronous. Expect about 1ms for a 16x16 cubemap.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this IndirectLight with.
|
||||
* @param buffer Client-side buffer containing the images to set.
|
||||
* @param faceOffsets Offsets in bytes into \p buffer for all six images. The offsets
|
||||
* are specified in the following order: +x, -x, +y, -y, +z, -z
|
||||
* @param options Optional parameter to controlling user-specified quality and options.
|
||||
*
|
||||
* @exception utils::PreConditionPanic if the source data constraints are not respected.
|
||||
*
|
||||
*/
|
||||
void generatePrefilterMipmap(Engine& engine,
|
||||
PixelBufferDescriptor&& buffer, const FaceOffsets& faceOffsets,
|
||||
PrefilterOptions const* options = nullptr);
|
||||
|
||||
|
||||
/** @deprecated */
|
||||
struct FaceOffsets {
|
||||
using size_type = size_t;
|
||||
union {
|
||||
struct {
|
||||
size_type px; //!< +x face offset in bytes
|
||||
size_type nx; //!< -x face offset in bytes
|
||||
size_type py; //!< +y face offset in bytes
|
||||
size_type ny; //!< -y face offset in bytes
|
||||
size_type pz; //!< +z face offset in bytes
|
||||
size_type nz; //!< -z face offset in bytes
|
||||
};
|
||||
size_type offsets[6];
|
||||
};
|
||||
size_type operator[](size_t n) const noexcept { return offsets[n]; }
|
||||
size_type& operator[](size_t n) { return offsets[n]; }
|
||||
FaceOffsets() noexcept = default;
|
||||
explicit FaceOffsets(size_type faceSize) noexcept {
|
||||
px = faceSize * 0;
|
||||
nx = faceSize * 1;
|
||||
py = faceSize * 2;
|
||||
ny = faceSize * 3;
|
||||
pz = faceSize * 4;
|
||||
nz = faceSize * 5;
|
||||
}
|
||||
FaceOffsets(const FaceOffsets& rhs) noexcept {
|
||||
px = rhs.px;
|
||||
nx = rhs.nx;
|
||||
py = rhs.py;
|
||||
ny = rhs.ny;
|
||||
pz = rhs.pz;
|
||||
nz = rhs.nz;
|
||||
}
|
||||
FaceOffsets& operator=(const FaceOffsets& rhs) noexcept {
|
||||
px = rhs.px;
|
||||
nx = rhs.nx;
|
||||
py = rhs.py;
|
||||
ny = rhs.ny;
|
||||
pz = rhs.pz;
|
||||
nz = rhs.nz;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_TEXTURE_H
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_TEXTURESAMPLER_H
|
||||
#define TNT_FILAMENT_TEXTURESAMPLER_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* TextureSampler defines how a texture is accessed.
|
||||
*/
|
||||
class UTILS_PUBLIC TextureSampler {
|
||||
public:
|
||||
using WrapMode = backend::SamplerWrapMode;
|
||||
using MinFilter = backend::SamplerMinFilter;
|
||||
using MagFilter = backend::SamplerMagFilter;
|
||||
using CompareMode = backend::SamplerCompareMode;
|
||||
using CompareFunc = backend::SamplerCompareFunc;
|
||||
|
||||
/**
|
||||
* Creates a default sampler.
|
||||
* The default parameters are:
|
||||
* - filterMag : NEAREST
|
||||
* - filterMin : NEAREST
|
||||
* - wrapS : CLAMP_TO_EDGE
|
||||
* - wrapT : CLAMP_TO_EDGE
|
||||
* - wrapR : CLAMP_TO_EDGE
|
||||
* - compareMode : NONE
|
||||
* - compareFunc : Less or equal
|
||||
* - no anisotropic filtering
|
||||
*/
|
||||
TextureSampler() noexcept = default;
|
||||
|
||||
TextureSampler(const TextureSampler& rhs) noexcept = default;
|
||||
TextureSampler& operator=(const TextureSampler& rhs) noexcept = default;
|
||||
|
||||
/**
|
||||
* Creates a TextureSampler with the default parameters but setting the filtering and wrap modes.
|
||||
* @param minMag filtering for both minification and magnification
|
||||
* @param str wrapping mode for all texture coordinate axes
|
||||
*/
|
||||
explicit TextureSampler(MagFilter minMag, WrapMode str = WrapMode::CLAMP_TO_EDGE) noexcept {
|
||||
mSamplerParams.filterMin = MinFilter(minMag);
|
||||
mSamplerParams.filterMag = minMag;
|
||||
mSamplerParams.wrapS = str;
|
||||
mSamplerParams.wrapT = str;
|
||||
mSamplerParams.wrapR = str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TextureSampler with the default parameters but setting the filtering and wrap modes.
|
||||
* @param min filtering for minification
|
||||
* @param mag filtering for magnification
|
||||
* @param str wrapping mode for all texture coordinate axes
|
||||
*/
|
||||
TextureSampler(MinFilter min, MagFilter mag, WrapMode str = WrapMode::CLAMP_TO_EDGE) noexcept {
|
||||
mSamplerParams.filterMin = min;
|
||||
mSamplerParams.filterMag = mag;
|
||||
mSamplerParams.wrapS = str;
|
||||
mSamplerParams.wrapT = str;
|
||||
mSamplerParams.wrapR = str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TextureSampler with the default parameters but setting the filtering and wrap modes.
|
||||
* @param min filtering for minification
|
||||
* @param mag filtering for magnification
|
||||
* @param s wrap mode for the s (horizontal)texture coordinate
|
||||
* @param t wrap mode for the t (vertical) texture coordinate
|
||||
* @param r wrap mode for the r (depth) texture coordinate
|
||||
*/
|
||||
TextureSampler(MinFilter min, MagFilter mag, WrapMode s, WrapMode t, WrapMode r) noexcept {
|
||||
mSamplerParams.filterMin = min;
|
||||
mSamplerParams.filterMag = mag;
|
||||
mSamplerParams.wrapS = s;
|
||||
mSamplerParams.wrapT = t;
|
||||
mSamplerParams.wrapR = r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TextureSampler with the default parameters but setting the compare mode and function
|
||||
* @param mode Compare mode
|
||||
* @param func Compare function
|
||||
*/
|
||||
explicit TextureSampler(CompareMode mode, CompareFunc func = CompareFunc::LE) noexcept {
|
||||
mSamplerParams.compareMode = mode;
|
||||
mSamplerParams.compareFunc = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minification filter
|
||||
* @param v Minification filter
|
||||
*/
|
||||
void setMinFilter(MinFilter v) noexcept {
|
||||
mSamplerParams.filterMin = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the magnification filter
|
||||
* @param v Magnification filter
|
||||
*/
|
||||
void setMagFilter(MagFilter v) noexcept {
|
||||
mSamplerParams.filterMag = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the wrap mode for the s (horizontal) texture coordinate
|
||||
* @param v wrap mode
|
||||
*/
|
||||
void setWrapModeS(WrapMode v) noexcept {
|
||||
mSamplerParams.wrapS = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the wrap mode for the t (vertical) texture coordinate
|
||||
* @param v wrap mode
|
||||
*/
|
||||
void setWrapModeT(WrapMode v) noexcept {
|
||||
mSamplerParams.wrapT = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the wrap mode for the r (depth, for 3D textures) texture coordinate
|
||||
* @param v wrap mode
|
||||
*/
|
||||
void setWrapModeR(WrapMode v) noexcept {
|
||||
mSamplerParams.wrapR = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* This controls anisotropic filtering.
|
||||
* @param anisotropy Amount of anisotropy, should be a power-of-two. The default is 0.
|
||||
* The maximum permissible value is 7.
|
||||
*/
|
||||
void setAnisotropy(float anisotropy) noexcept {
|
||||
const int log2 = ilogbf(anisotropy > 0 ? anisotropy : -anisotropy);
|
||||
mSamplerParams.anisotropyLog2 = uint8_t(log2 < 7 ? log2 : 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the compare mode and function.
|
||||
* @param mode Compare mode
|
||||
* @param func Compare function
|
||||
*/
|
||||
void setCompareMode(CompareMode mode, CompareFunc func = CompareFunc::LE) noexcept {
|
||||
mSamplerParams.compareMode = mode;
|
||||
mSamplerParams.compareFunc = func;
|
||||
}
|
||||
|
||||
//! returns the minification filter value
|
||||
MinFilter getMinFilter() const noexcept { return mSamplerParams.filterMin; }
|
||||
|
||||
//! returns the magnification filter value
|
||||
MagFilter getMagFilter() const noexcept { return mSamplerParams.filterMag; }
|
||||
|
||||
//! returns the s-coordinate wrap mode (horizontal)
|
||||
WrapMode getWrapModeS() const noexcept { return mSamplerParams.wrapS; }
|
||||
|
||||
//! returns the t-coordinate wrap mode (vertical)
|
||||
WrapMode getWrapModeT() const noexcept { return mSamplerParams.wrapT; }
|
||||
|
||||
//! returns the r-coordinate wrap mode (depth)
|
||||
WrapMode getWrapModeR() const noexcept { return mSamplerParams.wrapR; }
|
||||
|
||||
//! returns the anisotropy value
|
||||
float getAnisotropy() const noexcept { return float(1u << mSamplerParams.anisotropyLog2); }
|
||||
|
||||
//! returns the compare mode
|
||||
CompareMode getCompareMode() const noexcept { return mSamplerParams.compareMode; }
|
||||
|
||||
//! returns the compare function
|
||||
CompareFunc getCompareFunc() const noexcept { return mSamplerParams.compareFunc; }
|
||||
|
||||
|
||||
// no user-serviceable parts below...
|
||||
backend::SamplerParams getSamplerParams() const noexcept { return mSamplerParams; }
|
||||
|
||||
private:
|
||||
backend::SamplerParams mSamplerParams{};
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_TEXTURESAMPLER_H
|
||||
227
flutter_filament/windows/include/filament/filament/ToneMapper.h
Normal file
227
flutter_filament/windows/include/filament/filament/ToneMapper.h
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_TONEMAPPER_H
|
||||
#define TNT_FILAMENT_TONEMAPPER_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Interface for tone mapping operators. A tone mapping operator, or tone mapper,
|
||||
* is responsible for compressing the dynamic range of the rendered scene to a
|
||||
* dynamic range suitable for display.
|
||||
*
|
||||
* In Filament, tone mapping is a color grading step. ToneMapper instances are
|
||||
* created and passed to the ColorGrading::Builder to produce a 3D LUT that will
|
||||
* be used during post-processing to prepare the final color buffer for display.
|
||||
*
|
||||
* Filament provides several default tone mapping operators that fall into three
|
||||
* categories:
|
||||
*
|
||||
* - Configurable tone mapping operators
|
||||
* - GenericToneMapper
|
||||
* - Fixed-aesthetic tone mapping operators
|
||||
* - ACESToneMapper
|
||||
* - ACESLegacyToneMapper
|
||||
* - FilmicToneMapper
|
||||
* - Debug/validation tone mapping operators
|
||||
* - LinearToneMapper
|
||||
* - DisplayRangeToneMapper
|
||||
*
|
||||
* You can create custom tone mapping operators by subclassing ToneMapper.
|
||||
*/
|
||||
struct UTILS_PUBLIC ToneMapper {
|
||||
ToneMapper() noexcept;
|
||||
virtual ~ToneMapper() noexcept;
|
||||
|
||||
/**
|
||||
* Maps an open domain (or "scene referred" values) color value to display
|
||||
* domain (or "display referred") color value. Both the input and output
|
||||
* color values are defined in the Rec.2020 color space, with no transfer
|
||||
* function applied ("linear Rec.2020").
|
||||
*
|
||||
* @param c Input color to tone map, in the Rec.2020 color space with no
|
||||
* transfer function applied ("linear")
|
||||
*
|
||||
* @return A tone mapped color in the Rec.2020 color space, with no transfer
|
||||
* function applied ("linear")
|
||||
*/
|
||||
virtual math::float3 operator()(math::float3 c) const noexcept = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Linear tone mapping operator that returns the input color but clamped to
|
||||
* the 0..1 range. This operator is mostly useful for debugging.
|
||||
*/
|
||||
struct UTILS_PUBLIC LinearToneMapper final : public ToneMapper {
|
||||
LinearToneMapper() noexcept;
|
||||
~LinearToneMapper() noexcept final;
|
||||
|
||||
math::float3 operator()(math::float3 c) const noexcept override;
|
||||
};
|
||||
|
||||
/**
|
||||
* ACES tone mapping operator. This operator is an implementation of the
|
||||
* ACES Reference Rendering Transform (RRT) combined with the Output Device
|
||||
* Transform (ODT) for sRGB monitors (dim surround, 100 nits).
|
||||
*/
|
||||
struct UTILS_PUBLIC ACESToneMapper final : public ToneMapper {
|
||||
ACESToneMapper() noexcept;
|
||||
~ACESToneMapper() noexcept final;
|
||||
|
||||
math::float3 operator()(math::float3 c) const noexcept override;
|
||||
};
|
||||
|
||||
/**
|
||||
* ACES tone mapping operator, modified to match the perceived brightness
|
||||
* of FilmicToneMapper. This operator is the same as ACESToneMapper but
|
||||
* applies a brightness multiplier of ~1.6 to the input color value to
|
||||
* target brighter viewing environments.
|
||||
*/
|
||||
struct UTILS_PUBLIC ACESLegacyToneMapper final : public ToneMapper {
|
||||
ACESLegacyToneMapper() noexcept;
|
||||
~ACESLegacyToneMapper() noexcept final;
|
||||
|
||||
math::float3 operator()(math::float3 c) const noexcept override;
|
||||
};
|
||||
|
||||
/**
|
||||
* "Filmic" tone mapping operator. This tone mapper was designed to
|
||||
* approximate the aesthetics of the ACES RRT + ODT for Rec.709
|
||||
* and historically Filament's default tone mapping operator. It exists
|
||||
* only for backward compatibility purposes and is not otherwise recommended.
|
||||
*/
|
||||
struct UTILS_PUBLIC FilmicToneMapper final : public ToneMapper {
|
||||
FilmicToneMapper() noexcept;
|
||||
~FilmicToneMapper() noexcept final;
|
||||
|
||||
math::float3 operator()(math::float3 x) const noexcept override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic tone mapping operator that gives control over the tone mapping
|
||||
* curve. This operator can be used to control the aesthetics of the final
|
||||
* image. This operator also allows to control the dynamic range of the
|
||||
* scene referred values.
|
||||
*
|
||||
* The tone mapping curve is defined by 5 parameters:
|
||||
* - contrast: controls the contrast of the curve
|
||||
* - midGrayIn: sets the input middle gray
|
||||
* - midGrayOut: sets the output middle gray
|
||||
* - hdrMax: defines the maximum input value that will be mapped to
|
||||
* output white
|
||||
*/
|
||||
struct UTILS_PUBLIC GenericToneMapper final : public ToneMapper {
|
||||
/**
|
||||
* Builds a new generic tone mapper. The default values of the
|
||||
* constructor parameters approximate an ACES tone mapping curve
|
||||
* and the maximum input value is set to 10.0.
|
||||
*
|
||||
* @param contrast controls the contrast of the curve, must be > 0.0, values
|
||||
* in the range 0.5..2.0 are recommended.
|
||||
* @param midGrayIn sets the input middle gray, between 0.0 and 1.0.
|
||||
* @param midGrayOut sets the output middle gray, between 0.0 and 1.0.
|
||||
* @param hdrMax defines the maximum input value that will be mapped to
|
||||
* output white. Must be >= 1.0.
|
||||
*/
|
||||
explicit GenericToneMapper(
|
||||
float contrast = 1.55f,
|
||||
float midGrayIn = 0.18f,
|
||||
float midGrayOut = 0.215f,
|
||||
float hdrMax = 10.0f
|
||||
) noexcept;
|
||||
~GenericToneMapper() noexcept final;
|
||||
|
||||
GenericToneMapper(GenericToneMapper const&) = delete;
|
||||
GenericToneMapper& operator=(GenericToneMapper const&) = delete;
|
||||
GenericToneMapper(GenericToneMapper&& rhs) noexcept;
|
||||
GenericToneMapper& operator=(GenericToneMapper&& rhs) noexcept;
|
||||
|
||||
math::float3 operator()(math::float3 x) const noexcept override;
|
||||
|
||||
/** Returns the contrast of the curve as a strictly positive value. */
|
||||
float getContrast() const noexcept;
|
||||
|
||||
/** Returns how fast scene referred values map to output white as a value between 0.0 and 1.0. */
|
||||
float getShoulder() const noexcept;
|
||||
|
||||
/** Returns the middle gray point for input values as a value between 0.0 and 1.0. */
|
||||
float getMidGrayIn() const noexcept;
|
||||
|
||||
/** Returns the middle gray point for output values as a value between 0.0 and 1.0. */
|
||||
float getMidGrayOut() const noexcept;
|
||||
|
||||
/** Returns the maximum input value that will map to output white, as a value >= 1.0. */
|
||||
float getHdrMax() const noexcept;
|
||||
|
||||
/** Sets the contrast of the curve, must be > 0.0, values in the range 0.5..2.0 are recommended. */
|
||||
void setContrast(float contrast) noexcept;
|
||||
|
||||
/** Sets the input middle gray, between 0.0 and 1.0. */
|
||||
void setMidGrayIn(float midGrayIn) noexcept;
|
||||
|
||||
/** Sets the output middle gray, between 0.0 and 1.0. */
|
||||
void setMidGrayOut(float midGrayOut) noexcept;
|
||||
|
||||
/** Defines the maximum input value that will be mapped to output white. Must be >= 1.0. */
|
||||
void setHdrMax(float hdrMax) noexcept;
|
||||
|
||||
private:
|
||||
struct Options;
|
||||
Options* mOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
* A tone mapper that converts the input HDR RGB color into one of 16 debug colors
|
||||
* that represent the pixel's exposure. When the output is cyan, the input color
|
||||
* represents middle gray (18% exposure). Every exposure stop above or below middle
|
||||
* gray causes a color shift.
|
||||
*
|
||||
* The relationship between exposures and colors is:
|
||||
*
|
||||
* - -5EV black
|
||||
* - -4EV darkest blue
|
||||
* - -3EV darker blue
|
||||
* - -2EV dark blue
|
||||
* - -1EV blue
|
||||
* - OEV cyan
|
||||
* - +1EV dark green
|
||||
* - +2EV green
|
||||
* - +3EV yellow
|
||||
* - +4EV yellow-orange
|
||||
* - +5EV orange
|
||||
* - +6EV bright red
|
||||
* - +7EV red
|
||||
* - +8EV magenta
|
||||
* - +9EV purple
|
||||
* - +10EV white
|
||||
*
|
||||
* This tone mapper is useful to validate and tweak scene lighting.
|
||||
*/
|
||||
struct UTILS_PUBLIC DisplayRangeToneMapper final : public ToneMapper {
|
||||
DisplayRangeToneMapper() noexcept;
|
||||
~DisplayRangeToneMapper() noexcept override;
|
||||
|
||||
math::float3 operator()(math::float3 c) const noexcept override;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_TONEMAPPER_H
|
||||
@@ -0,0 +1,316 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_TRANSFORMMANAGER_H
|
||||
#define TNT_FILAMENT_TRANSFORMMANAGER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/EntityInstance.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <iterator>
|
||||
|
||||
|
||||
namespace utils {
|
||||
class Entity;
|
||||
} // namespace utils
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FTransformManager;
|
||||
|
||||
/**
|
||||
* TransformManager is used to add transform components to entities.
|
||||
*
|
||||
* A Transform component gives an entity a position and orientation in space in the coordinate
|
||||
* space of its parent transform. The TransformManager takes care of computing the world-space
|
||||
* transform of each component (i.e. its transform relative to the root).
|
||||
*
|
||||
* Creation and destruction
|
||||
* ========================
|
||||
*
|
||||
* A transform component is created using TransformManager::create() and destroyed by calling
|
||||
* TransformManager::destroy().
|
||||
*
|
||||
* ~~~~~~~~~~~{.cpp}
|
||||
* filament::Engine* engine = filament::Engine::create();
|
||||
* utils::Entity object = utils::EntityManager.get().create();
|
||||
*
|
||||
* auto& tcm = engine->getTransformManager();
|
||||
*
|
||||
* // create the transform component
|
||||
* tcm.create(object);
|
||||
*
|
||||
* // set its transform
|
||||
* auto i = tcm.getInstance(object);
|
||||
* tcm.setTransform(i, mat4f::translation({ 0, 0, -1 }));
|
||||
*
|
||||
* // destroy the transform component
|
||||
* tcm.destroy(object);
|
||||
* ~~~~~~~~~~~
|
||||
*
|
||||
*/
|
||||
class UTILS_PUBLIC TransformManager : public FilamentAPI {
|
||||
public:
|
||||
using Instance = utils::EntityInstance<TransformManager>;
|
||||
|
||||
class children_iterator {
|
||||
friend class FTransformManager;
|
||||
TransformManager const& mManager;
|
||||
Instance mInstance;
|
||||
children_iterator(TransformManager const& mgr, Instance instance) noexcept
|
||||
: mManager(mgr), mInstance(instance) { }
|
||||
public:
|
||||
using value_type = Instance;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = Instance*;
|
||||
using reference = Instance&;
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
|
||||
children_iterator& operator++();
|
||||
|
||||
children_iterator operator++(int) { // NOLINT
|
||||
children_iterator ret(*this);
|
||||
++(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool operator == (const children_iterator& other) const noexcept {
|
||||
return mInstance == other.mInstance;
|
||||
}
|
||||
|
||||
bool operator != (const children_iterator& other) const noexcept {
|
||||
return mInstance != other.mInstance;
|
||||
}
|
||||
|
||||
value_type operator*() const { return mInstance; }
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns whether a particular Entity is associated with a component of this TransformManager
|
||||
* @param e An Entity.
|
||||
* @return true if this Entity has a component associated with this manager.
|
||||
*/
|
||||
bool hasComponent(utils::Entity e) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets an Instance representing the transform component associated with the given Entity.
|
||||
* @param e An Entity.
|
||||
* @return An Instance object, which represents the transform component associated with the Entity e.
|
||||
* @note Use Instance::isValid() to make sure the component exists.
|
||||
* @see hasComponent()
|
||||
*/
|
||||
Instance getInstance(utils::Entity e) const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable the accurate translation mode. Disabled by default.
|
||||
*
|
||||
* When accurate translation mode is active, the translation component of all transforms is
|
||||
* maintained at double precision. This is only useful if the mat4 version of setTransform()
|
||||
* is used, as well as getTransformAccurate().
|
||||
*
|
||||
* @param enable true to enable the accurate translation mode, false to disable.
|
||||
*
|
||||
* @see isAccurateTranslationsEnabled
|
||||
* @see create(utils::Entity, Instance, const math::mat4&);
|
||||
* @see setTransform(Instance, const math::mat4&)
|
||||
* @see getTransformAccurate
|
||||
* @see getWorldTransformAccurate
|
||||
*/
|
||||
void setAccurateTranslationsEnabled(bool enable) noexcept;
|
||||
|
||||
/**
|
||||
* Returns whether the high precision translation mode is active.
|
||||
* @return true if accurate translations mode is active, false otherwise
|
||||
* @see setAccurateTranslationsEnabled
|
||||
*/
|
||||
bool isAccurateTranslationsEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Creates a transform component and associate it with the given entity.
|
||||
* @param entity An Entity to associate a transform component to.
|
||||
* @param parent The Instance of the parent transform, or Instance{} if no parent.
|
||||
* @param localTransform The transform to initialize the transform component with.
|
||||
* This is always relative to the parent.
|
||||
*
|
||||
* If this component already exists on the given entity, it is first destroyed as if
|
||||
* destroy(utils::Entity e) was called.
|
||||
*
|
||||
* @see destroy()
|
||||
*/
|
||||
void create(utils::Entity entity, Instance parent, const math::mat4f& localTransform);
|
||||
void create(utils::Entity entity, Instance parent, const math::mat4& localTransform); //!< \overload
|
||||
void create(utils::Entity entity, Instance parent = {}); //!< \overload
|
||||
|
||||
/**
|
||||
* Destroys this component from the given entity, children are orphaned.
|
||||
* @param e An entity.
|
||||
*
|
||||
* @note If this transform had children, these are orphaned, which means their local
|
||||
* transform becomes a world transform. Usually it's nonsensical. It's recommended to make
|
||||
* sure that a destroyed transform doesn't have children.
|
||||
*
|
||||
* @see create()
|
||||
*/
|
||||
void destroy(utils::Entity e) noexcept;
|
||||
|
||||
/**
|
||||
* Re-parents an entity to a new one.
|
||||
* @param i The instance of the transform component to re-parent
|
||||
* @param newParent The instance of the new parent transform
|
||||
* @attention It is an error to re-parent an entity to a descendant and will cause undefined behaviour.
|
||||
* @see getInstance()
|
||||
*/
|
||||
void setParent(Instance i, Instance newParent) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the parent of a transform component, or the null entity if it is a root.
|
||||
* @param i The instance of the transform component to query.
|
||||
*/
|
||||
utils::Entity getParent(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the number of children of a transform component.
|
||||
* @param i The instance of the transform component to query.
|
||||
* @return The number of children of the queried component.
|
||||
*/
|
||||
size_t getChildCount(Instance i) const noexcept;
|
||||
|
||||
/**
|
||||
* Gets a list of children for a transform component.
|
||||
*
|
||||
* @param i The instance of the transform component to query.
|
||||
* @param children Pointer to array-of-Entity. The array must have at least "count" elements.
|
||||
* @param count The maximum number of children to retrieve.
|
||||
* @return The number of children written to the pointer.
|
||||
*/
|
||||
size_t getChildren(Instance i, utils::Entity* children, size_t count) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns an iterator to the Instance of the first child of the given parent.
|
||||
*
|
||||
* @param parent Instance of the parent
|
||||
* @return A forward iterator pointing to the first child of the given parent.
|
||||
*
|
||||
* A child_iterator can only safely be dereferenced if it's different from getChildrenEnd(parent)
|
||||
*/
|
||||
children_iterator getChildrenBegin(Instance parent) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns an undreferencable iterator representing the end of the children list
|
||||
*
|
||||
* @param parent Instance of the parent
|
||||
* @return A forward iterator.
|
||||
*
|
||||
* This iterator cannot be dereferenced
|
||||
*/
|
||||
children_iterator getChildrenEnd(Instance parent) const noexcept;
|
||||
|
||||
/**
|
||||
* Sets a local transform of a transform component.
|
||||
* @param ci The instance of the transform component to set the local transform to.
|
||||
* @param localTransform The local transform (i.e. relative to the parent).
|
||||
* @see getTransform()
|
||||
* @attention This operation can be slow if the hierarchy of transform is too deep, and this
|
||||
* will be particularly bad when updating a lot of transforms. In that case,
|
||||
* consider using openLocalTransformTransaction() / commitLocalTransformTransaction().
|
||||
*/
|
||||
void setTransform(Instance ci, const math::mat4f& localTransform) noexcept;
|
||||
|
||||
/**
|
||||
* Sets a local transform of a transform component and keeps double precision translation.
|
||||
* All other values of the transform are stored at single precision.
|
||||
* @param ci The instance of the transform component to set the local transform to.
|
||||
* @param localTransform The local transform (i.e. relative to the parent).
|
||||
* @see getTransform()
|
||||
* @attention This operation can be slow if the hierarchy of transform is too deep, and this
|
||||
* will be particularly bad when updating a lot of transforms. In that case,
|
||||
* consider using openLocalTransformTransaction() / commitLocalTransformTransaction().
|
||||
*/
|
||||
void setTransform(Instance ci, const math::mat4& localTransform) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the local transform of a transform component.
|
||||
* @param ci The instance of the transform component to query the local transform from.
|
||||
* @return The local transform of the component (i.e. relative to the parent). This always
|
||||
* returns the value set by setTransform().
|
||||
* @see setTransform()
|
||||
*/
|
||||
const math::mat4f& getTransform(Instance ci) const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the local transform of a transform component.
|
||||
* @param ci The instance of the transform component to query the local transform from.
|
||||
* @return The local transform of the component (i.e. relative to the parent). This always
|
||||
* returns the value set by setTransform().
|
||||
* @see setTransform()
|
||||
*/
|
||||
const math::mat4 getTransformAccurate(Instance ci) const noexcept;
|
||||
|
||||
/**
|
||||
* Return the world transform of a transform component.
|
||||
* @param ci The instance of the transform component to query the world transform from.
|
||||
* @return The world transform of the component (i.e. relative to the root). This is the
|
||||
* composition of this component's local transform with its parent's world transform.
|
||||
* @see setTransform()
|
||||
*/
|
||||
const math::mat4f& getWorldTransform(Instance ci) const noexcept;
|
||||
|
||||
/**
|
||||
* Return the world transform of a transform component.
|
||||
* @param ci The instance of the transform component to query the world transform from.
|
||||
* @return The world transform of the component (i.e. relative to the root). This is the
|
||||
* composition of this component's local transform with its parent's world transform.
|
||||
* @see setTransform()
|
||||
*/
|
||||
const math::mat4 getWorldTransformAccurate(Instance ci) const noexcept;
|
||||
|
||||
/**
|
||||
* Opens a local transform transaction. During a transaction, getWorldTransform() can
|
||||
* return an invalid transform until commitLocalTransformTransaction() is called. However,
|
||||
* setTransform() will perform significantly better and in constant time.
|
||||
*
|
||||
* This is useful when updating many transforms and the transform hierarchy is deep (say more
|
||||
* than 4 or 5 levels).
|
||||
*
|
||||
* @note If the local transform transaction is already open, this is a no-op.
|
||||
*
|
||||
* @see commitLocalTransformTransaction(), setTransform()
|
||||
*/
|
||||
void openLocalTransformTransaction() noexcept;
|
||||
|
||||
/**
|
||||
* Commits the currently open local transform transaction. When this returns, calls
|
||||
* to getWorldTransform() will return the proper value.
|
||||
*
|
||||
* @attention failing to call this method when done updating the local transform will cause
|
||||
* a lot of rendering problems. The system never closes the transaction
|
||||
* automatically.
|
||||
*
|
||||
* @note If the local transform transaction is not open, this is a no-op.
|
||||
*
|
||||
* @see openLocalTransformTransaction(), setTransform()
|
||||
*/
|
||||
void commitLocalTransformTransaction() noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
|
||||
#endif // TNT_TRANSFORMMANAGER_H
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_VERTEXBUFFER_H
|
||||
#define TNT_FILAMENT_VERTEXBUFFER_H
|
||||
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/MaterialEnums.h>
|
||||
|
||||
#include <backend/BufferDescriptor.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
class FVertexBuffer;
|
||||
|
||||
class BufferObject;
|
||||
class Engine;
|
||||
|
||||
/**
|
||||
* Holds a set of buffers that define the geometry of a Renderable.
|
||||
*
|
||||
* The geometry of the Renderable itself is defined by a set of vertex attributes such as
|
||||
* position, color, normals, tangents, etc...
|
||||
*
|
||||
* There is no need to have a 1-to-1 mapping between attributes and buffer. A buffer can hold the
|
||||
* data of several attributes -- attributes are then referred as being "interleaved".
|
||||
*
|
||||
* The buffers themselves are GPU resources, therefore mutating their data can be relatively slow.
|
||||
* For this reason, it is best to separate the constant data from the dynamic data into multiple
|
||||
* buffers.
|
||||
*
|
||||
* It is possible, and even encouraged, to use a single vertex buffer for several Renderables.
|
||||
*
|
||||
* @see IndexBuffer, RenderableManager
|
||||
*/
|
||||
class UTILS_PUBLIC VertexBuffer : public FilamentAPI {
|
||||
struct BuilderDetails;
|
||||
|
||||
public:
|
||||
using AttributeType = backend::ElementType;
|
||||
using BufferDescriptor = backend::BufferDescriptor;
|
||||
|
||||
class Builder : public BuilderBase<BuilderDetails> {
|
||||
friend struct BuilderDetails;
|
||||
public:
|
||||
Builder() noexcept;
|
||||
Builder(Builder const& rhs) noexcept;
|
||||
Builder(Builder&& rhs) noexcept;
|
||||
~Builder() noexcept;
|
||||
Builder& operator=(Builder const& rhs) noexcept;
|
||||
Builder& operator=(Builder&& rhs) noexcept;
|
||||
|
||||
/**
|
||||
* Defines how many buffers will be created in this vertex buffer set. These buffers are
|
||||
* later referenced by index from 0 to \p bufferCount - 1.
|
||||
*
|
||||
* This call is mandatory. The default is 0.
|
||||
*
|
||||
* @param bufferCount Number of buffers in this vertex buffer set. The maximum value is 8.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& bufferCount(uint8_t bufferCount) noexcept;
|
||||
|
||||
/**
|
||||
* Size of each buffer in the set in vertex.
|
||||
*
|
||||
* @param vertexCount Number of vertices in each buffer in this set.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*/
|
||||
Builder& vertexCount(uint32_t vertexCount) noexcept;
|
||||
|
||||
/**
|
||||
* Allows buffers to be swapped out and shared using BufferObject.
|
||||
*
|
||||
* If buffer objects mode is enabled, clients must call setBufferObjectAt rather than
|
||||
* setBufferAt. This allows sharing of data between VertexBuffer objects, but it may
|
||||
* slightly increase the memory footprint of Filament's internal bookkeeping.
|
||||
*
|
||||
* @param enabled If true, enables buffer object mode. False by default.
|
||||
*/
|
||||
Builder& enableBufferObjects(bool enabled = true) noexcept;
|
||||
|
||||
/**
|
||||
* Sets up an attribute for this vertex buffer set.
|
||||
*
|
||||
* Using \p byteOffset and \p byteStride, attributes can be interleaved in the same buffer.
|
||||
*
|
||||
* @param attribute The attribute to set up.
|
||||
* @param bufferIndex The index of the buffer containing the data for this attribute. Must
|
||||
* be between 0 and bufferCount() - 1.
|
||||
* @param attributeType The type of the attribute data (e.g. byte, float3, etc...)
|
||||
* @param byteOffset Offset in *bytes* into the buffer \p bufferIndex
|
||||
* @param byteStride Stride in *bytes* to the next element of this attribute. When set to
|
||||
* zero the attribute size, as defined by \p attributeType is used.
|
||||
*
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*
|
||||
* @warning VertexAttribute::TANGENTS must be specified as a quaternion and is how normals
|
||||
* are specified.
|
||||
*
|
||||
* @warning Not all backends support 3-component attributes that are not floats. For help
|
||||
* with conversion, see geometry::Transcoder.
|
||||
*
|
||||
* @see VertexAttribute
|
||||
*
|
||||
* This is a no-op if the \p attribute is an invalid enum.
|
||||
* This is a no-op if the \p bufferIndex is out of bounds.
|
||||
*
|
||||
*/
|
||||
Builder& attribute(VertexAttribute attribute, uint8_t bufferIndex,
|
||||
AttributeType attributeType,
|
||||
uint32_t byteOffset = 0, uint8_t byteStride = 0) noexcept;
|
||||
|
||||
/**
|
||||
* Sets whether a given attribute should be normalized. By default attributes are not
|
||||
* normalized. A normalized attribute is mapped between 0 and 1 in the shader. This applies
|
||||
* only to integer types.
|
||||
*
|
||||
* @param attribute Enum of the attribute to set the normalization flag to.
|
||||
* @param normalize true to automatically normalize the given attribute.
|
||||
* @return A reference to this Builder for chaining calls.
|
||||
*
|
||||
* This is a no-op if the \p attribute is an invalid enum.
|
||||
*/
|
||||
Builder& normalized(VertexAttribute attribute, bool normalize = true) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the VertexBuffer object and returns a pointer to it.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this VertexBuffer with.
|
||||
*
|
||||
* @return pointer to the newly created object or nullptr if exceptions are disabled and
|
||||
* an error occurred.
|
||||
*
|
||||
* @exception utils::PostConditionPanic if a runtime error occurred, such as running out of
|
||||
* memory or other resources.
|
||||
* @exception utils::PreConditionPanic if a parameter to a builder function was invalid.
|
||||
*/
|
||||
VertexBuffer* build(Engine& engine);
|
||||
|
||||
private:
|
||||
friend class FVertexBuffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the vertex count.
|
||||
* @return Number of vertices in this vertex buffer set.
|
||||
*/
|
||||
size_t getVertexCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Asynchronously copy-initializes the specified buffer from the given buffer data.
|
||||
*
|
||||
* Do not use this if you called enableBufferObjects() on the Builder.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this VertexBuffer with.
|
||||
* @param bufferIndex Index of the buffer to initialize. Must be between 0
|
||||
* and Builder::bufferCount() - 1.
|
||||
* @param buffer A BufferDescriptor representing the data used to initialize the buffer at
|
||||
* index \p bufferIndex. BufferDescriptor points to raw, untyped data that will
|
||||
* be copied as-is into the buffer.
|
||||
* @param byteOffset Offset in *bytes* into the buffer at index \p bufferIndex of this vertex
|
||||
* buffer set.
|
||||
*/
|
||||
void setBufferAt(Engine& engine, uint8_t bufferIndex, BufferDescriptor&& buffer,
|
||||
uint32_t byteOffset = 0);
|
||||
|
||||
/**
|
||||
* Swaps in the given buffer object.
|
||||
*
|
||||
* To use this, you must first call enableBufferObjects() on the Builder.
|
||||
*
|
||||
* @param engine Reference to the filament::Engine to associate this VertexBuffer with.
|
||||
* @param bufferIndex Index of the buffer to initialize. Must be between 0
|
||||
* and Builder::bufferCount() - 1.
|
||||
* @param bufferObject The handle to the GPU data that will be used in this buffer slot.
|
||||
*/
|
||||
void setBufferObjectAt(Engine& engine, uint8_t bufferIndex, BufferObject const* bufferObject);
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_VERTEXBUFFER_H
|
||||
839
flutter_filament/windows/include/filament/filament/View.h
Normal file
839
flutter_filament/windows/include/filament/filament/View.h
Normal file
@@ -0,0 +1,839 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_VIEW_H
|
||||
#define TNT_FILAMENT_VIEW_H
|
||||
|
||||
#include <filament/Color.h>
|
||||
#include <filament/FilamentAPI.h>
|
||||
#include <filament/Options.h>
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Entity.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
namespace backend {
|
||||
class CallbackHandler;
|
||||
} // namespace backend
|
||||
|
||||
class Camera;
|
||||
class ColorGrading;
|
||||
class MaterialInstance;
|
||||
class RenderTarget;
|
||||
class Scene;
|
||||
class Viewport;
|
||||
|
||||
/**
|
||||
* A View encompasses all the state needed for rendering a Scene.
|
||||
*
|
||||
* Renderer::render() operates on View objects. These View objects specify important parameters
|
||||
* such as:
|
||||
* - The Scene
|
||||
* - The Camera
|
||||
* - The Viewport
|
||||
* - Some rendering parameters
|
||||
*
|
||||
* \note
|
||||
* View instances are heavy objects that internally cache a lot of data needed for rendering.
|
||||
* It is not advised for an application to use many View objects.
|
||||
*
|
||||
* For example, in a game, a View could be used for the main scene and another one for the
|
||||
* game's user interface. More View instances could be used for creating special effects (e.g.
|
||||
* a View is akin to a rendering pass).
|
||||
*
|
||||
*
|
||||
* @see Renderer, Scene, Camera, RenderTarget
|
||||
*/
|
||||
class UTILS_PUBLIC View : public FilamentAPI {
|
||||
public:
|
||||
using QualityLevel = QualityLevel;
|
||||
using BlendMode = BlendMode;
|
||||
using AntiAliasing = AntiAliasing;
|
||||
using Dithering = Dithering;
|
||||
using ShadowType = ShadowType;
|
||||
|
||||
using DynamicResolutionOptions = DynamicResolutionOptions;
|
||||
using BloomOptions = BloomOptions;
|
||||
using FogOptions = FogOptions;
|
||||
using DepthOfFieldOptions = DepthOfFieldOptions;
|
||||
using VignetteOptions = VignetteOptions;
|
||||
using RenderQuality = RenderQuality;
|
||||
using AmbientOcclusionOptions = AmbientOcclusionOptions;
|
||||
using TemporalAntiAliasingOptions = TemporalAntiAliasingOptions;
|
||||
using MultiSampleAntiAliasingOptions = MultiSampleAntiAliasingOptions;
|
||||
using VsmShadowOptions = VsmShadowOptions;
|
||||
using SoftShadowOptions = SoftShadowOptions;
|
||||
using ScreenSpaceReflectionsOptions = ScreenSpaceReflectionsOptions;
|
||||
using GuardBandOptions = GuardBandOptions;
|
||||
|
||||
/**
|
||||
* Sets the View's name. Only useful for debugging.
|
||||
* @param name Pointer to the View's name. The string is copied.
|
||||
*/
|
||||
void setName(const char* name) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the View's name
|
||||
*
|
||||
* @return a pointer owned by the View instance to the View's name.
|
||||
*
|
||||
* @attention Do *not* free the pointer or modify its content.
|
||||
*/
|
||||
const char* getName() const noexcept;
|
||||
|
||||
/**
|
||||
* Set this View instance's Scene.
|
||||
*
|
||||
* @param scene Associate the specified Scene to this View. A Scene can be associated to
|
||||
* several View instances.\n
|
||||
* \p scene can be nullptr to dissociate the currently set Scene
|
||||
* from this View.\n
|
||||
* The View doesn't take ownership of the Scene pointer (which
|
||||
* acts as a reference).
|
||||
*
|
||||
* @note
|
||||
* There is no reference-counting.
|
||||
* Make sure to dissociate a Scene from all Views before destroying it.
|
||||
*/
|
||||
void setScene(Scene* scene);
|
||||
|
||||
/**
|
||||
* Returns the Scene currently associated with this View.
|
||||
* @return A pointer to the Scene associated to this View. nullptr if no Scene is set.
|
||||
*/
|
||||
Scene* getScene() noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Scene currently associated with this View.
|
||||
* @return A pointer to the Scene associated to this View. nullptr if no Scene is set.
|
||||
*/
|
||||
Scene const* getScene() const noexcept {
|
||||
return const_cast<View*>(this)->getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies an offscreen render target to render into.
|
||||
*
|
||||
* By default, the view's associated render target is nullptr, which corresponds to the
|
||||
* SwapChain associated with the engine.
|
||||
*
|
||||
* A view with a custom render target cannot rely on Renderer::ClearOptions, which only apply
|
||||
* to the SwapChain. Such view can use a Skybox instead.
|
||||
*
|
||||
* @param renderTarget Render target associated with view, or nullptr for the swap chain.
|
||||
*/
|
||||
void setRenderTarget(RenderTarget* renderTarget) noexcept;
|
||||
|
||||
/**
|
||||
* Gets the offscreen render target associated with this view.
|
||||
*
|
||||
* Returns nullptr if the render target is the swap chain (which is default).
|
||||
*
|
||||
* @see setRenderTarget
|
||||
*/
|
||||
RenderTarget* getRenderTarget() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the rectangular region to render to.
|
||||
*
|
||||
* The viewport specifies where the content of the View (i.e. the Scene) is rendered in
|
||||
* the render target. The Render target is automatically clipped to the Viewport.
|
||||
*
|
||||
* @param viewport The Viewport to render the Scene into. The Viewport is a value-type, it is
|
||||
* therefore copied. The parameter can be discarded after this call returns.
|
||||
*/
|
||||
void setViewport(Viewport const& viewport) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the rectangular region that gets rendered to.
|
||||
* @return A constant reference to View's viewport.
|
||||
*/
|
||||
Viewport const& getViewport() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets this View's Camera.
|
||||
*
|
||||
* @param camera Associate the specified Camera to this View. A Camera can be associated to
|
||||
* several View instances.\n
|
||||
* \p camera can be nullptr to dissociate the currently set Camera from this
|
||||
* View.\n
|
||||
* The View doesn't take ownership of the Camera pointer (which
|
||||
* acts as a reference).
|
||||
*
|
||||
* @note
|
||||
* There is no reference-counting.
|
||||
* Make sure to dissociate a Camera from all Views before destroying it.
|
||||
*/
|
||||
void setCamera(Camera* camera) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Camera currently associated with this View.
|
||||
* @return A reference to the Camera associated to this View.
|
||||
*/
|
||||
Camera& getCamera() noexcept;
|
||||
|
||||
/**
|
||||
* Returns the Camera currently associated with this View.
|
||||
* @return A reference to the Camera associated to this View.
|
||||
*/
|
||||
Camera const& getCamera() const noexcept {
|
||||
return const_cast<View*>(this)->getCamera();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the blending mode used to draw the view into the SwapChain.
|
||||
*
|
||||
* @param blendMode either BlendMode::OPAQUE or BlendMode::TRANSLUCENT
|
||||
* @see getBlendMode
|
||||
*/
|
||||
void setBlendMode(BlendMode blendMode) noexcept;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return blending mode set by setBlendMode
|
||||
* @see setBlendMode
|
||||
*/
|
||||
BlendMode getBlendMode() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets which layers are visible.
|
||||
*
|
||||
* Renderable objects can have one or several layers associated to them. Layers are
|
||||
* represented with an 8-bits bitmask, where each bit corresponds to a layer.
|
||||
*
|
||||
* This call sets which of those layers are visible. Renderables in invisible layers won't be
|
||||
* rendered.
|
||||
*
|
||||
* @param select a bitmask specifying which layer to set or clear using \p values.
|
||||
* @param values a bitmask where each bit sets the visibility of the corresponding layer
|
||||
* (1: visible, 0: invisible), only layers in \p select are affected.
|
||||
*
|
||||
* @see RenderableManager::setLayerMask().
|
||||
*
|
||||
* @note By default only layer 0 (bitmask 0x01) is visible.
|
||||
* @note This is a convenient way to quickly show or hide sets of Renderable objects.
|
||||
*/
|
||||
void setVisibleLayers(uint8_t select, uint8_t values) noexcept;
|
||||
|
||||
/**
|
||||
* Helper function to enable or disable a visibility layer.
|
||||
* @param layer layer between 0 and 7 to enable or disable
|
||||
* @param enabled true to enable the layer, false to disable it
|
||||
* @see RenderableManager::setVisibleLayers()
|
||||
*/
|
||||
inline void setLayerEnabled(size_t layer, bool enabled) noexcept {
|
||||
const uint8_t mask = 1u << layer;
|
||||
setVisibleLayers(mask, enabled ? mask : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the visible layers.
|
||||
*
|
||||
* @see View::setVisibleLayers()
|
||||
*/
|
||||
uint8_t getVisibleLayers() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables shadow mapping. Enabled by default.
|
||||
*
|
||||
* @param enabled true enables shadow mapping, false disables it.
|
||||
*
|
||||
* @see LightManager::Builder::castShadows(),
|
||||
* RenderableManager::Builder::receiveShadows(),
|
||||
* RenderableManager::Builder::castShadows(),
|
||||
*/
|
||||
void setShadowingEnabled(bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* @return whether shadowing is enabled
|
||||
*/
|
||||
bool isShadowingEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables screen space refraction. Enabled by default.
|
||||
*
|
||||
* @param enabled true enables screen space refraction, false disables it.
|
||||
*/
|
||||
void setScreenSpaceRefractionEnabled(bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* @return whether screen space refraction is enabled
|
||||
*/
|
||||
bool isScreenSpaceRefractionEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets how many samples are to be used for MSAA in the post-process stage.
|
||||
* Default is 1 and disables MSAA.
|
||||
*
|
||||
* @param count number of samples to use for multi-sampled anti-aliasing.\n
|
||||
* 0: treated as 1
|
||||
* 1: no anti-aliasing
|
||||
* n: sample count. Effective sample could be different depending on the
|
||||
* GPU capabilities.
|
||||
*
|
||||
* @note Anti-aliasing can also be performed in the post-processing stage, generally at lower
|
||||
* cost. See setAntialiasing.
|
||||
*
|
||||
* @see setAntialiasing
|
||||
* @deprecated use setMultiSampleAntiAliasingOptions instead
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
void setSampleCount(uint8_t count = 1) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the sample count set by setSampleCount(). Effective sample count could be different.
|
||||
* A value of 0 or 1 means MSAA is disabled.
|
||||
*
|
||||
* @return value set by setSampleCount().
|
||||
* @deprecated use getMultiSampleAntiAliasingOptions instead
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
uint8_t getSampleCount() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables anti-aliasing in the post-processing stage. Enabled by default.
|
||||
* MSAA can be enabled in addition, see setSampleCount().
|
||||
*
|
||||
* @param type FXAA for enabling, NONE for disabling anti-aliasing.
|
||||
*
|
||||
* @note For MSAA anti-aliasing, see setSamplerCount().
|
||||
*
|
||||
* @see setSampleCount
|
||||
*/
|
||||
void setAntiAliasing(AntiAliasing type) noexcept;
|
||||
|
||||
/**
|
||||
* Queries whether anti-aliasing is enabled during the post-processing stage. To query
|
||||
* whether MSAA is enabled, see getSampleCount().
|
||||
*
|
||||
* @return The post-processing anti-aliasing method.
|
||||
*/
|
||||
AntiAliasing getAntiAliasing() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable temporal anti-aliasing (TAA). Disabled by default.
|
||||
*
|
||||
* @param options temporal anti-aliasing options
|
||||
*/
|
||||
void setTemporalAntiAliasingOptions(TemporalAntiAliasingOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns temporal anti-aliasing options.
|
||||
*
|
||||
* @return temporal anti-aliasing options
|
||||
*/
|
||||
TemporalAntiAliasingOptions const& getTemporalAntiAliasingOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable screen-space reflections. Disabled by default.
|
||||
*
|
||||
* @param options screen-space reflections options
|
||||
*/
|
||||
void setScreenSpaceReflectionsOptions(ScreenSpaceReflectionsOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns screen-space reflections options.
|
||||
*
|
||||
* @return screen-space reflections options
|
||||
*/
|
||||
ScreenSpaceReflectionsOptions const& getScreenSpaceReflectionsOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable screen-space guard band. Disabled by default.
|
||||
*
|
||||
* @param options guard band options
|
||||
*/
|
||||
void setGuardBandOptions(GuardBandOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns screen-space guard band options.
|
||||
*
|
||||
* @return guard band options
|
||||
*/
|
||||
GuardBandOptions const& getGuardBandOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disable multi-sample anti-aliasing (MSAA). Disabled by default.
|
||||
*
|
||||
* @param options multi-sample anti-aliasing options
|
||||
*/
|
||||
void setMultiSampleAntiAliasingOptions(MultiSampleAntiAliasingOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns multi-sample anti-aliasing options.
|
||||
*
|
||||
* @return multi-sample anti-aliasing options
|
||||
*/
|
||||
MultiSampleAntiAliasingOptions const& getMultiSampleAntiAliasingOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets this View's color grading transforms.
|
||||
*
|
||||
* @param colorGrading Associate the specified ColorGrading to this View. A ColorGrading can be
|
||||
* associated to several View instances.\n
|
||||
* \p colorGrading can be nullptr to dissociate the currently set
|
||||
* ColorGrading from this View. Doing so will revert to the use of the
|
||||
* default color grading transforms.\n
|
||||
* The View doesn't take ownership of the ColorGrading pointer (which
|
||||
* acts as a reference).
|
||||
*
|
||||
* @note
|
||||
* There is no reference-counting.
|
||||
* Make sure to dissociate a ColorGrading from all Views before destroying it.
|
||||
*/
|
||||
void setColorGrading(ColorGrading* colorGrading) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the color grading transforms currently associated to this view.
|
||||
* @return A pointer to the ColorGrading associated to this View.
|
||||
*/
|
||||
const ColorGrading* getColorGrading() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets ambient occlusion options.
|
||||
*
|
||||
* @param options Options for ambient occlusion.
|
||||
*/
|
||||
void setAmbientOcclusionOptions(AmbientOcclusionOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Gets the ambient occlusion options.
|
||||
*
|
||||
* @return ambient occlusion options currently set.
|
||||
*/
|
||||
AmbientOcclusionOptions const& getAmbientOcclusionOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables bloom in the post-processing stage. Disabled by default.
|
||||
*
|
||||
* @param options options
|
||||
*/
|
||||
void setBloomOptions(BloomOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Queries the bloom options.
|
||||
*
|
||||
* @return the current bloom options for this view.
|
||||
*/
|
||||
BloomOptions getBloomOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables fog. Disabled by default.
|
||||
*
|
||||
* @param options options
|
||||
*/
|
||||
void setFogOptions(FogOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Queries the fog options.
|
||||
*
|
||||
* @return the current fog options for this view.
|
||||
*/
|
||||
FogOptions getFogOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables Depth of Field. Disabled by default.
|
||||
*
|
||||
* @param options options
|
||||
*/
|
||||
void setDepthOfFieldOptions(DepthOfFieldOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Queries the depth of field options.
|
||||
*
|
||||
* @return the current depth of field options for this view.
|
||||
*/
|
||||
DepthOfFieldOptions getDepthOfFieldOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables the vignetted effect in the post-processing stage. Disabled by default.
|
||||
*
|
||||
* @param options options
|
||||
*/
|
||||
void setVignetteOptions(VignetteOptions options) noexcept;
|
||||
|
||||
/**
|
||||
* Queries the vignette options.
|
||||
*
|
||||
* @return the current vignette options for this view.
|
||||
*/
|
||||
VignetteOptions getVignetteOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables dithering in the post-processing stage. Enabled by default.
|
||||
*
|
||||
* @param dithering dithering type
|
||||
*/
|
||||
void setDithering(Dithering dithering) noexcept;
|
||||
|
||||
/**
|
||||
* Queries whether dithering is enabled during the post-processing stage.
|
||||
*
|
||||
* @return the current dithering type for this view.
|
||||
*/
|
||||
Dithering getDithering() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the dynamic resolution options for this view. Dynamic resolution options
|
||||
* controls whether dynamic resolution is enabled, and if it is, how it behaves.
|
||||
*
|
||||
* @param options The dynamic resolution options to use on this view
|
||||
*/
|
||||
void setDynamicResolutionOptions(DynamicResolutionOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the dynamic resolution options associated with this view.
|
||||
* @return value set by setDynamicResolutionOptions().
|
||||
*/
|
||||
DynamicResolutionOptions getDynamicResolutionOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets the rendering quality for this view. Refer to RenderQuality for more
|
||||
* information about the different settings available.
|
||||
*
|
||||
* @param renderQuality The render quality to use on this view
|
||||
*/
|
||||
void setRenderQuality(RenderQuality const& renderQuality) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the render quality used by this view.
|
||||
* @return value set by setRenderQuality().
|
||||
*/
|
||||
RenderQuality getRenderQuality() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets options relative to dynamic lighting for this view.
|
||||
*
|
||||
* @param zLightNear Distance from the camera where the lights are expected to shine.
|
||||
* This parameter can affect performance and is useful because depending
|
||||
* on the scene, lights that shine close to the camera may not be
|
||||
* visible -- in this case, using a larger value can improve performance.
|
||||
* e.g. when standing and looking straight, several meters of the ground
|
||||
* isn't visible and if lights are expected to shine there, there is no
|
||||
* point using a short zLightNear. (Default 5m).
|
||||
*
|
||||
* @param zLightFar Distance from the camera after which lights are not expected to be visible.
|
||||
* Similarly to zLightNear, setting this value properly can improve
|
||||
* performance. (Default 100m).
|
||||
*
|
||||
*
|
||||
* Together zLightNear and zLightFar must be chosen so that the visible influence of lights
|
||||
* is spread between these two values.
|
||||
*
|
||||
*/
|
||||
void setDynamicLightingOptions(float zLightNear, float zLightFar) noexcept;
|
||||
|
||||
/*
|
||||
* Set the shadow mapping technique this View uses.
|
||||
*
|
||||
* The ShadowType affects all the shadows seen within the View.
|
||||
*
|
||||
* ShadowType::VSM imposes a restriction on marking renderables as only shadow receivers (but
|
||||
* not casters). To ensure correct shadowing with VSM, all shadow participant renderables should
|
||||
* be marked as both receivers and casters. Objects that are guaranteed to not cast shadows on
|
||||
* themselves or other objects (such as flat ground planes) can be set to not cast shadows,
|
||||
* which might improve shadow quality.
|
||||
*
|
||||
* @warning This API is still experimental and subject to change.
|
||||
*/
|
||||
void setShadowType(ShadowType shadow) noexcept;
|
||||
|
||||
/**
|
||||
* Sets VSM shadowing options that apply across the entire View.
|
||||
*
|
||||
* Additional light-specific VSM options can be set with LightManager::setShadowOptions.
|
||||
*
|
||||
* Only applicable when shadow type is set to ShadowType::VSM.
|
||||
*
|
||||
* @param options Options for shadowing.
|
||||
*
|
||||
* @see setShadowType
|
||||
*
|
||||
* @warning This API is still experimental and subject to change.
|
||||
*/
|
||||
void setVsmShadowOptions(VsmShadowOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the VSM shadowing options associated with this View.
|
||||
*
|
||||
* @return value set by setVsmShadowOptions().
|
||||
*/
|
||||
VsmShadowOptions getVsmShadowOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Sets soft shadowing options that apply across the entire View.
|
||||
*
|
||||
* Additional light-specific soft shadow parameters can be set with LightManager::setShadowOptions.
|
||||
*
|
||||
* Only applicable when shadow type is set to ShadowType::DPCF or ShadowType::PCSS.
|
||||
*
|
||||
* @param options Options for shadowing.
|
||||
*
|
||||
* @see setShadowType
|
||||
*
|
||||
* @warning This API is still experimental and subject to change.
|
||||
*/
|
||||
void setSoftShadowOptions(SoftShadowOptions const& options) noexcept;
|
||||
|
||||
/**
|
||||
* Returns the soft shadowing options associated with this View.
|
||||
*
|
||||
* @return value set by setSoftShadowOptions().
|
||||
*/
|
||||
SoftShadowOptions getSoftShadowOptions() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables or disables post processing. Enabled by default.
|
||||
*
|
||||
* Post-processing includes:
|
||||
* - Depth-of-field
|
||||
* - Bloom
|
||||
* - Vignetting
|
||||
* - Temporal Anti-aliasing (TAA)
|
||||
* - Color grading & gamma encoding
|
||||
* - Dithering
|
||||
* - FXAA
|
||||
* - Dynamic scaling
|
||||
*
|
||||
* Disabling post-processing forgoes color correctness as well as some anti-aliasing techniques
|
||||
* and should only be used for debugging, UI overlays or when using custom render targets
|
||||
* (see RenderTarget).
|
||||
*
|
||||
* @param enabled true enables post processing, false disables it.
|
||||
*
|
||||
* @see setBloomOptions, setColorGrading, setAntiAliasing, setDithering, setSampleCount
|
||||
*/
|
||||
void setPostProcessingEnabled(bool enabled) noexcept;
|
||||
|
||||
//! Returns true if post-processing is enabled. See setPostProcessingEnabled() for more info.
|
||||
bool isPostProcessingEnabled() const noexcept;
|
||||
|
||||
/**
|
||||
* Inverts the winding order of front faces. By default front faces use a counter-clockwise
|
||||
* winding order. When the winding order is inverted, front faces are faces with a clockwise
|
||||
* winding order.
|
||||
*
|
||||
* Changing the winding order will directly affect the culling mode in materials
|
||||
* (see Material::getCullingMode()).
|
||||
*
|
||||
* Inverting the winding order of front faces is useful when rendering mirrored reflections
|
||||
* (water, mirror surfaces, front camera in AR, etc.).
|
||||
*
|
||||
* @param inverted True to invert front faces, false otherwise.
|
||||
*/
|
||||
void setFrontFaceWindingInverted(bool inverted) noexcept;
|
||||
|
||||
/**
|
||||
* Returns true if the winding order of front faces is inverted.
|
||||
* See setFrontFaceWindingInverted() for more information.
|
||||
*/
|
||||
bool isFrontFaceWindingInverted() const noexcept;
|
||||
|
||||
/**
|
||||
* Enables use of the stencil buffer.
|
||||
*
|
||||
* The stencil buffer is an 8-bit, per-fragment unsigned integer stored alongside the depth
|
||||
* buffer. The stencil buffer is cleared at the beginning of a frame and discarded after the
|
||||
* color pass.
|
||||
*
|
||||
* Each fragment's stencil value is set during rasterization by specifying stencil operations on
|
||||
* a Material. The stencil buffer can be used as a mask for later rendering by setting a
|
||||
* Material's stencil comparison function and reference value. Fragments that don't pass the
|
||||
* stencil test are then discarded.
|
||||
*
|
||||
* Post-processing must be enabled in order to use the stencil buffer.
|
||||
*
|
||||
* A renderable's priority (see RenderableManager::setPriority) is useful to control the order
|
||||
* in which primitives are drawn.
|
||||
*
|
||||
* @param enabled True to enable the stencil buffer, false disables it (default)
|
||||
*/
|
||||
void setStencilBufferEnabled(bool enabled) noexcept;
|
||||
|
||||
/**
|
||||
* Returns true if the stencil buffer is enabled.
|
||||
* See setStencilBufferEnabled() for more information.
|
||||
*/
|
||||
bool isStencilBufferEnabled() const noexcept;
|
||||
|
||||
// for debugging...
|
||||
|
||||
//! debugging: allows to entirely disable frustum culling. (culling enabled by default).
|
||||
void setFrustumCullingEnabled(bool culling) noexcept;
|
||||
|
||||
//! debugging: returns whether frustum culling is enabled.
|
||||
bool isFrustumCullingEnabled() const noexcept;
|
||||
|
||||
//! debugging: sets the Camera used for rendering. It may be different from the culling camera.
|
||||
void setDebugCamera(Camera* camera) noexcept;
|
||||
|
||||
//! debugging: returns a Camera from the point of view of *the* dominant directional light used for shadowing.
|
||||
Camera const* getDirectionalLightCamera() const noexcept;
|
||||
|
||||
|
||||
/** Result of a picking query */
|
||||
struct PickingQueryResult {
|
||||
utils::Entity renderable{}; //! RenderableManager Entity at the queried coordinates
|
||||
float depth{}; //! Depth buffer value (1 (near plane) to 0 (infinity))
|
||||
uint32_t reserved1{};
|
||||
uint32_t reserved2{};
|
||||
/**
|
||||
* screen space coordinates in GL convention, this can be used to compute the view or
|
||||
* world space position of the picking hit. For e.g.:
|
||||
* clip_space_position = (fragCoords.xy / viewport.wh, fragCoords.z) * 2.0 - 1.0
|
||||
* view_space_position = inverse(projection) * clip_space_position
|
||||
* world_space_position = model * view_space_position
|
||||
*
|
||||
* The viewport, projection and model matrices can be obtained from Camera. Because
|
||||
* pick() has some latency, it might be more accurate to obtain these values at the
|
||||
* time the View::pick() call is made.
|
||||
*/
|
||||
math::float3 fragCoords; //! screen space coordinates in GL convention
|
||||
};
|
||||
|
||||
/** User data for PickingQueryResultCallback */
|
||||
struct PickingQuery {
|
||||
// note: this is enough to store a std::function<> -- just saying...
|
||||
void* storage[4];
|
||||
};
|
||||
|
||||
/** callback type used for picking queries. */
|
||||
using PickingQueryResultCallback = void(*)(PickingQueryResult const& result, PickingQuery* pq);
|
||||
|
||||
/**
|
||||
* Helper for creating a picking query from Foo::method, by pointer.
|
||||
* e.g.: pick<Foo, &Foo::bar>(x, y, &foo);
|
||||
*
|
||||
* @tparam T Class of the method to call (e.g.: Foo)
|
||||
* @tparam method Method to call on T (e.g.: &Foo::bar)
|
||||
* @param x Horizontal coordinate to query in the viewport with origin on the left.
|
||||
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
|
||||
* @param instance A pointer to an instance of T
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler.
|
||||
*/
|
||||
template<typename T, void(T::*method)(PickingQueryResult const&)>
|
||||
void pick(uint32_t x, uint32_t y, T* instance, backend::CallbackHandler* handler = nullptr) noexcept {
|
||||
PickingQuery& query = pick(x, y, [](PickingQueryResult const& result, PickingQuery* pq) {
|
||||
void* user = pq->storage;
|
||||
(*static_cast<T**>(user)->*method)(result);
|
||||
}, handler);
|
||||
query.storage[0] = instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for creating a picking query from Foo::method, by copy for a small object
|
||||
* e.g.: pick<Foo, &Foo::bar>(x, y, foo);
|
||||
*
|
||||
* @tparam T Class of the method to call (e.g.: Foo)
|
||||
* @tparam method Method to call on T (e.g.: &Foo::bar)
|
||||
* @param x Horizontal coordinate to query in the viewport with origin on the left.
|
||||
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
|
||||
* @param instance An instance of T
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler.
|
||||
*/
|
||||
template<typename T, void(T::*method)(PickingQueryResult const&)>
|
||||
void pick(uint32_t x, uint32_t y, T instance, backend::CallbackHandler* handler = nullptr) noexcept {
|
||||
static_assert(sizeof(instance) <= sizeof(PickingQuery::storage), "user data too large");
|
||||
PickingQuery& query = pick(x, y, [](PickingQueryResult const& result, PickingQuery* pq) {
|
||||
void* user = pq->storage;
|
||||
T* that = static_cast<T*>(user);
|
||||
(that->*method)(result);
|
||||
that->~T();
|
||||
}, handler);
|
||||
new(query.storage) T(std::move(instance));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for creating a picking query from a small functor
|
||||
* e.g.: pick(x, y, [](PickingQueryResult const& result){});
|
||||
*
|
||||
* @param x Horizontal coordinate to query in the viewport with origin on the left.
|
||||
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
|
||||
* @param functor A functor, typically a lambda function.
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler.
|
||||
*/
|
||||
template<typename T>
|
||||
void pick(uint32_t x, uint32_t y, T functor, backend::CallbackHandler* handler = nullptr) noexcept {
|
||||
static_assert(sizeof(functor) <= sizeof(PickingQuery::storage), "functor too large");
|
||||
PickingQuery& query = pick(x, y, handler,
|
||||
(PickingQueryResultCallback)[](PickingQueryResult const& result, PickingQuery* pq) {
|
||||
void* user = pq->storage;
|
||||
T& that = *static_cast<T*>(user);
|
||||
that(result);
|
||||
that.~T();
|
||||
});
|
||||
new(query.storage) T(std::move(functor));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a picking query. Multiple queries can be created (e.g.: multi-touch).
|
||||
* Picking queries are all executed when Renderer::render() is called on this View.
|
||||
* The provided callback is guaranteed to be called at some point in the future.
|
||||
*
|
||||
* Typically it takes a couple frames to receive the result of a picking query.
|
||||
*
|
||||
* @param x Horizontal coordinate to query in the viewport with origin on the left.
|
||||
* @param y Vertical coordinate to query on the viewport with origin at the bottom.
|
||||
* @param callback User callback, called when the picking query result is available.
|
||||
* @param handler Handler to dispatch the callback or nullptr for the default handler.
|
||||
* @return A reference to a PickingQuery structure, which can be used to store up to
|
||||
* 8*sizeof(void*) bytes of user data. This user data is later accessible
|
||||
* in the PickingQueryResultCallback callback 3rd parameter.
|
||||
*/
|
||||
PickingQuery& pick(uint32_t x, uint32_t y, backend::CallbackHandler* handler,
|
||||
PickingQueryResultCallback callback) noexcept;
|
||||
|
||||
|
||||
/**
|
||||
* List of available ambient occlusion techniques
|
||||
* @deprecated use AmbientOcclusionOptions::enabled instead
|
||||
*/
|
||||
enum class UTILS_DEPRECATED AmbientOcclusion : uint8_t {
|
||||
NONE = 0, //!< No Ambient Occlusion
|
||||
SSAO = 1 //!< Basic, sampling SSAO
|
||||
};
|
||||
|
||||
/**
|
||||
* Activates or deactivates ambient occlusion.
|
||||
* @deprecated use setAmbientOcclusionOptions() instead
|
||||
* @see setAmbientOcclusionOptions
|
||||
*
|
||||
* @param ambientOcclusion Type of ambient occlusion to use.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
void setAmbientOcclusion(AmbientOcclusion ambientOcclusion) noexcept;
|
||||
|
||||
/**
|
||||
* Queries the type of ambient occlusion active for this View.
|
||||
* @deprecated use getAmbientOcclusionOptions() instead
|
||||
* @see getAmbientOcclusionOptions
|
||||
*
|
||||
* @return ambient occlusion type.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
AmbientOcclusion getAmbientOcclusion() const noexcept;
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_VIEW_H
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_VIEWPORT_H
|
||||
#define TNT_FILAMENT_VIEWPORT_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <math/scalar.h>
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
/**
|
||||
* Viewport describes a view port in pixel coordinates
|
||||
*
|
||||
* A view port is represented by its left-bottom coordinate, width and height in pixels.
|
||||
*/
|
||||
class UTILS_PUBLIC Viewport : public backend::Viewport {
|
||||
public:
|
||||
/**
|
||||
* Creates a Viewport of zero width and height at the origin.
|
||||
*/
|
||||
Viewport() noexcept : backend::Viewport{} {}
|
||||
|
||||
/**
|
||||
* Creates a Viewport from its left-bottom coordinates, width and height in pixels
|
||||
*
|
||||
* @param left left coordinate in pixel
|
||||
* @param bottom bottom coordinate in pixel
|
||||
* @param width width in pixel
|
||||
* @param height height in pixel
|
||||
*/
|
||||
Viewport(int32_t left, int32_t bottom, uint32_t width, uint32_t height) noexcept
|
||||
: backend::Viewport{ left, bottom, width, height } {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the area of the view port is null.
|
||||
*
|
||||
* @return true if either width or height is 0 pixel.
|
||||
*/
|
||||
bool empty() const noexcept { return !width || !height; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Compares two Viewports for equality
|
||||
* @param lhs reference to the left hand side Viewport
|
||||
* @param rhs reference to the right hand side Viewport
|
||||
* @return true if \p rhs and \p lhs are identical.
|
||||
*/
|
||||
friend bool operator==(Viewport const& lhs, Viewport const& rhs) noexcept {
|
||||
return (&rhs == &lhs) ||
|
||||
(rhs.left == lhs.left && rhs.bottom == lhs.bottom &&
|
||||
rhs.width == lhs.width && rhs.height == lhs.height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two Viewports for inequality
|
||||
* @param lhs reference to the left hand side Viewport
|
||||
* @param rhs reference to the right hand side Viewport
|
||||
* @return true if \p rhs and \p lhs are different.
|
||||
*/
|
||||
friend bool operator!=(Viewport const& lhs, Viewport const& rhs) noexcept {
|
||||
return !(rhs == lhs);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_VIEWPORT_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user