HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
simd::vfloat3 Class Reference

#include <simd.h>

+ Inheritance diagram for simd::vfloat3:

Public Types

enum  { elements = 3 }
 
enum  { paddedelements = 4 }
 
- Public Types inherited from simd::vfloat4
enum  { elements = 4 }
 
enum  { paddedelements = 4 }
 
enum  { bits = elements*32 }
 
typedef float value_t
 Underlying equivalent scalar value type. More...
 
typedef simd_raw_t< float, 4 >
::type 
simd_t
 the native SIMD type used More...
 
typedef vfloat4 vfloat_t
 SIMD int type. More...
 
typedef vint4 vint_t
 SIMD int type. More...
 
typedef vbool4 vbool_t
 SIMD bool type. More...
 
typedef vint4 int_t
 
typedef vbool4 bool_t
 

Public Member Functions

 vfloat3 ()
 Default constructor (contents undefined) More...
 
 vfloat3 (float a)
 Construct from a single value (store it in all slots) More...
 
 vfloat3 (float a, float b, float c)
 Construct from 3 or 4 values. More...
 
 vfloat3 (const float *f)
 Construct from a pointer to 4 values. More...
 
 vfloat3 (const vfloat3 &other)
 Copy construct from another vfloat3. More...
 
 vfloat3 (const vfloat4 &other)
 
 vfloat3 (const Imath::V3f &v)
 Construct from a Imath::V3f. More...
 
const Imath::V3f & V3f () const
 Cast to a Imath::V3f. More...
 
 vfloat3 (const unsigned short *vals)
 Construct from a pointer to 4 unsigned short values. More...
 
 vfloat3 (const short *vals)
 Construct from a pointer to 4 short values. More...
 
 vfloat3 (const unsigned char *vals)
 Construct from a pointer to 4 unsigned char values. More...
 
 vfloat3 (const char *vals)
 Construct from a pointer to 4 char values. More...
 
const vfloat3operator= (float a)
 Assign a single value to all components. More...
 
void load (float val)
 Helper: load a single value into all components. More...
 
void load (const float *values)
 Load from an array of 4 values. More...
 
void load (const float *values, int n)
 Load from an array of 4 values. More...
 
void load (const unsigned short *values)
 Load from an array of 4 unsigned short values, convert to float. More...
 
void load (const short *values)
 Load from an array of 4 short values, convert to float. More...
 
void load (const unsigned char *values)
 Load from an array of 4 unsigned char values, convert to float. More...
 
void load (const char *values)
 Load from an array of 4 char values, convert to float. More...
 
void store (float *values) const
 
void store (float *values, int n) const
 
void store (Imath::V3f &vec) const
 Store into an Imath::V3f reference. More...
 
const vfloat3operator+= (const vfloat3 &a)
 
vfloat3 operator- () const
 
const vfloat3operator-= (const vfloat3 &a)
 
const vfloat3operator*= (const vfloat3 &a)
 
const vfloat3operator*= (float a)
 
const vfloat3operator/= (const vfloat3 &a)
 
const vfloat3operator/= (float a)
 
float length2 () const
 Square of the length of the vector. More...
 
float length () const
 Length of the vector. More...
 
vfloat3 normalized () const
 Return a normalized version of the vector. More...
 
vfloat3 normalized_fast () const
 Return a fast, approximate normalized version of the vector. More...
 
void normalize ()
 Normalize in place. More...
 
- Public Member Functions inherited from simd::vfloat4
 vfloat4 ()
 Default constructor (contents undefined) More...
 
 vfloat4 (float a)
 Construct from a single value (store it in all slots) More...
 
 vfloat4 (float a, float b, float c, float d=0.0f)
 Construct from 3 or 4 values. More...
 
 vfloat4 (const float *f)
 Construct from a pointer to 4 values. More...
 
 vfloat4 (const vfloat4 &other)
 Copy construct from another vfloat4. More...
 
 vfloat4 (const vint4 &ival)
 Construct from an vint4 (promoting all components to float) More...
 
 vfloat4 (const simd_t &m)
 Construct from the underlying SIMD type. More...
 
 operator simd_t () const
 Return the raw SIMD type. More...
 
simd_t simd () const
 
simd_tsimd ()
 
const value_tdata () const
 Return a pointer to the underlying scalar type. More...
 
