]> git.tdb.fi Git - libs/gl.git/blob - source/core/uniform.cpp
Rearrange soucre files into subdirectories
[libs/gl.git] / source / core / uniform.cpp
1 #include <msp/gl/extensions/arb_shader_objects.h>
2 #include <msp/gl/extensions/nv_non_square_matrices.h>
3 #include "uniform.h"
4
5 namespace Msp {
6 namespace GL {
7
8 template<>
9 void UniformScalar<int>::apply(int index, unsigned size, const int *value)
10 {
11         glUniform1iv(index, size, value);
12 }
13
14 template<>
15 void UniformScalar<float>::apply(int index, unsigned size, const float *value)
16 {
17         glUniform1fv(index, size, value);
18 }
19
20
21 template<>
22 void UniformVector<int, 2>::apply(int index, unsigned size, const int *value)
23 {
24         glUniform2iv(index, size, value);
25 }
26
27 template<>
28 void UniformVector<float, 2>::apply(int index, unsigned size, const float *value)
29 {
30         glUniform2fv(index, size, value);
31 }
32
33 template<>
34 void UniformVector<int, 3>::apply(int index, unsigned size, const int *value)
35 {
36         glUniform3iv(index, size, value);
37 }
38
39 template<>
40 void UniformVector<float, 3>::apply(int index, unsigned size, const float *value)
41 {
42         glUniform3fv(index, size, value);
43 }
44
45 template<>
46 void UniformVector<int, 4>::apply(int index, unsigned size, const int *value)
47 {
48         glUniform4iv(index, size, value);
49 }
50
51 template<>
52 void UniformVector<float, 4>::apply(int index, unsigned size, const float *value)
53 {
54         glUniform4fv(index, size, value);
55 }
56
57
58 template<>
59 void UniformMatrix<float, 2, 2>::apply(int index, unsigned size, const float *value)
60 {
61         glUniformMatrix2fv(index, size, false, value);
62 }
63
64 template<>
65 void UniformMatrix<float, 2, 3>::apply(int index, unsigned size, const float *value)
66 {
67         glUniformMatrix3x2fv(index, size, false, value);
68 }
69
70 template<>
71 void UniformMatrix<float, 2, 4>::apply(int index, unsigned size, const float *value)
72 {
73         glUniformMatrix4x2fv(index, size, false, value);
74 }
75
76 template<>
77 void UniformMatrix<float, 3, 2>::apply(int index, unsigned size, const float *value)
78 {
79         glUniformMatrix2x3fv(index, size, false, value);
80 }
81
82 template<>
83 void UniformMatrix<float, 3, 3>::apply(int index, unsigned size, const float *value)
84 {
85         glUniformMatrix3fv(index, size, false, value);
86 }
87
88 template<>
89 void UniformMatrix<float, 3, 4>::apply(int index, unsigned size, const float *value)
90 {
91         glUniformMatrix4x3fv(index, size, false, value);
92 }
93
94 template<>
95 void UniformMatrix<float, 4, 2>::apply(int index, unsigned size, const float *value)
96 {
97         glUniformMatrix2x4fv(index, size, false, value);
98 }
99
100 template<>
101 void UniformMatrix<float, 4, 3>::apply(int index, unsigned size, const float *value)
102 {
103         glUniformMatrix3x4fv(index, size, false, value);
104 }
105
106 template<>
107 void UniformMatrix<float, 4, 4>::apply(int index, unsigned size, const float *value)
108 {
109         glUniformMatrix4fv(index, size, false, value);
110 }
111
112 } // namespace GL
113 } // namespace Msp