Example_Models

Description

static class Tinman.Demo.Examples.Example_Models

Full source code is included in the Tinman 3D SDK download.

This example contains some methods for construction of 3D models.

Public / Methods

Build​Bounding​Cylinder​Gizmo


public static method BuildBoundingCylinderGizmo → (5)

origin in : Vec3D

The pick origin, usually the camera position.

ray in : Ray

The pick ray, in terrain-space.

transform in : AffineTransform

The transformation from model-space to terrain-space.

model in : IModel

[not-null]
The model for which to a picked bounding cylinder.

pose in : ModelPose

The model pose or null.

returns → IModel

The built model.

Builds a 3D gizmo for a picked bounding cylinder.

The gizmo contains three parts:

Build​Cylinder


public static method BuildCylinder → (4)

parent in : Model

[not-null]
The parent model to which to add the cylinder model.

ray in : Ray

The ray to use as the cylinder spine.

range in : RangeD

The ray distance range of the cylinder.

radius in : float64

[>=0]
The cylinder radius.

Builds a transparent cylinder model along the given ray in distance range in and radius in.

Build​Model​Soup


public static method BuildModelSoup → (2)

opt : int32 = 100

[>=1]
The number of models in the soup.

seed opt : int32 = 0x3EA3BC75

Seed value for random number generator.

returns → IModel

The root model that contains the soup as child models.

Builds a soup of non-colliding 3D models.

Build​Particle


[Pure]
public static method BuildParticle → ()

returns → IModel

The built model.

Builds a simple 3D model for a spherical particle with a fluffy appearance.

Build​Point​Soup​From​Model​Vertices


public static method BuildPointSoupFromModelVertices → (5)

parent in : Model

[not-null]
The parent model to which to add the point soup model.

model in : IModel

[not-null]
The model for which to build the point soup.

pose in : ModelPose

The model pose to use or null.

transform in : AffineTransform

The transformation from model-space to terrain-space.

color opt : int64 = Colors.Red

The point color to use for the soup.

Builds a point soup for the vertices of the given model in.

Build​Ray​With​Two​Segments


public static method BuildRayWithTwoSegments → (7)

parent in : Model

[not-null]
The parent model to which to add the line segment model.

ray in : Ray

The ray along which to build the line segment model.

range in : RangeD

The ray distance of the line segment.

delimiter in : float64

The delimiter ray distance that splits the line segment into two parts.

colorFirst opt : int64 = Colors.Green

Color of the first line segment part.

colorSecond opt : int64 = Colors.Red

Color of the second line segment part.

thickness opt : float32 = 3

The line segment thickness, in pixels.

Builds a thick line segment on the given ray in along the specified ray distance range in, splitting it into a first and a second part at the delimiter in ray distance and using the given colors for the two parts.

Build​Silhouette


public static method BuildSilhouette → ()

returns → IModel

A model with four children: the original model from which the silhouette has been computed, a flat-shaded model of the collected triangular faces, a wireframe model of the collected face edges and a wireframe model of the actual silhouette edges.

Shows how to use the Silhouette class to generate the silhouette of a 3D model.

Build​Triangle​On​Pillar​On​Square


public static method BuildTriangleOnPillarOnSquare → (2)

colorEdges opt : int64 = Colors.PapayaWhip

The color to use for the edge lines.

colorFaces opt : int64 = Colors.SoylentGreen

The color to use for the face fill.

returns → IModel

The built model.

Composes a simple 3D model from some basic 2D shapes.

The following 2D shapes are use to compose the 3D model:

  • A square in the X/Z plane.

  • A pillar along the Y-axis, standing on the square.

  • A triangle in the X/Y plane, on top of the pillar.

Load3rd​Party​Material_​TEXTURECAN


public static method Load3rdPartyMaterial_TEXTURECAN → (3)

repository in : Path

[not-null]
Path to the SDK folder data/demo/3rdParty/.

name in : string

Name of the material, without the "_1k" suffix.

downscale opt : int32 = 0

[0..10]
The logarithm of base two of the factor by which to downscale the 1024 x 1024 textures.

returns → IMaterial

The loaded material.

Loads a 3rd-party material (https://www.texturecan.com).

IOException

If name in yields an invalid path.