Class HighlightShell
One glowing shell that moves onto whatever should look highlighted: a copy of the target's model, every material slot filled with a highlight material, drawn a little larger over the original. A selection or hover highlight with no render feature and no post effect, only a material and an entity - the way the engine's TopDownRPG template lights up the loot under the mouse.
public sealed class HighlightShell
- Inheritance
-
HighlightShell
Remarks
Call Show(ModelComponent) every frame with what is under the mouse, or once on a selection; showing the same target again costs nothing. The shell becomes a child of the target's entity, so it follows the target as it moves. For one instance of an instanced model, which has no entity of its own, Show(ModelComponent, Matrix) places the shell at the instance's world matrix instead.
The shell casts no shadow and draws in its own render group, Group30 by default, so a picker can leave it out: a GPU picker that sees the shell answers "the shell" for every pixel it covers. Exclude the group from the picker's pickable mask.
Constructors
HighlightShell(Material, RenderGroup)
One glowing shell that moves onto whatever should look highlighted: a copy of the target's model, every material slot filled with a highlight material, drawn a little larger over the original. A selection or hover highlight with no render feature and no post effect, only a material and an entity - the way the engine's TopDownRPG template lights up the loot under the mouse.
public HighlightShell(Material material, RenderGroup renderGroup = RenderGroup.Group30)
Parameters
materialMaterialThe material every slot of the shell gets; compile Highlight(Color, float, float).
renderGroupRenderGroupThe render group the shell draws in.
Remarks
Call Show(ModelComponent) every frame with what is under the mouse, or once on a selection; showing the same target again costs nothing. The shell becomes a child of the target's entity, so it follows the target as it moves. For one instance of an instanced model, which has no entity of its own, Show(ModelComponent, Matrix) places the shell at the instance's world matrix instead.
The shell casts no shadow and draws in its own render group, Group30 by default, so a picker can leave it out: a GPU picker that sees the shell answers "the shell" for every pixel it covers. Exclude the group from the picker's pickable mask.
Properties
Entity
The shell's entity: detached while hidden, a child of the target or a free entity at an instance while shown.
public Entity Entity { get; }
Property Value
IsShown
Whether the shell is on something.
public bool IsShown { get; }
Property Value
Material
The material every slot of the shell gets.
public Material Material { get; }
Property Value
RenderGroup
The render group the shell draws in; leave it out of a picker's pickable mask.
public RenderGroup RenderGroup { get; }
Property Value
Target
What the shell is on, or null while hidden.
public ModelComponent? Target { get; }
Property Value
Methods
Hide()
Takes the shell off whatever it is on.
public void Hide()
Show(ModelComponent)
Puts the shell on a model, as a child of its entity, so it follows the model as it moves.
public void Show(ModelComponent target)
Parameters
targetModelComponentThe model to highlight.
Show(ModelComponent, Matrix)
Puts the shell on one instance of an instanced model: the model's shape, placed at the instance's world matrix in the target's scene. Call again when the instance moves.
public void Show(ModelComponent target, Matrix world)
Parameters
targetModelComponentThe instanced model's component.
worldMatrixThe instance's world matrix.