The Cmaxwell class describes the whole Maxwell Render scene.
...
Type | Name | Description |
---|---|---|
unsigned char | _interactiveFlags | Internal use. |
Enumerations
typeCallback and InteractiveFlags.
Methods
Name | Description | ||
---|---|---|---|
Cmaxwell | Class constructor. | ||
~Cmaxwell | Class destructor. | ||
getMxsVersion | Gets MXS file version. | ||
getMostRecentVersionMXS | Gets most recent MXS version supported. | ||
getPluginID | Gets the plug-in identifier from which the MXS was created. | ||
setPluginID | Gets the plug-in identifier from which the MXS was created. | ||
isProtectionEnabled | Gets scene protection state in Maxwell Studio (ability to export to other formats). | ||
enableProtection | Sets scene protection state in Maxwell Studio (ability to export to other formats). | ||
Scene methods | |||
freeGeometry | Deletes all geometry of the scene. | ||
freeScene | Resets the scene. Cleans all objects, geometry, materials, etc. | ||
getScenePreview | Preview image of the scene stored in the file (useful for thumbnals). | ||
setScenePreview | Sets preview image. | ||
readPreview | Sets sene preview image from another MXS. | ||
setInputDataType | Set the axis orientation of the scene. | ||
setSinglePrecisionOfGeometry | Uses floats instead of doubles for geometry. | ||
setSceneUserData | Internal use. | ||
addCluster | Adds a triangle cluster to the scene. | ||
Object methods | |||
getObject | Gets a object reference from the scene. | ||
createMesh | Creates a mesh with the given parameters and adds it to the scene. | ||
createInstancement | Creates an instancement. | ||
createProxy | Creates a proxy object from a MXS. | ||
createRFRK | Creates a RealFlow RenderKit object. | ||
addObject | Adds an existent object to the scene. | ||
mergeMeshes | Merges meshes into a new one. | ||
Camera methods | |||
addCamera | Adds a new camera to the scene with the given parameters. | ||
getCamera | Gets a camera requested by name. | ||
getActiveCamera | Gets the active camera of the scene. | ||
Paths methods | |||
setPath | Sets the path and depth for the given channel. | ||
getPath | Gets the path and depth for the given channel. | ||
addSearchingPath | Adds a path to look for missing textures, ior and ies files. | ||
getSearchingPaths | Gets all searching paths of the scene. | ||
Sky methods | |||
getSunPositionType | Sets sun position type. | ||
setSunPositionType | Gets sun position type. | ||
getSkyConstant | Gets the parameters of the constant sky. | ||
setSkyConstant | Sets the parameters of the constant sky. | ||
getSunLongitudeAndLatitude | Gets sun longitude and latitude data. | ||
setSunLongitudeAndLatitude | Sets sun longitude and latitude data. | ||
getSunAngles | Gets sun position angles. | ||
setSunAngles | Sets sun position angles. | ||
getSunDirection | Gets sun direction vector. | ||
setSunDirection | Sets sun direction vector. | ||
getSunRotation | Gets sun rotation angles. | ||
setSunRotation | Sets sun rotation angles. | ||
getSunProperties | Gets sun properties | ||
setSunProperties | Sets sun properties. | ||
getPhysicalSkyAtmosphere | Gets physical atmosphere parameters. | ||
setPhysicalSkyAtmosphere | Sets physical atmosphere parameters. | ||
getActiveSky | Gets active sky name. | ||
setActiveSky | Sets active sky name. | ||
Additional sky methods | |||
getSunDirectionUsedForRendering | Returns the sun direction. | ||
saveSkyToHDR | Saves current sky to an HDR file. | ||
saveSkyToPreset | Saves current physical sky values to a file. | ||
loadSkyFromPreset | Loads a preset file replacing current physical sky values. | ||
getSkyColor | Returns sky RGB color of the current sky values in the given direction. | ||
getSkyColorNoTonemapped | Returns sky RGB color (without tonemapping nor exposure) of the current sky values in the given direction. | ||
Environment methods | |||
isEnvironmentEnabled | Gets IBL (Image Based Lighting) state. | ||
enableEnvironment | Sets the IBL (Image Based Lighting) on/off. | ||
getEnvironmentWeight | Gets the value for the global multiplier of all the environment layers. | ||
setEnvironmentWeight | Sets the value for the global multiplier of all the environment layers. | ||
getEnvironmentLayer | Gets the parameters of each environment layer. | ||
setEnvironmentLayer | Sets the parameters of each environment layer. | ||
Material methods | |||
readMaterial | Reads a material from file (MXM). | ||
createMaterial | Creates a new material. | ||
getMaterial | Gets a material by name. | ||
addMaterial | Adds a material to the scene. | ||
eraseUnusedMaterials | Remove unused materials from the scene. | ||
setOverrideMaterial | Sets the path and state (enabled/disabled) of the material that overrides all materials of the scene (except emitter materials). | ||
getOverrideMaterial | gets the path and state (enabled/disabled) of the material that overrides all materials of the scene (except emitter materials). | ||
setDefaultMaterial | Sets the path and state (enabled/disabled) of the material that will be used for all the objects/triangles without material. | ||
getDefaultMaterial | Gets the path and state (enabled/disabled) of the material that will be used for all the objects/triangles without material. | ||
Render methods | |||
setRenderParameter | Sets render parameter. | ||
getRenderParameter | Gets render parameter. | ||
Tonemapping methods | |||
getToneMapping | Gets tonemapping values. | ||
setToneMapping | Sets tonemapping values. | ||
getActiveToneMapping | Gets the active tonemapping used ("BASIC" or "ADVANCED" ). | ||
setAdvancedToneMapping | Deprecated. | ||
getAdvancedToneMapping | Deprecated. | ||
Read/write scene methods | |||
readMXS | Reads scene from disk. | ||
writeMXS | Writes scene to disk. | ||
Glare methods | |||
setDiffraction | Sets diffraction parameters. | ||
getDiffraction | Gets diffraction parameters. | ||
enableDiffraction | Enables diffraction. | ||
disableDiffraction | Disables diffraction. | ||
setColorSpace | Sets the output color space used by the render engine. | ||
getColorSpace | Gets the output color space used by the render engine. | ||
getColorSpaceGamma | Returns the gamma used by the active color space. | ||
Miscellaneous methods | |||
getLastError | Returns the latest error occurred. | ||
getLastErrorString | Returns an human readable string containing the latest error occurred. | ||
getDependencies | Returns all the extern dependencies of the scene (textures, ior files, hdr files, etc). | ||
getObjectsCount | Returns the number of objects in the scene. | ||
getMaterialsCount | Returns the number of materials in the scene. | ||
getCamerasCount | Returns the number of cameras in the scene. | ||
getTriangleGroupsCount | Returns the number of triangle groups in the scene. Deprecated. | ||
getSceneInfo | Returns by reference a Cmaxwell::CsceneInfo structure with information about the scene. | ||
computeFresnelGraph | --TODO-- | computeAbbeGraph | --TODO--Computes the reflectance as a function of the angle of incidence. |
computeAbbeGraph | Computes the reflectance as a function of the spectral input. | ||
getCorrelatedColorTemperature | Gets the correlated RGB values given the temperature color. | ||
generateUuid | Generates an unique ID. | ||
searchFileInCommonPaths | Looks for the given file in all of the searching paths of the scene. | ||
createGeometryLoaderObject | --TODO-- | ||
createGeometryProceduralObject | --TODO-- | ||
applySkyExtension | --TODO-- | ||
applySceneModifierExtension | --TODO-- |
Static Methods
Name | Description |
---|---|
getEngineVersion | Returns the current engine version. |
getSdkVersion | Returns the current SDK version. |
isDepthSupportedForThisFormat | Returns true if for the given extension the depth is valid. |
getHighestDepthSupportedForThisFormat | Returns the highest bits per plane supported for the given format. |
isEmbeddingAlphaSupportedForThisFormat | Returns true if for the given format it is possible embedding the alpha channel. |
isEmbeddingAllChannelsSupportedForThisFormat | Returns true if for the given format it is possible embedding all channels in a multilayer file. |
isTextureExtensionSupported | Returns true if the extension of the given texture path is supported by the render engine. |
getSquareSwatchIES | Used to get the IES/EULUM emission pattern plotted into a square rgb buffer of size "resolution". The caller is responsible of freeing the buffer "buf" after using it. |
getSolidLobeIES | Used to get the IES/EULUM emission pattern plotted as a 3d object. The caller is responsible of freeing the buffers "faces, points" after using them. |
Virtual Methods
Name | Description |
---|---|
printMessage | Prints a message in the render console or in the message handler installed. |
Anchor | ||||
---|---|---|---|---|
|
...
Type | Name | In/Out | Description |
---|---|---|---|
const char* | pInput | in | Must be one of the following: "YXZ", "ZXY" or "YZX". The following equivalences are accepted Typedefs with plugin names can be used as well: "YXZYZXRH" = "MAXWELL", "LIGHTWAVEMAYA" or , "CINEMAXSI"., "ZXYHOUDINI" = , "FORMZRHINO" or "3DSMAXSOLIDWORKS". "YZXZXYLH" = "MAXWELLFORMZ" , or "MAYA3DSMAX", . "XSIYXZLH" , = "HOUDINICINEMA", . "RHINOYZXLH" or = "SOLIDWORKSLIGHTWAVE". |
Anchor | ||||
---|---|---|---|---|
|
...
Type | Name | In/out | Description |
---|---|---|---|
const char* | pName | in | Cluster name |
Return value
Returns a Cmaxwell::Ccluster object, that is a reference to the cluster added to the scene.
...
Returns the Cobject with the given name or a null object if there is not an object with that name ( Cmaxwell::Cobject::isNull() == true ).
Anchor | ||||
---|---|---|---|---|
|
...
Cmaxwell::Cobject reference to the new mesh object created in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
So it's highly reccommended to assign unique names in each instancement creation when we create a lot of them. A good example of creating instancements is provided here.
Language | Syntax |
---|---|
C++ | Cmaxwell::Cobject createInstancement( const char* pName, Cmaxwell::Cobject& object ) |
Python | CmaxwellObject createInstancement( str pName, CmaxwellObject object ) |
...
Cmaxwell::Cobject reference to the new instance object created in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Cmaxwell::Cobject reference to the new proxy object created in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Method used to create RealFlow objects. Returns a null object that can be filled with Cmaxwell::Cobject::setRfrkParameters().
Language | Syntax |
---|---|
C++ | Cmaxwell::Cobject createRFRK( const char* objName ) |
Python | CmaxwellObject createRFRK( str objName ) |
Cmaxwell::Cobject reference to the new RFRK object created in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Cmaxwell::Cobject reference to the object added in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Cmaxwell::Cobject reference to the new merged object created in the scene. Null object if it was not created (Cmaxwell::Cobject::isNull() = true).
Examples
Code Block | ||
---|---|---|
| ||
list = [] list.append(scene.getObject('sphere')); list.append(scene.getObject('cube')); newobject = scene.mergeMeshes('merged',list); |
...
Type | Name | In/Out | Description |
---|---|---|---|
const char* | pType | in | Path type: "RENDER", "ALPHA", "SHADOW", "OBJECT", "MATERIAL", "MOTION", "Z". ("BITMAPS" is deprecated, use Cmaxwell::addSearchingPath() instead) |
const char* | pPath | in | Output path of the channel. |
byte | outputBitDepthMode | in | Bits depth per pixel (8/16/32). If the depth is not correct for the given format, the engine tries to change this parameter. i.e. setPath( "image.jpg", 32 ) is not correct because jpg does not support 32 bits so the engine will change it to 8. Get more info about supported image formats. |
...
Type | Name | In/Out | Description |
---|---|---|---|
const char* | pType | in | Path type: "RENDER", "ALPHA", "SHADOW", "OBJECT", "MATERIAL", "MOTION", "Z". ("BITMAPS" is deprecated, use Cmaxwell::addSearchingPath() instead) |
byte | outputBitDepthMode | out | Bits depth per pixel (8/16/32). |
...
Gets the location of the sun when Cmaxwell::getSunPositionType() = 0.
Language | Syntax |
---|---|
C++ | byte getSunLongitudeAndLatitude( real& longitude, real& latitude, int& sm, dword& dayOfYear, real&timeOfDay ) |
Python | (float longitude, float latitude, int sm, int dayOfYear, int timeOfDay) getSunLongitudeAndLatitude() |
...
Sets the location of the sun when Cmaxwell::getSunPositionType() = 0.
Language | Syntax |
---|---|
C++ | byte setSunLongitudeAndLatitude( real longitude, real latitude, int sm, dword dayOfYear, real timeOfDay ) |
Python | int setSunLongitudeAndLatitude( float longitude, float latitude, int sm, int dayOfYear, float timeOfDay ) |
...
Returns a Cmaxwell::Cmaterial object. Null if it was not created (Cmaxwell::Cmaterial::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Returns a Cmaxwell::Cmaterial object. Null if it was not created (Cmaxwell::Cmaterial::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Returns a Cmaxwell::Cmaterial object. Null if it was not created (Cmaxwell::Cmaterial::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Returns a Cmaxwell::Cmaterial object. Null if it was not created (Cmaxwell::Cmaterial::isNull() = true).
Anchor | ||||
---|---|---|---|---|
|
...
Type | Name | In/Out | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
const char* | pParameterName | in | Parameter name (see pParameterValue for parameter name list). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dword | size | in | Size of the parameter in bytes (see pParameterValue to view sizes by parameter). Note: parameter size is not needed in Python. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
void* | pParameterValue | in/out | Parameter value, according to the following correspondences:
|
...
Type | Name | In/Out | Description |
---|---|---|---|
dword | type | in | Color space selected. See COLOR_SPACES enum. |
Return value
0 = Error setting color space.
...
Type | Name | In/Out | Description |
---|---|---|---|
dword | type | out | (C++) Color space used. See COLOR_SPACES enum. |
Return value
Python
Color space used. See COLOR_SPACES enum.
Anchor | ||||
---|---|---|---|---|
|
...
Returns the latest error occurred, Cerror is defined in error.h. Useful for finding out i/o problems when reading/writing MXS/MXI files.
Language | Syntax |
---|---|
C++ | Cerror::error getLastError() |
Python | int getLastError() |
...
Anchor | ||||
---|---|---|---|---|
|
computeFresnelGraph
--TODO--Computes the reflectance as a function of the angle of incidence.
Language | Syntax |
---|---|
C++ | void computeFresnelGraph( float* pX, float* pY, dword n, real iorOutgoing ) |
Python | array list[2] computeFresnelGraph( int n, float ioirOutgoing ) |
...
Type | Name | In/Out | Description |
---|---|---|---|
float* | pX | out | Float array of size 'n' containing the fresnel graph in the X axisangle of incidence (from 0 to Pi/2). It must be allocated before call computeFresnelGraph. --TODO-- |
float* | pY | out | Float array of size 'n' containing the fresnel graph in the Y axisreflectance graph (from 0 to 1). It must be allocated before call computeFresnelGraph. --TODO-- |
dword | n | in | Size of pX and pY float vectors. |
real | iorOutgoing | in--TODO-- | Refraction index of the material. |
Return value
Python
List containing both (pX and pY) vectors as NumPy arrays.
Anchor | ||||
---|---|---|---|---|
|
computeAbbeGraph
--TODO--Computes the reflectance as a function of the spectral input.
Language | Syntax |
---|---|
C++ | void computeAbbeGraph( float* pX, float* pY, dword n, real nd, real abbe ) |
Python | array list[2] computeAbbeGraph( int n, float nd, float abbe ) |
...
Type | Name | In/Out | Description |
---|---|---|---|
float* | pX | out | Float array of size 'n' containing the abbe graph in the X axisspectral range (in nm). It must be allocated before call computeAbbeGraph . --TODO--(C++). |
float* | pY | out | Float array of size 'n' containing the abbe graph in the Y axisspectral IOR. It must be allocated before call computeAbbeGraph . --TODO--(C++). |
dword | n | in | Size of pX and pY float vectors. |
real | nd | in--TODO-- | Refraction index. |
real | abbe | in--TODO-- | Abbe number of the material. |
Return value
Python
List containing both (pX and pY) vectors as NumPy arrays.
...
Language | Syntax |
---|---|
C++ | void getSdkVersion( char pVersion[64] ) |
int getSdkVersion() | |
Python | str getSdkVersionString() |
int getSdkVersion() |
Anchor | ||||
---|---|---|---|---|
|
...
Type | Name | In/Out | Description |
---|---|---|---|
const char* | fileName | in | IES/EULUM file name. |
unsigned int& | numPoints | out | Number of points returned. |
unsigned int& | numTriangles | out | Number of triangles returned. |
unsigned int*& | faces | out | 0-based indices into points array : v00, v01, v02, v10, v11, v12, ..... |
float*& | points | out | Array of vertices, x0, y0, z0, x1, y1, z1, ..... |
const char* | pAxisSystem | in | Same as setInputDataType. |
Return value
C++
0 = Error getting IES/EULUM 3D emission pattern.
...
Tuple containing 'numPoints', 'points', 'numTriangles' and 'faces'.
Anchor | ||||
---|---|---|---|---|
|
printMessage
Prints a message in the render console or in the message handler installed. Can be reimplemented in subclasses to install handlers.
Language | Syntax |
---|---|
C++ | virtual void printMessage( const char* text, const int code ) |
Parameters
Type | Name | In/Out | Description |
---|---|---|---|
const char* | text | in | Message. |
const int | code | in | 0 = Info. 1 = Error. 2 = Warning. |
Anchor | ||||
---|---|---|---|---|
|
...
InteractiveFlags
Values of the _interactiveFlags property.
Value | C++ | Python |
---|---|---|
0 | Cmaxwell::ALL_CLEAN | Cmaxwell.ALL_CLEAN |
1 | Cmaxwell::CAMERA_DIRTY | Cmaxwell.CAMERA_DIRTY |
2 | Cmaxwell::MATERIALS_ASSIGNMENTS_DIRTY | Cmaxwel.MATERIALS_ASSIGNMENTS_DIRTY |
8 | Cmaxwell::GEOMETRY_DIRTY | Cmaxwell.GEOMETRY_DIRTY |
16 | Cmaxwell::VOXELIZATION_DIRTY | Cmaxwell.VOXELIZATION_DIRTY |
32 | Cmaxwell::SKY_OR_HDR_DIRTY | Cmaxwell.SKY_OR_HDR_DIRTY |
64 | Cmaxwell::DEFAULT_OR_OVERRIDE_MATERIAL_DIRTY | Cmaxwell.DEFAULT_OR_OVERRIDE_MATERIAL_DIRTY |
0x3F | Cmaxwell::ALL_DIRTY | Cmaxwell.ALL_DIRTY |
...