Files Class List
HairFile Class Reference

Detailed Description

HAIR file class.

#include <cyHairFile.h>

Classes

struct  Header
 Hair file header. More...
 

Public Member Functions

Constant Data Access Methods
Header const & GetHeader () const
 Use this method to access header data.
 
unsigned short const * GetSegmentsArray () const
 Returns segments array (segment count for each hair strand).
 
float const * GetPointsArray () const
 Returns points array (xyz coordinates of each hair point).
 
float const * GetThicknessArray () const
 Returns thickness array (thickness at each hair point}.
 
float const * GetTransparencyArray () const
 Returns transparency array (transparency at each hair point).
 
float const * GetColorsArray () const
 Returns colors array (rgb color at each hair point).
 
Data Access Methods
unsigned short * GetSegmentsArray ()
 Returns segments array (segment count for each hair strand).
 
float * GetPointsArray ()
 Returns points array (xyz coordinates of each hair point).
 
float * GetThicknessArray ()
 Returns thickness array (thickness at each hair point}.
 
float * GetTransparencyArray ()
 Returns transparency array (transparency at each hair point).
 
float * GetColorsArray ()
 Returns colors array (rgb color at each hair point).
 
Methods for Setting Array Sizes
void Initialize ()
 Deletes all arrays and initializes the header data.
 
void SetHairCount (int count)
 Sets the hair count, re-allocates segments array if necessary.
 
void SetPointCount (int count)
 Deletes all arrays and initializes the header data.
 
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.
 
void SetDefaultSegmentCount (int s)
 Sets default number of segments for all hair strands, which is used if segments array does not exist.
 
void SetDefaultThickness (float t)
 Sets default hair strand thickness, which is used if thickness array does not exist.
 
void SetDefaultTransparency (float t)
 Sets default hair strand transparency, which is used if transparency array does not exist.
 
void SetDefaultColor (float r, float g, float b)
 Sets default hair color, which is used if color array does not exist.
 
Load and Save Methods
int LoadFromFile (char const *filename)
 Loads hair data from the given HAIR file.
 
int SaveToFile (char const *filename) const
 Saves hair data to the given HAIR file.
 
Other Methods
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.