Example_SceneApi

Description

static class Tinman.Demo.Examples.Code.Example_SceneApi

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

This example contains some useful helpers for dealing with the Scene API.

These are the primary entry points of this example:

Public / Methods

Build​Building


public static method BuildBuilding → (8)

footprint in : IShape

[not-null]
The footprint shape of the building.

height in : float64

The building height.

name in : string

The name to use for creating a label for the building or null to not create a label. Labelled buildings also get the terrain below flattened.

texture in : IShapeExtruderTexture

The IShapeExtruderTexture to use for IShapeExtruder.Texture, in order to generate a textured 3D model. Set to null to create an untextured one.

materialFront in : IMaterial

The material to use for the building front.

materialRoof in : IMaterial

The material to use for the building root.

scene opt : IScene = null

The IScene object to use for adding a label (see name), flattening the terrain below the building and adding the built model to the scene. Set to null to just build the model.

parent opt : Model = null

If not null, the built model will be added to the given parent model (see Model.ChildAdd6, instead of to the scene (see ITerrainEntityContainer.TerrainDecalAdd.

returns → Pair<IModel, LatLon>

The built model and the geographic coordinates of the model origin.

Builds a 3D model from the given footprint shape.

GeorefException

If the geo-reference of footprint in is invalid.

RenderException

If ISceneEntityContainer.EntityAdd has thrown an exception.

Build​Buildings​From​Footprint​Shapes


public static method BuildBuildingsFromFootprintShapes → (7)

shapeFile in : Path

[not-null]
The path to the shape file to read.

options in : BuildingOptions

[not-null]
The options to use for generating the buildings.

nameAndHeight in : BuildingDelegate

[not-null]
The delegate to use for determining the building name and height for each footprint shape.

materialFront in : IMaterial

The material to use for the building front.

materialRoof in : IMaterial

The material to use for the building root.

minimumVertexCount opt : int32 = 0

[>=0]
The minimum vertex count that a footprint shape must have in order to have a building generated for it.

maximumBuildingCount opt : int32 = Maths.MaxInt

[>=0]
The maximum number of buildings to generate.

returns → Pair<IModel, LatLon> [ ]

The results of calling BuildBuilding.

Reads the given shapeFile in and generated a building for each footprint shape, with BuildBuilding.

GeorefException

If the geo-reference of shapeFile in is invalid.

IOException

If an I/O error has occurred while reading shapeFile in.

ValidatingException

If a data validation error has occurred while reading shapeFile in.

Build​Fire​Effect


[OwnerReturn] [Pure]
public static method BuildFireEffect → (2)

source in : Example_ParticleSource

[not-null]
The fire effect particle source.

entityViewMask in : int64

The value for IEntityViewMask.EntityViewMask.

returns → ParticleEffect

The created particle effect.

Creates an example particle effect for fire, smoke and explosions.

Build​Heightmap​Shape


[Pure]
public static method BuildHeightmapShape → (3)

shape in : IShape

[not-null]
The shape.

range in : VerticalRange

The vertical range of the target heightmap.

falloff in : float64

The shape distance falloff value.

returns → HeightmapShape

The built heightmap correction shape.

Builds a HeightmapShape for the given shape in.

The ShapeValue.Vertical values of the shape in vertices are interpreted a ellipsoid height.

Build​Shape​From​Geocentric​Box


public static method BuildShapeFromGeocentricBox → (5)

scene in : IScene

[not-null]
The scene to use.

box in : Box3D

The box in the local coordinate system, which uses the same length unit as the scene in.

falloff in : float64

The shape distance falloff to use.

offset in : float64

The surface offset to tolerate, see ComputeCurvatureOffset.

terrain in : AffineTransform

The transformation from the local coordinate system to the geocentric coordinate system of the scene (see IScene.Geocentric).

returns → HeightmapShape

The built heightmap correction shape.

Builds a HeightmapShape for adding a terrain correction via IScene.Correction, based on the given box in a local coordinate system.

Using a shape in a projected coordinate system will adjust the terrain along the surface of the reference ellipsoid. This method adjusts the terrain along a box in the geocentric coordinate system, which is usually necessary when static 3D terrain models are used in the scene.

Camera​Look​At


public static method CameraLookAt → (2)

sceneView in : SceneView

The scene view whose camera to update.

coordinates in : LatLonHeight

The geographic coordinates to look at.

Points the camera of the given SceneView to the given geographic coordinates in.

Compute​Curvature​Offset


[Pure]
public static method ComputeCurvatureOffset → (2)

radius in : float64

The sphere radius.

distance in : float64

The distance between the points on the sphere surface.

returns → float64

The maximum distance.

Given two points on a sphere that have the specified distance in, computes the maximum distance between the line segment that connects both points and the surface of the sphere.

Compute​Curvature​Offset​Inv


[Pure]
public static method ComputeCurvatureOffsetInv → (2)

radius in : float64

The sphere radius.

offset in : float64

The maximum distance.

returns → float64

The distance between the points on the sphere surface.

Performs the inverse computation of ComputeCurvatureOffset.

Transform​Point​To​Map​With​Height


[Pure]
public static method TransformPointToMapWithHeight → (4)

point in : Vec3D

The point to transform, in the local coordinate system, which is assumed to use the same length unit as geocentric in.

terrain in : AffineTransform

The transformation from the local coordinate system to the coordinate system of geocentric in.

geocentric in : Geocentric

[not-null]
The geocentric coordinate system.

projection in : ICoordinateTransform

[not-null]
The map projection that defines the projected map coordinate system.

returns → Vec3D

The computed projected map coordinates (XY) and computed height (Z).

Transform the given point from its local coordinate system to a projected map coordinate system, including height.