#ifndef _LENSDISTORTIONCALLBACK_H
#define _LENSDISTORTIONCALLBACK_H
#include <maya/MPxCommand.h>
#include <maya/MSyntax.h>
#include <maya/MArgDatabase.h>
#include <maya/MArgList.h>
#include <maya/MUiMessage.h>
#include <maya/M3dView.h>
#include <maya/MImage.h>
#include <maya/MStringArray.h>
#define MAX_MODEL_PANEL 4
class lensDistortionCompute;
{
public:
lensDistortionCallback();
~lensDistortionCallback() override;
static void* creator();
private:
bool mRemoveOperation;
bool mExistOperation;
bool mListOperation;
};
class lensDistortionCompute
{
public:
lensDistortionCompute(
const MString &panelName);
~lensDistortionCompute();
MString getPanelName(){
return mPanelName;};
void setPanelName(
const MString &panelName) { mPanelName = panelName; }
static bool panelHasCallback(
MString& pPanelName );
void clearCallbacks();
static lensDistortionCompute* currentLensDistortionCompute[MAX_MODEL_PANEL];
protected:
static void deleteCB(
const MString& panelName,
void * data);
static void preRenderCB(
const MString& panelName,
void * data);
static void postRenderCB(
const MString& panelName,
void * data);
static void preMultipleDrawPassCB(
const MString& pPanelName,
unsigned int passIndex,
void * data);
static void postMultipleDrawPassCB(
const MString& pPanelName,
unsigned int passIndex,
void * data);
private:
void textureUpdate( );
void draw();
void drawLensDistortionPlane(
GLenum drawMethod
, double renderResolutionX
, double renderResolutionY
, int previewResolutionX
, int previewResolutionY
, double width
, double height
, double principalPointX
, double principalPointY
, double kc1, double kc2, double kc3, double kc4
, double horizontalFilmAperture
, double verticalFilmAperture
);
void applyLensDistortion(
double& Xd
, double& Yd
, double renderResolutionX
, double renderResolutionY
, double width
, double height
, double principalPointX
, double principalPointY
, double kc1, double kc2, double kc3, double kc4
, double horizontalFilmAperture
, double verticalFilmAperture
);
double getDoubleValueFromCameraAttr(
MObject& node,
MString attrName );
unsigned int mTextureIndex;
unsigned int mTextureWidth;
unsigned int mTextureHeight;
unsigned int mMultipleDrawPassCount;
unsigned int mObjectDisplayState;
};
#endif