Files Class List
HairFile Class Reference

Detailed Description

HAIR file class.

#include <cyHairFile.h>

Classes

struct  Header
 

Public Member Functions

Constant Data Access Methods
const HeaderGetHeader () const
 
const unsigned short * GetSegmentsArray () const
 
const float * GetPointsArray () const
 
const float * GetThicknessArray () const
 
const float * GetTransparencyArray () const
 
const float * GetColorsArray () const
 
Data Access Methods
unsigned short * GetSegmentsArray ()
 
float * GetPointsArray ()
 
float * GetThicknessArray ()
 
float * GetTransparencyArray ()
 
float * GetColorsArray ()
 
Methods for Setting Array Sizes
void Initialize ()
 
void SetHairCount (int count)
 
void SetPointCount (int count)
 
void SetArrays (int array_types)
 
void SetDefaultSegmentCount (int s)
 
void SetDefaultThickness (float t)
 
void SetDefaultTransparency (float t)
 
void SetDefaultColor (float r, float g, float b)
 
Load and Save Methods
int LoadFromFile (const char *filename)
 
int SaveToFile (const char *filename) const
 
Other Methods
int FillDirectionArray (float *dir)
 

Member Function Documentation

§ GetHeader()

const Header& GetHeader ( ) const

Use this method to access header data.

§ GetSegmentsArray() [1/2]

const unsigned short* GetSegmentsArray ( ) const

Returns segments array (segment count for each hair strand).

§ GetPointsArray() [1/2]

const float* GetPointsArray ( ) const

Returns points array (xyz coordinates of each hair point).

§ GetThicknessArray() [1/2]

const float* GetThicknessArray ( ) const

Returns thickness array (thickness at each hair point}.

§ GetTransparencyArray() [1/2]

const float* GetTransparencyArray ( ) const

Returns transparency array (transparency at each hair point).

§ GetColorsArray() [1/2]

const float* GetColorsArray ( ) const

Returns colors array (rgb color at each hair point).

§ GetSegmentsArray() [2/2]

unsigned short* GetSegmentsArray ( )

Returns segments array (segment count for each hair strand).

§ GetPointsArray() [2/2]

float* GetPointsArray ( )

Returns points array (xyz coordinates of each hair point).

§ GetThicknessArray() [2/2]

float* GetThicknessArray ( )

Returns thickness array (thickness at each hair point}.

§ GetTransparencyArray() [2/2]

float* GetTransparencyArray ( )

Returns transparency array (transparency at each hair point).

§ GetColorsArray() [2/2]

float* GetColorsArray ( )

Returns colors array (rgb color at each hair point).

§ Initialize()

void Initialize ( )

Deletes all arrays and initializes the header data.

§ SetHairCount()

void SetHairCount ( int  count)

Sets the hair count, re-allocates segments array if necessary.

§ SetPointCount()

void SetPointCount ( int  count)

Deletes all arrays and initializes the header data.

§ SetArrays()

void SetArrays ( int  array_types)

Use this function to allocate/delete arrays. Before you call this method set hair count and point count. Note that a valid HAIR file should always have points array.

§ SetDefaultSegmentCount()

void SetDefaultSegmentCount ( int  s)

Sets default number of segments for all hair strands, which is used if segments array does not exist.

§ SetDefaultThickness()

void SetDefaultThickness ( float  t)

Sets default hair strand thickness, which is used if thickness array does not exist.

§ SetDefaultTransparency()

void SetDefaultTransparency ( float  t)

Sets default hair strand transparency, which is used if transparency array does not exist.

§ SetDefaultColor()

void SetDefaultColor ( float  r,
float  g,
float  b 
)

Sets default hair color, which is used if color array does not exist.

§ LoadFromFile()

int LoadFromFile ( const char *  filename)

Loads hair data from the given HAIR file.

§ SaveToFile()

int SaveToFile ( const char *  filename) const

Saves hair data to the given HAIR file.

§ FillDirectionArray()

int FillDirectionArray ( float *  dir)

Fills the given direction array with normalized directions using the points array. Call this function if you need strand directions for shading. The given array dir should be allocated as an array of size 3 times point count. Returns point count, returns zero if fails.