aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/hairAPI.h
blob: 816c2366fb6df03e8ef1603450f766ab7039a967 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
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_