value_tdata ()
 
 vfloat4 (const Imath::V3f &v)
 Construct from a Imath::V3f. More...
 
const Imath::V3f & V3f () const
 Cast to a Imath::V3f. More...
 
 vfloat4 (const Imath::V4f &v)
 Construct from a Imath::V4f. More...
 
const Imath::V4f & V4f () const
 Cast to a Imath::V4f. More...
 
 vfloat4 (const unsigned short *vals)
 Construct from a pointer to 4 unsigned short values. More...
 
 vfloat4 (const short *vals)
 Construct from a pointer to 4 short values. More...
 
 vfloat4 (const unsigned char *vals)
 Construct from a pointer to 4 unsigned char values. More...
 
 vfloat4 (const char *vals)
 Construct from a pointer to 4 char values. More...
 
const vfloat4operator= (float a)
 Assign a single value to all components. More...
 
const vfloat4operator= (vfloat4 other)
 Assign a vfloat4. More...
 
void clear ()
 Set all components to 0.0. More...
 
const vfloat4operator= (const Imath::V4f &v)
 Assign from a Imath::V4f. More...
 
const vfloat4operator= (const Imath::V3f &v)
 Assign from a Imath::V3f. More...
 
float operator[] (int i) const
 Component access (get) More...
 
floatoperator[] (int i)
 Component access (set) More...
 
void setcomp (int i, float value)
 Component access (set). More...
 
value_t x () const
 
value_t y () const
 
value_t z () const
 
value_t w () const
 
void set_x (value_t val)
 
void set_y (value_t val)
 
void set_z (value_t val)
 
void set_w (value_t val)
 
void load (float val)
 Helper: load a single value into all components. More...
 
void load (float a, float b, float c, float d=0.0f)
 Helper: load 3 or 4 values. (If 3 are supplied, the 4th will be 0.) More...
 
void load (const float *values)
 Load from an array of 4 values. More...
 
void load (const float *values, int n)
 
void load (const unsigned short *values)
 Load from an array of 4 unsigned short values, convert to float. More...
 
void load (const short *values)
 Load from an array of 4 short values, convert to float. More...
 
void load (const unsigned char *values)
 Load from an array of 4 unsigned char values, convert to float. More...
 
void load (const char *values)
 Load from an array of 4 char values, convert to float. More...
 
void store (float *values) const
 
void store (float *values, int n) const
 Store the first n values into memory. More...
 
void load_mask (int mask, const value_t *values)
 
void load_mask (const vbool_t &mask, const value_t *values)
 
void store_mask (int mask, value_t *values) const
 
void store_mask (const vbool_t &mask, value_t *values) const
 
template<int scale = 4>
void gather (const value_t *baseptr, const vint_t &vindex)
 Load values from addresses (char*)basepatr + vindex[i]*scale. More...
 
template<int scale = 4>
void gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex)
 Gather elements defined by the mask, leave others unchanged. More...
 
template<int scale = 4>
void gather_mask (int mask, const value_t *baseptr, const vint_t &vindex)
 
template<int scale = 4>
void scatter (value_t *baseptr, const vint_t &vindex) const
 Store values at addresses (char*)basepatr + vindex[i]*scale. More...
 
template<int scale = 4>
void scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const
 Scatter elements defined by the mask. More...
 
template<int scale = 4>
void scatter_mask (int mask, value_t *baseptr, const vint_t &vindex) const
 
const vfloat4operator+= (const vfloat4 &a)
 
vfloat4 operator- () const
 
const vfloat4operator-= (const vfloat4 &a)
 
const vfloat4operator*= (const vfloat4 &a)
 
const vfloat4operator*= (float val)
 
const vfloat4operator/= (const vfloat4 &a)
 
const vfloat4operator/= (float val)
 
vfloat4 xyz0 () const
 Return xyz components, plus 0 for w. More...
 
vfloat4 xyz1 () const
 Return xyz components, plus 1 for w. More...
 
template<int scale>
OIIO_FORCEINLINE void gather (const value_t *baseptr, const vint_t &vindex)
 
template<int scale>
OIIO_FORCEINLINE void gather_mask (const vbool_t &mask, const value_t *baseptr, const vint_t &vindex)
 
