[GLSL]Mipmap 相关函数
int textureQueryLevels(sampler)
:返回该材质Mipmap数量vec2 textureQueryLod(sampler, vec2)
:返回Mipmap与LOD所在等级
int textureQueryLevels(sampler)
:返回该材质Mipmap数量vec2 textureQueryLod(sampler, vec2)
:返回Mipmap与LOD所在等级1vec3 rgb(float h, float s, float v)
2{
3 int hi = int(mod(floor(h / 60), 6));
4 float f = h / 60 - hi;
5 float p = v * (1 - s);
6 float q = v * (1 - f * s);
7 float t = v * (1 - (1 - f) * s);
8 switch(hi)
9 {
10 case 0:
11 return vec3(v, t, p);
12 case 1:
13 return vec3(q, v, p);
14 case 2:
15 return vec3(p, v, t);
16 case 3:
17 return vec3(p, q, v);
18 case 4:
19 return vec3(t, p, v);
20 case 5:
21 return vec3(v, p, q);
22 }
23}
glsl请看以下代码:
1// ...
2
3uniform struct
4{
5 struct
6 {
7 vec3 pos;
8 } list[10];
9} lights;
10
11// ...
glsl有的显卡可以正常处理以上定义,有的不行(即禁止在结构中定义结构)。
请改用以下方式声明:
1// ...
2
3struct whatever
4{
5 vec3 pos;
6};
7
8uniform struct
9{
10 struct whatever list[10];
11} lights;
12
13// ...
glsl