author  Ryan C. Gordon <icculus@icculus.org> 
Thu, 09 Apr 2015 22:33:39 0400  
branch  iOSimprovements 
changeset 9542  618662dc9e82 
parent 8764  3d5ef7548688 
child 9619  b94b6d0bff0f 
permissions  rwrr 
8599
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

1 
/* 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

2 
Simple DirectMedia Layer 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

3 
Copyright (C) 19972014 Sam Lantinga <slouken@libsdl.org> 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

4 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

5 
This software is provided 'asis', without any express or implied 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

6 
warranty. In no event will the authors be held liable for any damages 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

7 
arising from the use of this software. 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

8 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

9 
Permission is granted to anyone to use this software for any purpose, 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

10 
including commercial applications, and to alter it and redistribute it 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

11 
freely, subject to the following restrictions: 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

12 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

13 
1. The origin of this software must not be misrepresented; you must not 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

14 
claim that you wrote the original software. If you use this software 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

15 
in a product, an acknowledgment in the product documentation would be 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

16 
appreciated but is not required. 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

17 
2. Altered source versions must be plainly marked as such, and must not be 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

18 
misrepresented as being the original software. 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

19 
3. This notice may not be removed or altered from any source distribution. 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

20 
*/ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

21 
#include "../SDL_internal.h" 
8764
3d5ef7548688
Fixes #2529, guard SDL_d3math.* with the proper defines
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8599
diff
changeset

22 

3d5ef7548688
Fixes #2529, guard SDL_d3math.* with the proper defines
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8599
diff
changeset

23 
#if (SDL_VIDEO_RENDER_D3D  SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED 
8599
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

24 
#include "SDL_stdinc.h" 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

25 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

26 
#include "SDL_d3dmath.h" 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

27 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

28 
/* Direct3D matrix math functions */ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

29 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

30 
Float4X4 MatrixIdentity() 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

31 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

32 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

33 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

34 
m._11 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

35 
m._22 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

36 
m._33 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

37 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

38 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

39 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

40 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

41 
Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

42 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

43 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

44 
m._11 = M1._11 * M2._11 + M1._12 * M2._21 + M1._13 * M2._31 + M1._14 * M2._41; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

45 
m._12 = M1._11 * M2._12 + M1._12 * M2._22 + M1._13 * M2._32 + M1._14 * M2._42; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

46 
m._13 = M1._11 * M2._13 + M1._12 * M2._23 + M1._13 * M2._33 + M1._14 * M2._43; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

47 
m._14 = M1._11 * M2._14 + M1._12 * M2._24 + M1._13 * M2._34 + M1._14 * M2._44; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

48 
m._21 = M1._21 * M2._11 + M1._22 * M2._21 + M1._23 * M2._31 + M1._24 * M2._41; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

49 
m._22 = M1._21 * M2._12 + M1._22 * M2._22 + M1._23 * M2._32 + M1._24 * M2._42; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

50 
m._23 = M1._21 * M2._13 + M1._22 * M2._23 + M1._23 * M2._33 + M1._24 * M2._43; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

51 
m._24 = M1._21 * M2._14 + M1._22 * M2._24 + M1._23 * M2._34 + M1._24 * M2._44; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

52 
m._31 = M1._31 * M2._11 + M1._32 * M2._21 + M1._33 * M2._31 + M1._34 * M2._41; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

53 
m._32 = M1._31 * M2._12 + M1._32 * M2._22 + M1._33 * M2._32 + M1._34 * M2._42; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

54 
m._33 = M1._31 * M2._13 + M1._32 * M2._23 + M1._33 * M2._33 + M1._34 * M2._43; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

55 
m._34 = M1._31 * M2._14 + M1._32 * M2._24 + M1._33 * M2._34 + M1._34 * M2._44; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

56 
m._41 = M1._41 * M2._11 + M1._42 * M2._21 + M1._43 * M2._31 + M1._44 * M2._41; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

57 
m._42 = M1._41 * M2._12 + M1._42 * M2._22 + M1._43 * M2._32 + M1._44 * M2._42; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

58 
m._43 = M1._41 * M2._13 + M1._42 * M2._23 + M1._43 * M2._33 + M1._44 * M2._43; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

59 
m._44 = M1._41 * M2._14 + M1._42 * M2._24 + M1._43 * M2._34 + M1._44 * M2._44; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

60 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

61 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

62 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

63 
Float4X4 MatrixScaling(float x, float y, float z) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

64 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

65 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

66 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

67 
m._11 = x; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

68 
m._22 = y; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

69 
m._33 = z; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

70 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

71 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

72 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

73 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

74 
Float4X4 MatrixTranslation(float x, float y, float z) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

75 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

76 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

77 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

78 
m._11 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

79 
m._22 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

80 
m._33 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

81 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

82 
m._41 = x; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

83 
m._42 = y; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

84 
m._43 = z; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

85 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

86 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

87 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

88 
Float4X4 MatrixRotationX(float r) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

89 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

90 
float sinR = SDL_sinf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

91 
float cosR = SDL_cosf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

92 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

93 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

94 
m._11 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

95 
m._22 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

96 
m._23 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

97 
m._32 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

98 
m._33 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

99 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

100 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

101 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

102 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

103 
Float4X4 MatrixRotationY(float r) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

104 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

105 
float sinR = SDL_sinf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

106 
float cosR = SDL_cosf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

107 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

108 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

109 
m._11 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

110 
m._13 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

111 
m._22 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

112 
m._31 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

113 
m._33 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

114 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

115 
return m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

116 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

117 

532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

118 
Float4X4 MatrixRotationZ(float r) 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

119 
{ 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

120 
float sinR = SDL_sinf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

121 
float cosR = SDL_cosf(r); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

122 
Float4X4 m; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

123 
SDL_zero(m); 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

124 
m._11 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

125 
m._12 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

126 
m._21 = sinR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

127 
m._22 = cosR; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

128 
m._33 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

129 
m._44 = 1.0f; 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

130 
return m; 
8764
3d5ef7548688
Fixes #2529, guard SDL_d3math.* with the proper defines
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8599
diff
changeset

131 

8599
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

132 
} 
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

133 

8764
3d5ef7548688
Fixes #2529, guard SDL_d3math.* with the proper defines
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8599
diff
changeset

134 
#endif /* (SDL_VIDEO_RENDER_D3D  SDL_VIDEO_RENDER_D3D11) && !SDL_RENDER_DISABLED */ 
3d5ef7548688
Fixes #2529, guard SDL_d3math.* with the proper defines
Gabriel Jacobo <gabomdq@gmail.com>
parents:
8599
diff
changeset

135 

8599
532cd234e923
Fixed D3D9 initialization on Windows 8, which doesn't have D3DX
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset

136 
/* vi: set ts=4 sw=4 expandtab: */ 