Skip to content

Commit

Permalink
Merge pull request #9 from z3y/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
z3y authored Nov 17, 2022
2 parents 1571c3b + f7dd9c8 commit c931fc5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Marker.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ MeshRenderer:
m_GameObject: {fileID: 2032845121056251825}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 0
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
Expand Down
4 changes: 2 additions & 2 deletions Marker.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ PrefabInstance:
- target: {fileID: 3968491154304474225, guid: d623141a231a48e43b02346883eea70d,
type: 3}
propertyPath: emission
value: 1.83
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3968491154304474225, guid: d623141a231a48e43b02346883eea70d,
type: 3}
Expand Down Expand Up @@ -3927,7 +3927,7 @@ PrefabInstance:
- target: {fileID: 3968491154304474225, guid: d623141a231a48e43b02346883eea70d,
type: 3}
propertyPath: emission
value: 1.21
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3968491154304474225, guid: d623141a231a48e43b02346883eea70d,
type: 3}
Expand Down
2 changes: 1 addition & 1 deletion Material/Marker.mat
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Material:
- _ParallaxSteps: 16
- _Reflectance: 0.5
- _SSSToggle: 0
- _Saturation: 0
- _Saturation: 0.5
- _SmoothnessAlbedoAlpha: 0
- _SpecularHighlights: 1
- _SpecularOcclusion: 0
Expand Down
60 changes: 6 additions & 54 deletions Scripts/EraseHandler.asset
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 8
Data: 7
- Name:
Entry: 7
Data:
Expand Down Expand Up @@ -378,66 +378,18 @@ MonoBehaviour:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _isHeldDown
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _isHeldDown
- Name: <UserType>k__BackingField
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: undoCountSync
- Name: $v
Entry: 7
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: undoCountSync
- Name: <UserType>k__BackingField
Entry: 7
Data: 24|System.RuntimeType, mscorlib
Data: 22|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
Expand All @@ -446,7 +398,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 24
Data: 22
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -461,13 +413,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 25|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 23|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 26|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 24|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
Expand Down
2 changes: 0 additions & 2 deletions Scripts/EraseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class EraseHandler : UdonSharpBehaviour

private bool _interactDown = false;

private bool _isHeldDown = false;

public override void Interact()
{
if (markerPickup.IsHeld && !Networking.IsOwner(Networking.LocalPlayer, markerPickup.gameObject))
Expand Down
21 changes: 11 additions & 10 deletions Scripts/MarkerTrail.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using JetBrains.Annotations;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
Expand Down Expand Up @@ -55,7 +56,7 @@ private void Start()
trailStorage.GetComponent<MeshFilter>().sharedMesh = _mesh;

_trailing = new Mesh();
_trailing.name = "Traling";
_trailing.name = "Trailing";
_trailing.MarkDynamic();
trailingMesh.sharedMesh = _trailing;

Expand Down Expand Up @@ -320,12 +321,12 @@ public void UpdateUsedVertices()
_lastTrianglesUsed = _trianglesUsed;
}

const int vertexIncrement = 7;
const int triangleIncrement = 9;
private const int VertexIncrement = 7;
private const int TriangleIncrement = 9;
public void CreateTrailLine(Vector3 end, Vector3 start)
{

UpdateArraySize(vertexIncrement, triangleIncrement);
UpdateArraySize(VertexIncrement, TriangleIncrement);

int v0 = _verticesUsed;
int v1 = _verticesUsed + 1;
Expand Down Expand Up @@ -386,8 +387,8 @@ public void CreateTrailLine(Vector3 end, Vector3 start)
_normals[v5] = Vector3.zero;
_normals[v6] = Vector3.zero;

_verticesUsed += vertexIncrement;
_trianglesUsed += triangleIncrement;
_verticesUsed += VertexIncrement;
_trianglesUsed += TriangleIncrement;
}

private void StoreLastLinesTransform(Vector3 position)
Expand All @@ -413,7 +414,7 @@ public bool UndoLastLines()
}


int newVertexCount = _verticesUsed - vertexIncrement;
int newVertexCount = _verticesUsed - VertexIncrement;
for (int i = _verticesUsed; i >= newVertexCount; i--)
{
_vertices[i] = Vector3.zero;
Expand All @@ -425,7 +426,7 @@ public bool UndoLastLines()

public bool IsLastPositionEndOfLine()
{
if (_verticesUsed <= vertexIncrement)
if (_verticesUsed <= VertexIncrement)
{
return false;
}
Expand Down Expand Up @@ -489,6 +490,7 @@ private static T[] ResizeArray<T>(T[] sourceArray, int incrementSize)
/// <summary>
/// Fix culling and other issues caused by transforms not being at zero when moving the root after Start.
/// </summary>
[PublicAPI]
public void ResetTransforms()
{
ResetTRS(transform);
Expand All @@ -503,8 +505,7 @@ private static void ResetTRS(Transform transform)
transform.localScale = Vector3.one;
transform.parent = parent;

transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
}
}
}
8 changes: 5 additions & 3 deletions Shader/Marker.shader
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

//[NoScaleOffset] _Data("Occlusion G, Color Mask B, Smoothness A", 2D) = "white" {}
//_Glossiness ("Smoothness", Range(0,1)) = 0.5
//_Saturation ("Saturation", Range(0,1)) = 0.5
_AccentSaturation ("Saturation", Range(0,1)) = 0.8

[Space(10)]
[ToggleUI] _toggle ("LTCGI: To enable open the shader file", Float) = 0 // line 31
Expand Down Expand Up @@ -77,6 +77,7 @@
sampler2D _MainTex;
sampler2D _Decal;
float4 _Decal_ST;
half _AccentSaturation;
//SamplerState sampler_MainTex;
//SamplerState sampler_MetallicGlossMap;

Expand Down Expand Up @@ -107,9 +108,10 @@

half3 color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
half3 albedo = dataTex.r;
half3 colorMask = dataTex.b * color;
half3 colorMask = dataTex.b;

half desaturatedColor = dot(color, float3(0.2125, 0.7154, 0.0721));
half grayscale = dot(color, float3(0.2125, 0.7154, 0.0721));
half3 desaturatedColor = lerp(grayscale, color, _AccentSaturation);
albedo = lerp(albedo, desaturatedColor, colorMask);

albedo = lerp(albedo, decal.rgb, decal.a);
Expand Down

0 comments on commit c931fc5

Please sign in to comment.