Support Forum       G3D Web Page     
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
G3D::ArticulatedModel::Specification Class Reference

Parameters for constructing a new ArticulatedModel from a file on disk. More...

Classes

class  ColladaOptions
 
class  HairOptions
 
class  HeightfieldOptions
 
class  VoxelOptions
 Used by VOX and Schematic formats. More...
 

Public Member Functions

 Specification ()
 
 Specification (const Any &a)
 If the any is a String ending with .ArticulatedModel.Any it is loaded and parsed. More...
 
UniversalMaterial::Specification convertMTLToUniversalMaterialSpecification (const shared_ptr< ParseMTL::Material > &m, AlphaFilter a, RefractionHint r) const
 Convert a legacy OBJ MTL specification to a physically-based UniversalMaterialSpecification using the options from this. More...
 
size_t hashCode () const
 
bool operator== (const Specification &other) const
 
Any toAny () const
 

Static Public Member Functions

static void mitsubaToG3D (const class XML &mitsubaXML, Specification &specification)
 

Public Attributes

AlphaFilter alphaFilter
 Default alpha filter for surfaces that have alpha maps at load time. More...
 
bool cachable
 If false, this articulated model may not be loaded from or stored in the global articulated model cache. More...
 
CleanGeometrySettings cleanGeometrySettings
 
class G3D::ArticulatedModel::Specification::ColladaOptions colladaOptions
 
String filename
 Materials will be loaded relative to this file. More...
 
class G3D::ArticulatedModel::Specification::HairOptions hairOptions
 
class G3D::ArticulatedModel::Specification::HeightfieldOptions heightfieldOptions
 
bool invertPrecomputedNormalYAxis
 Invert the green channel of the normal map using Texture::Preprocess::modulate and Texture::Preprocess::offset. More...
 
float meshMergeOpaqueClusterRadius
 
Radius for clusters of meshes [that have the same material] that can be merged to reduce draw calls. More...
 
float meshMergeTransmissiveClusterRadius
 The default value is 0.0. More...
 
ParseOBJ::Options objOptions
 
Array< Instructionpreprocess
 A program to execute to preprocess the mesh before cleaning geometry. More...
 
RefractionHint refractionHint
 Default refraction hint for surfaces that have refractive transmission and don't specify a value. More...
 
float scale
 Multiply all vertex positions and part translations by this factor after loading and before preprocessing. More...
 
bool stripLightMapCoords
 
bool stripLightMaps
 
bool stripMaterials
 Ignore materials specified in the file, replacing them with UniversalMaterial::create(). More...
 
bool stripVertexColors
 Ignore vertex colors in the specified file. More...
 
class G3D::ArticulatedModel::Specification::VoxelOptions voxelOptions
 

Detailed Description

Parameters for constructing a new ArticulatedModel from a file on disk.

