#include <stdio.h>
#include <maya/MIOStream.h>
#include <maya/MGlobal.h>
#include <maya/MString.h>
#include <maya/MPxCommand.h>
#include <maya/MSyntax.h>
#include <maya/MArgDatabase.h>
#include <maya/MArgList.h>
#include <maya/MSelectionList.h>
#include <maya/MItSelectionList.h>
#include <maya/M3dView.h>
#include <maya/MPoint.h>
#include <maya/MImage.h>
#include <maya/MViewport2Renderer.h>
#include <maya/MRenderTargetManager.h>
#include <maya/MStateManager.h>
#include <maya/MShaderManager.h>
#include <maya/MTextureManager.h>
#include <maya/MDrawContext.h>
#include "viewRenderOverride.h"
viewRenderUserOperation::viewRenderUserOperation(
const MString &name)
: MUserRenderOperation( name )
, fDrawLabel(false)
, fUserCameraOverride(false)
, fDebugLightingInfo(false)
, fDebugDrawContext(false)
, fEnableSRGBWriteFlag(false)
{
mViewRectangle[0] = 0.0f;
mViewRectangle[1] = 0.0f;
mViewRectangle[2] = 1.0f;
mViewRectangle[3] = 1.0f;
}
viewRenderUserOperation::~viewRenderUserOperation()
{
}
{
static const bool debugPassInformation = false;
if (debugPassInformation)
{
printf(
"viewRenderUserOperation: drawing in pass[%s], semantic[", passId.
asChar());
for (
unsigned int i=0; i<passSem.
length(); i++)
printf(" %s", passSem[i].asChar());
printf("\n");
}
if (theRenderer)
{
}
if (fDebugLightingInfo)
{
viewRenderOverrideUtilities::printDrawContextLightInfo( drawContext );
}
if (fDebugDrawContext)
{
double dest[4][4];
status = matrix.
get(dest);
printf("World matrix is:\n");
printf("\t%f, %f, %f, %f\n", dest[0][0], dest[0][1], dest[0][2], dest[0][3]);
printf("\t%f, %f, %f, %f\n", dest[1][0], dest[1][1], dest[1][2], dest[1][3]);
printf("\t%f, %f, %f, %f\n", dest[2][0], dest[2][1], dest[2][2], dest[2][3]);
printf("\t%f, %f, %f, %f\n", dest[3][0], dest[3][1], dest[3][2], dest[3][3]);
printf("Viewdirection is: %f, %f, %f\n", viewDirection[0], viewDirection[1], viewDirection[2]);
printf("Screen box is:\n");
printf(
"\twidth=%f, height=%f, depth=%f\n", box.
width(), box.
height(), box.
depth());
float center[4];
printf("\tcenter=(%f, %f, %f, %f)\n", center[0], center[1], center[2], center[3]);
int originX, originY, width, height;
printf("Viewport dimension: center(%d, %d), width=%d, heigh=%d\n", originX, originY, width, height);
}
if (mPanelName.length() &&
{
int targetW, targetH;
if (fDrawLabel)
{
MString testString(
"Drawing with override: ");
testString += overridePtr->
name();
glColor3f( 1.0f, 1.0f, 1.0f );
_OPENMAYA_DEPRECATION_PUSH_AND_DISABLE_WARNING
_OPENMAYA_POP_WARNING
}
}
}
viewRenderUserOperation::cameraOverride()
{
if (fUserCameraOverride)
{
if (mPanelName.length() &&
{
mView.
getCamera( mCameraOverride.mCameraPath );
return &mCameraOverride;
}
}
return NULL;
}
viewRenderUserOperation::targetOverrideList(unsigned int &listSize)
{
if (mTargets)
{
listSize = 2;
return &mTargets[kMyColorTarget];
}
return NULL;
}
bool viewRenderUserOperation::enableSRGBWrite()
{
return fEnableSRGBWriteFlag;
}
bool viewRenderUserOperation::hasUIDrawables() const
{
return true;
}
void viewRenderUserOperation::addUIDrawables(
{
}