Add new shader
This commit is contained in:
Родитель
fa96072f52
Коммит
e92e1061cd
|
@ -0,0 +1,37 @@
|
|||
Shader "GameTelemetry" {
|
||||
Properties
|
||||
{
|
||||
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Transparent" "IgnoreProjector" = "True" "Queue" = "Transparent" }
|
||||
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Lambert alpha:fade
|
||||
|
||||
fixed4 _Color;
|
||||
|
||||
// Note: pointless texture coordinate. I couldn't get Unity (or Cg)
|
||||
// to accept an empty Input structure or omit the inputs.
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
};
|
||||
|
||||
void surf(Input IN, inout SurfaceOutput o)
|
||||
{
|
||||
o.Albedo = _Color.rgb;
|
||||
o.Emission = _Color.rgb;
|
||||
o.Alpha = _Color.a;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
|
@ -130,6 +130,8 @@ namespace GameTelemetry
|
|||
}
|
||||
}
|
||||
|
||||
private Material localMaterial = new Material(Shader.Find("GameTelemetry"));
|
||||
|
||||
//Populates event values based on a telemetry event
|
||||
public void SetEvent(TelemetryEvent inEvent, Color inColor, PrimitiveType inType)
|
||||
{
|
||||
|
@ -190,9 +192,7 @@ namespace GameTelemetry
|
|||
if (gameObject != null)
|
||||
{
|
||||
eventRenderer.GetPropertyBlock(properties);
|
||||
properties.SetColor("_BaseColor", color);
|
||||
properties.SetColor("_Color", color);
|
||||
properties.SetColor("_EmissionColor", color);
|
||||
eventRenderer.SetPropertyBlock(properties);
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ namespace GameTelemetry
|
|||
}
|
||||
|
||||
eventRenderer = gameObject.GetComponent<Renderer>();
|
||||
eventRenderer.material = localMaterial;
|
||||
|
||||
EventInfo newInfo = gameObject.AddComponent<EventInfo>();
|
||||
newInfo.CopyFrom(eventInfo);
|
||||
|
|
Загрузка…
Ссылка в новой задаче