aboutsummaryrefslogtreecommitdiff
path: root/mayaPlug/shaveVertexShader.h
blob: a7c6057ea82a7464433d7a63000db03906f6d9fb (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
#ifndef shaveVertexShader_h
#define shaveVertexShader_h
// Shave and a Haircut
// (c) 2019 Epic Games
// US Patent 6720962

#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MFloatVector.h>
#include <maya/MPlug.h>
#include <maya/MPxNode.h>
#include <maya/MSceneMessage.h>
#include <maya/MTypeId.h>


class shaveVertexShader : public MPxNode
{
public:
								shaveVertexShader();
    virtual						~shaveVertexShader();

    virtual MStatus				compute(const MPlug&, MDataBlock&);
	virtual void				postConstructor();

#if MAYA_API_VERSION >= 201600
	virtual SchedulingType		schedulingType() const { return kUntrusted; }
#endif

    static void*				creator();
    static MStatus				initialize();

    static MTypeId				id;
	static const MString		nodeTypeName;

private:
	static inline float dotProduct(const MFloatVector&, const MFloatVector&); 

	// Input attributes

	static MObject	pointAttr;
	static MObject	surfaceIndexAttr;
	static MObject	objectIdAttr;
	static MObject	primitiveIdAttr;

	// Output attributes
	static MObject	outColorAttr;
	static MObject	outAlphaAttr;

	//
	// Local members.
	//
};


inline float shaveVertexShader::dotProduct(
	const MFloatVector& v1,
	const MFloatVector& v2
) 
{	return (v1.x*v2.x + v1.y*v2.y + v1.z*v2.z);	}

#endif