Everything related to SDK.
By rmw
#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?
Code: Select all
#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;
}
Thanks for any help
User avatar
By victor
#171630
- vertices and faces for the mesh are missing
- check the syntax here, use c:\\ instead of c:\ in writemxs.
By rmw
#171631
Thanks alot Victor, I thought it might work without defining any geometry just to see if it will create a .mxs, because I was having trouble setting vertices and triangles.
By rmw
#171632
Ok its working great now 8)

Probably the use of two "." in the file […]

Maxwell and Blender

An addon for Blender would be amazing. It would in[…]

Hey Patrik, thanks for the suggestion. 🙌🏼 Creams […]

Hi ki_cz, this is my attempt with another engine,[…]