Initial commit + move of the project from the VR Foundation Toolkit
This commit is contained in:
Родитель
2958852f89
Коммит
592d2a707a
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c486c724e0c9764e965b8ef889b9974
|
||||
folderAsset: yes
|
||||
timeCreated: 1460416554
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: AdditiveLine
|
||||
m_Shader: {fileID: 4800000, guid: d689c77434e9ecb4084bd09df8d53140, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0, g: 0.21568628, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 0, g: 0.21379282, b: 1, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 1, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 1, b: 0.5019608, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e381d940f0ee33445b16f286c175a437
|
||||
timeCreated: 1460657499
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: AlphaLine
|
||||
m_Shader: {fileID: 4800000, guid: d2d82e816970e9849bc93f1842c33050, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.4679156, g: 0.9411765, b: 0.42906576, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 0.15, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 1, b: 0.5019608, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4a10e4f88372c8d488aaeb8a2a406e04
|
||||
timeCreated: 1460592339
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: CleanLine
|
||||
m_Shader: {fileID: 4800000, guid: d2d82e816970e9849bc93f1842c33050, type: 3}
|
||||
m_ShaderKeywords: LINE_FIXED_WIDTH LINE_MODEL_SPACE
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 0
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.05
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 0.05, g: 0, b: 0.1, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 0.65, b: 1, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8a2e408edfc70b4429dd0a23d491b3fe
|
||||
timeCreated: 1460503976
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: MaxLine
|
||||
m_Shader: {fileID: 4800000, guid: c03eb3285154f9d48aef80b7b148e361, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 2, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 1, b: 0.5019608, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dd3701db925467648931a23810852797
|
||||
timeCreated: 1460488272
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: MinLine
|
||||
m_Shader: {fileID: 4800000, guid: 9e975b2c6a84c4f479b8ef83f0a88e6f, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 2, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 1, b: 0.5, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6aa5f808098ddc646b19ec1b94158659
|
||||
timeCreated: 1460503971
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: PhotonBladeCore
|
||||
m_Shader: {fileID: 4800000, guid: d2d82e816970e9849bc93f1842c33050, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.05
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 1, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 0.447, b: 0.5019608, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f3e05c2aa6d9cb4a9d0835514837ac3
|
||||
timeCreated: 1460768986
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d901fe6933510974e963164c35e7aa36
|
||||
timeCreated: 1460768991
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,127 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: ShowcaseBox
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _EMISSION
|
||||
m_LightmapFlags: 1
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0
|
||||
- first:
|
||||
name: _GlossyReflections
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SmoothnessTextureChannel
|
||||
second: 0
|
||||
- first:
|
||||
name: _SpecularHighlights
|
||||
second: 1
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec1c961e32d65a94b9872bd36cdba0c7
|
||||
timeCreated: 1482362887
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: SubtractiveLine
|
||||
m_Shader: {fileID: 4800000, guid: 9d1af3afcc83db644b8abe552f6a0e05, type: 3}
|
||||
m_ShaderKeywords: LINE_MODEL_SPACE LINE_PERSPECTIVE_WIDTH
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 0
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 0.5882353, g: 0.5882353, b: 0.5882353, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 0.5882352, g: 0.5882352, b: 0.5882352, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 2, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 1, b: 0.5, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a7be3ae795c98f64cbcd52badad12c94
|
||||
timeCreated: 1460657505
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,142 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: TrailLine
|
||||
m_Shader: {fileID: 4800000, guid: d2d82e816970e9849bc93f1842c33050, type: 3}
|
||||
m_ShaderKeywords: LINE_PERSPECTIVE_WIDTH LINE_WORLD_SPACE
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _lineMap
|
||||
second:
|
||||
m_Texture: {fileID: 2800000, guid: 97ccbea2599c2ef4898bce1c04becddc, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Cutoff
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
- first:
|
||||
name: _Glossiness
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _LineDepthScale
|
||||
second: 1
|
||||
- first:
|
||||
name: _Metallic
|
||||
second: 0
|
||||
- first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
- first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
- first:
|
||||
name: _Parallax
|
||||
second: 0.02
|
||||
- first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
- first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
- first:
|
||||
name: _WorldData
|
||||
second: 1
|
||||
- first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: 0.5
|
||||
- first:
|
||||
name: _lineRadiusMin
|
||||
second: 0
|
||||
m_Colors:
|
||||
- first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
- first:
|
||||
name: _lineColor
|
||||
second: {r: 1, g: 1, b: 1, a: 1}
|
||||
- first:
|
||||
name: _lineRadius
|
||||
second: {r: 1, g: 0, b: 100, a: 1}
|
||||
- first:
|
||||
name: _lineSettings
|
||||
second: {r: 0, g: 0.12, b: 0.5019608, a: 1}
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad3c41a831eb2514ebdff29205b96b60
|
||||
timeCreated: 1461966782
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
README.md
28
README.md
|
@ -1,2 +1,26 @@
|
|||
# VRLineRenderer
|
||||
A VR-Focused line renderer that utilizes GPU expansion and eliminates extreme-angle artifacts while still using billboards.
|
||||
# VR Line Renderer
|
||||
A VR-Optimized line renderer that is also capable of producing very inexpensive glow effects. The VRLineRenderer mimics rendering with 3d capsules while only using two quads worth of geometry.
|
||||
|
||||
## Setup and usage
|
||||
|
||||
1. Place the VRLineRenderer folder into the assets folder of your project.
|
||||
|
||||
2. Add a VRLineRenderer or VRTrailRenderer component to your gameobject. The interface is nearly identical to the built in Unity Line and Trail Renderers.
|
||||
|
||||
3. Create a new material using the VRLineRenderer shaders. You can find some examples in VRLineRenderer\Materials
|
||||
|
||||
4. Apply this material to the mesh renderer of your VRLineRenderer or VRTrailRenderer.
|
||||
|
||||
|
||||
## VRLineRenderer Shader
|
||||
You will find five shader variants under the VRLineRenderer category. Each of these corresponds to a shader blend mode.
|
||||
Max Color and Min Color are the cheapest variants - if you are using the line renderer to mimic glow effects these variants also are stable in that color will not blow out.
|
||||
|
||||
Explanation of interesting shader parameters:
|
||||
Line Rendering Levels - This allows control over the blend between the inner(most opaque/intense) part of the line and outer(transparent) area. Adjust the level curve to 0 will give a very glow-like effect while setting the cruve to 1 will make the line completely solid.
|
||||
|
||||
Line Scaled by Depth - Turning this option off means the line will stay the same thickness regardless of your distance from it. This is excellent for drafting lines and also for simulating glow. Radius minimum and maximum allow you to clamp this size adjustment.
|
||||
|
||||
|
||||
## Custom VR Line Rendering
|
||||
The Scripts\Meshchain class provides everything you need to make your own custom line rendering constructs. VRLineRenderer and VRTrailRenderer emulate what the classic Unity components provide, but there are many more use cases out there.
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 643ade27617b1bd4bb0b64de11085d28
|
||||
timeCreated: 1486337121
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 13c323b825ff3df4b8498d6d9b660d6b
|
||||
folderAsset: yes
|
||||
timeCreated: 1460484083
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 54b91779ae2a1dd40b626ed47c268cd2
|
||||
folderAsset: yes
|
||||
timeCreated: 1482362754
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 31528fcfa5e9f924fb8647576d8c4d0a
|
||||
timeCreated: 1460484083
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4d270cf50eb095f47bd0549313ca53e0
|
||||
timeCreated: 1486337184
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Двоичный файл не отображается.
|
@ -0,0 +1,69 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fa9c0f4da32d92a448c19382517ae17c
|
||||
timeCreated: 1482362755
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName:
|
||||
8900000: generatedCubemap
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 1
|
||||
seamlessCubemap: 1
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 2
|
||||
aniso: 0
|
||||
mipBias: 0
|
||||
wrapMode: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 2
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 100
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a336e70424915bc45923b94630e45131
|
||||
folderAsset: yes
|
||||
timeCreated: 1462396705
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,190 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!74 &7400000
|
||||
AnimationClip:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: TrailExample
|
||||
serializedVersion: 6
|
||||
m_Legacy: 1
|
||||
m_Compressed: 0
|
||||
m_UseHighQualityCurve: 1
|
||||
m_RotationCurves: []
|
||||
m_CompressedRotationCurves: []
|
||||
m_EulerCurves: []
|
||||
m_PositionCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: {x: 1.43, y: 3.87, z: -5.699}
|
||||
inSlope: {x: -1.0699999, y: 8.379311, z: 3.1427588}
|
||||
outSlope: {x: -1.0699999, y: 8.379311, z: 3.1427588}
|
||||
tangentMode: 0
|
||||
- time: 0.48333332
|
||||
value: {x: -0.623, y: 6.803, z: -4.18}
|
||||
inSlope: {x: -1.0699999, y: 2.5541713, z: 5.1036377}
|
||||
outSlope: {x: -1.0699999, y: 2.5541713, z: 5.1036377}
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: {x: 0.36, y: 6.23, z: -0.53}
|
||||
inSlope: {x: -0.34500003, y: -5.7454844, z: 4.262258}
|
||||
outSlope: {x: -0.34500003, y: -5.7454844, z: 4.262258}
|
||||
tangentMode: 0
|
||||
- time: 1.5
|
||||
value: {x: 4.06, y: 3.55, z: 0.2}
|
||||
inSlope: {x: 0.38, y: -8.22, z: 1.4599999}
|
||||
outSlope: {x: 0.38, y: -8.22, z: 1.4599999}
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: {x: 1.43, y: 3.87, z: -5.699}
|
||||
inSlope: {x: 0, y: 0, z: 0}
|
||||
outSlope: {x: 0, y: 0, z: 0}
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
path:
|
||||
m_ScaleCurves: []
|
||||
m_FloatCurves: []
|
||||
m_PPtrCurves: []
|
||||
m_SampleRate: 60
|
||||
m_WrapMode: 2
|
||||
m_Bounds:
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
m_Extent: {x: 0, y: 0, z: 0}
|
||||
m_ClipBindingConstant:
|
||||
genericBindings: []
|
||||
pptrCurveMapping: []
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
m_AdditiveReferencePoseTime: 0
|
||||
m_StartTime: 0
|
||||
m_StopTime: 2
|
||||
m_OrientationOffsetY: 0
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
m_LoopBlendPositionXZ: 0
|
||||
m_KeepOriginalOrientation: 0
|
||||
m_KeepOriginalPositionY: 1
|
||||
m_KeepOriginalPositionXZ: 0
|
||||
m_HeightFromFeet: 0
|
||||
m_Mirror: 0
|
||||
m_EditorCurves:
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 1.43
|
||||
inSlope: -1.0699999
|
||||
outSlope: -1.0699999
|
||||
tangentMode: 0
|
||||
- time: 0.48333332
|
||||
value: -0.623
|
||||
inSlope: -1.0699999
|
||||
outSlope: -1.0699999
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: 0.36
|
||||
inSlope: -0.34500003
|
||||
outSlope: -0.34500003
|
||||
tangentMode: 0
|
||||
- time: 1.5
|
||||
value: 4.06
|
||||
inSlope: 0.38
|
||||
outSlope: 0.38
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: 1.43
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.x
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: 3.87
|
||||
inSlope: 8.379311
|
||||
outSlope: 8.379311
|
||||
tangentMode: 0
|
||||
- time: 0.48333332
|
||||
value: 6.803
|
||||
inSlope: 2.5541713
|
||||
outSlope: 2.5541713
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: 6.23
|
||||
inSlope: -5.7454844
|
||||
outSlope: -5.7454844
|
||||
tangentMode: 0
|
||||
- time: 1.5
|
||||
value: 3.55
|
||||
inSlope: -8.22
|
||||
outSlope: -8.22
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: 3.87
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.y
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
- curve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- time: 0
|
||||
value: -5.699
|
||||
inSlope: 3.1427588
|
||||
outSlope: 3.1427588
|
||||
tangentMode: 0
|
||||
- time: 0.48333332
|
||||
value: -4.18
|
||||
inSlope: 5.1036377
|
||||
outSlope: 5.1036377
|
||||
tangentMode: 0
|
||||
- time: 1
|
||||
value: -0.53
|
||||
inSlope: 4.262258
|
||||
outSlope: 4.262258
|
||||
tangentMode: 0
|
||||
- time: 1.5
|
||||
value: 0.2
|
||||
inSlope: 1.4599999
|
||||
outSlope: 1.4599999
|
||||
tangentMode: 0
|
||||
- time: 2
|
||||
value: -5.699
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
attribute: m_LocalPosition.z
|
||||
path:
|
||||
classID: 4
|
||||
script: {fileID: 0}
|
||||
m_EulerEditorCurves: []
|
||||
m_HasGenericRootTransform: 0
|
||||
m_HasMotionFloatCurves: 0
|
||||
m_GenerateMotionCurves: 0
|
||||
m_Events: []
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e7d49c1611fbf01478922b466af91d61
|
||||
timeCreated: 1462396705
|
||||
licenseType: Pro
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3723a07280d304a4b9436306b61dfafc
|
||||
folderAsset: yes
|
||||
timeCreated: 1460396598
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4fd9fe4d6579634459e5e84b3e164981
|
||||
folderAsset: yes
|
||||
timeCreated: 1461004779
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,207 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor
|
||||
{
|
||||
public class MeshChainShaderGUI : ShaderGUI
|
||||
{
|
||||
protected static class Styles
|
||||
{
|
||||
public static string emptyTootip = "";
|
||||
public static GUIContent colorText = new GUIContent("Line Tint", "Line Color (RGB) and Transparency (A)");
|
||||
public static GUIContent lineDataSpaceText = new GUIContent("World Space Data", "If true, the data " +
|
||||
"will not be transformed before rendering");
|
||||
|
||||
public static string lineSettingsText = "Line Rendering Levels";
|
||||
public static GUIContent lineCurveMinText = new GUIContent("Minimum Cutoff", "How far from the edge" +
|
||||
" of the geometry to start fading in line");
|
||||
public static GUIContent lineCurveMaxText = new GUIContent("Maximum Cutoff", "How far from the center " +
|
||||
"of the geometry to start fading out the line");
|
||||
public static GUIContent lineCurveBendText = new GUIContent("Level Curve", "The intensity curve from " +
|
||||
"line edge to line center");
|
||||
|
||||
public static string lineRadiusText = "Line Radius Settings";
|
||||
public static GUIContent lineRadiusDepthText = new GUIContent("Line Scaled by Depth", "Set to false to " +
|
||||
"get fixed width lines - useful for debugging or drafting views");
|
||||
public static GUIContent lineRadiusScaleText = new GUIContent("Radius Scale", "How much to scale the " +
|
||||
"width of the line in total");
|
||||
public static GUIContent lineRadiusMinText = new GUIContent("Radius Minimum", "Minimum size the line " +
|
||||
"width must be regardless of distance");
|
||||
public static GUIContent lineRadiusMaxText = new GUIContent("Radius Maximum", "Maximum size the line " +
|
||||
"widht must be regardless of distance");
|
||||
}
|
||||
|
||||
MaterialEditor m_MaterialEditor;
|
||||
bool m_FirstTimeApply = true;
|
||||
|
||||
MaterialProperty m_LineColor;
|
||||
MaterialProperty m_LineSettings;
|
||||
MaterialProperty m_LineRadius;
|
||||
|
||||
MaterialProperty m_LineDataSpace;
|
||||
MaterialProperty m_LineDepthScaleMode;
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)
|
||||
{
|
||||
FindProperties(props); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
m_MaterialEditor = materialEditor;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
MaterialChanged(material);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void FindProperties(MaterialProperty[] props)
|
||||
{
|
||||
m_LineColor = FindProperty("_Color", props);
|
||||
m_LineSettings = FindProperty("_lineSettings", props);
|
||||
m_LineRadius = FindProperty("_lineRadius", props);
|
||||
|
||||
// CCS Customizations
|
||||
m_LineDataSpace = FindProperty("_WorldData", props, false);
|
||||
m_LineDepthScaleMode = FindProperty("_LineDepthScale", props, false);
|
||||
}
|
||||
|
||||
public void ShaderPropertiesGUI(Material material)
|
||||
{
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
// Detect any changes to the material
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
// Color
|
||||
m_MaterialEditor.ShaderProperty(m_LineColor, Styles.colorText.text);
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
// World space flag
|
||||
if (m_LineDataSpace != null)
|
||||
{
|
||||
bool inWorldSpace = !Mathf.Approximately(m_LineDataSpace.floatValue, 0.0f);
|
||||
var newWorldSpace = EditorGUILayout.Toggle(Styles.lineDataSpaceText, inWorldSpace);
|
||||
if (newWorldSpace != inWorldSpace)
|
||||
{
|
||||
if (newWorldSpace == true)
|
||||
{
|
||||
m_LineDataSpace.floatValue = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LineDataSpace.floatValue = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EditorGUILayout.Space();
|
||||
// Line thickness curve settings
|
||||
GUILayout.Label(Styles.lineSettingsText, EditorStyles.boldLabel);
|
||||
var lineLevels = m_LineSettings.vectorValue;
|
||||
var newLineMin = EditorGUILayout.Slider(Styles.lineCurveMinText, lineLevels.x, 0.0f, 1.0f);
|
||||
var newLineMax = EditorGUILayout.Slider(Styles.lineCurveMaxText, lineLevels.y, 0.0f, 1.0f);
|
||||
var newLineBend = EditorGUILayout.Slider(Styles.lineCurveBendText, lineLevels.z, 0.0f, 1.0f);
|
||||
|
||||
if (newLineMin != lineLevels.x || newLineMax != lineLevels.y || newLineBend != lineLevels.z)
|
||||
{
|
||||
lineLevels.x = newLineMin;
|
||||
lineLevels.y = newLineMax;
|
||||
lineLevels.z = newLineBend;
|
||||
m_LineSettings.vectorValue = lineLevels;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
// Maximum line radius
|
||||
GUILayout.Label(Styles.lineRadiusText, EditorStyles.boldLabel);
|
||||
var radiusSettings = m_LineRadius.vectorValue;
|
||||
var depthScaleMode = true;
|
||||
if (m_LineDepthScaleMode != null)
|
||||
{
|
||||
// depthScaleMode = (m_LineDepthScaleMode.floatValue != 0.0f);
|
||||
depthScaleMode = !Mathf.Approximately(m_LineDepthScaleMode.floatValue, 0.0f);
|
||||
var newDepthScaleMode = EditorGUILayout.Toggle(Styles.lineRadiusDepthText, depthScaleMode);
|
||||
if (newDepthScaleMode != depthScaleMode)
|
||||
{
|
||||
if (newDepthScaleMode == true)
|
||||
{
|
||||
m_LineDepthScaleMode.floatValue = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LineDepthScaleMode.floatValue = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
var newRadiusScale = EditorGUILayout.FloatField(Styles.lineRadiusScaleText, radiusSettings.x);
|
||||
var newRadiusMin = radiusSettings.y;
|
||||
var newRadiusMax = radiusSettings.z;
|
||||
|
||||
if (depthScaleMode == false)
|
||||
{
|
||||
newRadiusMin = Mathf.Max(EditorGUILayout.FloatField(Styles.lineRadiusMinText, radiusSettings.y), 0.0f);
|
||||
newRadiusMax = Mathf.Max(EditorGUILayout.FloatField(Styles.lineRadiusMaxText, radiusSettings.z), newRadiusMin);
|
||||
}
|
||||
|
||||
if (newRadiusScale != radiusSettings.x || newRadiusMin != radiusSettings.y || newRadiusMax != radiusSettings.z)
|
||||
{
|
||||
radiusSettings.x = newRadiusScale;
|
||||
radiusSettings.y = newRadiusMin;
|
||||
radiusSettings.z = newRadiusMax;
|
||||
m_LineRadius.vectorValue = radiusSettings;
|
||||
}
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
MaterialChanged(material);
|
||||
}
|
||||
}
|
||||
|
||||
static void MaterialChanged(Material material)
|
||||
{
|
||||
var worldDataMode = false;
|
||||
var depthScaleMode = true;
|
||||
if (material.HasProperty("_WorldData"))
|
||||
{
|
||||
worldDataMode = !Mathf.Approximately(material.GetFloat("_WorldData"), 0.0f);
|
||||
}
|
||||
if (material.HasProperty("_LineDepthScale"))
|
||||
{
|
||||
depthScaleMode = !Mathf.Approximately(material.GetFloat("_LineDepthScale"), 0.0f);
|
||||
}
|
||||
if (worldDataMode)
|
||||
{
|
||||
SetKeyword(material, "LINE_MODEL_SPACE", false);
|
||||
SetKeyword(material, "LINE_WORLD_SPACE", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetKeyword(material, "LINE_MODEL_SPACE", true);
|
||||
SetKeyword(material, "LINE_WORLD_SPACE", false);
|
||||
}
|
||||
|
||||
if (depthScaleMode)
|
||||
{
|
||||
SetKeyword(material, "LINE_FIXED_WIDTH", false);
|
||||
SetKeyword(material, "LINE_PERSPECTIVE_WIDTH", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetKeyword(material, "LINE_FIXED_WIDTH", true);
|
||||
SetKeyword(material, "LINE_PERSPECTIVE_WIDTH", false);
|
||||
}
|
||||
}
|
||||
|
||||
static void SetKeyword(Material m, string keyword, bool state)
|
||||
{
|
||||
if (state)
|
||||
m.EnableKeyword(keyword);
|
||||
else
|
||||
m.DisableKeyword(keyword);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ab884b866da2f9428e66d9b6b4b5488
|
||||
timeCreated: 1461005730
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,22 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace UnityEditor
|
||||
{
|
||||
[CustomEditor(typeof(VRLineRenderer))]
|
||||
[CanEditMultipleObjects]
|
||||
public class VRLineRendererEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
// This is a bit of a brute force method to make this work in editor mode.
|
||||
// If we detect any kind of change, we just force a reinitialization
|
||||
// This way, nothing sneaks through from serialization
|
||||
base.OnInspectorGUI();
|
||||
if (GUI.changed)
|
||||
{
|
||||
var lineRenderer = (VRLineRenderer)target;
|
||||
lineRenderer.EditorCheckForUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f4c5ea26f559a1142a56ad844b2636ad
|
||||
timeCreated: 1461105823
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,300 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace VRLineRendererInternal
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The mesh chain handles all the translation between Unity's mesh class,
|
||||
/// what the line renderers want to do, and what the billboard-pipe based shaders expect
|
||||
/// If you need more custom/optimized access to this kind of mesh information, feel
|
||||
/// free to hook into this structure directly.
|
||||
/// </summary>
|
||||
public class MeshChain
|
||||
{
|
||||
[System.Flags]
|
||||
public enum MeshRefreshFlag
|
||||
{
|
||||
None = 0,
|
||||
Positions = 1,
|
||||
Colors = 2,
|
||||
Sizes = 4,
|
||||
All = 7
|
||||
}
|
||||
|
||||
Vector3[] m_Verts;
|
||||
Color32[] m_Colors;
|
||||
List<Vector4> m_ShapeData; // xy: UV coordinates for GPU expansion zw: Size of this vertex, size of the neighbor
|
||||
List<Vector3> m_NeighborPoints; // Location of the next point this pipe connects to, or itself if it is a billboard
|
||||
|
||||
// Update flags to prevent unncessary mesh data generation
|
||||
MeshRefreshFlag m_DataThatNeedsUpdate = MeshRefreshFlag.All;
|
||||
|
||||
// Cached runtime data
|
||||
Mesh m_Mesh;
|
||||
Transform m_OwnerTransform;
|
||||
|
||||
bool m_WorldSpaceData;
|
||||
// Stored mesh data we use to update our runtime mesh
|
||||
public bool worldSpaceData { get { return m_WorldSpaceData; } set { m_WorldSpaceData = value; } }
|
||||
public int reservedElements { get; private set; }
|
||||
|
||||
public MeshChain()
|
||||
{
|
||||
reservedElements = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates or re-creates the mesh with all the data needed for billboard-pipe based line rendering
|
||||
/// </summary>
|
||||
/// <param name="owner">The gameobject that will own the created mesh</param>
|
||||
/// <param name="dynamic">Whether this mesh is going to updated frequently or not</param>
|
||||
/// <param name="totalElements">How many total billboards and pipes are needed for this renderer</param>
|
||||
public void GenerateMesh(GameObject owner, bool dynamic, int totalElements)
|
||||
{
|
||||
// Precache neccessary data
|
||||
// The mesh, vertex and triangle counts
|
||||
if (m_Mesh == null)
|
||||
{
|
||||
m_Mesh = new Mesh();
|
||||
}
|
||||
if (dynamic == true)
|
||||
{
|
||||
m_Mesh.MarkDynamic();
|
||||
}
|
||||
owner.GetComponent<MeshFilter>().mesh = m_Mesh;
|
||||
m_OwnerTransform = owner.transform;
|
||||
|
||||
reservedElements = totalElements;
|
||||
|
||||
var vertCount = 4 * reservedElements;
|
||||
var triCount = 6 * reservedElements;
|
||||
|
||||
m_Verts = new Vector3[vertCount];
|
||||
m_Colors = new Color32[vertCount];
|
||||
m_ShapeData = new List<Vector4>(vertCount);
|
||||
m_NeighborPoints = new List<Vector3>(vertCount);
|
||||
|
||||
var triangles = new int[triCount];
|
||||
|
||||
var defaultWhite = new Color32(255, 255, 255, 255);
|
||||
|
||||
var uvSet1 = new Vector4(0, 0, 1, 1);
|
||||
var uvSet2 = new Vector4(1, 0, 1, 1);
|
||||
var uvSet3 = new Vector4(1, 1, 1, 1);
|
||||
var uvSet4 = new Vector4(0, 1, 1, 1);
|
||||
|
||||
// Set up the basic data for all of our geometry
|
||||
var pointCounter = 0;
|
||||
while (pointCounter < reservedElements)
|
||||
{
|
||||
// Get where in the various indices we need to write
|
||||
var vertOffset = pointCounter * 4;
|
||||
var triOffset = pointCounter * 6;
|
||||
|
||||
// Store default color
|
||||
m_Colors[vertOffset] = defaultWhite;
|
||||
m_Colors[vertOffset + 1] = defaultWhite;
|
||||
m_Colors[vertOffset + 2] = defaultWhite;
|
||||
m_Colors[vertOffset + 3] = defaultWhite;
|
||||
|
||||
// Write traditional billboard coordinates
|
||||
// We use the UV coordinates to determine direction each
|
||||
// individual vertex will expand in, in screen space
|
||||
// Last two coordinates are size expansion
|
||||
m_ShapeData.Add(uvSet1);
|
||||
m_ShapeData.Add(uvSet2);
|
||||
m_ShapeData.Add(uvSet3);
|
||||
m_ShapeData.Add(uvSet4);
|
||||
|
||||
// Zero out neighbor points
|
||||
m_NeighborPoints.Add(Vector3.zero);
|
||||
m_NeighborPoints.Add(Vector3.zero);
|
||||
m_NeighborPoints.Add(Vector3.zero);
|
||||
m_NeighborPoints.Add(Vector3.zero);
|
||||
|
||||
// And a proper index buffer for this element
|
||||
triangles[triOffset] = vertOffset;
|
||||
triangles[triOffset + 1] = vertOffset + 1;
|
||||
triangles[triOffset + 2] = vertOffset + 2;
|
||||
triangles[triOffset + 3] = vertOffset;
|
||||
triangles[triOffset + 4] = vertOffset + 2;
|
||||
triangles[triOffset + 5] = vertOffset + 3;
|
||||
|
||||
pointCounter++;
|
||||
}
|
||||
|
||||
// Now set any values we can
|
||||
m_Mesh.triangles = null;
|
||||
m_Mesh.vertices = m_Verts;
|
||||
m_Mesh.SetUVs(0, m_ShapeData);
|
||||
m_Mesh.SetUVs(1, m_NeighborPoints);
|
||||
m_Mesh.triangles = triangles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates any mesh vertex data that is marked as dirty
|
||||
/// </summary>
|
||||
public void RefreshMesh()
|
||||
{
|
||||
if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Positions) != 0)
|
||||
{
|
||||
m_Mesh.vertices = m_Verts;
|
||||
m_Mesh.SetUVs(1, m_NeighborPoints);
|
||||
}
|
||||
if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Colors) != 0)
|
||||
{
|
||||
m_Mesh.colors32 = m_Colors;
|
||||
}
|
||||
if ((m_DataThatNeedsUpdate & MeshRefreshFlag.Sizes) != 0)
|
||||
{
|
||||
m_Mesh.SetUVs(0, m_ShapeData);
|
||||
}
|
||||
m_DataThatNeedsUpdate = MeshRefreshFlag.None;
|
||||
|
||||
m_Mesh.RecalculateBounds();
|
||||
if (m_WorldSpaceData == true)
|
||||
{
|
||||
var newBounds = m_Mesh.bounds;
|
||||
newBounds.center = m_OwnerTransform.InverseTransformPoint(newBounds.center);
|
||||
m_Mesh.bounds = newBounds;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used by external classes to alert the mesh chain that they have modified its data
|
||||
/// </summary>
|
||||
/// <param name="dataThatNeedsUpdate">Which type of data (position, color, size) has been changed</param>
|
||||
public void SetMeshDataDirty(MeshRefreshFlag dataThatNeedsUpdate)
|
||||
{
|
||||
m_DataThatNeedsUpdate |= dataThatNeedsUpdate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the position of a specific point in the chain
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">Which control point to update</param>
|
||||
/// <param name="position">The updated position of the control point</param>
|
||||
public void SetElementPosition(int elementIndex, ref Vector3 position)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Verts[offset] = position;
|
||||
m_Verts[offset + 1] = position;
|
||||
m_Verts[offset + 2] = position;
|
||||
m_Verts[offset + 3] = position;
|
||||
|
||||
m_NeighborPoints[offset] = position;
|
||||
m_NeighborPoints[offset + 1] = position;
|
||||
m_NeighborPoints[offset + 2] = position;
|
||||
m_NeighborPoints[offset + 3] = position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the endpoints of a pipe in the chain - The pipe equivalent of SetElementPosition
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">Which control pipe to update</param>
|
||||
/// <param name="startPoint">The position of the previous control point being connected to</param>
|
||||
/// <param name="endPoint">The position of the next control point being connected to</param>
|
||||
public void SetElementPipe(int elementIndex, ref Vector3 startPoint, ref Vector3 endPoint)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Verts[offset] = startPoint;
|
||||
m_Verts[offset + 1] = startPoint;
|
||||
m_Verts[offset + 2] = endPoint;
|
||||
m_Verts[offset + 3] = endPoint;
|
||||
|
||||
m_NeighborPoints[offset] = endPoint;
|
||||
m_NeighborPoints[offset + 1] = endPoint;
|
||||
m_NeighborPoints[offset + 2] = startPoint;
|
||||
m_NeighborPoints[offset + 3] = startPoint;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the size of the billboard or pipe being rendered
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the control point to update</param>
|
||||
/// <param name="sizeModification">What the radius or width of the element should be</param>
|
||||
public void SetElementSize(int elementIndex, float sizeModification)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_ShapeData[offset] = new Vector4(0, 0, sizeModification, sizeModification);
|
||||
m_ShapeData[offset + 1] = new Vector4(1, 0, sizeModification, sizeModification);
|
||||
m_ShapeData[offset + 2] = new Vector4(1, 1, sizeModification, sizeModification);
|
||||
m_ShapeData[offset + 3] = new Vector4(0, 1, sizeModification, sizeModification);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the size of the pipe being rendered
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the pipe control point to update</param>
|
||||
/// <param name="sizeModification">What the width of the pipe should be</param>
|
||||
public void SetElementSize(int elementIndex, float startSize, float endSize)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
|
||||
m_ShapeData[offset] = new Vector4(0, 0, startSize, endSize);
|
||||
m_ShapeData[offset + 1] = new Vector4(1, 0, startSize, endSize);
|
||||
m_ShapeData[offset + 2] = new Vector4(1, 1, endSize, startSize);
|
||||
m_ShapeData[offset + 3] = new Vector4(0, 1, endSize, startSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color of a billboard or pipe in the chain
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the element we are coloring</param>
|
||||
/// <param name="color">What the color of this element should be</param>
|
||||
public void SetElementColor(int elementIndex, ref Color color)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Colors[offset] = color;
|
||||
m_Colors[offset + 1] = m_Colors[offset];
|
||||
m_Colors[offset + 2] = m_Colors[offset];
|
||||
m_Colors[offset + 3] = m_Colors[offset];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color of a billboard or pipe in the chain
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the element we are coloring</param>
|
||||
/// <param name="color">What the color of this element should be</param>
|
||||
public void SetElementColor32(int elementIndex, ref Color32 color)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Colors[offset] = color;
|
||||
m_Colors[offset + 1] = color;
|
||||
m_Colors[offset + 2] = color;
|
||||
m_Colors[offset + 3] = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the colors of a pipe in the chain
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the pipe we are coloring</param>
|
||||
/// <param name="startColor">The color of the startpoint of the pipe</param>
|
||||
/// <param name="endColor">The color of the endpoint of the pipe</param>
|
||||
public void SetElementColor(int elementIndex, ref Color startColor, ref Color endColor)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Colors[offset] = startColor;
|
||||
m_Colors[offset + 1] = m_Colors[offset];
|
||||
m_Colors[offset + 2] = endColor;
|
||||
m_Colors[offset + 3] = m_Colors[offset + 2];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the colors of a pipe in the chain
|
||||
/// </summary>
|
||||
/// <param name="elementIndex">The index of the pipe we are coloring</param>
|
||||
/// <param name="startColor">The color of the startpoint of the pipe</param>
|
||||
/// <param name="endColor">The color of the endpoint of the pipe</param>
|
||||
public void SetElementColor32(int elementIndex, ref Color32 startColor, ref Color32 endColor)
|
||||
{
|
||||
var offset = elementIndex * 4;
|
||||
m_Colors[offset] = startColor;
|
||||
m_Colors[offset + 1] = m_Colors[offset];
|
||||
m_Colors[offset + 2] = endColor;
|
||||
m_Colors[offset + 3] = m_Colors[offset + 2];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 23f2c633373418648b62a3777231015b
|
||||
timeCreated: 1460396386
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,389 @@
|
|||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A VR-Focused drop-in replacement for the Line Renderer
|
||||
/// This renderer draws fixed-width lines with simulated volume and glow.
|
||||
/// This has many of the advantages of the traditional Line Renderer, old-school system-level line rendering functions,
|
||||
/// and volumetric (a linked series of capsules or cubes) rendering
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[ExecuteInEditMode]
|
||||
public class VRLineRenderer : MonoBehaviour
|
||||
{
|
||||
// Stored Line Data
|
||||
[SerializeField]
|
||||
protected Vector3[] m_Positions;
|
||||
|
||||
[SerializeField]
|
||||
protected Color m_ColorStart = Color.white;
|
||||
[SerializeField]
|
||||
protected Color m_ColorEnd = Color.white;
|
||||
|
||||
[SerializeField]
|
||||
protected float m_WidthStart = 1.0f;
|
||||
[SerializeField]
|
||||
protected float m_WidthEnd = 1.0f;
|
||||
|
||||
[SerializeField]
|
||||
protected bool m_WorldSpaceData;
|
||||
|
||||
// Cached Data
|
||||
VRLineRendererInternal.MeshChain m_MeshData;
|
||||
bool m_MeshNeedsRefreshing;
|
||||
|
||||
// LineRenderer Interface
|
||||
/// <summary>
|
||||
/// If enabled, the lines are defined in world space.
|
||||
/// This means the object's position is ignored and the lines are rendered around the world origin.
|
||||
/// </summary>
|
||||
public bool useWorldSpace
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WorldSpaceData;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WorldSpaceData = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float widthStart { get { return m_WidthStart; } }
|
||||
public float widthEnd { get { return m_WidthEnd; } }
|
||||
|
||||
/// <summary>
|
||||
/// Ensures the lines have all their data precached upon loading
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does the actual internal mesh updating as late as possible so nothing ends up a frame behind
|
||||
/// </summary>
|
||||
void LateUpdate()
|
||||
{
|
||||
if (m_MeshNeedsRefreshing == true)
|
||||
{
|
||||
m_MeshData.RefreshMesh();
|
||||
m_MeshNeedsRefreshing = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows the component to be referenced as a renderer, forwarding the MeshRenderer ahead
|
||||
/// </summary>
|
||||
public static implicit operator Renderer(VRLineRenderer lr)
|
||||
{
|
||||
return lr.GetComponent<MeshRenderer>();
|
||||
}
|
||||
|
||||
//////////////////
|
||||
/// Editor Usage
|
||||
//////////////////
|
||||
public void EditorCheckForUpdate()
|
||||
{
|
||||
// If we did not initialize, refresh all the properties instead
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the line color at the start and at the end
|
||||
/// </summary>
|
||||
public void SetColors(Color start, Color end)
|
||||
{
|
||||
// Worth detecting a no op consideirng how much this function can potentially do
|
||||
if (start == m_ColorStart && end == m_ColorEnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Update internal data
|
||||
m_ColorStart = start;
|
||||
m_ColorEnd = end;
|
||||
|
||||
// See if the data needs initializing
|
||||
if (Initialize())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If it doesn't, go through each point and set the data
|
||||
var pointCounter = 0;
|
||||
var elementCounter = 0;
|
||||
|
||||
m_MeshData.SetElementColor(elementCounter, ref m_ColorStart);
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
|
||||
float stepSize = 1.0f / Mathf.Max((m_Positions.Length - 1.0f), 1.0f);
|
||||
float stepPercent = stepSize;
|
||||
var lastColor = m_ColorStart;
|
||||
|
||||
while (pointCounter < m_Positions.Length)
|
||||
{
|
||||
var currentColor = Color.Lerp(m_ColorStart, m_ColorEnd, stepPercent);
|
||||
m_MeshData.SetElementColor(elementCounter, ref lastColor, ref currentColor);
|
||||
elementCounter++;
|
||||
|
||||
m_MeshData.SetElementColor(elementCounter, ref currentColor);
|
||||
|
||||
lastColor = currentColor;
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
stepPercent += stepSize;
|
||||
}
|
||||
|
||||
// Dirty the color meshChain flags so the mesh gets new data
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.Colors);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the position of the vertex in the line.
|
||||
/// </summary>
|
||||
public void SetPosition(int index, Vector3 position)
|
||||
{
|
||||
// Update internal data
|
||||
m_Positions[index] = position;
|
||||
|
||||
// See if the data needs initializing
|
||||
if (Initialize())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, do fast setting
|
||||
if (index > 0)
|
||||
{
|
||||
m_MeshData.SetElementPipe((index * 2) - 1, ref m_Positions[index - 1], ref m_Positions[index]);
|
||||
}
|
||||
m_MeshData.SetElementPosition(index * 2, ref m_Positions[index]);
|
||||
if (index < (m_Positions.Length - 1))
|
||||
{
|
||||
m_MeshData.SetElementPipe((index * 2) + 1, ref m_Positions[index], ref m_Positions[index + 1]);
|
||||
}
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.Positions);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the positions of all vertices in the line
|
||||
/// This method is preferred to SetPosition for updating multiple points, as it is more efficient to set all positions using a single command than to set each position individually.
|
||||
/// </summary>
|
||||
public void SetPositions(Vector3[] newPositions, bool knownSizeChange = false)
|
||||
{
|
||||
// Update internal data
|
||||
if (m_Positions == null || newPositions.Length != m_Positions.Length)
|
||||
{
|
||||
if (knownSizeChange == false)
|
||||
{
|
||||
Debug.LogWarning("New positions does not match size of existing array. Adjusting vertex count as well");
|
||||
}
|
||||
m_Positions = newPositions;
|
||||
Initialize(true);
|
||||
return;
|
||||
}
|
||||
m_Positions = newPositions;
|
||||
|
||||
// See if the data needs initializing
|
||||
if (Initialize())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, do fast setting
|
||||
var pointCounter = 0;
|
||||
var elementCounter = 0;
|
||||
m_MeshData.SetElementPosition(elementCounter, ref m_Positions[pointCounter]);
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
while (pointCounter < m_Positions.Length)
|
||||
{
|
||||
m_MeshData.SetElementPipe(elementCounter, ref m_Positions[pointCounter - 1], ref m_Positions[pointCounter]);
|
||||
elementCounter++;
|
||||
m_MeshData.SetElementPosition(elementCounter, ref m_Positions[pointCounter]);
|
||||
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
}
|
||||
|
||||
// Dirty all the MeshChain flags so everything gets refreshed
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.Positions);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the number of billboard-line chains. This function regenerates the point list, so use it sparingly.
|
||||
/// </summary>
|
||||
public void SetVertexCount(int count)
|
||||
{
|
||||
// See if anything needs updating
|
||||
if (m_Positions.Length == count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Adjust this array
|
||||
var newPositions = new Vector3[count];
|
||||
var copyCount = Mathf.Min(m_Positions.Length, count);
|
||||
var copyIndex = 0;
|
||||
|
||||
while (copyIndex < copyCount)
|
||||
{
|
||||
newPositions[copyIndex] = m_Positions[copyIndex];
|
||||
copyIndex++;
|
||||
}
|
||||
m_Positions = newPositions;
|
||||
|
||||
// Do an initialization, this changes everything
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the line width at the start and at the end.
|
||||
/// Note, varying line widths will have a segmented appearance vs. the smooth look one gets with the traditional linerenderer.
|
||||
/// </summary>
|
||||
public void SetWidth(float start, float end)
|
||||
{
|
||||
// Update internal data
|
||||
m_WidthStart = start;
|
||||
m_WidthEnd = end;
|
||||
|
||||
// See if the data needs initializing
|
||||
if (Initialize())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, do fast setting
|
||||
var pointCounter = 0;
|
||||
var elementCounter = 0;
|
||||
|
||||
// We go through the element list, much like initialization, but only update the width part of the variables
|
||||
m_MeshData.SetElementSize(elementCounter, m_WidthStart);
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
|
||||
float stepSize = 1.0f / Mathf.Max((m_Positions.Length - 1.0f), 1.0f);
|
||||
float stepPercent = stepSize;
|
||||
var lastWidth = m_WidthStart;
|
||||
|
||||
while (pointCounter < m_Positions.Length)
|
||||
{
|
||||
var currentWidth = Mathf.Lerp(m_WidthStart, m_WidthEnd, stepPercent);
|
||||
|
||||
m_MeshData.SetElementSize(elementCounter, lastWidth, currentWidth);
|
||||
elementCounter++;
|
||||
m_MeshData.SetElementSize(elementCounter, currentWidth);
|
||||
lastWidth = currentWidth;
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
stepPercent += stepSize;
|
||||
}
|
||||
|
||||
// Dirty all the MeshChain flags so everything gets refreshed
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.Sizes);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures the mesh data for the renderer is created, and updates it if neccessary
|
||||
/// </summary>
|
||||
/// <param name="force">Whether or not to force a full rebuild of the mesh data</param>
|
||||
/// <returns>True if an initialization occurred, false if it was skipped</returns>
|
||||
protected bool Initialize(bool force = false)
|
||||
{
|
||||
if (m_Positions == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var performFullInitialize = force;
|
||||
|
||||
// For a line renderer we assume one big chain
|
||||
// We need a control point for each billboard and a control point for each pipe connecting them together
|
||||
// Except for the end, which must be capped with another billboard. This gives us (positions * 2) - 1
|
||||
var neededPoints = Mathf.Max((m_Positions.Length * 2) - 1, 0);
|
||||
if (m_MeshData == null)
|
||||
{
|
||||
m_MeshData = new VRLineRendererInternal.MeshChain();
|
||||
}
|
||||
if (m_MeshData.reservedElements != neededPoints)
|
||||
{
|
||||
m_MeshData.worldSpaceData = useWorldSpace;
|
||||
m_MeshData.GenerateMesh(gameObject, true, neededPoints);
|
||||
performFullInitialize = true;
|
||||
}
|
||||
if (performFullInitialize == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (neededPoints == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var pointCounter = 0;
|
||||
var elementCounter = 0;
|
||||
|
||||
// Initialize the single starting point
|
||||
m_MeshData.SetElementSize(elementCounter, m_WidthStart);
|
||||
m_MeshData.SetElementPosition(elementCounter, ref m_Positions[pointCounter]);
|
||||
m_MeshData.SetElementColor(elementCounter, ref m_ColorStart);
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
|
||||
float stepSize = 1.0f / Mathf.Max((m_Positions.Length - 1.0f), 1.0f);
|
||||
float stepPercent = stepSize;
|
||||
var lastWidth = m_WidthStart;
|
||||
var lastColor = m_ColorStart;
|
||||
|
||||
// Now do the chain
|
||||
while (pointCounter < m_Positions.Length)
|
||||
{
|
||||
var currentWidth = Mathf.Lerp(m_WidthStart, m_WidthEnd, stepPercent);
|
||||
var currentColor = Color.Lerp(m_ColorStart, m_ColorEnd, stepPercent);
|
||||
|
||||
// Create a pipe from the previous point to here
|
||||
m_MeshData.SetElementSize(elementCounter, lastWidth, currentWidth);
|
||||
m_MeshData.SetElementPipe(elementCounter, ref m_Positions[pointCounter - 1], ref m_Positions[pointCounter]);
|
||||
m_MeshData.SetElementColor(elementCounter, ref lastColor, ref currentColor);
|
||||
elementCounter++;
|
||||
|
||||
// Now record our own point data
|
||||
m_MeshData.SetElementSize(elementCounter, currentWidth);
|
||||
m_MeshData.SetElementPosition(elementCounter, ref m_Positions[pointCounter]);
|
||||
m_MeshData.SetElementColor(elementCounter, ref currentColor);
|
||||
|
||||
// Go onto the next point while retaining previous values we might need to lerp between
|
||||
lastWidth = currentWidth;
|
||||
lastColor = currentColor;
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
stepPercent += stepSize;
|
||||
}
|
||||
|
||||
// Dirty all the MeshChain flags so everything gets refreshed
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.All);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables the internal mesh representing the line
|
||||
/// </summary>
|
||||
void OnEnable()
|
||||
{
|
||||
GetComponent<MeshRenderer>().enabled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disables the internal mesh representing the line
|
||||
/// </summary>
|
||||
void OnDisable()
|
||||
{
|
||||
GetComponent<MeshRenderer>().enabled = false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d580b86a6ae18014293c9b5059b2121b
|
||||
timeCreated: 1460396552
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,406 @@
|
|||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// A VR-Focused drop-in replacement for the Line Renderer
|
||||
/// This renderer draws fixed-width lines with simulated volume and glow.
|
||||
/// This has many of the advantages of the traditional Line Renderer, old-school system-level line rendering functions, and volumetric (a linked series of capsules or cubes) rendering
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(MeshRenderer))]
|
||||
[RequireComponent(typeof(MeshFilter))]
|
||||
[ExecuteInEditMode]
|
||||
public class VRTrailRenderer : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
// Stored Trail Data
|
||||
[SerializeField]
|
||||
protected int m_MaxTrailPoints = 20; // How many points to store for tracing.
|
||||
|
||||
[SerializeField]
|
||||
protected bool m_StealLastPointWhenEmpty = true; // Whether to use the last point or the first point of the trail when more are needed and none are available
|
||||
|
||||
[SerializeField]
|
||||
protected Color[] m_Colors;
|
||||
|
||||
// Circular array support for trail point recording
|
||||
protected Vector3[] m_Points;
|
||||
protected float[] m_PointTimes;
|
||||
protected int m_PointIndexStart = 0;
|
||||
protected int m_PointIndexEnd = 0;
|
||||
|
||||
|
||||
// Cached Data
|
||||
VRLineRendererInternal.MeshChain m_MeshData;
|
||||
bool m_MeshNeedsRefreshing = false;
|
||||
Renderer m_MeshRenderer;
|
||||
Vector3 m_LastRecordedPoint = Vector3.zero;
|
||||
|
||||
int m_UsedPoints; // How many points we are currently rendering - for size/color blending
|
||||
float m_LastPointTime;
|
||||
|
||||
float m_EditorDeltaHelper; // This lets us have access to a time data while not in play mode
|
||||
|
||||
[SerializeField]
|
||||
protected float m_Time = 5.0f;
|
||||
|
||||
// TrailRenderer Interface
|
||||
public float time
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Time;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Time = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected float m_StartWidth = 1.0f;
|
||||
|
||||
public float startWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_StartWidth;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_StartWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected float m_EndWidth = 1.0f;
|
||||
|
||||
public float endWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_EndWidth;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_EndWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected float m_MinVertexDistance = 0.1f;
|
||||
|
||||
public float minVertexDistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_MinVertexDistance;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_MinVertexDistance = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
protected bool m_Autodestruct = false;
|
||||
|
||||
public bool autodestruct
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Autodestruct;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Autodestruct = value;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
public bool m_SmoothInterpolation = false; // With this enabled, the last point will smooth lerp between the last recorded anchor point and the one after it
|
||||
|
||||
public bool smoothInterpolation
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_SmoothInterpolation;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_SmoothInterpolation = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures the trails have all their data precached upon loading
|
||||
/// </summary>
|
||||
void Awake()
|
||||
{
|
||||
m_MeshRenderer = GetComponent<Renderer>();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the built-in mesh data for each control point of the trail
|
||||
/// </summary>
|
||||
void LateUpdate()
|
||||
{
|
||||
// We do the actual internal mesh updating as late as possible so nothing ends up a frame behind
|
||||
var deltaTime = Time.deltaTime;
|
||||
|
||||
// We give the editor a little help with handling delta time in edit mode
|
||||
if (Application.isPlaying == false)
|
||||
{
|
||||
deltaTime = Time.realtimeSinceStartup - m_EditorDeltaHelper;
|
||||
m_EditorDeltaHelper = Time.realtimeSinceStartup;
|
||||
}
|
||||
|
||||
// Get the current position of the renderer
|
||||
var currentPoint = transform.position;
|
||||
var pointDistance = (currentPoint - m_LastRecordedPoint).sqrMagnitude;
|
||||
|
||||
// Is it more than minVertexDistance from the last position?
|
||||
if (pointDistance > (m_MinVertexDistance*m_MinVertexDistance))
|
||||
{
|
||||
// In the situation we have no points, we need to record the start point as well
|
||||
if (m_PointIndexStart == m_PointIndexEnd)
|
||||
{
|
||||
m_Points[m_PointIndexStart] = m_LastRecordedPoint;
|
||||
m_PointTimes[m_PointIndexStart] = m_Time;
|
||||
}
|
||||
|
||||
// Make space for a new point
|
||||
var newEndIndex = (m_PointIndexEnd + 1) % m_MaxTrailPoints;
|
||||
|
||||
// In the situation that we are rendering all available vertices
|
||||
// We can either keep using the current point, or take the last point, depending on the user's preference
|
||||
if (newEndIndex != m_PointIndexStart)
|
||||
{
|
||||
m_PointIndexEnd = newEndIndex;
|
||||
m_PointTimes[m_PointIndexEnd] = 0;
|
||||
m_UsedPoints++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_StealLastPointWhenEmpty)
|
||||
{
|
||||
m_MeshData.SetElementSize(m_PointIndexStart * 2, 0);
|
||||
m_MeshData.SetElementSize((m_PointIndexStart * 2) + 1, 0);
|
||||
m_PointIndexStart = (m_PointIndexStart + 1) % m_MaxTrailPoints;
|
||||
m_PointIndexEnd = newEndIndex;
|
||||
m_PointTimes[m_PointIndexEnd] = 0;
|
||||
m_LastPointTime = m_PointTimes[m_PointIndexStart];
|
||||
}
|
||||
}
|
||||
|
||||
m_Points[m_PointIndexEnd] = currentPoint;
|
||||
|
||||
// Update the last recorded point
|
||||
m_LastRecordedPoint = currentPoint;
|
||||
}
|
||||
// Do time processing
|
||||
// The end point counts up to a maximum of 'time'
|
||||
m_PointTimes[m_PointIndexEnd] = Mathf.Min(m_PointTimes[m_PointIndexEnd] + deltaTime, m_Time);
|
||||
|
||||
if (m_PointIndexStart != m_PointIndexEnd)
|
||||
{
|
||||
// Run down the counter on the start point
|
||||
m_PointTimes[m_PointIndexStart] -= deltaTime;
|
||||
|
||||
// If we've hit 0, this point is done for
|
||||
if (m_PointTimes[m_PointIndexStart] <= 0.0f)
|
||||
{
|
||||
m_MeshData.SetElementSize(m_PointIndexStart * 2, 0);
|
||||
m_MeshData.SetElementSize((m_PointIndexStart * 2) + 1, 0);
|
||||
m_PointIndexStart = (m_PointIndexStart + 1) % m_MaxTrailPoints;
|
||||
m_LastPointTime = m_PointTimes[m_PointIndexStart];
|
||||
m_UsedPoints--;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_PointIndexStart != m_PointIndexEnd)
|
||||
{
|
||||
m_MeshNeedsRefreshing = true;
|
||||
m_MeshRenderer.enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MeshNeedsRefreshing = false;
|
||||
m_MeshRenderer.enabled = false;
|
||||
}
|
||||
if (m_MeshNeedsRefreshing == true)
|
||||
{
|
||||
m_MeshRenderer.enabled = true;
|
||||
|
||||
// Update first and last points position-wise
|
||||
var nextIndex = (m_PointIndexStart + 1) % m_MaxTrailPoints;
|
||||
if (m_SmoothInterpolation)
|
||||
{
|
||||
var toNextPoint = 1.0f - (m_PointTimes[m_PointIndexStart] / m_LastPointTime);
|
||||
var lerpPoint = Vector3.Lerp(m_Points[m_PointIndexStart], m_Points[nextIndex], toNextPoint);
|
||||
m_MeshData.SetElementPosition((m_PointIndexStart * 2), ref lerpPoint);
|
||||
m_MeshData.SetElementPipe((m_PointIndexStart * 2) + 1, ref lerpPoint, ref m_Points[nextIndex]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_MeshData.SetElementPosition((m_PointIndexStart * 2), ref m_Points[m_PointIndexStart]);
|
||||
m_MeshData.SetElementPipe((m_PointIndexStart * 2) + 1, ref m_Points[m_PointIndexStart], ref m_Points[nextIndex]);
|
||||
}
|
||||
|
||||
var prevIndex = m_PointIndexEnd - 1;
|
||||
if (prevIndex < 0)
|
||||
{
|
||||
prevIndex = m_MaxTrailPoints - 1;
|
||||
}
|
||||
|
||||
m_MeshData.SetElementPipe((prevIndex * 2) + 1, ref m_Points[prevIndex], ref m_Points[m_PointIndexEnd]);
|
||||
m_MeshData.SetElementPosition((m_PointIndexEnd * 2), ref m_Points[m_PointIndexEnd]);
|
||||
|
||||
|
||||
// Go through all points and update size and color
|
||||
var pointUpdateCounter = m_PointIndexStart;
|
||||
var pointCount = 0;
|
||||
var blendStep = 1.0f / m_UsedPoints;
|
||||
var colorValue = 1.0f;
|
||||
|
||||
while (pointUpdateCounter != m_PointIndexEnd)
|
||||
{
|
||||
var currentBlend = blendStep * pointCount;
|
||||
var nextBlend = blendStep * (pointCount + 1.0f);
|
||||
|
||||
var currentWidth = Mathf.Lerp(m_EndWidth, m_StartWidth, currentBlend);
|
||||
var nextWidth = Mathf.Lerp(m_EndWidth, m_StartWidth, nextBlend);
|
||||
|
||||
m_MeshData.SetElementSize(pointUpdateCounter * 2, currentWidth);
|
||||
m_MeshData.SetElementSize((pointUpdateCounter * 2) + 1, currentWidth, nextWidth);
|
||||
|
||||
var currentColor = GetLerpedColor(colorValue);
|
||||
var nextColor = GetLerpedColor(colorValue - blendStep);
|
||||
|
||||
m_MeshData.SetElementColor(pointUpdateCounter * 2, ref currentColor);
|
||||
m_MeshData.SetElementColor((pointUpdateCounter * 2) + 1, ref currentColor, ref nextColor);
|
||||
|
||||
pointUpdateCounter = (pointUpdateCounter + 1) % m_MaxTrailPoints;
|
||||
pointCount++;
|
||||
colorValue -= blendStep;
|
||||
}
|
||||
|
||||
m_MeshData.SetElementSize((m_PointIndexEnd * 2), m_StartWidth);
|
||||
m_MeshData.SetElementColor((m_PointIndexEnd * 2), ref m_Colors[0]);
|
||||
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.All);
|
||||
|
||||
m_MeshData.RefreshMesh();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Editor helper function to ensure changes are reflected in edit-mode
|
||||
/// </summary>
|
||||
public void EditorCheckForUpdate()
|
||||
{
|
||||
// If we did not initialize, refresh all the properties instead
|
||||
Initialize();
|
||||
}
|
||||
|
||||
// TrailRenderer Functions
|
||||
/// <summary>
|
||||
/// Removes all points from the TrailRenderer. Useful for restarting a trail from a new position.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
m_PointIndexStart = 0;
|
||||
m_PointIndexEnd = 0;
|
||||
m_LastRecordedPoint = transform.position;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the blended color through any point on the trail's color chain
|
||||
/// </summary>
|
||||
/// <param name="percent">How far along the trail's color chain to get the color</param>
|
||||
/// <returns>The blended color</returns>
|
||||
protected Color GetLerpedColor(float percent)
|
||||
{
|
||||
var stretchedColorValue = percent * (m_Colors.Length);
|
||||
var curColorIndex = Mathf.Clamp(Mathf.FloorToInt(stretchedColorValue), 0, m_Colors.Length - 1);
|
||||
var nextColorIndex = Mathf.Clamp(Mathf.FloorToInt(stretchedColorValue + 1), 0, m_Colors.Length - 1);
|
||||
var blendValue = stretchedColorValue % 1.0f;
|
||||
|
||||
return Color.Lerp(m_Colors[curColorIndex], m_Colors[nextColorIndex], blendValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures the mesh data for the renderer is created, and updates it if neccessary
|
||||
/// </summary>
|
||||
/// <param name="force">Whether or not to force a full rebuild of the mesh data</param>
|
||||
/// <returns>True if an initialization occurred, false if it was skipped</returns>
|
||||
protected bool Initialize()
|
||||
{
|
||||
m_MaxTrailPoints = Mathf.Max(m_MaxTrailPoints, 3);
|
||||
// If we have a point mismatch, we force this operation
|
||||
if (m_Points != null && m_MaxTrailPoints == m_Points.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Points = new Vector3[m_MaxTrailPoints];
|
||||
m_PointTimes = new float[m_MaxTrailPoints];
|
||||
Clear();
|
||||
|
||||
if (m_Colors == null || m_Colors.Length == 0)
|
||||
{
|
||||
m_Colors = new Color[1];
|
||||
m_Colors[0] = Color.white;
|
||||
}
|
||||
|
||||
// For a trail renderer we assume one big chain
|
||||
// We need a control point for each billboard and a control point for each pipe connecting them together
|
||||
// We make this a circular trail so the update logic is easier. This gives us (position * 2)
|
||||
var neededPoints = Mathf.Max((m_MaxTrailPoints * 2), 0);
|
||||
|
||||
if (m_MeshData == null)
|
||||
{
|
||||
m_MeshData = new VRLineRendererInternal.MeshChain();
|
||||
}
|
||||
|
||||
if (m_MeshData.reservedElements != neededPoints)
|
||||
{
|
||||
m_MeshData.worldSpaceData = true;
|
||||
m_MeshData.GenerateMesh(gameObject, true, neededPoints);
|
||||
|
||||
if (neededPoints == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var pointCounter = 0;
|
||||
var elementCounter = 0;
|
||||
var zeroVec = Vector3.zero;
|
||||
var zeroColor = new Color(0,0,0,0);
|
||||
|
||||
// Initialize everything to 0 so we don't render any trails at first
|
||||
m_MeshData.SetElementColor(0, ref zeroColor);
|
||||
while (pointCounter < m_Points.Length)
|
||||
{
|
||||
// Start point
|
||||
m_MeshData.SetElementSize(elementCounter, 0);
|
||||
m_MeshData.SetElementPosition(elementCounter, ref zeroVec);
|
||||
elementCounter++;
|
||||
|
||||
// Pipe to the next point
|
||||
m_MeshData.SetElementSize(elementCounter, 0);
|
||||
m_MeshData.SetElementPipe(elementCounter, ref zeroVec, ref zeroVec);
|
||||
|
||||
// Go onto the next point while retaining previous values we might need to lerp between
|
||||
elementCounter++;
|
||||
pointCounter++;
|
||||
}
|
||||
|
||||
// Dirty all the MeshChain flags so everything gets refreshed
|
||||
m_MeshRenderer.enabled = false;
|
||||
m_MeshData.SetMeshDataDirty(VRLineRendererInternal.MeshChain.MeshRefreshFlag.All);
|
||||
m_MeshNeedsRefreshing = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a52ac20b8c7e8274e965d22ace23d416
|
||||
timeCreated: 1461798751
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 301b199c2a561924d909ab2069898931
|
||||
folderAsset: yes
|
||||
timeCreated: 1460416660
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,160 @@
|
|||
#ifndef MESH_CHAIN
|
||||
#define MESH_CHAIN
|
||||
|
||||
half4 _Color; // What color to tint the line
|
||||
half4 _lineSettings; // Settings for how to shade the line - basically applying a levels filter to the gradient
|
||||
|
||||
half3 _lineRadius; // x: Element size multiplier, y: min, z: max
|
||||
|
||||
struct appdata_meshChain
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
float4 texcoord1 : TEXCOORD1;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
struct meshChain_vertex
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
};
|
||||
|
||||
meshChain_vertex vert(appdata_meshChain v)
|
||||
{
|
||||
meshChain_vertex o;
|
||||
|
||||
// In 5.4 and later we have stereo instance rendering so we go through the
|
||||
// ClipPos function which is aware of the proper projection matrix per-eye
|
||||
#if LINE_WORLD_SPACE
|
||||
o.pos = mul(UNITY_MATRIX_VP, v.vertex);
|
||||
#elif UNITY_VERSION < 540
|
||||
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
#else
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
#endif
|
||||
|
||||
// We calculate the aspect ratio since the lines are
|
||||
// being transformed into a psuedo-screen space area
|
||||
half aspectRatio = _ScreenParams.x / _ScreenParams.y;
|
||||
|
||||
// Determine the location of our neighbor
|
||||
#if LINE_WORLD_SPACE
|
||||
half4 neighborPos = mul(UNITY_MATRIX_VP, v.texcoord1);
|
||||
#elif UNITY_VERSION < 540
|
||||
half4 neighborPos = mul(UNITY_MATRIX_MVP, v.texcoord1);
|
||||
#else
|
||||
half4 neighborPos = UnityObjectToClipPos(v.texcoord1);
|
||||
#endif
|
||||
|
||||
// We calculate the distance this billboard or pipe expands at each end
|
||||
// We use this for the vertex deformation and proper non-perspective texture mapping
|
||||
#if LINE_FIXED_WIDTH
|
||||
half expandDistanceSource = clamp(_lineRadius.x * o.pos.z * .1, _lineRadius.y, _lineRadius.z) * v.texcoord.z;
|
||||
half expandDistanceDest = clamp(_lineRadius.x * neighborPos.z * .1, _lineRadius.y, _lineRadius.z) * v.texcoord.w;
|
||||
#else
|
||||
half expandDistanceSource = _lineRadius * .1 * v.texcoord.z;
|
||||
half expandDistanceDest = _lineRadius * .1 * v.texcoord.w;
|
||||
#endif
|
||||
|
||||
// If the screen space distance between these two points is under a threshold, we are a billboard
|
||||
// Otherwise, we are a pipe
|
||||
half2 perpVec = (neighborPos.xy / neighborPos.w) - (o.pos.xy / o.pos.w);
|
||||
half pipeFlag = step(.001, length(perpVec));
|
||||
perpVec = normalize(perpVec).yx;
|
||||
perpVec.y *= -1;
|
||||
perpVec.xy *= (2 * (v.texcoord.x - .5)) * (2 * (v.texcoord.y - .5));
|
||||
|
||||
// Billboard logic
|
||||
// We billboard based off the UV's we had stored
|
||||
// Since the UV's represent each corner, we convert these into offsets
|
||||
half2 billboardVec = 2 * (v.texcoord.xy - .5);
|
||||
|
||||
// Whether this element is a billboard or a pipe is encoded in the secondary texture coordinates
|
||||
// A 0 on the u coordinate specifies using the billboard rendering mode
|
||||
// A 1 on the u coordinate specifies using the pipe rendering mode
|
||||
o.pos.x += lerp(billboardVec.x, perpVec.x, pipeFlag) * expandDistanceSource;
|
||||
o.pos.y += lerp(billboardVec.y, perpVec.y, pipeFlag) * expandDistanceSource*aspectRatio;
|
||||
|
||||
// We store the w coordinate of the worldspace position separately here
|
||||
// We need to conditionally undo the perspective correction on these UV coordinates
|
||||
// And the w coordinate is needed for that
|
||||
float sizeRatio = ((expandDistanceSource + expandDistanceDest) / expandDistanceDest);
|
||||
o.uv = float4(v.texcoord.x, v.texcoord.y, pipeFlag, sizeRatio);
|
||||
o.uv.y = o.uv.y * (1.0 - pipeFlag) + .5 * pipeFlag;
|
||||
o.uv.xy *= sizeRatio;
|
||||
|
||||
o.color = v.color * _Color;
|
||||
return o;
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Function that takes an input brightness,
|
||||
// and applies the levels logic we've described
|
||||
//----------------------------------------------
|
||||
// curve.x : min range (0 - 1, based on brightness)
|
||||
// curve.y : max range (1 - 0, based on brightness)
|
||||
// curve.z : bend (.5 is linear)
|
||||
fixed applyLevels(fixed original, fixed3 curve)
|
||||
{
|
||||
// Any value less than 1/256 (the minimum the color variable can represent in the editor)
|
||||
// is clamped to 0 to prevent texture bleeding
|
||||
fixed inRange = saturate((original - curve.x) / (curve.y - curve.x)) * step(1.0 / 256.0, original);
|
||||
|
||||
// We take this in-range value and apply a power function to it
|
||||
// We calculate the power from our bend value with the following logic
|
||||
// Any curve value from 0 to .5 goes from 1/32 to 1
|
||||
// Any curve value from .5 to 1 goes from 1 to 32
|
||||
// This lets us have really strong curve controls
|
||||
// Pow is not necessarily cheap, but equivalent perf to lerping
|
||||
// between a curve that bows out and one that bows in
|
||||
half bendValue = curve.z;
|
||||
fixed powValue = (saturate(-(bendValue - .5)) * 5) + (1 / (saturate(bendValue - .5) * 5 + 1));
|
||||
return pow(inRange, powValue);
|
||||
}
|
||||
|
||||
half4 frag(meshChain_vertex i) : COLOR
|
||||
{
|
||||
// This used to be a texture lookup, we have now turned it into pure math
|
||||
// Undo the perspective correction
|
||||
float2 texCoord = i.uv.xy / i.uv.w;
|
||||
|
||||
// Calculate the how close to the center of the billboard or pipe we are, and convert
|
||||
// that to a brightness value
|
||||
half lineAlpha = 1 - saturate(length(texCoord * 2 - float2(1.0, 1.0)));
|
||||
// Apply our curve logic and color tint
|
||||
return applyLevels(lineAlpha*i.color.a, _lineSettings.rgb) * i.color;
|
||||
}
|
||||
|
||||
half4 fragInvert(meshChain_vertex i) : COLOR
|
||||
{
|
||||
// This used to be a texture lookup, we have now turned it into pure math
|
||||
// Undo the perspective correction
|
||||
float2 texCoord = i.uv.xy / i.uv.w;
|
||||
|
||||
// Calculate the how close to the center of the billboard or pipe we are, and convert
|
||||
// that to a brightness value
|
||||
half lineAlpha = 1 - saturate(length(texCoord * 2 - float2(1.0, 1.0)));
|
||||
// Apply our curve logic and color tint
|
||||
return lerp(i.color, half4(1,1,1,1), 1 - applyLevels(lineAlpha * i.color.a, _lineSettings.rgb));
|
||||
}
|
||||
|
||||
half4 fragAlphaMask(meshChain_vertex i) : COLOR
|
||||
{
|
||||
// This used to be a texture lookup, we have now turned it into pure math
|
||||
// Undo the perspective correction
|
||||
float2 texCoord = i.uv.xy / i.uv.w;
|
||||
|
||||
// Calculate the how close to the center of the billboard or pipe we are, and convert
|
||||
// that to a brightness value
|
||||
half lineAlpha = 1 - saturate(length(texCoord * 2 - float2(1.0, 1.0)));
|
||||
lineAlpha = lerp(1, 1 - applyLevels(lineAlpha, _lineSettings.rgb), i.color.a);
|
||||
return half4(0, 0, 0, lineAlpha);
|
||||
}
|
||||
|
||||
half4 fragColor(meshChain_vertex i) : COLOR
|
||||
{
|
||||
return half4(i.color.rgb,1);
|
||||
}
|
||||
#endif // MESH_CHAIN
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28d4fa881b1b2df4e92e693c84774031
|
||||
timeCreated: 1460504260
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,77 @@
|
|||
Shader "VRLineRenderer/MeshChain - Additive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color Tint", COLOR) = (1,1,1,1)
|
||||
_lineSettings ("Line Thickness Settings", VECTOR) = (0, 1, .5, 1)
|
||||
|
||||
_lineRadius("Line Radius Scale, Min, Max", VECTOR) = (1, 0, 100)
|
||||
|
||||
// Local space or world space data
|
||||
[HideInInspector] _WorldData("__worlddata", Float) = 0.0
|
||||
|
||||
// Depth effects line width
|
||||
[HideInInspector] _LineDepthScale("__linedepthscale", Float) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
LOD 100
|
||||
|
||||
// We don't want the line segments and caps to draw overtop
|
||||
// one another as it breaks the continous segment illusion
|
||||
// To alpha blend with the background, we use a two-pass technique
|
||||
Pass
|
||||
{
|
||||
// In the first pass we write only to the alpha channel.
|
||||
// This lets us punch a hole in the background that our
|
||||
// line color then shows through
|
||||
Blend One One
|
||||
BlendOp Min
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ColorMask A
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAlphaMask
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
// In this second pass, we write our line color only as much
|
||||
// as the alpha value we wrote before allows through. To
|
||||
// prevent overlapping lines from adding too much color,
|
||||
// we set the alpha value to one after visiting a pixel.
|
||||
Blend OneMinusDstAlpha One, One One
|
||||
BlendOp Add
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragColor
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "MeshChainShaderGUI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d689c77434e9ecb4084bd09df8d53140
|
||||
timeCreated: 1460657575
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,77 @@
|
|||
Shader "VRLineRenderer/MeshChain - Alpha Blended"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color Tint", COLOR) = (1,1,1,1)
|
||||
_lineSettings ("Line Thickness Settings", VECTOR) = (0, 1, .5, 1)
|
||||
|
||||
_lineRadius("Line Radius Scale, Min, Max", VECTOR) = (1, 0, 100)
|
||||
|
||||
// Local space or world space data
|
||||
[HideInInspector] _WorldData("__worlddata", Float) = 0.0
|
||||
|
||||
// Depth effects line width
|
||||
[HideInInspector] _LineDepthScale("__linedepthscale", Float) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
LOD 100
|
||||
|
||||
// We don't want the line segments and caps to draw overtop
|
||||
// one another as it breaks the continous segment illusion
|
||||
// To alpha blend with the background, we use a two-pass technique
|
||||
Pass
|
||||
{
|
||||
// In the first pass we write only to the alpha channel.
|
||||
// This lets us punch a hole in the background that our
|
||||
// line color then shows through
|
||||
Blend One One
|
||||
BlendOp Min
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ColorMask A
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAlphaMask
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
// In this second pass, we write our line color only as much
|
||||
// as the alpha value we wrote before allows through. To
|
||||
// prevent overlapping lines from adding too much color,
|
||||
// we set the alpha value to one after visiting a pixel.
|
||||
Blend OneMinusDstAlpha DstAlpha, One One
|
||||
BlendOp Add
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragColor
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "MeshChainShaderGUI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d2d82e816970e9849bc93f1842c33050
|
||||
timeCreated: 1460591258
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,47 @@
|
|||
Shader "VRLineRenderer/MeshChain - Max Color"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color Tint", COLOR) = (1,1,1,1)
|
||||
_lineSettings ("Line Thickness Settings", VECTOR) = (0, 1, .5, 1)
|
||||
|
||||
_lineRadius ("Line Radius Scale, Min, Max", VECTOR) = (1, 0, 100)
|
||||
|
||||
// Local space or world space data
|
||||
[HideInInspector] _WorldData("__worlddata", Float) = 0.0
|
||||
|
||||
// Depth effects line width
|
||||
[HideInInspector] _LineDepthScale("__linedepthscale", Float) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
// This version of the shader writes any pixel brighter than the background
|
||||
// It uses the 'max' operation so it won't blow out the screen
|
||||
Blend One One
|
||||
BlendOp Max
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "MeshChainShaderGUI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c03eb3285154f9d48aef80b7b148e361
|
||||
timeCreated: 1460416660
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,47 @@
|
|||
Shader "VRLineRenderer/MeshChain - Min Color"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color Tint", COLOR) = (1,1,1,1)
|
||||
_lineSettings ("Line Thickness Settings", VECTOR) = (0, 1, .5, 1)
|
||||
|
||||
_lineRadius("Line Radius Scale, Min, Max", VECTOR) = (1, 0, 100)
|
||||
|
||||
// Local space or world space data
|
||||
[HideInInspector] _WorldData("__worlddata", Float) = 0.0
|
||||
|
||||
// Depth effects line width
|
||||
[HideInInspector] _LineDepthScale("__linedepthscale", Float) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
// This version of the shader writes any pixel darker than the background
|
||||
// It uses the 'min' operation to keep line consistency
|
||||
Blend One One
|
||||
BlendOp Min
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragInvert
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "MeshChainShaderGUI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e975b2c6a84c4f479b8ef83f0a88e6f
|
||||
timeCreated: 1460504404
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,77 @@
|
|||
Shader "VRLineRenderer/MeshChain - Subtractive"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color Tint", COLOR) = (1,1,1,1)
|
||||
_lineSettings ("Line Thickness Settings", VECTOR) = (0, 1, .5, 1)
|
||||
|
||||
_lineRadius("Line Radius Scale, Min, Max", VECTOR) = (1, 0, 100)
|
||||
|
||||
// Local space or world space data
|
||||
[HideInInspector] _WorldData("__worlddata", Float) = 0.0
|
||||
|
||||
// Depth effects line width
|
||||
[HideInInspector] _LineDepthScale("__linedepthscale", Float) = 1.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
|
||||
LOD 100
|
||||
|
||||
// We don't want the line segments and caps to draw overtop
|
||||
// one another as it breaks the continous segment illusion
|
||||
// To alpha blend with the background, we use a two-pass technique
|
||||
Pass
|
||||
{
|
||||
// In the first pass we write only to the alpha channel.
|
||||
// This lets us punch a hole in the background that our
|
||||
// line color then shows through
|
||||
Blend One One
|
||||
BlendOp Min
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
ColorMask A
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragAlphaMask
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
Pass
|
||||
{
|
||||
// In this second pass, we write our line color only as much
|
||||
// as the alpha value we wrote before allows through. To
|
||||
// prevent overlapping lines from adding too much color,
|
||||
// we set the alpha value to one after visiting a pixel.
|
||||
Blend OneMinusDstAlpha One, One One
|
||||
BlendOp RevSub, Add
|
||||
Cull Off
|
||||
Lighting Off
|
||||
ZWrite Off
|
||||
Offset 0, -.1
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment fragColor
|
||||
#pragma multi_compile LINE_PERSPECTIVE_WIDTH LINE_FIXED_WIDTH
|
||||
#pragma multi_compile LINE_MODEL_SPACE LINE_WORLD_SPACE
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "MeshChain.cginc"
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "MeshChainShaderGUI"
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9d1af3afcc83db644b8abe552f6a0e05
|
||||
timeCreated: 1460657638
|
||||
licenseType: Pro
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Загрузка…
Ссылка в новой задаче