|
- char SphereMapTextureVertexShaderSource[] =
- "vec4 texture( in vec3 position, in vec3 normal ) \n" //1
- "{ \n" //2
- " vec3 u = normalize( position ); \n" //3
- " vec3 r = reflect(u, normal); \n" //4
- " float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z+1.0) * (r.z+1.0)); \n" //5
- " return vec4(r.x / m + 0.5, r.y / m + 0.5, 1.0, 1.0 ); \n" //6
- "} \n";//7
复制代码 |
|