#ifndef _hwPhongShader
#define _hwPhongShader
#include <maya/MPxHwShaderNode.h>
#include <maya/MPoint.h>
#include <maya/MHardwareRenderer.h>
#include <maya/MGeometryData.h>
{
public:
hwPhongShader();
~hwPhongShader() override;
void releaseEverything();
int prim,
unsigned int writable,
int indexCount,
const unsigned int * indexArray,
int vertexCount,
const int * vertexIDs,
const float * vertexArray,
int normalCount,
const float ** normalArrays,
int colorCount,
const float ** colorArrays,
int texCoordCount,
const float ** texCoordArrays,
const int * faceIDs,
const float * localUVCoord) override;
int prim,
unsigned int writable,
int indexCount,
const unsigned int * indexArray,
int vertexCount,
const int * vertexIDs,
const float * vertexArray,
int normalCount,
const float ** normalArrays,
int colorCount,
const float ** colorArrays,
int texCoordCount,
const float ** texCoordArrays,
const int * faceIDs,
const float * localUVCoord) override;
int prim,
unsigned int writable,
int indexCount,
const unsigned int * indexArray,
int vertexCount,
const int * vertexIDs,
const float * vertexArray,
int normalCount,
const float ** normalArrays,
int colorCount,
const float ** colorArrays,
int texCoordCount,
const float ** texCoordArrays,
const int * faceIDs,
const float * localUVCoord);
void drawDefaultGeometry();
unsigned int* pIndexing,
unsigned int numberOfData,
unsigned int indexCount );
static void * creator();
void init_Phong_texture ( void );
unsigned int PhongTextureId() const { return phong_map_id; }
float Transparency() const { return mTransparency; }
const float3 * Ambient() const { return &mAmbientColor; }
const float3 * Diffuse() const { return &mDiffuseColor; }
const float3 * Specular() const { return &mSpecularColor; }
const float3 * Shininess() const { return &mShininess; }
void setTransparency(const float fTransparency);
void setAmbient(const float3 &fAmbient);
void setDiffuse(const float3 &fDiffuse);
void setSpecular(const float3 &fSpecular);
void setShininess(const float3 &fShininess);
void printGlError( const char *call );
bool attributesChangedVP2() { return mAttributesChangedVP2; }
void markAttributesChangedVP2() { mAttributesChangedVP2 = true; }
void markAttributesCleanVP2() { mAttributesChangedVP2 = false; }
protected:
void attachSceneCallbacks();
void detachSceneCallbacks();
static void releaseCallback(void* clientData);
private:
GLuint phong_map_id;
float3 mAmbientColor;
float mTransparency;
float3 mDiffuseColor;
float3 mSpecularColor;
float3 mShininess;
unsigned int mGeometryShape;
bool mAttributesChanged;
bool mAttributesChangedVP2;
MCallbackId fBeforeNewCB;
MCallbackId fBeforeOpenCB;
MCallbackId fBeforeRemoveReferenceCB;
MCallbackId fMayaExitingCB;
};
#endif