Tanoda
Leap.Unity.GraphicalRenderer.LeapSlicedGraphic Class Referenceabstract

The base class for LeapPanelGraphic, LeapBoxGraphic, and similar generators. More...

Inheritance diagram for Leap.Unity.GraphicalRenderer.LeapSlicedGraphic:
Leap.Unity.GraphicalRenderer.LeapMeshGraphicBase Leap.Unity.GraphicalRenderer.LeapGraphic Leap.Unity.GraphicalRenderer.LeapGraphic Leap.Unity.Space.ISpaceComponent Leap.Unity.Space.ISpaceComponent Leap.Unity.GraphicalRenderer.LeapBoxGraphic Leap.Unity.GraphicalRenderer.LeapPanelGraphic Leap.Unity.GraphicalRenderer.LeapPanelOutlineGraphic

Classes

struct  RectMargins
 
struct  Vector2i
 

Public Types

enum  ResolutionType { Vertices , VerticesPerRectilinearMeter }
 

Public Member Functions

override void RefreshMeshData ()
 When this method is called, the mesh property and the remappableChannels property must be assigned to valid states correctly matching the current state of the object. This is the method where you would do procedural mesh generation, or dynamic creations of mesh objects. More...
 
abstract void RefreshSlicedMeshData (Vector2i resolution, RectMargins meshMargins, RectMargins uvMargins)
 Set the mesh property equal to the correct mesh given the Sliced Graphic's current settings. More...
 
- Public Member Functions inherited from Leap.Unity.GraphicalRenderer.LeapMeshGraphicBase
abstract void RefreshMeshData ()
 When this method is called, the mesh property and the remappableChannels property must be assigned to valid states correctly matching the current state of the object. This is the method where you would do procedural mesh generation, or dynamic creations of mesh objects. More...
 
 LeapMeshGraphicBase ()
 
- Public Member Functions inherited from Leap.Unity.GraphicalRenderer.LeapGraphic
void SetBlendShapeAmount (float amount)
 Helper method to set the blend shape amount for a blend shape data object attached to this graphic. This method will throw an exception if there is no blend shape data obj attached to this graphic. More...
 
float GetBlendShapeAmount ()
 Helper method to get the blend shape amount for a blend shape data object attached to this graphic. This method will throw an exception if there is no blend shape data obj attached to this graphic. More...
 
void SetCustomChannel (string channelName, Color color)
 Helper method to set the custom channel value for the given channel name. This method will throw an exception if there is no channel with the given name, if the graphic is not currently attached to a group, or if the channel does not match up with the data type. More...
 
void SetCustomChannel (string channelName, float value)
 Helper method to set the custom channel value for the given channel name. This method will throw an exception if there is no channel with the given name, if the graphic is not currently attached to a group, or if the channel does not match up with the data type. More...
 
void SetCustomChannel (string channelName, Matrix4x4 value)
 Helper method to set the custom channel value for the given channel name. This method will throw an exception if there is no channel with the given name, if the graphic is not currently attached to a group, or if the channel does not match up with the data type. More...
 
void SetCustomChannel (string channelName, Vector4 value)
 Helper method to set the custom channel value for the given channel name. This method will throw an exception if there is no channel with the given name, if the graphic is not currently attached to a group, or if the channel does not match up with the data type. More...
 
GetCustomChannel< T > (string channelName)
 Helper method to get a custom channel data object given the name of the feature it is attached to. This method can only be used if the graphic is currently attached to a group. More...
 
void SetRuntimeTint (Color color)
 Helper method to set the runtime tint color for a runtime tint data object attached to this graphic. This method will throw an exception if there is no tint data obj attached to this graphic. More...
 
void SetRuntimeTint (string htmlString)
 Overload of SetRuntimeTint that takes in a Html style string code that represents a color. Any string that can be parsed by ColorUtility.TryParseHtmlString can be used as an argument to this method. More...
 
Color GetRuntimeTint ()
 Helper method to get the runtime tint color for a runtime tint data object attached to this graphic. This method will throw an exception if there is no tint data obj attached to this graphic. More...
 
bool TryDetach ()
 This method tries to detach this graphic from whatever group it is currently attached to. It can fail if the graphic is not attached to any group, or if the group it is attached to does not support adding/removing graphics at runtime. More...
 
GetFeatureData< T > ()
 Gets a single feature data object of a given type T. This will return null if there is no feature data object attached to this graphic of type T. More...
 
virtual void NotifyWillBeAttached (LeapGraphicGroup toBeAttachedTo)
 Called by the system to notify that this graphic will be attached within the next frame. This is only called at runtime. More...
 
