#include <maya/MPxImageFile.h>
#include <maya/MImageFileInfo.h>
#include <maya/MImage.h>
#include <maya/MFnPlugin.h>
#include <maya/MStringArray.h>
#include <maya/MIOStream.h>
#include <maya/MGL.h>
MString kImagePluginName(
"SimpleImageFile");
{
public:
SimpleImageFile();
virtual ~SimpleImageFile();
static void* creator();
private:
void populateTestImage( float* pixels, unsigned int w, unsigned int h);
};
SimpleImageFile::SimpleImageFile()
{
}
SimpleImageFile::~SimpleImageFile()
{
}
void * SimpleImageFile::creator()
{
return new SimpleImageFile();
}
{
if( info)
{
}
}
void SimpleImageFile::populateTestImage( float* pixels, unsigned int w, unsigned int h)
{
#define RAINBOW_SCALE 4.0f
unsigned int x, y;
for( y = 0; y < h; y++)
{
float g = RAINBOW_SCALE * y / (float)h;
for( x = 0; x < w; x++)
{
float r = RAINBOW_SCALE * x / (float)w;
*pixels++ = r;
*pixels++ = g;
*pixels++ = RAINBOW_SCALE * 1.5f - r - g;
}
}
}
{
unsigned int w = 512;
unsigned int h = 512;
}
{
unsigned int w = info.
width();
unsigned int h = info.
height();
float* pixels = new float[ w * h * 3];
populateTestImage( pixels, w, h);
::glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_FLOAT, pixels);
delete[] pixels;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"8.0",
"Any" );
kImagePluginName,
SimpleImageFile::creator,
extensions));
}
{
}