Description
Renders a triangle mesh in the 3D scene. Examples of triangle meshes include polygons on the globe (e.g. states or countries), terrain and imagery extents, ellipses, and extrusions.
Public Methods
Set | Defines the triangle mesh using an indexed triangle list specified by positions, normals, and indices. The mesh is rendered in the primitive's Reference Frame. |
SetTriangulator | Defines the triangle mesh using the specified triangulator. The mesh is rendered in the primitive's Reference Frame. |
SetWithOptionalParameters | Defines the triangle mesh using an indexed triangle list specified by positions, normals, indices, and optionalParameters. The mesh is rendered in the primitive's Reference Frame. |
Public Properties
CentralBodyClipped | Gets or sets whether individual points will be clipped by the central body. |
CullFace | Gets or sets whether front and/or back-facing triangles may be culled. This is used in combination with Triangle Winding Order for culling. |
Lighting | Gets or sets whether the primitive is lit. |
RenderBackThenFrontFaces | Gets or sets whether the primitive is rendered in two passes to improve the visual quality for translucent, convex meshes. |
SetHint | Gets the primitive's Set Hint. See the Set Hint Performance Overview for selecting an appropriate value to construct the primitive with. |
ShadeModel | Gets or sets the shading model for the mesh. |
Texture | Gets or sets the texture to be drawn on the triangle mesh. Textures can be obtained from SceneManager.Textures. |
TextureFilter | Gets or sets the filter used for the Texture associated with this triangle mesh. |
TriangleWindingOrder | Gets or sets the orientation of front-facing triangles. This is used in combination with Cull Face for culling. |
TwoSidedLighting | Gets or sets whether the primitive's translucent geometry will be lit from both sides of the surface. |
Wireframe | Gets or sets whether the primitive is rendered in wireframe. This is useful for debugging. |
Interfaces
CoClasses that Implement IAgStkGraphicsTriangleMeshPrimitive
Example
Draw a filled STK area target
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsSurfaceTriangulatorResult triangles =
manager.Initializers.SurfacePolygonTriangulator.Compute("Earth", ref positions);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.Red;
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
|
|
Draw a filled circle on the globe
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array center = new object[] { 39.88, -75.25, 0.0 };
IAgStkGraphicsSurfaceShapesResult shape = manager.Initializers.SurfaceShapes.ComputeCircleCartographic("Earth", ref center, 10000);
Array positions = shape.Positions;
IAgStkGraphicsSurfaceTriangulatorResult triangles = manager.Initializers.SurfacePolygonTriangulator.Compute("Earth", ref positions);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.White;
((IAgStkGraphicsPrimitive)mesh).Translucency = 0.5f;
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
|
|
Draw a filled ellipse on the globe
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array center = new object[] { 38.85, -77.04, 3000.0 }; // Washington, DC
IAgStkGraphicsSurfaceShapesResult shape = manager.Initializers.SurfaceShapes.ComputeEllipseCartographic(
"Earth", ref center, 45000, 30000, 45);
Array positions = shape.Positions;
IAgStkGraphicsSurfaceTriangulatorResult triangles = manager.Initializers.SurfacePolygonTriangulator.Compute(
"Earth", ref positions);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.Cyan;
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
|
|
Draw a filled rectangular extent on the globe
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
Array extent = new object[]
{
-94, 29,
-89, 33
};
IAgStkGraphicsSurfaceTriangulatorResult triangles = manager.Initializers.SurfaceExtentTriangulator.ComputeSimple(
"Earth", ref extent);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.Salmon;
mesh.Lighting = false; /* Turn off lighting for the mesh so the color we assigned will always be consistent */
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
|
|
Draw an extrusion around a STK area target
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsExtrudedPolylineTriangulatorResult triangles =
manager.Initializers.ExtrudedPolylineTriangulator.ComputeWithAltitudes(
"Earth", ref positions, 10000, 25000);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.Red;
((IAgStkGraphicsPrimitive)mesh).Translucency = 0.4f;
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
|
|
Draw a filled polygon with a hole on the globe
[C#] |
---|
IAgStkGraphicsSceneManager manager = ((IAgScenario)root.CurrentScenario).SceneManager;
IAgStkGraphicsSurfaceTriangulatorResult triangles = manager.Initializers.SurfacePolygonTriangulator.ComputeWithHole(
"Earth", ref positions, ref holePositions);
IAgStkGraphicsTriangleMeshPrimitive mesh = manager.Initializers.TriangleMeshPrimitive.Initialize();
mesh.SetTriangulator((IAgStkGraphicsTriangulatorResult)triangles);
((IAgStkGraphicsPrimitive)mesh).Color = Color.Gray;
((IAgStkGraphicsPrimitive)mesh).Translucency = 0.5f;
manager.Primitives.Add((IAgStkGraphicsPrimitive)mesh);
IAgStkGraphicsPolylinePrimitive boundaryLine = manager.Initializers.PolylinePrimitive.Initialize();
Array boundaryPositionsArray = triangles.BoundaryPositions;
boundaryLine.Set(ref boundaryPositionsArray);
((IAgStkGraphicsPrimitive)boundaryLine).Color = Color.Red;
boundaryLine.Width = 2;
manager.Primitives.Add((IAgStkGraphicsPrimitive)boundaryLine);
IAgStkGraphicsPolylinePrimitive holeLine = manager.Initializers.PolylinePrimitive.Initialize();
holeLine.Set(ref holePositions);
((IAgStkGraphicsPrimitive)holeLine).Color = Color.Red;
holeLine.Width = 2;
manager.Primitives.Add((IAgStkGraphicsPrimitive)holeLine);
|
|
Draw a filled STK area target
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim triangles As IAgStkGraphicsSurfaceTriangulatorResult = manager.Initializers.SurfacePolygonTriangulator.Compute("Earth", positions)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.Red
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
|
|
Draw a filled circle on the globe
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
'$lat$new latitude$
'$lon$new longitude$
'$alt$new altitude$
Dim center As Array = New Object() {39.88, -75.25, 0.0}
'$planetName$Name of the planet to place primitive$
'$radius$The radius of the circle.$
Dim shape As IAgStkGraphicsSurfaceShapesResult = manager.Initializers.SurfaceShapes.ComputeCircleCartographic("Earth", center, 10000)
Dim positions As Array = shape.Positions
Dim triangles As IAgStkGraphicsSurfaceTriangulatorResult = manager.Initializers.SurfacePolygonTriangulator.Compute("Earth", positions)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.White
DirectCast(mesh, IAgStkGraphicsPrimitive).Translucency = 0.5F
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
|
|
Draw a filled ellipse on the globe
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim washingtonDC As Array = New Object() {38.85, -77.04, 3000.0}
Dim shape As IAgStkGraphicsSurfaceShapesResult = manager.Initializers.SurfaceShapes.ComputeEllipseCartographic("Earth", washingtonDC, 45000, 30000, 45)
Dim positions As Array = shape.Positions
Dim triangles As IAgStkGraphicsSurfaceTriangulatorResult = manager.Initializers.SurfacePolygonTriangulator.Compute("Earth", positions)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.Cyan
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
|
|
Draw a filled rectangular extent on the globe
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim extent As Array = New Object() {-94, 29, -89, 33}
Dim triangles As IAgStkGraphicsSurfaceTriangulatorResult = manager.Initializers.SurfaceExtentTriangulator.ComputeSimple("Earth", extent)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.Salmon
mesh.Lighting = False
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
|
|
Draw an extrusion around a STK area target
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim triangles As IAgStkGraphicsExtrudedPolylineTriangulatorResult = manager.Initializers.ExtrudedPolylineTriangulator.ComputeWithAltitudes("Earth", positions, 10000, 25000)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.Red
DirectCast(mesh, IAgStkGraphicsPrimitive).Translucency = 0.4F
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
|
|
Draw a filled polygon with a hole on the globe
[Visual Basic .NET] |
---|
Dim manager As IAgStkGraphicsSceneManager = DirectCast(root.CurrentScenario, IAgScenario).SceneManager
Dim triangles As IAgStkGraphicsSurfaceTriangulatorResult = manager.Initializers.SurfacePolygonTriangulator.ComputeWithHole("Earth", positions, holePositions)
Dim mesh As IAgStkGraphicsTriangleMeshPrimitive = manager.Initializers.TriangleMeshPrimitive.Initialize()
mesh.SetTriangulator(DirectCast(triangles, IAgStkGraphicsTriangulatorResult))
DirectCast(mesh, IAgStkGraphicsPrimitive).Color = Color.Gray
DirectCast(mesh, IAgStkGraphicsPrimitive).Translucency = 0.5F
manager.Primitives.Add(DirectCast(mesh, IAgStkGraphicsPrimitive))
Dim boundaryLine As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.Initialize()
Dim boundaryPositionsArray As Array = triangles.BoundaryPositions
boundaryLine.Set(boundaryPositionsArray)
DirectCast(boundaryLine, IAgStkGraphicsPrimitive).Color = Color.Red
boundaryLine.Width = 2
manager.Primitives.Add(DirectCast(boundaryLine, IAgStkGraphicsPrimitive))
Dim holeLine As IAgStkGraphicsPolylinePrimitive = manager.Initializers.PolylinePrimitive.Initialize()
holeLine.Set(holePositions)
DirectCast(holeLine, IAgStkGraphicsPrimitive).Color = Color.Red
holeLine.Width = 2
manager.Primitives.Add(DirectCast(holeLine, IAgStkGraphicsPrimitive))
|
|
See Also