- Sun Jul 16, 2006 4:18 pm
#171627
Hello,
Here is some code (by Juan from this post -> http://www.maxwellrender.com/forum/view ... hp?t=17458) which I put into a simple console application.
I include all the libraries and header file directories and it all compiles. But when I run the application it gives an error before it writes the .mxs file. Does anyone know what might be wrong?
Here is some code (by Juan from this post -> http://www.maxwellrender.com/forum/view ... hp?t=17458) which I put into a simple console application.
I include all the libraries and header file directories and it all compiles. But when I run the application it gives an error before it writes the .mxs file. Does anyone know what might be wrong?
Code: Select all
Thanks for any help#include <maxwell.h>
#include <rawimage.h>
#include <iostream>
#include <stdlib.h>
byte pErrorCallBack( byte isError, const char *pMethod, const char *pError, const void *pValue )
{
if ( isError )
{
// It is a good idea to put a breakpoint here
// Also it is a good idea to check all the functions return byte = 1
}
return ( 0 );
}
int main()
{
Cmaxwell* pScene= new Cmaxwell( pErrorCallBack );
// Set a blue sky dome
Crgb skyColor;
skyColor.assign( 0.0, 0.0, 1.0 );
pScene->setSkyConstant(skyColor, 5 );
// Create a camera
Cpoint from;
Cpoint to;
Cvector up;
from.assign( 0,0,0);
to.assign(0,0,-1);
up.assign(0,1,0);
pScene->createCamera( 1, 1/125, 0.024, 0.036, 100, "CIRCULAR", 30, 6, 25, 800, 600, 1);
pScene->setCamera( 0, from, to, up, 0.050, 8, false );
// Create a default material
Cmaxwell::Cmaterial yourMaterial = pScene->createMaterial( "gattomanzo material", true );
// Create a mesh with just one triangle and apply the material to it
Cmaxwell::Cobject yourMesh = pScene->createMesh( "gattomanzo mesh", 3, 3, 1, 1 );
yourMesh .setMaterial( yourMaterial );
// Set a couple of render parameters and tonemapping
dword maxTime = 1;
pScene->setRenderParameter( "STOP TIME", sizeof ( dword ), &maxTime );
dword sL = 18;
pScene->setRenderParameter( "SAMPLING LEVEL", sizeof ( dword ), &sL);
pScene->setToneMapping( 2.2, 0.7);
// Write the file
pScene->writeMXS( "C:\test.mxs" );
return 0;
}