virtual void CancelWillBeAttached ()
 Called by the system to notify that a previous notification that this graphic would be attached has been cancelled due to a call to TryRemoveGraphic. More...
 
virtual void NotifyWillBeDetached (LeapGraphicGroup toBeDetachedFrom)
 Called by the system to notify that this graphic will be detached within the next frame. This is only called at runtime. More...
 
virtual void CancelWillBeDetached ()
 Called by the system to notify that a previous notification that this graphic would be detached has been cancelled due to a call to TryAddGraphic. More...
 
virtual void OnAttachedToGroup (LeapGraphicGroup group, LeapSpaceAnchor anchor)
 Called by the system when this graphic is attached to a group. This method is invoked both at runtime and at edit time. More...
 
void OnUpdateAnchor (LeapSpaceAnchor anchor)
 Called by graphic groups when a renderer's attached space changes. More...
 
virtual void OnDetachedFromGroup ()
 Called by the system when this graphic is detached from a group. This method is invoked both at runtime and at edit time. More...
 
virtual void OnAssignFeatureData (List< LeapFeatureData > data)
 Called by the system whenever feature data is re-assigned to this graphic. This is only called at edit time. More...
 
virtual void OnBeforeSerialize ()
 
virtual void OnAfterDeserialize ()
 

Static Public Member Functions

static bool IsValidDataSource (LeapFeatureData dataSource)
 Returns whether or not a feature data object is a valid object that can be used to drive texture data for this panel. Only a TextureData object or a SpriteData object are currently valid. More...
 

Static Public Attributes

const int MAX_RESOLUTION = 128
 

Protected Member Functions

override void Reset ()
 
override void OnValidate ()
 
void assignDefaultSourceValue ()
 
void setSourceFeatureDirty ()
 
float calculateVertAxis (int vertIdx, int vertCount, float size, float border0, float border1, bool alwaysRespectBorder=false)
 Given a vertex index from an edge, the total vertCount and size along the current dimension, and the distance to the beginning and end borders along the current dimension (if nine-slicing is enabled ONLY), this method will return the distance along the current dimension that the vertIdx should be from the origin of the dimension. More...
 
- Protected Member Functions inherited from Leap.Unity.GraphicalRenderer.LeapGraphic
virtual void Reset ()
 
virtual void OnValidate ()
 
virtual void Awake ()
 
virtual void OnEnable ()
 
virtual void OnDestroy ()
 
virtual void OnDrawGizmos ()
 

Protected Attributes

int _sourceDataIndex = -1
 
ResolutionType _resolutionType = ResolutionType.VerticesPerRectilinearMeter
 
int _resolution_vert_x = 4
 
int _resolution_vert_y = 4
 
Vector2 _resolution_verts_per_meter = new Vector2(20, 20)
 
Vector2 _size = new Vector2(0.1f, 0.1f)
 
bool _nineSliced = false
 
- Protected Attributes inherited from Leap.Unity.GraphicalRenderer.LeapGraphic
LeapSpaceAnchor _anchor
 
FeatureDataList _featureData = new FeatureDataList()
 
LeapGraphicRenderer _attachedRenderer
 
int _attachedGroupIndex = -1
 
string _favoriteGroupName
 
SerializableType _preferredRendererType
 

Properties

ResolutionType resolutionType [get]
 Returns the current resolution type being used for this panel. More...
 
Rect rect [get]
 Returns the current local-space rect of this panel. If there is a RectTransform attached to this panel, this value is the same as calling rectTransform.rect. More...
 
bool nineSliced [get, set]
 Gets or sets whether or not this panel is currently using nine slicing. More...
 
bool canNineSlice [get]
 Returns whether or not the current source supports nine slicing. More...
 
UVChannelFlags uvChannel [get]
 Returns which uv channel is being used for this panel. It will always match the uv channel being used by the source. More...
 
LeapFeatureData sourceData [get]
 Returns the current feature data object being used as source. More...
 
- Properties inherited from Leap.Unity.GraphicalRenderer.LeapMeshGraphicBase
Mesh mesh [get, protected set]
 Returns the mesh that represents this graphic. It can have any topology, any number of uv channels, vertex colors, or normals. Note that the specific rendering method you might use might not support all of these features! More...
 
UVChannelFlags remappableChannels [get, protected set]
 Returns an enum mask that represents the union of all channels that are allowed to be remapped for this mesh. If a uv channel is included in this mask, the matching uv coordinates are allowed to be remapped by any rendering method to implement texture atlasing. More...
 
