#include "TessellatedQuadNode.h"
#include "TessellatedQuadGeomOverride.h"
#include <maya/MDistance.h>
#include <maya/MDrawRegistry.h>
#include <maya/MGLFunctionTable.h>
#include <maya/MHardwareRenderer.h>
#include <maya/MFnDagNode.h>
#include <maya/MFnPlugin.h>
const MString kPluginRegistrantId(
"tessellatedQuadRegistrant");
const MTypeId TessellatedQuadNode::kTypeId(0x8003A);
const MString TessellatedQuadNode::kTypeName(
"tessellatedQuad" );
const MString TessellatedQuadNode::kDrawClassification(
"drawdb/geometry/tessellatedQuad" );
void* TessellatedQuadNode::creator()
{
return new TessellatedQuadNode();
}
MStatus TessellatedQuadNode::initialize()
{
}
TessellatedQuadNode::TessellatedQuadNode()
{
}
TessellatedQuadNode::~TessellatedQuadNode()
{
}
void TessellatedQuadNode::draw(
{
if (!pRenderer)
return;
if (!pGLFT)
return;
const bool isShaded = (style == M3dView::DisplayStyle::kFlatShaded
|| style == M3dView::DisplayStyle::kGouraudShaded
const bool isDormant = (displayStatus == M3dView::DisplayStatus::kDormant);
const MColor wireframeColor(isDormant ? dagNodeFn.dormantColor() : dagNodeFn.activeColor());
pGLFT->
glPushAttrib(GL_CURRENT_BIT | GL_LINE_BIT | GL_COLOR_BUFFER_BIT);
pGLFT->
glEnable(GL_LINE_SMOOTH);
if (isShaded)
{
static const MColor faceColor(0.5, 0.5, 0.5, 1.0);
pGLFT->
glColor4fv(&(faceColor.r));
pGLFT->
glBegin(GL_QUADS);
pGLFT->
glVertex3f(1.0, 0.0, 1.0);
pGLFT->glVertex3f(1.0, 0.0, -1.0);
pGLFT->glVertex3f(-1.0, 0.0, -1.0);
pGLFT->glVertex3f(-1.0, 0.0, 1.0);
}
pGLFT->
glColor4f(wireframeColor.r, wireframeColor.g, wireframeColor.b, wireframeColor.a);
pGLFT->glBegin(GL_LINE_LOOP);
pGLFT->glVertex3f(1.0, 0.0, 1.0);
pGLFT->glVertex3f(1.0, 0.0, -1.0);
pGLFT->glVertex3f(-1.0, 0.0, -1.0);
pGLFT->glVertex3f(-1.0, 0.0, 1.0);
pGLFT->glEnd();
}
bool TessellatedQuadNode::isBounded() const
{
return true;
}
{
return bb;
}
{
MFnPlugin plugin(obj, kPluginRegistrantId.asChar(),
"2019",
"Any");
status = plugin.registerNode(TessellatedQuadNode::kTypeName,
TessellatedQuadNode::kTypeId,
TessellatedQuadNode::creator,
TessellatedQuadNode::initialize,
&TessellatedQuadNode::kDrawClassification);
if (!status)
{
status.
perror(
"registerNode " + TessellatedQuadNode::kTypeName);
return status;
}
TessellatedQuadNode::kDrawClassification,
kPluginRegistrantId,
TessellatedQuadGeomOverride::creator);
if (!status)
{
status.perror("registerGeometryOverrideCreator " + TessellatedQuadNode::kDrawClassification);
return status;
}
return status;
}
{
TessellatedQuadNode::kDrawClassification,
kPluginRegistrantId);
if (!status)
{
status.
perror(
"deregisterGeometryOverrideCreator " + TessellatedQuadNode::kDrawClassification);
return status;
}
status = plugin.deregisterNode(TessellatedQuadNode::kTypeId);
if (!status) {
status.
perror(
"deregisterNode " + TessellatedQuadNode::kTypeName);
return status;
}
return status;
}