Simple Directmedia Layer
at main 85 lines 2.3 kB view raw
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21#include "SDL_internal.h" 22 23#if defined(SDL_VIDEO_RENDER_D3D) || \ 24 defined(SDL_VIDEO_RENDER_D3D11) || \ 25 defined(SDL_VIDEO_RENDER_D3D12) || \ 26 defined(SDL_VIDEO_RENDER_GPU) || \ 27 defined(SDL_VIDEO_RENDER_VULKAN) 28 29// Set up for C function definitions, even when using C++ 30#ifdef __cplusplus 31extern "C" { 32#endif 33 34// Direct3D matrix math functions 35 36typedef struct 37{ 38 float x; 39 float y; 40} Float2; 41 42typedef struct 43{ 44 float x; 45 float y; 46 float z; 47} Float3; 48 49typedef struct 50{ 51 float x; 52 float y; 53 float z; 54 float w; 55} Float4; 56 57typedef struct 58{ 59 union 60 { 61 struct 62 { 63 float _11, _12, _13, _14; 64 float _21, _22, _23, _24; 65 float _31, _32, _33, _34; 66 float _41, _42, _43, _44; 67 } v; 68 float m[4][4]; 69 }; 70} Float4X4; 71 72extern Float4X4 MatrixIdentity(void); 73extern Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2); 74extern Float4X4 MatrixScaling(float x, float y, float z); 75extern Float4X4 MatrixTranslation(float x, float y, float z); 76extern Float4X4 MatrixRotationX(float r); 77extern Float4X4 MatrixRotationY(float r); 78extern Float4X4 MatrixRotationZ(float r); 79 80// Ends C function definitions when using C++ 81#ifdef __cplusplus 82} 83#endif 84 85#endif // SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12 || SDL_VIDEO_RENDER_VULKAN