template<int scale>
OIIO_FORCEINLINE void scatter (value_t *baseptr, const vint_t &vindex) const
 
template<int scale>
OIIO_FORCEINLINE void scatter_mask (const vbool_t &mask, value_t *baseptr, const vint_t &vindex) const
 

Static Public Member Functions

static const char * type_name ()
 
static const vfloat3 Zero ()
 Return a vfloat3 with all components set to 0.0. More...
 
static const vfloat3 One ()
 Return a vfloat3 with all components set to 1.0. More...
 
static const vfloat3 Iota (float start=0.0f, float step=1.0f)
 
- Static Public Member Functions inherited from simd::vfloat4
static const char * type_name ()
 
static const vfloat4 Zero ()
 Return a vfloat4 with all components set to 0.0. More...
 
static const vfloat4 One ()
 Return a vfloat4 with all components set to 1.0. More...
 
static const vfloat4 Iota (float start=0.0f, float step=1.0f)
 

Friends

vfloat3 operator+ (const vfloat3 &a, const vfloat3 &b)
 
vfloat3 operator- (const vfloat3 &a, const vfloat3 &b)
 
vfloat3 operator* (const vfloat3 &a, const vfloat3 &b)
 
vfloat3 operator* (const vfloat3 &a, float b)
 
vfloat3 operator* (float a, const vfloat3 &b)
 
vfloat3 operator/ (const vfloat3 &a, const vfloat3 &b)
 
std::ostream & operator<< (std::ostream &cout, const vfloat3 &val)
 Stream output. More...
 

Additional Inherited Members

- Protected Attributes inherited from simd::vfloat4
union {
   simd_t   m_simd
 
   value_t   m_val [paddedelements]
 
}; 
 

Detailed Description

Floating point 3-vector, aligned to be internally identical to a vfloat4. The way it differs from vfloat4 is that all of he load functions only load three values, and all the stores only store 3 values. The vast majority of ops just fall back to the vfloat4 version, and so will operate on the 4th component, but we won't care about that results.

Definition at line 2148 of file simd.h.

Member Enumeration Documentation

anonymous enum
Enumerator
elements 

Definition at line 2151 of file simd.h.

anonymous enum
Enumerator
paddedelements 

Definition at line 2152 of file simd.h.

Constructor & Destructor Documentation

simd::vfloat3::vfloat3 ( )
inline

Default constructor (contents undefined)

Definition at line 2155 of file simd.h.

simd::vfloat3::vfloat3 ( float  a)
inline

Construct from a single value (store it in all slots)

Definition at line 2158 of file simd.h.

simd::vfloat3::vfloat3 ( float  a,
float  b,
float  c 
)
inline

Construct from 3 or 4 values.

Definition at line 2161 of file simd.h.

simd::vfloat3::vfloat3 ( const float f)
inline

Construct from a pointer to 4 values.

Definition at line 2164 of file simd.h.

OIIO_FORCEINLINE simd::vfloat3::vfloat3 ( const vfloat3 other)

Copy construct from another vfloat3.

Definition at line 7865 of file simd.h.

OIIO_FORCEINLINE simd::vfloat3::vfloat3 ( const vfloat4 other)
explicit

Construct from a vfloat4. Note: it will not zero out the internal 4th component, but rather accept on faith that the vfloat4 you are giving it is a valid vfloat3. Be careful!

Definition at line 7873 of file simd.h.

simd::vfloat3::vfloat3 ( const Imath::V3f v)
inline

Construct from a Imath::V3f.

Definition at line 2182 of file simd.h.

simd::vfloat3::vfloat3 ( const unsigned short *  vals)
inlineexplicit

Construct from a pointer to 4 unsigned short values.

Definition at line 2188 of file simd.h.

simd::vfloat3::vfloat3 ( const short *  vals)
inlineexplicit

Construct from a pointer to 4 short values.

Definition at line 2191 of file simd.h.

simd::vfloat3::vfloat3 ( const unsigned char *  vals)
inlineexplicit

Construct from a pointer to 4 unsigned char values.

Definition at line 2194 of file simd.h.

simd::vfloat3::vfloat3 ( const char *  vals)
inlineexplicit

Construct from a pointer to 4 char values.

Definition at line 2197 of file simd.h.

Member Function Documentation

