#include <maya/MIOStream.h>
#include <stdlib.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MGlobal.h>
#include <maya/MFnPlugin.h>
#include <maya/MPxNode.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFloatPoint.h>
#include <maya/MRenderData.h>
#include <maya/MRenderShadowData.h>
#include <maya/MRenderUtil.h>
#include <maya/MRenderCallback.h>
{
public:
myCallback2() {;}
~myCallback2() override {;}
void setObj(
MObject &obj) { nodeObj = obj;}
private:
};
class renderAccessNode :
public MPxNode
{
myCallback2 callback;
public:
renderAccessNode();
~renderAccessNode() override;
static void * creator();
public:
};
{
}
bool myCallback2::renderCallback(
const MRenderData &data )
{
getFloat3( nodeObj, renderAccessNode::aPointWorld, wp );
fprintf( stderr, "\n*** Render Callback\n\n" );
fprintf( stderr,
"Image: %d %d\n", data.
resX, data.
resY );
fprintf( stderr, "region rect: %d %d %d %d\n",
);
return 0;
}
{
getFloat3( nodeObj, renderAccessNode::aPointWorld, wp );
fprintf( stderr, "\n*** Shadow cast Callback\n\n" );
fprintf( stderr, "Light Position (%2.2f, %2.2f, %2.2f), size (%dx%d)\n",
fprintf( stderr, "Light type: %d, perspective: %d\n",
fprintf( stderr, "World Point( %g, %g, %g) = shadowmap (%g, %g, %g)\n\n",
fprintf( stderr, "shadowmap( %g, %g, %g ) = World Point( %g, %g, %g)\n\n",
return 0;
}
bool myCallback2::postProcessCallback(
const MRenderData &data )
{
getFloat3( nodeObj, renderAccessNode::aPointWorld, wp );
float screenZ;
MPlug plug(nodeObj, renderAccessNode::aDist );
plug.getValue( screenZ );
fprintf( stderr, "\n*** Post process Callback\n\n" );
fprintf( stderr,
"Image: %d %d\n", data.
resX, data.
resX );
fprintf( stderr, "region rect: %d %d %d %d\n",
);
float r, g, b, a;
r = 0.0;
g = 255.0;
b = 255.0;
a = 255.0;
short x, y;
unsigned char *addr;
for ( y = 0; y < data.
ysize/2; y+= 3 )
{
for ( x = 0; x < data.
xsize/2; x+= 3 )
{
{
addr[0] = (char)a;
addr[1] = (char)b;
addr[2] = (char)g;
addr[3] = (char)r;
}
else
{
addr[0] = (char)a;
addr[1] = (char)(((a - (int)(a)) * 256.0));
addr[2] = (char)b;
addr[3] = (char)(((b - (int)(b)) * 256.0));
addr[4] = (char)g;
addr[5] = (char)(((g - (int)(g)) * 256.0));
addr[6] = (char)r;
addr[7] = (char)(((r - (int)(r)) * 256.0));
}
}
}
fprintf( stderr, "\nWorld point: ( %2.2f, %2.2f, %2.2f ) = Screen (%2.2f, %2.2f) depth: %2.2f\n\n",
fprintf( stderr, "Screen point: ( %2.2f, %2.2f, %2.2f ) = World (%2.2f, %2.2f, %2.2f)\n",
fprintf( stderr, "\n" );
return 0;
}
MTypeId renderAccessNode::id( 0x81018 );
MObject renderAccessNode::aSamples;
MObject renderAccessNode::aInColor;
MObject renderAccessNode::aPointWorld;
renderAccessNode::renderAccessNode()
{}
renderAccessNode::~renderAccessNode()
{
}
void renderAccessNode::postConstructor()
{
callback.setObj( obj );
}
void * renderAccessNode::creator()
{
return new renderAccessNode();
}
MStatus renderAccessNode::initialize()
{
attributeAffects( aPointWorld, aOutput );
attributeAffects( aInColor, aOutput );
return MS::kSuccess;
}
{
if ( plug == renderAccessNode::aOutput )
{
of = 1.0f;
}
return MS::kSuccess;
}
{
const MString UserClassify(
"utility/general" );
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"4.5",
"Any");
plugin.registerNode( "renderAccessNode", renderAccessNode::id,
renderAccessNode::creator, renderAccessNode::initialize,
return MS::kSuccess;
}
{
plugin.deregisterNode( renderAccessNode::id );
return MS::kSuccess;
}