LuciadCPillar 2023.1.04
|
An Icon3DDrawCommand describes how a 3D icon is painted in a 2D and a 3D view. More...
#include <luciad/layers/features/FeatureCanvas.h>
Public Member Functions | |
virtual | ~Icon3DDrawCommand ()=default |
virtual Icon3DDrawCommand & | color (Color color)=0 |
The color of the 3D icon. More... | |
virtual Icon3DDrawCommand & | facetCulling (FacetCullingType facetCulling)=0 |
This setting determines which side of the surfaces (facets) that make up a mesh are omitted (culled) from the rendering result. More... | |
virtual Icon3DDrawCommand & | orientation (Azimuth heading, Angle pitch, Angle roll)=0 |
Defines the orientation of a 3D icon. More... | |
virtual Icon3DDrawCommand & | position (std::shared_ptr< Point > position)=0 |
The location where the 3D icon will be drawn. More... | |
virtual Icon3DDrawCommand & | queryable (bool queryable)=0 |
Indicates whether or not the 3D icon should be considered when a Map::queryFeatures is requested. More... | |
virtual Icon3DDrawCommand & | rotation (Angle rotationX, Angle rotationY, Angle rotationZ)=0 |
Defines the rotation angle in degrees around the various axes of the 3D icon in its local reference. More... | |
virtual Icon3DDrawCommand & | scale (double scaleX, double scaleY, double scaleZ)=0 |
Defines the factor by which the 3D icon is scaled along the various axes of the 3D icon's local reference. More... | |
virtual Icon3DDrawCommand & | source (const std::string &source)=0 |
Specifies the path to the 3D icon to draw. More... | |
virtual void | submit ()=0 |
Submits this draw command. More... | |
virtual Icon3DDrawCommand & | translation (double translateX, double translateY, double translateZ)=0 |
Defines the distance by which coordinates are translated in the various axes direction of the 3D icon local reference. More... | |
virtual Icon3DDrawCommand & | transparency (bool transparency)=0 |
Indicates whether transparent surfaces should be painted transparently. More... | |
An Icon3DDrawCommand describes how a 3D icon is painted in a 2D and a 3D view.
The key parts of an Icon3DDrawCommand are:
scale
, rotation
, and translation
orientation
By default, the following assumptions are made about the 3D mesh in LuciadCPillar:
The glTF format uses a Y-up axis, this is automatically converted to the axis used in LuciadCPillar. Should your mesh not be aligned as intended, you can use the scale
, rotation
, and translation
parameters.
Example: you have a 3D aircraft mesh. The aircraft is defined in millimeters and it points to the halfway point between the X and Y direction.
If you want to align this mesh with our assumptions, you must scale by a factor of 1/1000, and rotate by 45 degrees about the Z-axis:
This results in:
Once you have your mesh correctly aligned in its own local reference using rotation, scale and translation, you are ready to orient the 3D mesh in the world. By default, the position of the mesh is parallel to the surface of the ellipsoid. The Y-direction points towards the north and the X-direction points towards the east.
You can change the heading, pitch and roll of the mesh by adjusting the orientation
. Example: you want your aircraft to point to the east. You must make sure that its heading is 90 degrees, measured clockwise from the north.
This orientation results in:
In addition to heading, an orientation object allows you to specify pitch and roll. See below for the effect of those parameters on the aircraft.
In the case where your gltf mesh is corrupted or cannot be decoded, a RuntimeError is thrown later on in the process.
|
virtualdefault |
|
pure virtual |
The color of the 3D icon.
Note that if the mesh contains textures, this color will act as a modulation color. This can be useful for selection.
color | the color to apply. If not set, The default value for this property is opaque white: rgba(255, 255, 255, 255). |
|
pure virtual |
This setting determines which side of the surfaces (facets) that make up a mesh are omitted (culled) from the rendering result.
When rendering meshes, all surfaces that make up the mesh face a certain direction. This direction is often called the normal direction. This normal is used to determine if the surface is being seen from the front or the back. When rendering objects that have no holes in them, it is only possible to see the front of all surfaces. Graphics pipelines therefore often don't render the back sides of those surfaces to speed up rendering.
Apart from performance, some applications are made possible by enabling back-face culling. Consider for example a mesh that represents a room. Its normals would all point to the inside of the room. When enabling back-face culling, you can see the walls and floor of the room, without having to move the camera inside the room itself.
In some cases however, enabling back-face culling (i.e. not rendering the back-side of surfaces) can have undesired artifacts. This can for example happen:
Both can be resolved by disabling culling.
By default, no culling takes place and both sides of a surface are painted.
facetCulling | the facet culling type to use |
|
pure virtual |
Defines the orientation of a 3D icon.
It is defined by the following angles:
The orientation is applied as roll first, then pitch and lastly heading.
This property is optional.
The difference between orientation and rotation is that orientation is defined in the world reference. Rotation
on the other hand is defined in the local reference of the mesh. You should use rotation
to align the mesh to its axes, before it is added to the world. You should use orientation to point the mesh in a certain world direction, after it has been added to the world.
heading | A number defining the heading in degrees. Default value is 0 (north). |
pitch | A number defining the pitch in degrees. Default value is 0. |
roll | A number defining the roll in degrees. Default value is 0. |
|
pure virtual |
The location where the 3D icon will be drawn.
This property is mandatory.
position | the position of the 3D coordinate. |
luciad::NullArgumentException | when no position has been set. |
|
pure virtual |
Indicates whether or not the 3D icon should be considered when a Map::queryFeatures
is requested.
This property is optional.
The default is true.
queryable | true if the icon should be considered. |
|
pure virtual |
Defines the rotation angle in degrees around the various axes of the 3D icon in its local reference.
Rotation happens around (0,0,0) in the local reference of the 3D icon. By default the rotation is 0 for all axis. This property is optional.
The difference between orientation
and rotation is that orientation
is defined in the world reference. Rotation on the other hand is defined in the local reference of the mesh. You should use rotation to align the mesh to its axes, before it is added to the world. You should use orientation
to point the mesh in a certain world direction, after it has been added to the world.
rotationX | The rotation around the x-axis. Default is 0. |
rotationY | The rotation around the y-axis. Default is 0. |
rotationZ | The rotation around the z-axis. Default is 0. |
|
pure virtual |
Defines the factor by which the 3D icon is scaled along the various axes of the 3D icon's local reference.
Scale can be used to convert a 3D icon from its local unit-of-measure to meters. By default, we assume that a 3D icon is defined in meters. If this is not the case, scale can be used to enlarge or shrink the 3D icon to fit its own unit of measure. This property is optional. Note that the scale must be a positive, non-zero floating point value.
scaleX | The scale around the x-axis. Default is 1. |
scaleY | The scale around the y-axis. Default is 1. |
scaleZ | The scale around the z-axis. Default is 1. |
InvalidArgumentException | if a value equal to or smaller than 0 is provided |
|
pure virtual |
Specifies the path to the 3D icon to draw.
This property is mandatory.
source | A path to a .GLTF or .GLB file. |
InvalidArgumentException | if the source file does not exists. |
|
pure virtual |
Submits this draw command.
Nothing will be painted if the draw command is not submitted.
luciad::LogicException | when there are missing 3D icon command calls or the command is already submitted. |
|
pure virtual |
Defines the distance by which coordinates are translated in the various axes direction of the 3D icon local reference.
This property should be used to center a 3D icon to (0,0,0) in its own local cartesian reference. This allows you to set the anchorpoint of the 3D icon, which is useful when you want to rotate the 3D icon around a specific point. This property is optional.
translateX | The translation around the x-axis. Default is 0. |
translateY | The translation around the y-axis. Default is 0. |
translateZ | The translation around the z-axis. Default is 0. |
|
pure virtual |
Indicates whether transparent surfaces should be painted transparently.
A transparent surface is a surface with either a color or a texture with an alpha channel value lower than 1. The transparency of a surface is not auto-detected.
If you set this property to true, LuciadCpillar considers the 3D icon to have transparent surfaces, and renders it as such. If you set it to false, there is no guarantee that LuciadCpillar renders the transparent surfaces of the 3D Icon properly.
For example, if you set transparency to false for this jet with a transparent cockpit, it has a see-through hole where the cockpit should be:
Note that setting this flag to true might affect performance. Use it for meshes with transparent surfaces only. Drawing a mesh with the transparency flag enabled comes at a cost. It amounts to drawing the mesh twice.
transparency | if the mesh has transparent component or not. The default value for transparency is false. |