aboutsummaryrefslogtreecommitdiff
path: root/vrayPlug/plugin/shaveVrayTriShadeData.h
blob: 94366e6d97c49987f1af2411fc5bb974dfa0994b (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
#ifndef _HAIR_VRAY_tri_SHADE_DATA_H_
#define _HAIR_VRAY_tri_SHADE_DATA_H_

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

// V-Ray headers
#include "vraybase.h"
#include "vraymayageom.h"
#include "vrayplugins.h"
#include "geometryclasses.h"
#include "hairprimitives.h"
#include "rayprimitives.h"
#include "vray3_compat.h"

class shaveVrayInstanceI;

class shaveVrayTriShadeData : public VR::BaseShadeData,
							  public VR::MappedSurface
{
	//void getPositionAndBlend(const VR::VRayContext &rc, int &pos, float &blend);

public:

	shaveVrayTriShadeData(shaveVrayInstanceI *instance );

	PluginBase* getPlugin(void) VRAY_OVERRIDE
	{
		return NULL;
	}
	PluginInterface* newInterface(InterfaceID id) VRAY_OVERRIDE 
	{
		switch (id) {
			case EXT_MAPPED_SURFACE: return static_cast<VR::MappedSurface*>(this);
		}
		return BaseShadeData::newInterface(id);
	}

	//VR::Color getColor(const VR::VRayContext &rc);
	//VR::Color getIncandescence(const VR::VRayContext &rc);
	//VR::Color getTransparency(const VR::VRayContext &rc);
	//void getShadeData(const VR::VRayContext &rc, VR::VRayMayaHairShadeData &result);

	// From MappedSurface
#if defined(VRAY30)
	VR::Transform getLocalUVWTransform(const VR::VRayContext &rc, int channel) VRAY_OVERRIDE;
	VR::Vector getLocalUVWCoordinates(const VR::VRayContext &rc, int channel) VRAY_OVERRIDE;
#elif defined(VRAY40)
	void getLocalUVWTransform(const VR::VRayContext &rc, int channel, VR::ShadeTransform &result) override;
	void getLocalUVWCoordinates(const VR::VRayContext &rc, int channel, VR::ShadeVec &result) override;
	int getLocalUVWTransformByName(const VR::VRayContext &rc, const VR::StringID &channelName, VR::ShadeTransform &result) override;
	int getUVWCoordinatesByName(const VR::VRayContext &rc, const VR::StringID &channelName, VR::ShadeVec &result) override;
	VR::ShadeVec getMapChannelVertexVector(int mapChannelIdx, int vertexIdx) override;
	VR::ShadeVec getUVWcoords(const VR::VRayContext &vri, int channel) override;
	void getUVWderivs(const VR::VRayContext &vri, int channel, VR::ShadeVec derivs[2]) override;
	void getUVWbases(const VR::VRayContext &vri, int channel, VR::ShadeVec bases[3]) override;
	VR::ShadeVec getUVWnormal(const VR::VRayContext &vri, int channel) override;
#endif

	void init(const VR::TraceTransform &itm);

private:
	bool getUVWTriVerts(const VR::VRayContext &rc, VR::ShadeVec &t0, VR::ShadeVec &t1, VR::ShadeVec &t2);

protected:

	VR::TraceTransform itm;

};

#endif