Rss

Loading Geometry

Geometry asteroid = Geometry.Load("Models/Stone_Pack1_Stone_1/Stone_Pack1_Stone_1.obj");

This code loads the Geometry in, in the same thread. Textures will be loaded from the same folder.
To load the geometry dynamically, use:

Geometry asteroid = Geometry.DynamicLoad("Models/Stone_Pack1_Stone_1/Stone_Pack1_Stone_1.obj");

This creates the Geometry class for reference, but then schedules the geometry for background loading, and loads the geometry in a background thread. If the underlying OS does not support background loading (MacOSX or iOS for example)
the geometry is loaded immediately. You may use any of the above variations, embed:// or http:// for dynamic loading as well.

Geometry Textures

Textures are loaded from the same folder by default. To specify a different folder, use the second parameter in the Geometry.Load (or Geometry.DynamicLoad function) to specify an alternate folder to search for textures.

Geometry Scaling

Geometry is loaded as-is in terms of scale. To specify a different scale, use the third and fourth parameters in Geometry.Load to specify the type of scale, and the scalar values:

gmeteor = Geometry.Load(Asset.LocalAssetFolder + "Models/Stone_Pack1_Stone_1/Stone_Pack1_Stone_1.obj", Asset.TexturePath + "Models/",
								ScaleType.Multiplier, new Vector(0.25, 0.25, 0.25));

Geometry Transformations

More advanced than scaling by itself, a Geometry transformation applies a transformation matrix to all coordinates (normals are renormalized):

Matrix rotate = Matrix.Rotation(new Angles(0, -Maths.NINETY, 0), Winding.XYZ);
Matrix scale = Matrix.Scale(new Vector(0.00015f, 0.00015f, 0.00015f));

Matrix transformation = scale * rotate;

Geometry Battleship = Geometry.Load(“space_battleship_5_upgraded.3DS”,””,transformation);

This is a one-time transformation during loading, and is particularly useful with third-party models to reorient and rescale the models for the needs of a scene.

Instancing

Once loaded, call Geometry.Instance to create an instance of the Geometry:

Geometry asteroid1 = Geometry.Instance(asteroid, true);

The second parameter, KeepMaterials will reuse the existing materials from the original class if set to True, so only the Geometry is instanced. If False, copies of the same materials will be created and referenced for the instance, so both the materials and the geometry will be instanced.

 Format-Specific Notes

The file format to import is determined by the filename extension (not case sensitive).

OBJ

.mtl files will be used to load materials (if available). If the .mtl file is not available, texture files that match the material name will be loaded if found (with .ibc, then .jpg, then .png extension).

3DS

Textures will attempt to load using the default file extension and type. If the texture is not found, the model importer will look for the equivalent .ibc file in the same location.

 

Like This Post? Share It

Previous Post

Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *