Tanoda
LeapMeshGraphic.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
10using UnityEngine.Rendering;
12
14
18 [DisallowMultipleComponent]
19 public abstract partial class LeapMeshGraphicBase : LeapGraphic {
20
21 [Tooltip("The tint to apply to the vertex colors of this mesh. This value cannot be changed " +
22 "at edit time. You can use a RuntimeTintFeature if you want to change the color of " +
23 "an object at runtime.")]
25 public Color vertexColor = Color.white;
26
32 public Mesh mesh { get; protected set; }
33
43 public UVChannelFlags remappableChannels { get; protected set; }
44
50 public abstract void RefreshMeshData();
51
53#if UNITY_EDITOR
54 editor = new MeshEditorApi(this);
55#endif
56 }
57 }
58
65
66 [Tooltip("The mesh that will represent this graphic")]
68 [SerializeField]
69 private Mesh _mesh;
70
71 [Tooltip("All channels that are allowed to be remapped into atlas coordinates.")]
73 [EnumFlags]
74 [SerializeField]
75 private UVChannelFlags _remappableChannels = UVChannelFlags.UV0 |
76 UVChannelFlags.UV1 |
77 UVChannelFlags.UV2 |
78 UVChannelFlags.UV3;
79
85 public void SetMesh(Mesh mesh) {
87 Debug.LogWarning("Changing the representation of the graphic is not supported by this rendering type");
88 }
89
91 _mesh = mesh;
92 }
93
94 public override void RefreshMeshData() {
95 //For the trivial MeshGraphic, simply copy data into the properties.
96 mesh = _mesh;
97 remappableChannels = _remappableChannels;
98 }
99 }
100}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
UnityEngine.Color Color
Definition: TestScript.cs:32
bool addRemoveSupported
Returns whether or not add/remove operations are supported at runtime by this group....
bool isAttachedToGroup
Returns whether or not this graphic is attached to any group. Can still return false at runtime even ...
Definition: LeapGraphic.cs:162
bool isRepresentationDirty
An internal flag that returns true if the visual representation of this graphic needs to be updated....
Definition: LeapGraphic.cs:64
LeapGraphicGroup attachedGroup
Returns the group this graphic is attached to.
Definition: LeapGraphic.cs:140
This class is a base class for all graphics that can be represented by a mesh object.
abstract void RefreshMeshData()
When this method is called, the mesh property and the remappableChannels property must be assigned to...
Mesh mesh
Returns the mesh that represents this graphic. It can have any topology, any number of uv channels,...
UVChannelFlags remappableChannels
Returns an enum mask that represents the union of all channels that are allowed to be remapped for th...
This class is the trivial implementation of LeapMeshGraphicBase. It references a mesh asset directly ...
override void RefreshMeshData()
When this method is called, the mesh property and the remappableChannels property must be assigned to...
void SetMesh(Mesh mesh)
Call this method at edit time or at runtime to set the specific mesh to be used to represent this gra...