MXVK Vulkan Framework 0.35.0
C++20 Vulkan rendering framework for practical 2D and 3D application development with SDL3.
Loading...
Searching...
No Matches
anonymous_namespace{mxvk_nanobind.cpp} Namespace Reference

Classes

class  PythonBuffer
class  PythonEvent
class  PythonIOWindow
class  PythonTexture
class  PythonWindow

Functions

glm::mat4 matrix_from_rows (const std::array< float, 16 > &values)
std::array< float, 16 > matrix_to_rows (const glm::mat4 &matrix)
std::filesystem::path python_module_directory ()
glm::vec4 vector4 (const std::array< float, 4 > &values)
std::array< float, 4 > vector4_array (const glm::vec4 &value)

Variables

const int MODULE_LOCATION_ANCHOR = 0

Function Documentation

◆ matrix_from_rows()

glm::mat4 anonymous_namespace{mxvk_nanobind.cpp}::matrix_from_rows ( const std::array< float, 16 > & values)

Definition at line 88 of file mxvk_nanobind.cpp.

88 {
89 glm::mat4 matrix{1.0F};
90 for (size_t row = 0; row < 4; ++row)
91 for (size_t column = 0; column < 4; ++column)
92 matrix[column][row] = values[row * 4 + column];
93 return matrix;
94 }

◆ matrix_to_rows()

std::array< float, 16 > anonymous_namespace{mxvk_nanobind.cpp}::matrix_to_rows ( const glm::mat4 & matrix)

Definition at line 96 of file mxvk_nanobind.cpp.

96 {
97 std::array<float, 16> values{};
98 for (size_t row = 0; row < 4; ++row)
99 for (size_t column = 0; column < 4; ++column)
100 values[row * 4 + column] = matrix[column][row];
101 return values;
102 }

◆ python_module_directory()

std::filesystem::path anonymous_namespace{mxvk_nanobind.cpp}::python_module_directory ( )

Definition at line 59 of file mxvk_nanobind.cpp.

59 {
60#if defined(_WIN32)
61 HMODULE module_handle = nullptr;
62 if (GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast<LPCWSTR>(&MODULE_LOCATION_ANCHOR), &module_handle) == 0) {
63 return {};
64 }
65
66 std::vector<wchar_t> module_path(1024);
67 while (true) {
68 const DWORD path_length = GetModuleFileNameW(module_handle, module_path.data(), static_cast<DWORD>(module_path.size()));
69 if (path_length == 0) {
70 return {};
71 }
72 if (path_length < module_path.size() - 1U) {
73 return std::filesystem::path(std::wstring(module_path.data(), path_length)).parent_path();
74 }
75 module_path.resize(module_path.size() * 2U);
76 }
77#elif defined(__APPLE__) || defined(__linux__)
78 Dl_info module_info{};
79 if (dladdr(&MODULE_LOCATION_ANCHOR, &module_info) == 0 || module_info.dli_fname == nullptr) {
80 return {};
81 }
82 return std::filesystem::path(module_info.dli_fname).parent_path();
83#else
84 return {};
85#endif
86 }

◆ vector4()

glm::vec4 anonymous_namespace{mxvk_nanobind.cpp}::vector4 ( const std::array< float, 4 > & values)

Definition at line 104 of file mxvk_nanobind.cpp.

104{ return {values[0], values[1], values[2], values[3]}; }

◆ vector4_array()

std::array< float, 4 > anonymous_namespace{mxvk_nanobind.cpp}::vector4_array ( const glm::vec4 & value)

Definition at line 105 of file mxvk_nanobind.cpp.

105{ return {value.x, value.y, value.z, value.w}; }

Variable Documentation

◆ MODULE_LOCATION_ANCHOR

const int anonymous_namespace{mxvk_nanobind.cpp}::MODULE_LOCATION_ANCHOR = 0

Definition at line 57 of file mxvk_nanobind.cpp.