OIIO_FORCEINLINE const vfloat3 simd::vfloat3::Iota ( float  start = 0.0f,
float  step = 1.0f 
)
static

Return a vfloat3 with incremented components (e.g., 0.0,1.0,2.0). Optional argument can give a non-zero starting point and non-1 step.

Definition at line 7886 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat3::length ( void  ) const

Length of the vector.

Definition at line 8092 of file simd.h.

OIIO_FORCEINLINE float simd::vfloat3::length2 ( ) const

Square of the length of the vector.

Definition at line 8086 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( float  val)

Helper: load a single value into all components.

Definition at line 7891 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const float values)

Load from an array of 4 values.

Definition at line 7893 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const float values,
int  n 
)

Load from an array of 4 values.

Definition at line 7895 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const unsigned short *  values)

Load from an array of 4 unsigned short values, convert to float.

Definition at line 7899 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const short *  values)

Load from an array of 4 short values, convert to float.

Definition at line 7903 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const unsigned char *  values)

Load from an array of 4 unsigned char values, convert to float.

Definition at line 7907 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::load ( const char *  values)

Load from an array of 4 char values, convert to float.

Definition at line 7911 of file simd.h.

void simd::vfloat3::normalize ( )
inline

Normalize in place.

Definition at line 2279 of file simd.h.

OIIO_FORCEINLINE vfloat3 simd::vfloat3::normalized ( ) const

Return a normalized version of the vector.

Definition at line 8098 of file simd.h.

OIIO_FORCEINLINE vfloat3 simd::vfloat3::normalized_fast ( ) const

Return a fast, approximate normalized version of the vector.

Definition at line 8110 of file simd.h.

OIIO_FORCEINLINE const vfloat3 simd::vfloat3::One ( )
static

Return a vfloat3 with all components set to 1.0.

Definition at line 7884 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator*= ( const vfloat3 a)

Definition at line 7971 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator*= ( float  a)

Definition at line 7975 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator+= ( const vfloat3 a)

Definition at line 7943 of file simd.h.

OIIO_FORCEINLINE vfloat3 simd::vfloat3::operator- ( ) const

Definition at line 7947 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator-= ( const vfloat3 a)

Definition at line 7955 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator/= ( const vfloat3 a)

Definition at line 7983 of file simd.h.

OIIO_FORCEINLINE const vfloat3 & simd::vfloat3::operator/= ( float  a)

Definition at line 7987 of file simd.h.

const vfloat3& simd::vfloat3::operator= ( float  a)
inline

Assign a single value to all components.

Definition at line 2205 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::store ( float values) const

Definition at line 7921 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::store ( float values,
int  n 
) const

Definition at line 7925 of file simd.h.

OIIO_FORCEINLINE void simd::vfloat3::store ( Imath::V3f vec) const

Store into an Imath::V3f reference.

Definition at line 7935 of file simd.h.

static const char* simd::vfloat3::type_name ( )
inlinestatic

Definition at line 2150 of file simd.h.

const Imath::V3f& simd::vfloat3::V3f ( ) const
inline

Cast to a Imath::V3f.

Definition at line 2185 of file simd.h.

OIIO_FORCEINLINE const vfloat3 simd::vfloat3::Zero ( )
static

Return a vfloat3 with all components set to 0.0.

Definition at line 7882 of file simd.h.

Friends And Related Function Documentation

vfloat3 operator* ( const vfloat3 a,
const vfloat3 b 
)
friend

Definition at line 7959 of file simd.h.

vfloat3 operator* ( const vfloat3 a,
float  b 
)
friend

Definition at line 7963 of file simd.h.

vfloat3 operator* ( float  a,
const vfloat3 b 
)
friend

Definition at line 7967 of file simd.h.

vfloat3 operator+ ( const vfloat3 a,
const vfloat3 b 
)
friend

Definition at line 7939 of file simd.h.

vfloat3 operator- ( const vfloat3 a,
const vfloat3 b 
)
friend

Definition at line 7951 of file simd.h.

vfloat3 operator/ ( const vfloat3 a,
const vfloat3 b 
)
friend

Definition at line 7979 of file simd.h.

std::ostream& operator<< ( std::ostream &  cout,
const vfloat3 val 
)
friend

Stream output.

Definition at line 7992 of file simd.h.


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