#include <string.h>
#include <float.h>
#include <maya/MIOStream.h>
#include <math.h>
#include <maya/MPxGeometryFilter.h>
#include <maya/MItGeometry.h>
#include <maya/MPxLocatorNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnMatrixAttribute.h>
#include <maya/MFnMatrixData.h>
#include <maya/MFnPlugin.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MArrayDataHandle.h>
#include <maya/MPoint.h>
#include <maya/MVector.h>
#include <maya/MMatrix.h>
#include <maya/MTimer.h>
#include <maya/MDagModifier.h>
#include <maya/MFnMesh.h>
#include <maya/MFloatPointArray.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnMeshData.h>
#include <maya/MFloatVectorArray.h>
#define MCheckStatus(status,message) \
if( MStatus::kSuccess != status ) { \
cerr << message << "\n"; \
return status; \
}
{
public:
sseDeformer();
virtual ~sseDeformer();
static void* creator();
public:
private:
};
MTypeId sseDeformer::id( 0x8104E );
sseDeformer::sseDeformer() {}
sseDeformer::~sseDeformer() {}
void* sseDeformer::creator()
{
return new sseDeformer();
}
{
status = addAttribute( sseEnabled );
MCheckStatus(status, "ERROR in addAttribute\n");
status = attributeAffects( sseEnabled, outputGeom );
MCheckStatus(status, "ERROR in attributeAffects\n");
}
{
MObject thisNode = this->thisMObject();
{
printf("Ignoring requested plug\n");
return status;
}
{
MPlug inPlug(thisNode,input);
MCheckStatus(status, "ERROR getting input mesh\n");
{
do
{
MCheckStatus(status, "ERROR getting input mesh element\n");
MCheckStatus(status, "ERROR getting input mesh element index\n");
computeOneOutput( inputIndex, data, hInputElement );
}
}
else
{
MPlug inPlug(thisNode,input);
inPlug.selectAncestorLogicalIndex(plug.
logicalIndex(),input);
MCheckStatus(status, "ERROR getting input mesh\n");
}
return status;
}
{
MObject thisNode = this->thisMObject();
MPlug outPlug(thisNode, outputGeom);
outPlug.selectAncestorLogicalIndex(index, outputGeom);
printf("Incorrect input geometry type\n");
}
printf("Incorrect output mesh type\n");
}
printf("Output surface is NULL\n");
}
MCheckStatus(status, "ERROR setting points\n");
bool sseEnabled = (bool) sseData.
asBool();
if(sseEnabled) {
for(int i=0; i<nPoints; i++) {
float* ptPtr = &pts[i].x;
for(int j=0; j<4; j++) {
ptPtr[j] = env * (cosf(ptPtr[j]) * sinf(ptPtr[j]) * tanf(ptPtr[j]));
}
}
} else {
for(int i=0; i<nPoints; i++) {
for(int j=0; j<3; j++) {
pt[j] = env * (cosf(pt[j]) * sinf(pt[j]) * tanf(pt[j]));
}
}
}
if(sseEnabled) {
printf(
"SSE enabled, runtime %f\n", timer.
elapsedTime());
} else {
printf(
"SSE disabled, runtime %f\n", timer.
elapsedTime());
}
return status;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"1.0",
"Any");
result = plugin.registerNode( "sseDeformer", sseDeformer::id, sseDeformer::creator,
return result;
}
{
result = plugin.deregisterNode( sseDeformer::id );
return result;
}