#include "TessellatedQuadNode.h"
#include "TessellatedQuadGeomOverride.h"
#include <maya/MDistance.h>
#include <maya/MDrawRegistry.h>
#include <maya/MFnDagNode.h>
#include <maya/MFnPlugin.h>
#include <maya/MGL.h>
#include <maya/MGLdefinitions.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(
{
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());
glPushAttrib(GL_CURRENT_BIT | GL_LINE_BIT | GL_COLOR_BUFFER_BIT);
glEnable(GL_LINE_SMOOTH);
if (isShaded)
{
static const MColor faceColor(0.5, 0.5, 0.5, 1.0);
glColor4fv(&(faceColor.r));
glBegin(GL_QUADS);
glVertex3f(1.0, 0.0, 1.0);
glVertex3f(1.0, 0.0, -1.0);
glVertex3f(-1.0, 0.0, -1.0);
glVertex3f(-1.0, 0.0, 1.0);
glEnd();
}
glColor4f(wireframeColor.r, wireframeColor.g, wireframeColor.b, wireframeColor.a);
glBegin(GL_LINE_LOOP);
glVertex3f(1.0, 0.0, 1.0);
glVertex3f(1.0, 0.0, -1.0);
glVertex3f(-1.0, 0.0, -1.0);
glVertex3f(-1.0, 0.0, 1.0);
glEnd();
glPopAttrib();
}
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;
}