Set Hint
SetHint is provided to primitive constructors to allow the primitive to optimize for your expected usage.
Topic | Description |
---|---|
Infrequent | Use SetHint.Infrequent if you don't plan on frequently updating a primitive with a Set or SetPartial method. For example, this would be used for a polyline primitive that represents a country boundary. |
Frequent | Use SetHint.Frequent if you plan on updating the entire primitive frequently with a Set method. |
Partial | Use SetHint.Partial if you plan on updating a small percent of a primitive's positions with a SetPartial method. |
Infrequent
Use SetHint.Infrequent for static primitives; that is, primitives you do not plan on updating frequently with a Set or SetPartial method. STK Engine will do several things to optimize performance.
- Ask the renderer to use video memory to store the primitive's vertices.
- If needed, divide up the primitive to get the desired precision. The CPU will not have to touch each vertex during rendering.
- The triangle mesh primitive will reorder indices for the GPU's vertex cache.
SetHint.Infrequent provides significant performance gains when used with the triangle mesh primitive.
SetHint.Infrequent is also faster than alternatives for polyline primitives.
Similar performance improvements are achieved when using SetHint.Infrequent with the point batch and text batch primitives.
Frequent
If you plan on updating the entire primitive frequently with a Set method, use SetHint.Frequent. This is common for data that may be completely recomputed every animation cycle, such as a polyline representing a sensor's intersection with the earth.
Partial
Use SetHint.Partial if you plan on updating a small percentage of a primitive's vertices with a SetPartial method.
SetPartial becomes more efficient than updating all the vertices with Set as the number of vertices updated becomes small.
If your indices are stored in ascending order, provide the IndicesOrderHint.SortedAscending enumeration to Partial to achieve the best performance. This indicates that no CPU time should be spent sorting indices.