Example:

        ArticulatedModel::Specification {
            filename = "house.obj";
            // Can be AUTO, ALL, NONE, or a number
            meshMergeOpaqueClusterRadius = inf;
            meshMergeTransmissiveClusterRadius = 10;
            // true = Don't load any materials, thus speeding up load time
            // significantly if many textures are used.
            //
            // false = Load all materials as specified in the file (default)
            stripMaterials = false;
            // true = Don't load any vertex colors, thus speeding up load time (and eventual render time)
            // significantly if there are vertex colors
            //
            // false = Load all vertex colors as specified in the file (default)
            stripVertexColors = false;
            objOptions = OBJOptions {
                stripRefraction = false;
                forceMaterialsToWhite = false;
                texCoord1Mode = NONE;
                materialOptions = ParseMTL::Options {
                    defaultKs = Color3(0.1);
                    defaultMapKs = Color3(1.0);
                    defaultBumpMapIterations = 1;
                };
            };
            cleanGeometrySettings = ArticulatedModel::CleanGeometrySettings {
                forceVertexMerging = true;
                allowVertexMerging = true;
                forceComputeNormals = false;
                forceComputeTangents = false;
                maxNormalWeldAngleDegrees = 8;
                maxSmoothAngleDegrees = 65;
            };
            // Apply this uniform scale factor to the geometry and all
            // transformation nodes.  (default = 1.0)
            scale = 0.5;
            // A small programming language for modifying the scene graph during
            // loading.  This can contain zero or more instructions, which will
            // be processed in the order in which they appear.
            preprocess = (
                // Set the reference frame of a part, relative to its parent
                // All parts and meshes may be referred to by name string or ID integer
                // in any instruction.   Use partID = 0 when using a mesh ID.
                setCFrame("fence", CFrame::fromXYZYPRDegrees(0, 13, 0));
                // Scale the entire object, including pivots, by another factor of 0.1
                scale(0.1);
                // Add this model as a new root part
                add(ArticulatedModel::Specification {
                   filename = "dog.obj";
                   preprocess = ( renamePart(root(), "dog"); );
                });
                // Add this model as a new part, as a child of the root.
                // This feature is currently reserved and not implemented.
                add(root(), ArticulatedModel::Specification {
                   filename = "cat.obj";
                });
                copyTexCoord0ToTexCoord1("fence");
                scaleAndOffsetTexCoord1("fence", scale, offset);
                scaleAndOffsetTexCoord0("wall", scale, offset);
                transformCFrame(root(), CFrame::fromXYZYPRDegrees(0,0,0,90));
                // Remove all vertices and triangles touching them that lie outside
                // of the specified world-space box when in the default pose.
                intersectBox(all(), AABox(Point3(-10, 0, -10), Point3(10, 10, 10)));
                // Transform the root part translations and geometry
                // so that the center of the bounding box in the
                // default pose is at the origin.
                moveCenterToOrigin();
                moveBaseToOrigin();
                reverseWinding("tree");
                // Apply a transformation to the vertices of a geometry, within its reference frame
                transformGeometry("geom", Matrix4::scale(0, 1, 2));
                // Remove a mesh.
                removeMesh("gate");
                // Remove a geometry. This also removes all meshes that use it
                removePart("porch");
                // Replace the material of a Mesh.
                // If the last argument is true (the default), but keep the light maps that are currently on that mesh.
                setMaterial("woodLegs", UniversalMaterial::Specification { lambertian = Color3(0.5); }, true);
                // Change the two-sided flag
                setTwoSided("glass", true);
                // Merge all meshes that share materials. The first argument
                // is the opaque merge cluster radius. The second argument is
                // the transmissive/partial coverage merge cluster radius.
                mergeAll(ALL, NONE);
                renamePart("x17", "television");
                renameMesh("foo", "bar");
                renameGeometry("base_geom", "floor");
            );
        }

Constructor & Destructor Documentation

◆ Specification() [1/2]

G3D::ArticulatedModel::Specification::Specification ( )
inline

◆ Specification() [2/2]

G3D::ArticulatedModel::Specification::Specification ( const Any a)

If the any is a String ending with .ArticulatedModel.Any it is loaded and parsed.

If it is a different string, it is used as the filename. Otherwise it is assumed to be a structure.

Member Function Documentation

◆ convertMTLToUniversalMaterialSpecification()

UniversalMaterial::Specification G3D::ArticulatedModel::Specification::convertMTLToUniversalMaterialSpecification ( const shared_ptr< ParseMTL::Material > &  m,
AlphaFilter  a,
RefractionHint  r 
) const

Convert a legacy OBJ MTL specification to a physically-based UniversalMaterialSpecification using the options from this.

◆ hashCode()

size_t G3D::ArticulatedModel::Specification::hashCode ( ) const

◆ mitsubaToG3D()

static void G3D::ArticulatedModel::Specification::mitsubaToG3D ( const class XML mitsubaXML,
Specification specification 
)
static

◆ operator==()

bool G3D::ArticulatedModel::Specification::operator== ( const Specification other) const

