aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVrayVoxelPrimBase.h
blob: 687a3025f1ce70a91d1c568bba1e55c32fe6c070 (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
#ifndef _HAIR_VR_VOXEL_PRIMITIVE_base_H_
#define _HAIR_VR_VOXEL_PRIMITIVE_base_H_

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

/**********************************************************************
 *<
	FILE:			shaveVrayVoxelPrimBase.h 

	DESCRIPTION:	Generic base class for all voxel primitive classes

	CREATED BY:		Vladimir Dubovoy <[email protected]>

	HISTORY:		created  12-05-2010 ( as part of 3ds Max + VRay hair shaders)
					
 *>
 **********************************************************************/

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

#include "hairAPIvrayutil.h"
#include "assert.h"

class shaveVrayVoxelPrimBase  {
public:
	shaveVrayVoxelPrimBase(IHairVoxel* vox, VR::VRayCore* vray)
	{
		assert(vox);
		_voxel() = vox;

		vrayCore = vray;

		if(vray)
		{
			const VR::VRayFrameData& vrfd = vray->getFrameData();
			_sceneOffset() = vrfd.sceneOffset;
		}
	}
	virtual ~shaveVrayVoxelPrimBase(){}

	inline IHairVoxel* GetVoxel() const {return voxel();}

protected:

	VR::VRayCore* vrayCore;
	
	//const member access
	inline const VR::TracePoint&  sceneOffset() const {return m_sceneOffset;}
	inline IHairVoxel*	voxel()	const {return m_voxel;}
	
	//member access
	inline VR::TracePoint& _sceneOffset() {return m_sceneOffset;}
public:
	inline IHairVoxel*&	   _voxel(){return m_voxel;}

private:

	IHairVoxel*	  m_voxel;
	//got form VRayFrameData::sceneOffset - it should be added to shaded points rc.rayresult.wpoint
	//
	//In versions of the V-Ray SDK prior to 1.90.00, wpoint was directly in world space. 
	//In versions 1.90.00 and later, the actual world-space coordinates can be obtained 
	//by adding VRayFrameData::sceneOffset to the wpoint. 
	VR::TracePoint  m_sceneOffset ;

};

#endif	//end of_HAIR_VR_VOXEL_PRIMITIVE_H_