Removed useless references

master
Christophe Riccio ago%!(EXTRA string=11 years)
commit 16124f0742
  1. 38
      glm/gtc/packing.hpp
  2. 50
      glm/gtc/packing.inl

@ -62,7 +62,7 @@ namespace glm
/// @see uint32 packUnorm4x8(vec4 const & v) /// @see uint32 packUnorm4x8(vec4 const & v)
/// @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/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> /// @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 uint8 packUnorm1x8(float v);
/// Convert a single 8-bit integer to a normalized floating-point value. /// Convert a single 8-bit integer to a normalized floating-point value.
/// ///
@ -74,7 +74,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 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> /// @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 float unpackUnorm1x8(uint8 const & p); GLM_FUNC_DECL float unpackUnorm1x8(uint8 p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// 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. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -106,7 +106,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 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> /// @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 vec2 unpackUnorm2x8(uint16 const & p); GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p);
/// First, converts the normalized floating-point value v into 8-bit integer value. /// 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. /// Then, the results are packed into the returned 8-bit unsigned integer.
@ -119,7 +119,7 @@ namespace glm
/// @see uint32 packSnorm4x8(vec4 const & v) /// @see uint32 packSnorm4x8(vec4 const & v)
/// @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/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> /// @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 uint8 packSnorm1x8(float s);
/// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers. /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
@ -132,7 +132,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 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> /// @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 float unpackSnorm1x8(uint8 const & p); GLM_FUNC_DECL float unpackSnorm1x8(uint8 p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// 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. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -164,7 +164,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 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> /// @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 vec2 unpackSnorm2x8(uint16 const & p); GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p);
/// First, converts the normalized floating-point value v into a 16-bit integer value. /// 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. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -177,7 +177,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @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/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> /// @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 const & v); GLM_FUNC_DECL uint16 packUnorm1x16(float v);
/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers. /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
@ -190,7 +190,7 @@ namespace glm
/// @see vec4 unpackUnorm4x16(uint64 p) /// @see vec4 unpackUnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 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> /// @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 float unpackUnorm1x16(uint16 const & p); GLM_FUNC_DECL float unpackUnorm1x16(uint16 p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// 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. /// Then, the results are packed into the returned 64-bit unsigned integer.
@ -222,7 +222,7 @@ namespace glm
/// @see vec2 unpackUnorm2x16(uint32 p) /// @see vec2 unpackUnorm2x16(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 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> /// @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 vec4 unpackUnorm4x16(uint64 const & p); GLM_FUNC_DECL vec4 unpackUnorm4x16(uint64 p);
/// First, converts the normalized floating-point value v into 16-bit integer value. /// 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. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -235,7 +235,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @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/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> /// @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 const & v); GLM_FUNC_DECL uint16 packSnorm1x16(float v);
/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers. /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned scalar. /// Then, each component is converted to a normalized floating-point value to generate the returned scalar.
@ -248,7 +248,7 @@ namespace glm
/// @see vec4 unpackSnorm4x16(uint64 p) /// @see vec4 unpackSnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 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> /// @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 float unpackSnorm1x16(uint16 const & p); GLM_FUNC_DECL float unpackSnorm1x16(uint16 p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// 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. /// Then, the results are packed into the returned 64-bit unsigned integer.
@ -291,7 +291,7 @@ namespace glm
/// @see uint64 packHalf4x16(vec4 const & v) /// @see uint64 packHalf4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 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> /// @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 packHalf1x16(float const & v); GLM_FUNC_DECL uint16 packHalf1x16(float v);
/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value, /// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,
/// interpreted as a 16-bit floating-point number according to the OpenGL Specification, /// interpreted as a 16-bit floating-point number according to the OpenGL Specification,
@ -302,7 +302,7 @@ namespace glm
/// @see vec4 unpackHalf4x16(uint64 const & v) /// @see vec4 unpackHalf4x16(uint64 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 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> /// @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 float unpackHalf1x16(uint16 const & v); GLM_FUNC_DECL float unpackHalf1x16(uint16 v);
/// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification, /// to the 16-bit floating-point representation found in the OpenGL Specification,
@ -328,7 +328,7 @@ namespace glm
/// @see vec2 unpackHalf2x16(uint32 const & v) /// @see vec2 unpackHalf2x16(uint32 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 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> /// @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 vec4 unpackHalf4x16(uint64 const & p); GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);
/// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
/// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification, /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
@ -352,7 +352,7 @@ namespace glm
/// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see uint32 packU3x10_1x2(uvec4 const & v)
/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
/// @see uvec4 unpackI3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 const & p); GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);
/// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
/// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification, /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
@ -376,7 +376,7 @@ namespace glm
/// @see uint32 packU3x10_1x2(uvec4 const & v) /// @see uint32 packU3x10_1x2(uvec4 const & v)
/// @see vec4 unpackSnorm3x10_1x2(uint32 const & p); /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
/// @see uvec4 unpackI3x10_1x2(uint32 const & p); /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 const & p); GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values. /// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.
/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed integer values.
@ -411,7 +411,7 @@ namespace glm
/// @see vec4 unpackUnorm3x10_1x2(uint32 const & p)) /// @see vec4 unpackUnorm3x10_1x2(uint32 const & p))
/// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
/// @see uvec4 unpackU3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 const & p); GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values. /// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.
/// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values. /// Then, converts the forth component of the normalized floating-point value v into 2-bit signed uninteger values.
@ -446,7 +446,7 @@ namespace glm
/// @see vec4 unpackInorm3x10_1x2(uint32 const & p)) /// @see vec4 unpackInorm3x10_1x2(uint32 const & p))
/// @see uvec4 unpackI3x10_1x2(uint32 const & p) /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
/// @see uvec4 unpackU3x10_1x2(uint32 const & p) /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 const & p); GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);
/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values. /// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value. /// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
@ -467,7 +467,7 @@ namespace glm
/// ///
/// @see gtc_packing /// @see gtc_packing
/// @see uint32 packF2x11_1x10(vec3 const & v) /// @see uint32 packF2x11_1x10(vec3 const & v)
GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 const & p); GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
/// @} /// @}
}// namespace glm }// namespace glm

@ -165,8 +165,14 @@ namespace detail
else if(x == (0x1f << 6)) else if(x == (0x1f << 6))
return ~0;//Inf return ~0;//Inf
uint result = packed11ToFloat(x); uint Result = packed11ToFloat(x);
return reinterpret_cast<float&>(result);
# if(GLM_COMPILER & GLM_COMPILER_GCC || GLM_COMPILER & GLM_COMPILER_CLANG)
float Temp = 0;
memcpy(&Temp, &Result, sizeof(Temp));
# else
return reinterpret_cast<float&>(Result);
# endif
} }
GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x) GLM_FUNC_QUALIFIER glm::uint floatTo10bit(float x)
@ -226,12 +232,12 @@ namespace detail
}//namespace detail }//namespace detail
GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float const & v) GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v)
{ {
return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f)); return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f));
} }
GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 p)
{ {
float Unpack(static_cast<float>(p)); float Unpack(static_cast<float>(p));
return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255 return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255
@ -244,20 +250,20 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p)
{ {
u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p)); u8vec2* Unpacked = reinterpret_cast<u8vec2*>(const_cast<uint16*>(&p));
return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255 return vec2(*Unpacked) * float(0.0039215686274509803921568627451); // 1 / 255
} }
GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float const & v) GLM_FUNC_QUALIFIER uint8 packSnorm1x8(float v)
{ {
int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f))); int8 Topack(static_cast<int8>(round(clamp(v ,-1.0f, 1.0f) * 127.0f)));
uint8* Packed = reinterpret_cast<uint8*>(&Topack); uint8* Packed = reinterpret_cast<uint8*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p)
{ {
float Unpack(static_cast<float>(*const_cast<uint8*>(&p))); float Unpack(static_cast<float>(*const_cast<uint8*>(&p)));
return clamp( return clamp(
@ -272,7 +278,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 const & p) GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p)
{ {
i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p)); i8vec2* Unpack = reinterpret_cast<i8vec2*>(const_cast<uint16*>(&p));
return clamp( return clamp(
@ -280,12 +286,12 @@ namespace detail
-1.0f, 1.0f); -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float const & s) GLM_FUNC_QUALIFIER uint16 packUnorm1x16(float s)
{ {
return static_cast<uint16>(round(clamp(s, 0.0f, 1.0f) * 65535.0f)); return static_cast<uint16>(round(clamp(s, 0.0f, 1.0f) * 65535.0f));
} }
GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 const & p) GLM_FUNC_QUALIFIER float unpackUnorm1x16(uint16 p)
{ {
float Unpack = static_cast<float>(*const_cast<uint16*>(&p)); float Unpack = static_cast<float>(*const_cast<uint16*>(&p));
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
@ -298,20 +304,20 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 p)
{ {
u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p)); u16vec4* Unpack = reinterpret_cast<u16vec4*>(const_cast<uint64*>(&p));
return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0 return vec4(*Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
} }
GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packSnorm1x16(float v)
{ {
int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f)); int16 Topack = static_cast<int16>(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
uint16* Packed = reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 const & p) GLM_FUNC_QUALIFIER float unpackSnorm1x16(uint16 p)
{ {
float Unpack = static_cast<float>(*const_cast<uint16*>(&p)); float Unpack = static_cast<float>(*const_cast<uint16*>(&p));
return clamp( return clamp(
@ -326,7 +332,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 const & p) GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p)
{ {
i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p))); i16vec4* Unpack(reinterpret_cast<i16vec4*>(const_cast<uint64*>(&p)));
return clamp( return clamp(
@ -334,14 +340,14 @@ namespace detail
-1.0f, 1.0f); -1.0f, 1.0f);
} }
GLM_FUNC_QUALIFIER uint16 packHalf1x16(float const & v) GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v)
{ {
int16 Topack = detail::toFloat16(v); int16 Topack = detail::toFloat16(v);
uint16* Packed = reinterpret_cast<uint16*>(&Topack); uint16* Packed = reinterpret_cast<uint16*>(&Topack);
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 const & v) GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v)
{ {
int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v)); int16* Unpack = reinterpret_cast<int16*>(const_cast<uint16*>(&v));
return detail::toFloat32(*Unpack); return detail::toFloat32(*Unpack);
@ -359,7 +365,7 @@ namespace detail
return *Packed; return *Packed;
} }
GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 const & v) GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 v)
{ {
i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v)); i16vec4* p = reinterpret_cast<i16vec4*>(const_cast<uint64*>(&v));
i16vec4 Unpack(*p); i16vec4 Unpack(*p);
@ -381,7 +387,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@ -402,7 +408,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 v)
{ {
detail::u10u10u10u2 Unpack; detail::u10u10u10u2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@ -423,7 +429,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER vec4 unpackSnorm3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@ -445,7 +451,7 @@ namespace detail
return Result.pack; return Result.pack;
} }
GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 const & v) GLM_FUNC_QUALIFIER vec4 unpackUnorm3x10_1x2(uint32 v)
{ {
detail::i10i10i10i2 Unpack; detail::i10i10i10i2 Unpack;
Unpack.pack = v; Unpack.pack = v;
@ -465,7 +471,7 @@ namespace detail
((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22); ((detail::floatTo10bit(v.z) & ((1 << 10) - 1)) << 22);
} }
GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 const & v) GLM_FUNC_QUALIFIER vec3 unpackF2x11_1x10(uint32 v)
{ {
return vec3( return vec3(
detail::packed11bitToFloat(v >> 0), detail::packed11bitToFloat(v >> 0),

Loading…
Cancel
Save