◆ toAny()

Any G3D::ArticulatedModel::Specification::toAny ( ) const

Member Data Documentation

◆ alphaFilter

AlphaFilter G3D::ArticulatedModel::Specification::alphaFilter

Default alpha filter for surfaces that have alpha maps at load time.

Default is AlphaFilter::DETECT, which will use AlphaFilter::BINARY for binary alpha channels and AlphaFilter::BLEND for fractional alpha channels. Switching this value to AlphaFilter::BINARY will lead to faster rendering for models with lots of masking (such as trees), at a cost of more aliasing.

◆ cachable

bool G3D::ArticulatedModel::Specification::cachable

If false, this articulated model may not be loaded from or stored in the global articulated model cache.

Default: true

◆ cleanGeometrySettings

CleanGeometrySettings G3D::ArticulatedModel::Specification::cleanGeometrySettings

◆ colladaOptions

class G3D::ArticulatedModel::Specification::ColladaOptions G3D::ArticulatedModel::Specification::colladaOptions

◆ filename

String G3D::ArticulatedModel::Specification::filename

Materials will be loaded relative to this file.

◆ hairOptions

class G3D::ArticulatedModel::Specification::HairOptions G3D::ArticulatedModel::Specification::hairOptions

◆ heightfieldOptions

class G3D::ArticulatedModel::Specification::HeightfieldOptions G3D::ArticulatedModel::Specification::heightfieldOptions

◆ invertPrecomputedNormalYAxis

bool G3D::ArticulatedModel::Specification::invertPrecomputedNormalYAxis

Invert the green channel of the normal map using Texture::Preprocess::modulate and Texture::Preprocess::offset.

◆ meshMergeOpaqueClusterRadius

float G3D::ArticulatedModel::Specification::meshMergeOpaqueClusterRadius


Radius for clusters of meshes [that have the same material] that can be merged to reduce draw calls.

  • ALL = inf = merge all [default]
  • positive, finite = merge if the combined mesh's bounding box will have an inscribed sphere of this radius
  • NONE = 0 = merge no meshes
  • AUTO = -inf = choose a finite radius based on the bounding box of the entire model [not currently implemented]

The radius is applied to part-space geometry bounds

◆ meshMergeTransmissiveClusterRadius

float G3D::ArticulatedModel::Specification::meshMergeTransmissiveClusterRadius

The default value is 0.0.

See also
meshMergeOpaqueClusterRadius

◆ objOptions

ParseOBJ::Options G3D::ArticulatedModel::Specification::objOptions

◆ preprocess

Array<Instruction> G3D::ArticulatedModel::Specification::preprocess

A program to execute to preprocess the mesh before cleaning geometry.

◆ refractionHint

RefractionHint G3D::ArticulatedModel::Specification::refractionHint

Default refraction hint for surfaces that have refractive transmission and don't specify a value.

Default is RefractionHint::DYNAMIC_FLAT.

◆ scale

float G3D::ArticulatedModel::Specification::scale

Multiply all vertex positions and part translations by this factor after loading and before preprocessing.

Default = 1.0.

◆ stripLightMapCoords

bool G3D::ArticulatedModel::Specification::stripLightMapCoords

◆ stripLightMaps

bool G3D::ArticulatedModel::Specification::stripLightMaps

◆ stripMaterials

bool G3D::ArticulatedModel::Specification::stripMaterials

Ignore materials specified in the file, replacing them with UniversalMaterial::create().

Setting to true increases loading performance and may allow more aggressive optimization if mergeMeshesByMaterial is also true.

◆ stripVertexColors

bool G3D::ArticulatedModel::Specification::stripVertexColors

Ignore vertex colors in the specified file.

◆ voxelOptions

class G3D::ArticulatedModel::Specification::VoxelOptions G3D::ArticulatedModel::Specification::voxelOptions

documentation generated on Wed Nov 24 2021 08:01:53 using doxygen 1.8.15