aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveRenderer.h
blob: b209e6519e29dd6134b873aff59707bf9b8c14fb (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
#ifndef shaveRenderer_h
#define shaveRenderer_h

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

#include <maya/MObjectArray.h>

#include "shaveConstant.h"
#include "shaveGlobals.h"

class shaveHairShape;


class shaveRenderer
{
public:
					shaveRenderer();
	virtual			~shaveRenderer();

	virtual	void	doShutter(
						const MTime& curTime, shaveConstant::ShutterState shutter
					);

	virtual	void	frameEnd(const shaveGlobals::Globals& g);
	virtual	void	frameStart(const shaveGlobals::Globals& g);

	virtual	shaveConstant::RenderMode
					getFilteredRenderMode(
						const MObjectArray&	shaveNodes,
						bool* renderInstances = NULL
					) const;

	virtual	shaveConstant::RenderMode
					getBaseRenderMode(bool* renderInstances = NULL) const;

	virtual	shaveConstant::ShadowSource
					getBaseShadowSource() const;

	virtual	void	getGeomVisibility(
						bool& hairPrimaryVisibility,
						bool& hairSecondaryVisibility,
						bool& instancePrimaryVisibility,
						bool& instanceSecondaryVisibility
					);

	virtual	float	getPixelAspect() const;

	virtual void	getRenderableShaveNodes(MObjectArray& nodes);

	virtual	void	getRenderableShaveNodesByRenderMode(
						MObjectArray* geomNodes, MObjectArray* nonGeomNodes
					);

	virtual	shaveConstant::RenderMode
					getRenderMode(bool* renderInstances = NULL) const;

	virtual	shaveConstant::ShadowSource
					getShadowSource() const;

	//
	// This method must return true if the shaveHairShape is to be rendered
	// as normal Maya geometry and therefore does not need to be included
	// in a Shave buffer render and should not be included in exported DRA
	// archives.
	//
	virtual	bool	isGeomNode(const shaveHairShape* nodePtr) const = 0;
	virtual	bool	needVertexColours() const;

	virtual	void	render(
						float frame,
						shaveConstant::ShutterState shutter,
						const MDagPath& camera
					) = 0;

	virtual	void	renderEnd();
	virtual	void	renderInterrupted();
	virtual void	renderStart();
	virtual	void	timeChange(const MTime& newTime) = 0;

protected:
	MObjectArray				mGeometryNodes;
	MObjectArray				mNonGeometryNodes;
	bool						mRendering;
	mutable bool				mWarningGivenInvalidHairMode;
	mutable bool				mWarningGivenInvalidInstanceMode;

	//
	// Note that these are only valid between startRender and endRender.
	//
	shaveConstant::RenderMode	mHairRenderMode;
	bool						mHaveHair;
	bool						mHaveInstances;
	bool						mRenderInstances;
	shaveConstant::ShadowSource	mHairShadowSource;
};

#endif