Skip to content

Commit 404ba99

Browse files
author
Stephen Hodgson
authored
Merge pull request #485 from HodgsonSDAS/HTK-Batching2
Minor fixes to Editor Hands
2 parents 229e4ee + b179cbc commit 404ba99

File tree

5 files changed

+121
-88
lines changed

5 files changed

+121
-88
lines changed

Assets/HoloToolkit/Input/Scripts/Editor.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using UnityEditor;
2+
3+
public class EditorHandsMaterialInspector : ShaderGUI
4+
{
5+
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
6+
{
7+
foreach (MaterialProperty materialProperty in properties)
8+
{
9+
if (materialProperty.flags != MaterialProperty.PropFlags.PerRendererData)
10+
{
11+
materialEditor.ShaderProperty(materialProperty, materialProperty.displayName);
12+
}
13+
}
14+
}
15+
}

Assets/HoloToolkit/Input/Scripts/Editor/EditorHandsMaterialInspector.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/HoloToolkit/Input/Scripts/Utilities/ManualHandControl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ private void Update()
270270

271271
private void UpdateHandVisualization()
272272
{
273-
leftHandVisualRenderer.material.SetColor("_Color", LeftHandInView ? ActiveHandColor : DroppedHandColor);
274-
rightHandVisualRenderer.material.SetColor("_Color", RightHandInView ? ActiveHandColor : DroppedHandColor);
273+
leftHandVisualPropertyBlock.SetColor("_Color", LeftHandInView ? ActiveHandColor : DroppedHandColor);
274+
rightHandVisualPropertyBlock.SetColor("_Color", RightHandInView ? ActiveHandColor : DroppedHandColor);
275275

276276
if (LeftHandVisualizer.activeSelf != VisualizeHands)
277277
{
Lines changed: 83 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,93 @@
11
Shader "HoloToolkit/EditorHands"
22
{
3-
Properties
4-
{
5-
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
6-
_Color ("Tint", Color) = (1,1,1,1)
7-
8-
_StencilComp ("Stencil Comparison", Float) = 8
9-
_Stencil ("Stencil ID", Float) = 0
10-
_StencilOp ("Stencil Operation", Float) = 0
11-
_StencilWriteMask ("Stencil Write Mask", Float) = 255
12-
_StencilReadMask ("Stencil Read Mask", Float) = 255
3+
Properties
4+
{
5+
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
6+
[PerRendererData] _Color ("Tint", Color) = (1,1,1,1)
7+
8+
_StencilComp ("Stencil Comparison", Float) = 8
9+
_Stencil ("Stencil ID", Float) = 0
10+
_StencilOp ("Stencil Operation", Float) = 0
11+
_StencilWriteMask ("Stencil Write Mask", Float) = 255
12+
_StencilReadMask ("Stencil Read Mask", Float) = 255
1313

14-
_ColorMask ("Color Mask", Float) = 15
15-
}
14+
_ColorMask ("Color Mask", Float) = 15
15+
}
1616

17-
SubShader
18-
{
19-
Tags
20-
{
21-
"Queue"="Transparent"
22-
"IgnoreProjector"="True"
23-
"RenderType"="Transparent"
24-
"PreviewType"="Plane"
25-
"CanUseSpriteAtlas"="True"
26-
}
27-
28-
Stencil
29-
{
30-
Ref [_Stencil]
31-
Comp [_StencilComp]
32-
Pass [_StencilOp]
33-
ReadMask [_StencilReadMask]
34-
WriteMask [_StencilWriteMask]
35-
}
17+
SubShader
18+
{
19+
Tags
20+
{
21+
"Queue"="Transparent"
22+
"IgnoreProjector"="True"
23+
"RenderType"="Transparent"
24+
"PreviewType"="Plane"
25+
"CanUseSpriteAtlas"="True"
26+
}
27+
28+
Stencil
29+
{
30+
Ref [_Stencil]
31+
Comp [_StencilComp]
32+
Pass [_StencilOp]
33+
ReadMask [_StencilReadMask]
34+
WriteMask [_StencilWriteMask]
35+
}
3636

37-
Cull Off
38-
Lighting Off
39-
ZWrite Off
40-
ZTest [unity_GUIZTestMode]
41-
Blend SrcAlpha OneMinusSrcAlpha
42-
ColorMask [_ColorMask]
37+
Cull Off
38+
Lighting Off
39+
ZWrite Off
40+
ZTest [unity_GUIZTestMode]
41+
Blend SrcAlpha OneMinusSrcAlpha
42+
ColorMask [_ColorMask]
4343

44-
Pass
45-
{
46-
CGPROGRAM
47-
#pragma vertex vert
48-
#pragma fragment frag
49-
#include "UnityCG.cginc"
50-
51-
struct appdata_t
52-
{
53-
float4 vertex : POSITION;
54-
float4 color : COLOR;
55-
float2 texcoord : TEXCOORD0;
56-
UNITY_VERTEX_INPUT_INSTANCE_ID
57-
};
44+
Pass
45+
{
46+
CGPROGRAM
47+
#pragma vertex vert
48+
#pragma fragment frag
49+
#include "UnityCG.cginc"
50+
51+
struct appdata_t
52+
{
53+
float4 vertex : POSITION;
54+
float4 color : COLOR;
55+
float2 texcoord : TEXCOORD0;
56+
UNITY_VERTEX_INPUT_INSTANCE_ID
57+
};
58+
struct v2f
59+
{
60+
float4 vertex : SV_POSITION;
61+
fixed4 color : COLOR;
62+
half2 texcoord : TEXCOORD0;
63+
UNITY_VERTEX_OUTPUT_STEREO
64+
};
65+
fixed4 _Color;
66+
v2f vert(appdata_t IN)
67+
{
68+
UNITY_SETUP_INSTANCE_ID(IN);
69+
v2f OUT;
70+
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
71+
OUT.texcoord = IN.texcoord;
72+
#ifdef UNITY_HALF_TEXEL_OFFSET
73+
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
74+
#endif
75+
OUT.color = IN.color * _Color;
76+
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
77+
return OUT;
78+
}
5879

59-
struct v2f
60-
{
61-
float4 vertex : SV_POSITION;
62-
fixed4 color : COLOR;
63-
half2 texcoord : TEXCOORD0;
64-
UNITY_VERTEX_OUTPUT_STEREO
65-
};
66-
67-
fixed4 _Color;
6880

69-
v2f vert(appdata_t IN)
70-
{
71-
UNITY_SETUP_INSTANCE_ID(IN);
81+
sampler2D _MainTex;
82+
fixed4 frag(v2f IN) : SV_Target
83+
{
84+
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
85+
clip (color.a - 0.01);
86+
return color;
87+
}
7288

73-
v2f OUT;
74-
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
75-
OUT.texcoord = IN.texcoord;
76-
#ifdef UNITY_HALF_TEXEL_OFFSET
77-
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
78-
#endif
79-
OUT.color = IN.color * _Color;
80-
81-
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT);
82-
return OUT;
83-
}
84-
85-
sampler2D _MainTex;
86-
87-
fixed4 frag(v2f IN) : SV_Target
88-
{
89-
half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
90-
clip (color.a - 0.01);
91-
return color;
92-
}
93-
ENDCG
94-
}
95-
}
89+
ENDCG
90+
}
91+
}
92+
CustomEditor "EditorHandsMaterialInspector"
9693
}

0 commit comments

Comments
 (0)