Im new to C++ and what im working on the docs tell me to look at the example code only it doesnt explain anything so im trying to decipher it.
i came a across this declaration of a function but i dont fully understand it.
just the first function
i get underneath part what i dont get is after the MHWRender::MPxShaderOverride(obj) and then it starts as a list of arguments(or what its called i dont know)
and i guess where i would find what the specified inputs would be.
again i have no idea what this is doing so im a bit lost in how to explain it.
full code can be found here: http://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__cpp_ref_hw_phong_shader_2hw_phong_shader_8cpp_example_html
hwPhongShaderOverride(const MObject& obj)
: MHWRender::MPxShaderOverride(obj)
, fShaderNode(NULL)
, fTextureData(NULL)
, fDrawUsingShader(true) // Disabling this will use fixed-function which only has an OpenGL implementation
, fShaderBound(false)
, fTexture(NULL)
, fInColorPass(false)
, fColorShaderInstance(NULL)
, fInShadowPass(false)
, fShadowShaderInstance(NULL)
, fTransparency(0.0f)
{
// Create a shader instance to use for drawing
//
if (fDrawUsingShader)
{
createShaderInstance();
}
fAmbient[0] = fAmbient[1] = fAmbient[2] = 0.0f;
fDiffuse[0] = fDiffuse[1] = fDiffuse[2] = fDiffuse[3] = 0.0f;
fSpecular[0] = fSpecular[1] = fSpecular[2] = 0.0f;
fShininess[0] = fShininess[1] = fShininess[2] = 500.0f;
}
// override blend state when there is blending
static const MHWRender::MBlendState *sBlendState;
// Current hwPhongShader node associated with the shader override.
// Updated during doDG() time.
hwPhongShader *fShaderNode;
// Shader inputs values including transparency
float fTransparency;
float fAmbient[3];
float fDiffuse[4];
float fSpecular[3];
float fShininess[3];
// Temporary system buffer for creating textures
unsigned char* fTextureData;
// Pass tracking
bool fInColorPass;
bool fInShadowPass;
// Draw with texture or shader flag
bool fDrawUsingShader;
// VP2 texture
MHWRender::MTexture *fTexture;
// VP2 color shader
MHWRender::MShaderInstance *fColorShaderInstance;
// VP2 shadow shader
MHWRender::MShaderInstance *fShadowShaderInstance;
mutable bool fShaderBound;