aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVrayTriShadeable.h
blob: 31648011cb7eb93d468e8725e8dc8d0b8fb58fc5 (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
#ifndef _HAIR_VR_tri_SHADEABLE_H_
#define _HAIR_VR_tri_SHADEABLE_H_

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

/**********************************************************************
 *<
	FILE:			shaveVrayTriShadeable.h 

	DESCRIPTION:	Used by VRay to shade instanced surface

	CREATED BY:		Vladimir Dubovoy <[email protected]>

	HISTORY:		created  13-05-2010 

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

#include "utils.h"
#include "box.h"
#include "rayserver.h"
#include "vrayplugins.h"
#include "rayserver.h"
#include "geometryclasses.h"
#include "brdfs.h"
#include "brdfpool.h"

#include "shaveVrayTriVoxelPrim.h"
//#include "shaveVrayBaseBSDF.h"

#define USE_WHITE_TRI_BRDF

class shaveVrayTriShadeable : public VR::BSDFShadeable {
public:
	shaveVrayTriShadeable(shaveVrayTriVoxelPrim* instanced);
	~shaveVrayTriShadeable();
	/*
	|	from Shadeable
	*/
	//  This is called to shade the intersection in the rayresult member of the given context. 
	void  shade(VR::VRayContext &rc);
	
	//Returns the name of the shadeable; used to print warnings if any shading errors occur. 
	tchar*  getName(VR::VRayContext &rc);

	/*
	|
	*/
	VR::BSDFSampler* newBSDF (const VR::VRayContext &rc, VR::BSDFFlags flags);
 
	void deleteBSDF(const VR::VRayContext &rc, VR::BSDFSampler *bsdf);

	/*
	|	own
	*/
	void initBSDFpool(VR::VRayCore *vray);

	void freeBSDFpool();

#if defined VRAY40
	int getBSDFFlags() VRAY_OVERRIDE;
#endif

protected:
	//const member access
#ifdef USE_WHITE_TRI_BRDF
	inline const VR::BRDFPool<VR::WhiteBRDF>& bsdfPool() const {return m_bsdfPool;}
#else
	inline const VR::BRDFPool<shaveVrayBaseBSDF>& bsdfPool() const {return m_bsdfPool;}
#endif
	inline shaveVrayTriVoxelPrim* prim() const {return m_prim;}

	//const member access
#ifdef USE_WHITE_TRI_BRDF
	inline VR::BRDFPool<VR::WhiteBRDF>& _bsdfPool() {return m_bsdfPool;}
#else
	inline VR::BRDFPool<shaveVrayBaseBSDF>& _bsdfPool() {return m_bsdfPool;}
#endif
	inline shaveVrayTriVoxelPrim*& _prim() {return m_prim;}

protected:
#ifdef USE_WHITE_TRI_BRDF
	VR::BRDFPool<VR::WhiteBRDF> m_bsdfPool;
#else
	VR::BRDFPool<shaveVrayBaseBSDF> m_bsdfPool;
#endif

	shaveVrayTriVoxelPrim* m_prim;
};

#endif //end of_HAIR_VR_tri_SHADEABLE_H_