- Properties inherited from Leap.Unity.GraphicalRenderer.LeapGraphic
bool isRepresentationDirty [get, set]
 An internal flag that returns true if the visual representation of this graphic needs to be updated. You can set this to true to request a regeneration of the graphic during the next update cycle of the renderer. Note however, that not all renderers support updating the representation at runtime. More...
 
bool isRepresentationDirtyOrEditTime [get]
 A simple utility getter that returns true if isRepresentationDirty is true, OR it is currently edit time. More...
 
string favoriteGroupName [get, set]
 Gets or sets the name of the group that this graphic likes to be attached to. Whenever a graphic is enabled, it will try to attach to its favorite group. Whenever a graphic gets attached to a group, that group becomes its new favorite. More...
 
LeapSpaceAnchor anchor [get]
 Returns the space anchor for this graphic. This will be null if the graphic is not currently part of a space. The anchor cannot be changed dynamically at runtime. More...
 
ITransformer transformer [get]
 A utility getter that returns a transformer for this graphic. Even if the space anchor for this graphic is null, this will still return a valid transformer. In the null case, the transformer is always the identity transformer. More...
 
IList< LeapFeatureDatafeatureData [get]
 Returns a list of feature data attached to this graphic. If this graphic is attached to a group, this feature data matches 1-to-1 with the features attached to this group. More...
 
LeapGraphicGroup attachedGroup [get]
 Returns the group this graphic is attached to. More...
 
bool isAttachedToGroup [get]
 Returns whether or not this graphic is attached to any group. Can still return false at runtime even if TryAddGraphic has just completed successfully due to the runtime delay for addition/removal of graphics. More...
 
bool willbeAttached [get]
 Returns whether or not this graphic will be attached to a group within the next frame. Can only be true at runtime, since runtime is the only time when delayed attachment occurs. More...
 
bool willbeDetached [get]
 Returns whether or not this graphic will be detached from a group within the next frame. Can only be true at runtime, since runtime is the only time when delayed detaching occurs. More...
 
Type preferredRendererType [get]
 Returns the type this graphic prefers to be attached to. When calling LeapGraphicRenderer.TryAddGraphic it will prioritize being attached to groups with this renderer type if possible. More...
 
- Properties inherited from Leap.Unity.Space.ISpaceComponent
LeapSpaceAnchor anchor [get]
 

Additional Inherited Members

- Public Attributes inherited from Leap.Unity.GraphicalRenderer.LeapMeshGraphicBase
Color vertexColor = Color.white
 
- Public Attributes inherited from Leap.Unity.GraphicalRenderer.LeapGraphic
Action< LeapGraphicGroupOnAttachedToGroupEvent
 
Action OnDetachedFromGroupEvent
 

Detailed Description

The base class for LeapPanelGraphic, LeapBoxGraphic, and similar generators.

This base class represents shared code when constructing graphics that:

  • Are generally rectangular, supporting dynamic tesselation along the X and Y axes
  • Can be intuitively controlled by an associated RectTransform
  • Support nine-slicing when using a Sprite as a source for Texture data

Definition at line 26 of file LeapSlicedGraphic.cs.

Member Enumeration Documentation

◆ ResolutionType

Enumerator
Vertices 
VerticesPerRectilinearMeter 

Definition at line 355 of file LeapSlicedGraphic.cs.

Member Function Documentation

◆ assignDefaultSourceValue()

void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.assignDefaultSourceValue ( )
protected

Definition at line 216 of file LeapSlicedGraphic.cs.

◆ calculateVertAxis()

float Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.calculateVertAxis ( int  vertIdx,
int  vertCount,
float  size,
float  border0,
float  border1,
bool  alwaysRespectBorder = false 
)
protected

Given a vertex index from an edge, the total vertCount and size along the current dimension, and the distance to the beginning and end borders along the current dimension (if nine-slicing is enabled ONLY), this method will return the distance along the current dimension that the vertIdx should be from the origin of the dimension.

If the sliced graphic has nine-slicing enabled, or if alwaysRespectBorder is set to true, the second and second-to-last vertices along an edge will reflect the border margin arguments instead of a uniform tesselation along the whole width of the dimension. Inner vertices will then respect this non-uniformity, slicing the rest of the inner width evenly.

e.g. Determine the distance along the X axis for:

  • vertIdx = 4, the fifth vertex along the X axis
  • vertCount = 16, given sixteen total grid columns (16 verts per X-axis row)
  • size = 2, given a box width of 2 units
  • border0 = 0.2f, given the left border starts at 0.2 units from the left edge
  • border1 = 0.2f, given the right border starts at 0.2 units from the right edge This method will return the X axis coordinate of the fifth vertex accordingly. To calculate the corresponding Y axis coordinate, simply provide the vertCount, size, and border information for the Y dimension instead.

