File: normals.sdr

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (12 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12

/**
 * @brief Unpacks a DXT5nm encoded normal
 * @param normal_sample The Alpha and Green channel of the DXT5 texture
 * @return The unpacked normal
 */
vec3 unpackNormal(vec2 normal_sample) {
	vec3 normal;
	normal.xy = normal_sample * 2.0 - 1.0;
	normal.z = sqrt(1 - normal_sample.x * normal_sample.x - normal_sample.y * normal_sample.y);
	return normal;
}