aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVraySharedFunctions.h
blob: 920e45a4dcac101b45db26c5d4402d3e6351b025 (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
#ifndef _HAIR_VR_PRIM_SHARED_FUCTIONS_H_
#define _HAIR_VR_PRIM_SHARED_FUCTIONS_H_

// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

/**********************************************************************
 *<
	FILE:			shaveVraySharedFunctions.h  

	DESCRIPTION:	Various shared functions

	CREATED BY:		Vladimir Dubovoy <[email protected]>

	HISTORY:		created  21-08-2008 ( as part of 3ds Max + VRay hair shaders)
					merged   31-03-2010 

 *>
 **********************************************************************/

#include <vraybase.h>
#include "hairAPIvray.h"

// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the HAIRVRAY_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// SHAVEVRAYSH_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef WIN32
#ifdef HAIRVRAY_EXPORTS
#define HAIRVRAY_API __declspec(dllexport)
#else
#define HAIRVRAY_API __declspec(dllimport)
#endif
#else
#define HAIRVRAY_API
#endif

#ifdef WIN32
extern HINSTANCE hInstance;
#endif

extern PFNCREATEBSDFPOOL CreateShaveBSDFPool;

bool LoadShaveBSDFPoolLib(const char* libPath = NULL);

void UnLoadShaveBSDFPoolLib();

inline void GenOrthVectors(const VR::Vector& in, VR::Vector& u, VR::Vector& v)
{
	u = (in.x != 0.0f || in.y != 0.0f) ?
		normalize(VR::Vector(-in.y, in.x, 0.0f)) :
				  VR::Vector(1.0f, 0.0f, 0.0f);

	v = normalize(in^u);
}


#endif //end of_HAIR_VR_PRIM_SHARED_FUCTIONS_H_