aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVrayInstance.h
blob: 33288f5f5e4f1755e02b6b0a0667a5f54a0c80a3 (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
#ifndef _HAIR_VRAY_INSTANCE_H_
#define _HAIR_VRAY_INSTANCE_H_

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

/**********************************************************************
 *<
	FILE:			shaveVrayInstance.h  

	DESCRIPTION:	VRay instance for regular hair

	CREATED BY:		Vladimir Dubovoy <[email protected]>

	HISTORY:		created  30-03-2010 

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

// V-Ray headers
#include "vraybase.h"
#include "vraymayageom.h"
#include "vrayplugins.h"
#include "geometryclasses.h"
//own headers
#include "hairAPIvrayutil.h"
#include "shaveVrayPlugin.h"
#include "shaveVrayVoxelPrim.h"
#include "shaveVrayInstanceBase.h"
#include "shaveVrayShadeData.h"

#if 0
class shaveVrayInstance : public shaveVrayInstanceBase {
public:
	
	shaveVrayInstance(shaveVrayPlugin *plugin, 
		VR::MaterialInterface *mtl, VR::BSDFInterface *bsdf, int renderID, 
		VR::VolumetricInterface *volume, VR::LightList *lightList, const VR::TraceTransform &baseTM, int objectID, 
		const tchar *userAttributes, int primaryVisibility);

	void compileGeometry(VR::VRayRenderer *vray, VR::TraceTransform *tm, double *times, int tmCount);
	void clearGeometry(VR::VRayRenderer *vray);
	

};
#endif


class shaveVrayInstance :
#if defined VRAY30
	public VR::BaseMeshInstance,
#elif defined(VRAY40)
	public VR::BaseInstance,
#endif
						  public shaveVrayInstanceBase{
public:
	//shaveVrayPlugin *plugin; //goes to base


	shaveVrayInstance(shaveVrayPlugin *plugin, 
		VR::MaterialInterface *mtl, VR::BSDFInterface *bsdf, int renderID, 
		VR::VolumetricInterface *volume, VR::LightList *lightList,
#if defined(VRAY30)
		const VR::TraceTransform &baseTM,
#elif defined(VRAY40)
		const VR::Transform &baseTM,
#endif
		int objectID, 
		const tchar *userAttributes, int primaryVisibility);

	~shaveVrayInstance();

#if defined(VRAY30)
	void compileGeometry(VR::VRayRenderer *vray, VR::TraceTransform *tm, double *times, int tmCount);
#elif defined(VRAY40)
	void compileGeometry(VR::VRayRenderer *vray, const VR::Transform *tm, double *times, int tmCount) VRAY_OVERRIDE;
#endif
	void clearGeometry(VR::VRayRenderer *vray) VRAY_OVERRIDE;

	//void freeMem();
	inline bool GetSquirrel() const {return squirrel();}
	inline bool GetUseOwnBSDF() const { return ownbsdf();}
	inline const VR::Color& GetSpecTint()  const {return spectint();}
	inline const VR::Color& GetSpecTint2()  const {return spectint2();}
	inline bool	 GetCameraVisibility() const {return cameraVisibility();}
	inline bool	 GetReflVisibility()   const {return reflVisibility();}
	inline bool	 GetRefrlVisibility()  const {return refrVisibility();}
	inline bool	 GetLightVisibility()  const {return lightVisibility();}
	inline bool	 GetGiVisibility()	   const {return giVisibility();}
	inline float  GetSelfShadow()	   const {return selfshadow();}
	inline float  GetRecvShadow()	   const {return recvshadow();}

	inline shaveVrayShadeData* GetShData() const { return shdata();}

protected:
	////const member access
	inline bool tipfade()		  const {return m_tipfade;}
	inline bool squirrel()		  const {return m_squirrel;}
	inline bool ownbsdf()		  const {return m_ownbsdf;}
	inline const VR::Color&	spectint()	const {return m_spectint;}
	inline const VR::Color&	spectint2() const {return m_spectint2;}
	inline bool	 cameraVisibility() const {return m_cameraVisibility;}
	inline bool	 lightVisibility()  const {return m_lightVisibility;}
	inline bool	 reflVisibility()   const {return	m_reflVisibility;}
	inline bool	 refrVisibility()   const {return	m_refrVisibility;}
	inline bool	 giVisibility()		const {return m_giVisibility;}
	inline float selfshadow()		const {return m_selfshadow;}
	inline bool  recvshadow()		const {return m_recvshadow;}
	inline shaveVrayShadeData*    shdata()	 const {return m_shdata;}

	////member access
	inline bool& _tipfade()		{return m_tipfade;}
	inline bool& _squirrel()	{return m_squirrel;}
	inline bool& _ownbsdf()		{return m_ownbsdf;}
	inline VR::Color&	_spectint()	 {return m_spectint;}
	inline VR::Color&	_spectint2() {return m_spectint2;}
	inline bool&	 _cameraVisibility(){return m_cameraVisibility;}
	inline bool&	 _reflVisibility() {return	m_reflVisibility;}
	inline bool&	 _refrVisibility() {return	m_refrVisibility;}

	inline bool&	 _lightVisibility() {return m_lightVisibility;}
	inline bool&	 _giVisibility()	{return m_giVisibility;}
	inline float&    _selfshadow()		{return m_selfshadow;}
	inline bool&     _recvshadow()		{return m_recvshadow;}
	inline shaveVrayShadeData*&    _shdata()	 {return m_shdata;}


private:
	bool		m_tipfade;
	bool		m_squirrel;
	bool		m_ownbsdf;
	VR::Color	m_spectint;
	VR::Color	m_spectint2;
	bool		m_cameraVisibility;
	bool		m_reflVisibility;
	bool		m_refrVisibility;
	bool		m_lightVisibility;
	bool		m_giVisibility;
	float       m_selfshadow;
	bool		m_recvshadow;

    shaveVrayShadeData* m_shdata;
};


#endif