...
Allocates and fills the "points" array with the coordinates of points to be drawn in the Studio viewport. Also sets "nPoints" to the actual number of points filled.
Arguments
const dword& percent : input, goes from 0 to 100, indicating the degree of desired precision to draw the proxy.
const dword& maxPoints : input, the maximum number of points allowed.
dword& nPoints : output, the actual number of points allocated. Must be <= maxPoints.
float*& points : output, array with the points, x0y0z0x1y1z1x2y2z2....
Returns
true on success, otherwise false;
getProxyDisplayLines
virtual bool getProxyDisplayLines( const dword& percent, const dword& maxPoints, const dword& maxLines, dword& nPoints,
float*& points, dword& nLines, dword*& pointsPerLine );
Allocates and fills the "points" array and "pointsPerLine" array with with the coordinates of points, and number of points per line to be drawn in the Studio viewport. Also sets "nPoints" to the actual number of points created and nLines to the actual number of lines created.
Arguments
const dword& percent : input, goes from 0 to 100, indicating the degree of desired precision to draw the proxy.
const dword& maxPoints : input, the maximum number of points allowed.
const dword& maxLines : input, the maximum number of lines allowed.
dword& nPoints : output, the actual number of points allocated. Must be <= maxPoints.
float*& points : output, array with the points, x0y0z0x1y1z1x2y2z2....
dword& nLines : output, the actual number of lines created. Must be <= maxLines.
dword*& pointsPerLine : output, array with the number of points per line, n0n1n2.... If this array is of size 3*nPoints floatsNULL, then the number of points per line is constant, and is nPoints/nLines.
Returns
true on success, otherwise false;
getProxyDisplayFaces
virtual bool getProxyDisplayFaces( const dword& percent, const dword& maxFaces, dword& nPoints, float*& points, dword& nFaces,
dword*& faces );
Allocates and fills the "points" array and "faces" array with with the coordinates of points, and indexes to vertices to be drawn in the Studio viewport. Also sets "nPoints" to the actual number of points created and "nFaces" to the actual number of triangles created.
Arguments
const dword& percent : input, goes from 0 to 100, indicating the degree of desired precision to draw the proxy.
const dword& maxPoints : input, the maximum number of points allowed.
const dword& maxFaces : input, the maximum number of faces allowed.
dword& nPoints : output, the actual number of points allocated. Must be <= maxPoints.
floatfloat*& points : output, array with the points, x0y0z0x1y1z1x2y2z2....
dword& nFaces : output, the actual number of faces created. Must be <= maxLines.
dword*& : output, array with the indices to vertices in the "points" array v00v01v02v10v11v12v20v21v22....
Returns
true on success, otherwise false;
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#include <math.h> #include "extensionmanager.h" #include "geometryextension.h" #include "maxwell.h" class CubeExampleExtension : public CgeometryLoaderExtension { DECLARE_EXTENSION_METHODS( "CubeExample", CubeExampleExtension, 1 ) Cmaxwell* pMaxwellLocal; //Handy to access the scene. public: CubeExampleExtension() { getExtensionData()->createDouble( "Cube size", 1.0, 0, 1000 );//Create parameter with Default value } ~CubeExampleExtension() { } bool initializeForRendering ( Cmaxwell* pMaxwell ) { pMaxwellLocal = pMaxwell; return true; } bool loadMesh( Cmaxwell::Cobject &cube ) { //Get the extension parameter getExtensionData()->getDouble( "Cube size", cubeSize ); //Create the mesh cube.initializeMesh( 8, 6, 12, 1 ); //Add the vertices Cpoint point; point.assign( 0.0, 0.0, 0.0 ); cube.setVertex ( 0, 0, point ); point.assign( 0.0, 0.0, cubeSize ); cube.setVertex ( 1, 0, point ); point.assign( cubeSize, 0.0, cubeSize ); cube.setVertex ( 2, 0, point ); point.assign( cubeSize, 0.0, 0.0 ); cube.setVertex ( 3, 0, point ); point.assign( 0.0, cubeSize, 0.0 ); cube.setVertex ( 4, 0, point ); point.assign( 0.0, cubeSize, cubeSize ); cube.setVertex ( 5, 0, point ); point.assign( cubeSize, cubeSize, cubeSize ); cube.setVertex ( 6, 0, point ); point.assign( cubeSize, cubeSize, 0.0 ); cube.setVertex ( 7, 0, point ); //Set some normals Cvector normal; normal.assign( 1.0, 0.0, 0.0 ); cube.setNormal( 0, 0, normal ); normal.assign( -1.0, 0.0, 0.0 ); cube.setNormal( 1, 0, normal ); normal.assign( 0.0, 1.0, 0.0 ); cube.setNormal( 2, 0, normal ); normal.assign( 0.0, -1.0, 0.0 ); cube.setNormal( 3, 0, normal ); normal.assign( 0.0, 0.0, 1.0 ); cube.setNormal( 4, 0, normal ); normal.assign( 0.0, 0.0, -1.0 ); cube.setNormal( 5, 0, normal ); //Add triangles cube.setTriangle ( 0, 0, 2, 1, 3, 3, 3 ); cube.setTriangle ( 1, 0, 3, 2, 3, 3, 3 ); cube.setTriangle ( 2, 4, 5, 6, 2, 2, 2 ); cube.setTriangle ( 3, 4, 6, 7, 2, 2, 2 ); cube.setTriangle ( 4, 2, 3, 7, 0, 0, 0 ); cube.setTriangle ( 5, 2, 7, 6, 0, 0, 0 ); cube.setTriangle ( 6, 0, 1, 5, 1, 1, 1 ); cube.setTriangle ( 7, 0, 5, 4, 1, 1, 1 ); cube.setTriangle ( 8, 1, 2, 6, 4, 4, 4 ); cube.setTriangle ( 9, 1, 6, 5, 4, 4, 4 ); cube.setTriangle ( 10, 0, 4, 7, 5, 5, 5 ); cube.setTriangle ( 11, 0, 7, 3, 5, 5, 5 ); //Generate some uvs dword cchanIdx = 0; dword daChan; cube.addChannelUVW( daChan, cchanIdx ); Cbase projBase; projBase.origin.assign( 0.5, 0.5, 0.5 ); projBase.xAxis.assign( 1.0, 0.0, 0.0 ); projBase.yAxis.assign( 0.0, 1.0, 0.0 ); projBase.zAxis.assign( 0.0, 0.0, 1.0 ); Cvector scale; scale.assign( 0.5, 0.5, 1.0 ); byte sux = cube.generateCubicUVW( cchanIdx, projBase ); return true; } bool getBoundingBox( Cvector &bmin, Cvector& bmax) { bmin.assign( -cubeSize, -cubeSize, -cubeSize ); bmax.assign( cubeSize, cubeSize, cubeSize ); return true; } }; EXPORT_GEOMETRY_LOADER_EXTENSION( CubeExampleExtension ) |