2
0
Эх сурвалжийг харах

Added packXNorm documentation

Christophe Riccio 12 жил өмнө
parent
commit
1807881509
1 өөрчлөгдсөн 84 нэмэгдсэн , 12 устгасан
  1. 84 12
      glm/gtc/packing.hpp

+ 84 - 12
glm/gtc/packing.hpp

@@ -51,33 +51,105 @@ namespace glm
 	/// @addtogroup gtc_packing
 	/// @{
 
+	/// First, converts the normalized floating-point value v into a 8-bit integer value.
+	/// Then, the results are packed into the returned 8-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packUnorm1x8:	round(clamp(c, 0, +1) * 255.0)
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint8 packUnorm1x8(float const & v);
 	GLM_FUNC_DECL float unpackUnorm1x8(uint8 v);
-	
+
+	/// First, converts each component of the normalized floating-point value v into 8-bit integer values.
+	/// Then, the results are packed into the returned 16-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packUnorm2x8:	round(clamp(c, 0, +1) * 255.0)
+	///
+	/// The first component of the vector will be written to the least significant bits of the output;
+	/// the last component will be written to the most significant bits.
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint16 packUnorm2x8(vec2 const & v);
 	GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 v);
-
 	
-	GLM_FUNC_DECL uint8 packSnorm1x8(float const & v);
-	GLM_FUNC_DECL float unpackSnorm1x8(uint8 v);
+	/// First, converts the normalized floating-point value v into 8-bit integer value.
+	/// Then, the results are packed into the returned 8-bit unsigned integer.
+	///
+	/// The conversion to fixed point is done as follows:
+	/// packSnorm1x8:	round(clamp(s, -1, +1) * 127.0)
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
+	GLM_FUNC_DECL uint8 packSnorm1x8(float const & s);
+	GLM_FUNC_DECL float unpackSnorm1x8(uint8 p);
 	
+	/// First, converts each component of the normalized floating-point value v into 8-bit integer values.
+	/// Then, the results are packed into the returned 16-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packSnorm2x8:	round(clamp(c, -1, +1) * 127.0)
+	///
+	/// The first component of the vector will be written to the least significant bits of the output;
+	/// the last component will be written to the most significant bits.
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint16 packSnorm2x8(vec2 const & v);
-	GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 v);
-	
+	GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);
 	
+	/// First, converts the normalized floating-point value v into a 16-bit integer value.
+	/// Then, the results are packed into the returned 16-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packUnorm1x16:	round(clamp(c, 0, +1) * 65535.0)
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint16 packUnorm1x16(float v);
-	GLM_FUNC_DECL float unpackUnorm1x16(uint16 v);
+	GLM_FUNC_DECL float unpackUnorm1x16(uint16 p);
 
+	/// First, converts each component of the normalized floating-point value v into 16-bit integer values.
+	/// Then, the results are packed into the returned 64-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packUnorm4x16:	round(clamp(c, 0, +1) * 65535.0)
+	///
+	/// The first component of the vector will be written to the least significant bits of the output;
+	/// the last component will be written to the most significant bits.
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint64 packUnorm4x16(vec4 const & v);
-	GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 const & v);
+	GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 const & p);
 
-	
+	/// First, converts the normalized floating-point value v into 16-bit integer value.
+	/// Then, the results are packed into the returned 16-bit unsigned integer.
+	///
+	/// The conversion to fixed point is done as follows:
+	/// packSnorm1x8:	round(clamp(s, -1, +1) * 32767.0)
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint16 packSnorm1x16(float v);
-	GLM_FUNC_DECL float unpackSnorm1x16(uint16 v);
+	GLM_FUNC_DECL float unpackSnorm1x16(uint16 p);
 
+	/// First, converts each component of the normalized floating-point value v into 16-bit integer values.
+	/// Then, the results are packed into the returned 64-bit unsigned integer.
+	///
+	/// The conversion for component c of v to fixed point is done as follows:
+	/// packSnorm2x8:	round(clamp(c, -1, +1) * 32767.0)
+	///
+	/// The first component of the vector will be written to the least significant bits of the output;
+	/// the last component will be written to the most significant bits.
+	///
+	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
+	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
 	GLM_FUNC_DECL uint64 packSnorm4x16(vec4 const & v);
-	GLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 const & v);
-
+	GLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 const & p);
 	
 	/// Returns an unsigned integer obtained by converting the components of a floating-point scalar
 	/// to the 16-bit floating-point representation found in the OpenGL Specification,