Definition at line 328 of file LeapSlicedGraphic.cs.

◆ IsValidDataSource()

static bool Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.IsValidDataSource ( LeapFeatureData  dataSource)
static

Returns whether or not a feature data object is a valid object that can be used to drive texture data for this panel. Only a TextureData object or a SpriteData object are currently valid.

Definition at line 211 of file LeapSlicedGraphic.cs.

◆ OnValidate()

override void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.OnValidate ( )
protectedvirtual

◆ RefreshMeshData()

override void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.RefreshMeshData ( )
virtual

When this method is called, the mesh property and the remappableChannels property must be assigned to valid states correctly matching the current state of the object. This is the method where you would do procedural mesh generation, or dynamic creations of mesh objects.

Implements Leap.Unity.GraphicalRenderer.LeapMeshGraphicBase.

Definition at line 230 of file LeapSlicedGraphic.cs.

◆ RefreshSlicedMeshData()

abstract void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.RefreshSlicedMeshData ( Vector2i  resolution,
RectMargins  meshMargins,
RectMargins  uvMargins 
)
pure virtual

Set the mesh property equal to the correct mesh given the Sliced Graphic's current settings.

Resolution along the X and Y axes are provided, as well as mesh-space and UV-space margins to pass into calculateVertAxis as border0 and border1 to support nine slicing (see Mesh Data Support).

Implemented in Leap.Unity.GraphicalRenderer.LeapBoxGraphic, Leap.Unity.GraphicalRenderer.LeapPanelGraphic, and Leap.Unity.GraphicalRenderer.LeapPanelOutlineGraphic.

◆ Reset()

override void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.Reset ( )
protectedvirtual

Reimplemented from Leap.Unity.GraphicalRenderer.LeapGraphic.

Definition at line 151 of file LeapSlicedGraphic.cs.

◆ setSourceFeatureDirty()

void Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.setSourceFeatureDirty ( )
protected

Definition at line 220 of file LeapSlicedGraphic.cs.

Member Data Documentation

◆ _nineSliced

bool Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._nineSliced = false
protected

Definition at line 68 of file LeapSlicedGraphic.cs.

◆ _resolution_vert_x

int Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._resolution_vert_x = 4
protected

Definition at line 51 of file LeapSlicedGraphic.cs.

◆ _resolution_vert_y

int Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._resolution_vert_y = 4
protected

Definition at line 51 of file LeapSlicedGraphic.cs.

◆ _resolution_verts_per_meter

Vector2 Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._resolution_verts_per_meter = new Vector2(20, 20)
protected

Definition at line 55 of file LeapSlicedGraphic.cs.

◆ _resolutionType

ResolutionType Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._resolutionType = ResolutionType.VerticesPerRectilinearMeter
protected

Definition at line 47 of file LeapSlicedGraphic.cs.

◆ _size

Vector2 Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._size = new Vector2(0.1f, 0.1f)
protected

Definition at line 60 of file LeapSlicedGraphic.cs.

◆ _sourceDataIndex

int Leap.Unity.GraphicalRenderer.LeapSlicedGraphic._sourceDataIndex = -1
protected

Definition at line 38 of file LeapSlicedGraphic.cs.

◆ MAX_RESOLUTION

const int Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.MAX_RESOLUTION = 128
static

Definition at line 30 of file LeapSlicedGraphic.cs.

Property Documentation

◆ canNineSlice

bool Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.canNineSlice
get

Returns whether or not the current source supports nine slicing.

Definition at line 117 of file LeapSlicedGraphic.cs.

◆ nineSliced

bool Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.nineSliced
getset

Gets or sets whether or not this panel is currently using nine slicing.

Definition at line 104 of file LeapSlicedGraphic.cs.

◆ rect

Rect Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.rect
get

Returns the current local-space rect of this panel. If there is a RectTransform attached to this panel, this value is the same as calling rectTransform.rect.

Definition at line 88 of file LeapSlicedGraphic.cs.

◆ resolutionType

ResolutionType Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.resolutionType
get

Returns the current resolution type being used for this panel.

Definition at line 77 of file LeapSlicedGraphic.cs.

◆ sourceData

LeapFeatureData Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.sourceData
get

Returns the current feature data object being used as source.

Definition at line 188 of file LeapSlicedGraphic.cs.

◆ uvChannel

UVChannelFlags Leap.Unity.GraphicalRenderer.LeapSlicedGraphic.uvChannel
get

Returns which uv channel is being used for this panel. It will always match the uv channel being used by the source.

Definition at line 128 of file LeapSlicedGraphic.cs.


The documentation for this class was generated from the following file: