- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions

# HWMatrix Struct Reference

Search for all occurrences

## Detailed Description

This class represents a four by four matrix stored in the SSE registers.

Definition at line 254 of file SSE.h.

`#include <SSE.h>`

List of all members.

## Public Member Functions
| HWMatrix (void)
| HWMatrix (const mudbox::Matrix &m)
void | MirrorX (void)
HWVector | Transform (const HWVector &v) const
HWVector | ProjectedTransform (const HWVector &v) const
| MB_SSE_ALIGN16_VAR (__m128 r0)
| MB_SSE_ALIGN16_VAR (__m128 r1)
| MB_SSE_ALIGN16_VAR (__m128 r2)
| MB_SSE_ALIGN16_VAR (__m128 r3)

## Constructor & Destructor Documentation

HWMatrix | ( | void |  | ) | `[inline]`

Definition at line 256 of file SSE.h.

    {};

HWMatrix | ( | const mudbox::Matrix & | m | ) | `[inline]`

Definition at line 257 of file SSE.h.

        {
            r0 = _mm_loadu_ps( &m._11 );
            r1 = _mm_loadu_ps( &m._21 );
            r2 = _mm_loadu_ps( &m._31 );
            r3 = _mm_loadu_ps( &m._41 );
        };

## Member Function Documentation

void MirrorX | ( | void |  | ) | `[inline]`

Search for all occurrences

Definition at line 264 of file SSE.h.

        {
            r0 = _mm_shuffle_ps( r0, r0, _MM_SHUFFLE(0, 1, 2, 3) );
            r1 = _mm_shuffle_ps( r1, r1, _MM_SHUFFLE(0, 1, 2, 3) );
            r2 = _mm_shuffle_ps( r2, r2, _MM_SHUFFLE(0, 1, 2, 3) );
            r3 = _mm_shuffle_ps( r3, r3, _MM_SHUFFLE(0, 1, 2, 3) );
        };

HWVector Transform | ( | const HWVector & | v | ) | const `[inline]`

Search for all occurrences

Definition at line 271 of file SSE.h.

        {
            static MB_SSE_ALIGN16_VAR(float c[4]) = { 1, 1, 1, 1 };

            __m128 v0 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(3,3,3,3) );
            __m128 v1 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(2,2,2,2) );
            __m128 v2 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(1,1,1,1) );
            __m128 v3 = _mm_load_ps( c );

            __m128 a0 = _mm_mul_ps( v0, r0 );
            __m128 a1 = _mm_mul_ps( v1, r1 );
            __m128 a2 = _mm_mul_ps( v2, r2 );
            __m128 a3 = _mm_mul_ps( v3, r3 );

            __m128 r = _mm_add_ps( a0, _mm_add_ps( a1, _mm_add_ps( a2, a3 ) ) );

            HWVector z;
            z.v = r;
            return z;
        };

HWVector ProjectedTransform | ( | const HWVector & | v | ) | const `[inline]`

Search for all occurrences

Definition at line 291 of file SSE.h.

        {
            static MB_SSE_ALIGN16_VAR(float c[4]) = { 1, 1, 1, 1 };

            __m128 v0 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(3,3,3,3) );
            __m128 v1 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(2,2,2,2) );
            __m128 v2 = _mm_shuffle_ps( v.v, v.v, _MM_SHUFFLE(1,1,1,1) );
            __m128 v3 = _mm_load_ps( c );

            __m128 a0 = _mm_mul_ps( v0, r0 );
            __m128 a1 = _mm_mul_ps( v1, r1 );
            __m128 a2 = _mm_mul_ps( v2, r2 );
            __m128 a3 = _mm_mul_ps( v3, r3 );

            __m128 r = _mm_add_ps( a0, _mm_add_ps( a1, _mm_add_ps( a2, a3 ) ) );
            __m128 d = _mm_shuffle_ps( r, r, _MM_SHUFFLE(3,3,3,3) );

            HWVector z;
            z.v = _mm_div_ps( r, d );
            return z;
        };

MB_SSE_ALIGN16_VAR | ( | __m128 | r0 | ) |

Search for all occurrences

MB_SSE_ALIGN16_VAR | ( | __m128 | r1 | ) |

Search for all occurrences

MB_SSE_ALIGN16_VAR | ( | __m128 | r2 | ) |

Search for all occurrences

MB_SSE_ALIGN16_VAR | ( | __m128 | r3 | ) |

Search for all occurrences

The documentation for this struct was generated from the following file:

- Mudbox/SSE.h