diff options
| author | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
|---|---|---|
| committer | Ben Marsh <[email protected]> | 2019-10-22 09:07:59 -0400 |
| commit | bd0027e737c6512397f841c22786274ed74b927f (patch) | |
| tree | f7ffbdb8f3741bb7f24635616cc189cba5cb865c /vrayPlug/plugin/hairAPI.h | |
| download | shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.tar.xz shave-and-a-haircut-bd0027e737c6512397f841c22786274ed74b927f.zip | |
Adding Shave-and-a-Haircut 9.6
Diffstat (limited to 'vrayPlug/plugin/hairAPI.h')
| -rw-r--r-- | vrayPlug/plugin/hairAPI.h | 835 |
1 files changed, 835 insertions, 0 deletions
diff --git a/vrayPlug/plugin/hairAPI.h b/vrayPlug/plugin/hairAPI.h new file mode 100644 index 0000000..816c236 --- /dev/null +++ b/vrayPlug/plugin/hairAPI.h @@ -0,0 +1,835 @@ +// Shave and a Haircut +// (c) 2019 Epic Games +// US Patent 6720962 + +/********************************************************************** + *< + FILE: hairAPI.h + + DESCRIPTION: C++ Intefraces for SHAVE2 functions + + CREATED BY: Vladimir Dubovoy <[email protected]> + + HISTORY: created 20-08-2008 + + *> + **********************************************************************/ + +#ifndef _SHAVE2_API_H_ +#define _SHAVE2_API_H_ + + +extern "C" +{ +#include "shaveSDKTYPES.h" +} + +//! \brief Preporcessor definitions +/*! + add HAIRAPI_STATIC preprocessor definitionsif you + are linking within static hairAPI.lib +*/ +#if defined(WIN32) && !defined(HAIRAPI_STATIC) +# ifdef HAIRAPI_EXPORTS +# define HAIRAPI __declspec(dllexport) +# else +# define HAIRAPI __declspec(dllimport) +# endif +#else +# define HAIRAPI +#endif + +// +//! \brief Instance oritented and Voxel orientead workflows are possible withi hairSDK +/*! + 1) Retrieve IHairStack instance using LoadHair(char* dra_file); + + a) Render instance (node) oriented workflow + 2) Retrive IHariNode by shave stack index IHairNode* hairNode = hairStack->GetHairNodeByID(stack_index); + 3) Retrive IHairVoxesl associated with node IHairVoxel* voxel = hairNode->GetVoxel(idx); + 4) Retrieve boudind boxes, hair types or uvsets from IHairVoxel using corespondent methods + + b) Voxel oriented workflow + 2) Retrieve voxels by need from IHairStack using IHairVoxel* voxel = hairStack->GetVoxel(...) methods + 3) Retrieve boudind boxes, hair types or uvsets from IHairVoxel using corespondent methods +*/ + +class IHairStack; + +//! \brief Fuction loads data from DRA file and creates new instance of IHairStack. +/*! + Any works is started by calling this function. + + \param[in] dra_file - The full path to dra file. + \return An isntace of IHairStack. +*/ +HAIRAPI IHairStack* LoadHair(char* dra_file, bool needYZswap = false); + +//! \brief Fuction new instance of IHairStack from DRA data +/*! + Any works is started by calling this function. + + \param[in] dra_data - DRA data. + \param[in] data_size - the size in bytes of data + \return An isntace of IHairStack. +*/ +HAIRAPI IHairStack* LoadHair(void* dra_data, long data_size, bool needYZswap = false); + + + +//! \brief A warapper for HAIRTYPE structure. +/*! No need to call SHAVE2init/free_hairtype(...) - + class consructor and destructor cares about it. +*/ +class HairType : public HAIRTYPE { +public: + IHairStack* owner; + bool squirrel; + + //! \brief Class contsructor + /*! + \param[in] init - Set 'true' if HAIRTYPE shold be initalized, 'true' by defult. + */ + HAIRAPI HairType(bool init = true); + + //! \brief Class desctuctor + /*! + Releases HAIRTYPE data + */ + HAIRAPI ~HairType(); + + + + //! \brief Retrieves the number of hair verts. + /*! + \return The number of hair verts. + */ + int GetNumVerts() const; + + //! \brief Retrives vertex index by face_list_idx . + /*! + \return vertex index can be used in GetVert. + + \param[in] face_list_idx - is value can vary from v_start to v_end retrived by GetFace. + */ + int GetFaceVert(int face_list_idx ) const; + + + //! \brief Retrives location of specified hair vertex. + /*! + The world space location is retrieved. + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve location for. + + \param[out] x - The 'x' coordinate of specified vertex in world space. + \param[out] y - The 'y' coordinate of specified vertex in world space. + \param[out] z - The 'z' coordinate of specified vertex in world space. + */ + void GetVert (int vertidx, float& x, float& y, float& z) const; + + //! \brief Retrives uv coordinates at specified vertex. + /*! + \param[in] vertidx - The index of vert to retrieve uvs for. + + \param[out] u - The 'u' coordinate of specified vertex. + \param[out] v - The 'v' coordinate of specified vertex. + \param[out] w - Not used, the value is zero. + */ + void GetUV (int vertidx, float& u, float& v, float& w) const; + + //! \brief Retrives velocity of specified hair vertex. + /*! + Speed vector in world space is retrieved. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve the speed for. + \param[out] x - The x-component of speed vector. + \param[out] y - The y-component of speed vector. + \param[out] z - The z-component of speed vector. + */ + void GetVelocity(int vertidx, float& x, float& y, float& z) const; + + + //! \brief Retrieves the number of strands. + /*! + \return Number of strands. + */ + int GetNumStrands() const; + + //! \brief Retrives the vertex indicies range for specified strand. + /*! + \param[in] strandidx - The strand index. + \param[out] v_start - The first vertex's index of specified strand. + \param[out] v_end - The index of the last vertex of strand. + */ + void GetStrand(int strandidx, int& v_start, int& v_end) const; + + //! \brief Retrieves the number of faces. Used for instanced hair. + /*! + \return Number of faces. + */ + int GetNumFaces() const; + + //! \brief Retrives the vertex indicies range for specified face. Used for instanced hair. + /*! + \param[in] faceidx - The face index. + \param[out] v_start - The first vertex's index of specified face. + \param[out] v_end - The index of the last vertex of face. + */ + void GetFace(int faceidx, int& v_start, int& v_end) const; + + //! \brief Idicates that color does not change along strand. + /*! + \param[in] strandidx - The strand index to perform the check for. + \return 'true' if color is constant along the strand otherwise 'false' + */ + bool IsColorConst(int strandidx) const; + + //! \brief Retrives the root color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + void GetRootColor(int strandidx, float& r, float& g, float& b) const; + + //! \brief Retrives the tip color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + void GetTipColor (int strandidx, float& r, float& g, float& b) const; + + //! \brief Retrives the color for specified knot (vertex) of the strand. + /*! + Interpolation is not performed if color is constant along the strand. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] knot_idx - Knot index in range [0; v_end-v_start] + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + //! See /see HairType::GetStrand for knot indexing details. + void GetVertColor(int strandidx, int knot_idx, float& r, float& g, float& b) const; + + //! \brief Retrives interplolated color along the strand. + /*! + Interpolation is not performed if color is constant. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] t - Value in range [0.0; 1.0] to define location along the strand. 0 is correspondent to root. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + void GetColor (int strandidx, float t, float& r, float& g, float& b) const; + + //! \brief Retrieves surface normal where specified strand is grown. + /*! + Normal vector in world space is retrieved. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive normal for. + \param[out] x - The x-component of normal vector. + \param[out] y - The y-component of normal vector. + \param[out] z - The z-component of normal vector. + */ + void GetSurfNormal(int strandidx, float& x, float& y, float& z) const; + + //! \brief Retrives the glossines value for specified strand. + /*! + \param[in] strandidx - The index of the strand to retrieve for. + /retrun Glossiness value. + */ + float GetStrandGlossiness(int strandidx) const; + + //! \brief Retrives the specular level for specified strand. + /* + \param[in] strandidx - The index of the strand to retrieve value for. + /retrun Specular level value. + */ + float GetStrandSpecLevel(int strandidx) const; + + //! \brief Retrives the opacity value for specified strand. + /*! + \param[in] strandidx - The index of the strand to retrieve for. + /retrun Opacity value. + */ + float GetStrandOpacity(int strandidx) const; + + //! \brief Retrieves the Ambient/Diffuse ratio for specified strand. + /*! + \param[in] strandidx- The index of the strand to retrieve for. + /retrun The Ambient/Diff ratio. + */ + float GetStrandAmbDiff(int strandidx) const; +}; + + +//! /bief A warapper class for UVSETS structure. +/*! + No need to call SHAVE2init/free_UVs(...) - + consructor and destructor and destructor cares about it. +*/ +class HairUVs : public UVSETS { +public: + + //! \brief Class constructor. + /*! + \param[in] init - Set 'true' if UVSETS shold be initalized, 'true' by defult. + */ + HAIRAPI HairUVs(bool init = true); + + //! \brief Class descructor. + /*! + Releases UVSETS data. + */ + HAIRAPI ~HairUVs(); +}; + + +//! \brief Provides access to HairType and HairUVs of voxel. +/*! + Hair is disributed in uniform grid. Hair data can be retrived + for each voxel in grid. Voxels associated with certain hair node + can be retrived via IHairNode class. +*/ +class IHairVoxel { +public: + + //! \brief Queries voxel for hair presnse. + /*! + \return 'true' if there is hair in voxel, otherwise 'false'. + */ + virtual HAIRAPI bool HasHair() const = 0; + + //! \brief Queries how hair was loaded. And is it associated with IHairNode. + /*! + \return 'true' if voxel was retrieved using SHAVE2import_mem_archive_voxel_by_node(...) + 'false' if voxel was retrived using SHAVE2import_mem_archive_voxel(...) and holds HairType + for all the nodes in voxel. + */ + virtual HAIRAPI bool IsNodeVoxel() const = 0; + + + //! \brief Returns node id if current voxel si node-voxel, otherwise returns -1. + /* + \return Node id voxel is associated with. Or -1 if IsNodeVoxel() is 'false'. + */ + //! /see IHairVoxel::IsNodeVoxel + virtual HAIRAPI int GetNodeID() const = 0; + + //! \brief Retrieves bounding box for the voxel if it is not empty. + /*! + \param[out] pmin - Bounding box minimum. + \param[out] pmax - Bounding box maximum. + \return 'true' if not epmty and bbox was retrieved succesfully, otherwise 'false'. + */ + virtual HAIRAPI bool GetBbox(VERT& pmin, VERT& pmax) const = 0; + + //! \brief Retrieves HairType for a voxel or for node in voxel. + /*! + \return NULL of voxel is empy, otherwise actuall HairType. + */ + virtual HAIRAPI const HairType& GetHair(/*bool isShadow = false*/) = 0; + + //! \brief Retrieves HairUVs for a voxel or for node in voxel. + /*! + \return NULL of voxel is empy, otherwise actuall HairUVs + */ + virtual HAIRAPI const HairUVs& GetUVs (/*bool isShadow = false*/) = 0; + + ///////////////////////////////////////////////////////////////////////// + // These methods retrieve data from voxel's HairType + //////////////////////////////////////////////////////////////////////// + + + //! \brief Retrieves the number of hair verts. + /*! + \return The number of hair verts. + */ + virtual HAIRAPI int GetNumVerts() const = 0; + + //! \brief Retrives location of specified hair vertex. + /*! + The world space location is retrieved. + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve location for. + + \param[out] x - The 'x' coordinate of specified vertex in world space. + \param[out] y - The 'y' coordinate of specified vertex in world space. + \param[out] z - The 'z' coordinate of specified vertex in world space. + */ + virtual HAIRAPI void GetVert (int vertidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrives velocity of specified hair vertex. + /*! + Speed vector in world space is retrieved. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve the speed for. + \param[out] x - The x-component of speed vector. + \param[out] y - The y-component of speed vector. + \param[out] z - The z-component of speed vector. + */ + virtual HAIRAPI void GetVelocity(int vertidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrieves the number of strands in voxel. + /*! + \return Number of strands. + */ + virtual HAIRAPI int GetNumStrands() const = 0; + + //! \brief Retrives the vertex indicies range for specified strand. + /*! + \param[in] strandidx - The strand index. + \param[out] v_start - The first vertex's index of specified strand. + \param[out] v_end - The index of the last vertex of strand. + */ + virtual HAIRAPI void GetStrand(int strandidx, int& v_start, int& v_end) const = 0; + + //! \brief Retrieves the number of faces in voxel. Used for instanced hair. + /*! + \return Number of faces. + */ + virtual HAIRAPI int GetNumFaces() const = 0; + + //! \brief Retrives the vertex indicies range for specified face. Used for instanced hair. + /*! + \param[in] faceidx - The face index. + \param[out] v_start - The first vertex's index of specified face. + \param[out] v_end - The index of the last vertex of face. + */ + virtual HAIRAPI void GetFace(int faceidx, int& v_start, int& v_end) const = 0; + + //! \brief Idicates that color does not change along strand. + /*! + \param[in] strandidx - The strand index to perform the check for. + \return 'true' if color is constant along the strand otherwise 'false' + */ + virtual HAIRAPI bool IsColorConst(int strandidx) const = 0; + + //! \brief Retrives the root color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetRootColor(int strandidx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives the tip color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetTipColor (int strandidx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives the color for specified knot (vertex) of the strand. + /*! + Interpolation is not performed if color is constant along the strand. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] knot_idx - Knot index in range [0; v_end-v_start] + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + //! See /see IHairVoxel::GetStrand for knot indexing details. + virtual HAIRAPI void GetVertColor(int strandidx, int knot_idx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives interplolated color along the strand. + /*! + Interpolation is not performed if color is constant. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] t - Value in range [0.0; 1.0] to define location along the strand. 0 is correspondent to root. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetColor (int strandidx, float t, float& r, float& g, float& b) const = 0; + + //! \brief Retrieves surface normal where specified strand is grown. + /*! + Normal vector in world space is retrieved. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive normal for. + \param[out] x - The x-component of normal vector. + \param[out] y - The y-component of normal vector. + \param[out] z - The z-component of normal vector. + */ + virtual HAIRAPI void GetSurfNormal(int strandidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrives the glossines value for specified strand. + /*! + \param[in] strandidx - The index of the strand to retrieve for. + /retrun Glossiness value. + */ + virtual HAIRAPI float GetStrandGlossiness(int strandidx) const = 0; + + //! \brief Retrives the specular level for specified strand. + /* + \param[in] strandidx - The index of the strand to retrieve value for. + /retrun Specular level value. + */ + virtual HAIRAPI float GetStrandSpecLevel(int strandidx) const = 0; + + //! \brief Retrives the opacity value for specified strand. + /*! + \param[in] strandidx - The index of the strand to retrieve for. + /retrun Opacity value. + */ + virtual HAIRAPI float GetStrandOpacity(int strandidx) const = 0; + + //! \brief Retrieves the Ambient/Diffuse ratio for specified strand. + /*! + \param[in] strandidx- The index of the strand to retrieve for. + /retrun The Ambient/Diff ratio. + */ + virtual HAIRAPI float GetStrandAmbDiff(int strandidx) const = 0; + +}; + + +//! \brief Provies access hair data and IHairVoxels associated with the current node. +/*! + All vertex or strand Get... methods are quering all the voxels + associated with current node. +*/ +class IHairNode { +public: + virtual ~IHairNode(){} + + //! brief Retrieves the version of Shave Engine. + /*! + Should return the sting in 'X.XvXX' format. + */ + static HAIRAPI char* GetVersion(); + + //! \brief Retrives bounding box of IHairNode. + /*! + Bounding box retrieved is equal to union of voxels' bounding boxes it occupies. + + \param[out] pmin - Bounding box minimum. + \param[out] pmax - Bounding box maximum. + \return Normaly 'true' if node has hair, 'false' otherwise. + */ + virtual HAIRAPI bool GetBbox(VERT& pmin, VERT& pmax) const = 0; + + + //! brief Retrieves current node index in hair stack. + /*! + \return Hair node stack index. + */ + virtual HAIRAPI int GetStackID() const = 0; + + //! \brief Retrieves the number of voxels node occupies. + /*! + \return Number of voxels. + */ + virtual HAIRAPI int GetNumVoxels()const = 0; + + //! \brief Retrives IHairVoxel(s) node occupies + /*! + \param[in] i - Index of voxel in range [0; GetNumVoxels()-1]. + \return Pointer to one of the voxels. Note: do not delete these instnces - IHairNode cares about it + */ + virtual HAIRAPI IHairVoxel* GetVoxel(int i) const = 0; + + ///////////////////////////////////////////////////////////////////////// + // These methods retrieve data from node's voxels + //////////////////////////////////////////////////////////////////////// + + //! \brief Retrieves the number of hair verts in the node. + /*! + \return The number of hair verts. + */ + virtual HAIRAPI int GetNumVerts() const = 0; + + //! \brief Retrives location of specified hair vertex. + /*! + The world space location is retrieved. + + All the voxels node occupies are taken into account. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve location for. + + \param[out] x - The 'x' coordinate of specified vertex in world space. + \param[out] y - The 'y' coordinate of specified vertex in world space. + \param[out] z - The 'z' coordinate of specified vertex in world space. + */ + virtual HAIRAPI void GetVert (int vertidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrives velocity of specified hair vertex. + /*! + Speed vector in world space is retrieved. + + All the voxels node occupies are taken into account. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] vertidx - The index of vert to retrieve the speed for. + \param[out] x - The x-component of speed vector. + \param[out] y - The y-component of speed vector. + \param[out] z - The z-component of speed vector. + */ + virtual HAIRAPI void GetVelocity(int vertidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrieves the number of strands node has. + /*! + All the voxels node occupies are taken into account. + + \return Number of strands. + */ + virtual HAIRAPI int GetNumStrands() const = 0; + + //! \brief Retrives the vertex indicies range for specified strand. + /*! + All the voxels node occupies are taken into account. + + \param[in] strandidx - The strand index. + \param[out] v_start - The first vertex's index of specified strand. + \param[out] v_end - The index of the last vertex of strand. + */ + virtual HAIRAPI void GetStrand(int strandidx, int& v_start, int& v_end) const = 0; + + //! \brief Retrieves the number of faces node has. Used for instanced hair. + /*! + All the voxels node occupies are taken into account. + + \return Number of faces. + */ + virtual HAIRAPI int GetNumFaces() const = 0; + + //! \brief Retrives the vertex indicies range for specified face. Used for instanced hair. + /*! + All the voxels node occupies are taken into account. + + \param[in] faceidx - The face index. + \param[out] v_start - The first vertex's index of specified face. + \param[out] v_end - The index of the last vertex of face. + */ + virtual HAIRAPI void GetFace(int faceidx, int& v_start, int& v_end) const = 0; + + //! \brief Idicates that color does not change along the specified strand. + /*! + \param[in] strandidx - The strand index to perform the check for. + \return 'true' if color is constant along the strand otherwise 'false' + */ + virtual HAIRAPI bool IsColorConst(int strandidx) const = 0; + + //! \brief Retrives the tip color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetRootColor(int strandidx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives the tip color of specified strand. + /*! + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The stand idnex to rentrive color for. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetTipColor (int strandidx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives interplolated color along the strand. + /*! + Interpolation is not performed if color is constant. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] t - Value in range [0.0; 1.0] to define location along the strand. 0 is correspondent to root. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetVertColor(int strandidx, int knot_idx, float& r, float& g, float& b) const = 0; + + //! \brief Retrives interplolated color along the strand. + /*! + Interpolation is not performed if color is constant. + + hairSDK does not use application dependent classes like 3ds Max's Color + so colors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive color for. + \param[in] t - Value in range [0.0; 1.0] to define location along the strand. 0 is correspondent to root. + \param[out] r - Red color component. + \param[out] g - Green color component. + \param[out] b - Blue color component. + */ + virtual HAIRAPI void GetColor (int strandidx, float t, float& r, float& g, float& b) const = 0; + + //! \brief Retrieves surface normal where specified strand is grown. + /*! + Normal vector in world space is retrieved. + + hairSDK does not use application dependent classes like 3ds Max's Point3 + so vectors are retrived by components. + + \param[in] strandidx - The strand idnex to rentrive normal for. + \param[out] x - The x-component of normal vector. + \param[out] y - The y-component of normal vector. + \param[out] z - The z-component of normal vector. + */ + virtual HAIRAPI void GetSurfNormal(int strandidx, float& x, float& y, float& z) const = 0; + + //! \brief Retrives the specular level for specified strand. + /* + \param[in] strandidx - The index of the strand to retrieve value for. + /retrun Specular level value. + */ + virtual HAIRAPI float GetStrandGlossiness(int strandidx) const = 0; + + //! \brief Retrives the specular level for specified strand. + /* + \param[in] strandidx - The index of the strand to retrieve value for. + /retrun Specular level value. + */ + virtual HAIRAPI float GetStrandSpecLevel(int strandidx) const = 0; + + //! \brief Retrives the opacity value for specified strand. + /*! + \param[in] strandidx - The index of the strand to retrieve for. + /retrun Opacity value. + */ + virtual HAIRAPI float GetStrandOpacity(int strandidx) const = 0; + + //! \brief Retrieves the Ambient/Diffuse ratio for specified strand. + /*! + \param[in] strandidx- The index of the strand to retrieve for. + /retrun The Ambient/Diff ratio. + */ + virtual HAIRAPI float GetStrandAmbDiff(int strandidx) const = 0; + +}; + + +//! \brief Provies access to IHairNodes and IHairVoxels +/*! + Instance of this class is create by LoadHair(...) function. + Then you can choose the workflow appropriate for you and + and work with hair on per-node or per-voxel base. +*/ +class IHairStack { +public: + virtual HAIRAPI ~IHairStack(){} + + //! brief Retrieves the version of Shave Engine. + /*! + Should return the sting in 'X.XvXX' format. + */ + static HAIRAPI char* GetVersion(); + + //! brief Retrieves DRA file name associated with stack. + /*! + Should return the same with passed to LoadHair. + */ + virtual HAIRAPI char* GetDRAname() const = 0; + + //! \brief Returns total number of voxels (res*res*res) in the stack. + /*! + \return The number of voxels in the stack. + */ + virtual HAIRAPI int GetNumVoxels() const = 0; + + //! \brief Retrieves the voxel resolution. + /*! + \return The voxel resolution. So numvoxels = res*res*res + */ + virtual HAIRAPI int GetVoxelRes() const = 0; + + //! \brief Retrieves IHairVoxel by grid indicies. + /*! + \param[in] vox_x - Voxel's x-index in the grid in range [0, voxel_resolution - 1]. + \param[in] vox_y - Voxel's y-index in the grid in range [0, voxel_resolution - 1]. + \param[in] vox_z - Voxel's z-index in the grid in range [0, voxel_resolution - 1]. + \return Pointer to IHairVoxel instance. You should not delete these instances, IHariStack will do it. + */ + virtual HAIRAPI IHairVoxel* GetHairVoxel(int vox_x, int vox_y, int vox_z) = 0; + + //! \brief Retrieves IHairVoxel by index. + /*! + \param[in] vox_index - Voxel's index in the grid in range [0, num_voxels - 1]. + \return Pointer to IHairVoxel instance. You should not delete these instances, IHairStack will do it. + */ + virtual HAIRAPI IHairVoxel* GetHairVoxel(int vox_index) = 0; + + //! \brief Retrieves IHairNode by its stack index. + /*! + \param[in] The stack index of node to retrieve. + \return Pointer to IHairNode instance. You should not delete these insntances, IHairStack will do it. + */ + virtual HAIRAPI IHairNode* GetHairNodeByID(int stack_id, bool squirrel = false) = 0; + + + //! \brief Places the thread lock (you do not need to call this routine direcly). + virtual void Lock() = 0; + + //! \brief Removes the thread lock (you do not need to call this routine direcly). + virtual void UnLock() = 0; +}; + + + +#endif //end of_SHAVE2_API_H_ |