chwan1 6 years ago
commit b520fcfb80
  1. 482
      Unity-19050-01_ForstCoronation/Assets/Scenes/Ice.unity
  2. 31
      Unity-19050-01_ForstCoronation/Assets/Scripts/DebugUI.cs
  3. 37
      Unity-19050-01_ForstCoronation/Assets/Textures/camera_tex.renderTexture
  4. 8
      Unity-19050-01_ForstCoronation/Assets/Textures/camera_tex.renderTexture.meta
  5. 1641
      Unity-19050-01_ForstCoronation/Assets/Visual Effect Graphs/frozenVFX.vfx
  6. 4
      Unity-19050-01_ForstCoronation/Packages/manifest.json
  7. 4
      Unity-19050-01_ForstCoronation/ProjectSettings/ProjectVersion.txt
  8. 43
      Unity-19050-03_RoyalGallery_iPad/.gitignore
  9. 1
      Unity-19050-03_RoyalGallery_iPad/.gitkeep
  10. 9
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo.meta
  11. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Materials.meta
  12. 52
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Materials/cube360.mat
  13. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Materials/cube360.mat.meta
  14. 28
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Materials/sphere360.mat
  15. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Materials/sphere360.mat.meta
  16. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs.meta
  17. 195
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/360CubeVideo.prefab
  18. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/360CubeVideo.prefab.meta
  19. 224
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/360SphereVideo.prefab
  20. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/360SphereVideo.prefab.meta
  21. 113
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/AudioOutput.prefab
  22. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/AudioOutput.prefab.meta
  23. 174
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/BackgroundVideo.prefab
  24. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/BackgroundVideo.prefab.meta
  25. 82
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/FullscreenVideo.prefab
  26. 4
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Prefabs/FullscreenVideo.prefab.meta
  27. 9
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources.meta
  28. BIN
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVPro.png
  29. 47
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVPro.png.meta
  30. BIN
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVPro1.png
  31. 47
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVPro1.png.meta
  32. BIN
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVProVideoIcon.png
  33. 47
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/AVProVideoIcon.png.meta
  34. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders.meta
  35. 95
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Background-FullScreen.shader
  36. 9
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Background-FullScreen.shader.meta
  37. 123
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Background-FullScreenTransparent.shader
  38. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Background-FullScreenTransparent.shader.meta
  39. 63
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-BlendFrames.shader
  40. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-BlendFrames.shader.meta
  41. 179
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Helper-Transition.shader
  42. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Helper-Transition.shader.meta
  43. 107
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-IMGUI-Transparent.shader
  44. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-IMGUI-Transparent.shader.meta
  45. 91
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Lit-Diffuse.shader
  46. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Lit-Diffuse.shader.meta
  47. 92
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Lit-Transparent-Diffuse.shader
  48. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Lit-Transparent-Diffuse.shader.meta
  49. 140
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-AndroidOES.shader
  50. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-AndroidOES.shader.meta
  51. 141
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-Default-Stereo.shader
  52. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-Default-Stereo.shader.meta
  53. 174
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-Default-Transparent.shader
  54. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-UI-Default-Transparent.shader.meta
  55. 74
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit-AndroidOES.shader
  56. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit-AndroidOES.shader.meta
  57. 129
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit-Transparent.shader
  58. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit-Transparent.shader.meta
  59. 128
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit.shader
  60. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-Unlit.shader.meta
  61. 111
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-AndroidOES.shader
  62. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-AndroidOES.shader.meta
  63. 114
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-StereoUV.shader
  64. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-StereoUV.shader.meta
  65. 282
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-Transparent.shader
  66. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere-Transparent.shader.meta
  67. 201
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere.shader
  68. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo-VR-InsideSphere.shader.meta
  69. 306
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo.cginc
  70. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Resources/Shaders/AVProVideo.cginc.meta
  71. 9
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts.meta
  72. 9
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components.meta
  73. 283
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/ApplyToMaterial.cs
  74. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/ApplyToMaterial.cs.meta
  75. 384
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/ApplyToMesh.cs
  76. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/ApplyToMesh.cs.meta
  77. 121
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/AudioOutput.cs
  78. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/AudioOutput.cs.meta
  79. 397
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/CubemapCube.cs
  80. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/CubemapCube.cs.meta
  81. 271
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DebugOverlay.cs
  82. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DebugOverlay.cs.meta
  83. 60
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayBackground.cs
  84. 10
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayBackground.cs.meta
  85. 314
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayIMGUI.cs
  86. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayIMGUI.cs.meta
  87. 663
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayUGUI.cs
  88. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/DisplayUGUI.cs.meta
  89. 2233
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/MediaPlayer.cs
  90. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/MediaPlayer.cs.meta
  91. 901
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/PlaylistMediaPlayer.cs
  92. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/PlaylistMediaPlayer.cs.meta
  93. 129
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/StreamParser.cs
  94. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/StreamParser.cs.meta
  95. 76
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/SubtitlesUGUI.cs
  96. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/SubtitlesUGUI.cs.meta
  97. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/Support.meta
  98. 5
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/Support/NGUI.meta
  99. 182
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/Support/NGUI/ApplyToTextureWidgetNGUI.cs
  100. 8
      Unity-19050-03_RoyalGallery_iPad/Assets/AVProVideo/Scripts/Components/Support/NGUI/ApplyToTextureWidgetNGUI.cs.meta
  101. Some files were not shown because too many files have changed in this diff Show More

@ -120,6 +120,76 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &71898631
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 71898632}
- component: {fileID: 71898634}
- component: {fileID: 71898633}
m_Layer: 5
m_Name: CameraImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &71898632
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 71898631}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1473451374}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1920, y: 1080}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &71898633
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 71898631}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 8400000, guid: 50e0f911f359d4746b586e8c5d6cfa82, type: 2}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!222 &71898634
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 71898631}
m_CullTransparentMesh: 0
--- !u!1 &154044454
GameObject:
m_ObjectHideFlags: 0
@ -245,7 +315,7 @@ RectTransform:
m_Children:
- {fileID: 1859907172}
m_Father: {fileID: 1473451374}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -548,7 +618,6 @@ GameObject:
- component: {fileID: 590248848}
- component: {fileID: 590248847}
- component: {fileID: 590248850}
- component: {fileID: 590248851}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -597,7 +666,7 @@ Camera:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetTexture: {fileID: 8400000, guid: 50e0f911f359d4746b586e8c5d6cfa82, type: 2}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
@ -720,20 +789,6 @@ MonoBehaviour:
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0
--- !u!114 &590248851
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 590248846}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45099d624c1e6c14e9514f4e5ea1ed9c, type: 3}
m_Name:
m_EditorClassIdentifier:
_sourceTexture: {fileID: 0}
_alphaSupport: 1
--- !u!1 &706372899
GameObject:
m_ObjectHideFlags: 0
@ -826,6 +881,189 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &940676729
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 940676733}
- component: {fileID: 940676732}
- component: {fileID: 940676731}
- component: {fileID: 940676730}
m_Layer: 0
m_Name: MonitorCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &940676730
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 940676729}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
m_Name:
m_EditorClassIdentifier:
clearColorMode: 0
backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
clearDepth: 1
volumeLayerMask:
serializedVersion: 2
m_Bits: 1
volumeAnchorOverride: {fileID: 0}
antialiasing: 0
SMAAQuality: 2
dithering: 0
stopNaNs: 0
physicalParameters:
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
flipYMode: 0
fullscreenPassthrough: 0
allowDynamicResolution: 0
customRenderingSettings: 0
invertFaceCulling: 0
probeLayerMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPathCustomFrameSettings:
bitDatas:
data1: 69456063627037
data2: 4539628424389459968
lodBias: 1
lodBiasMode: 0
maximumLODLevel: 0
maximumLODLevelMode: 0
renderingPathCustomFrameSettingsOverrideMask:
mask:
data1: 0
data2: 0
defaultFrameSettings: 0
m_Version: 6
m_ObsoleteRenderingPath: 0
m_ObsoleteFrameSettings:
overrides: 0
enableShadow: 0
enableContactShadows: 0
enableShadowMask: 0
enableSSR: 0
enableSSAO: 0
enableSubsurfaceScattering: 0
enableTransmission: 0
enableAtmosphericScattering: 0
enableVolumetrics: 0
enableReprojectionForVolumetrics: 0
enableLightLayers: 0
enableExposureControl: 1
diffuseGlobalDimmer: 0
specularGlobalDimmer: 0
shaderLitMode: 0
enableDepthPrepassWithDeferredRendering: 0
enableTransparentPrepass: 0
enableMotionVectors: 0
enableObjectMotionVectors: 0
enableDecals: 0
enableRoughRefraction: 0
enableTransparentPostpass: 0
enableDistortion: 0
enablePostprocess: 0
enableOpaqueObjects: 0
enableTransparentObjects: 0
enableRealtimePlanarReflection: 0
enableMSAA: 0
enableAsyncCompute: 0
runLightListAsync: 0
runSSRAsync: 0
runSSAOAsync: 0
runContactShadowsAsync: 0
runVolumeVoxelizationAsync: 0
lightLoopSettings:
overrides: 0
enableDeferredTileAndCluster: 0
enableComputeLightEvaluation: 0
enableComputeLightVariants: 0
enableComputeMaterialVariants: 0
enableFptlForForwardOpaque: 0
enableBigTilePrepass: 0
isFptlEnabled: 0
--- !u!81 &940676731
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 940676729}
m_Enabled: 1
--- !u!20 &940676732
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 940676729}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_AllowMSAA: 0
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &940676733
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 940676729}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 54.324394, y: -41.333282, z: 100.27602}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1111578216
GameObject:
m_ObjectHideFlags: 0
@ -881,8 +1119,8 @@ MonoBehaviour:
m_ExecuteInEditor: 1
m_Bindings:
- {fileID: 1111578222}
- {fileID: 1111578227}
- {fileID: 1111578217}
- {fileID: 1111578227}
m_VisualEffect: {fileID: 1111578220}
--- !u!73398921 &1111578219
VFXRenderer:
@ -1059,82 +1297,6 @@ MonoBehaviour:
m_Parameter:
m_Name: _Emitter
Target: {fileID: 1324214450}
--- !u!114 &1279790688
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3df29e7cc05fbec4aa43e06ea875565d, type: 3}
m_Name:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 0
rotation:
m_OverrideState: 0
m_Value: 0
min: 0
max: 360
skyIntensityMode:
m_OverrideState: 0
m_Value: 0
exposure:
m_OverrideState: 0
m_Value: 0
multiplier:
m_OverrideState: 0
m_Value: 1
min: 0
upperHemisphereLuxValue:
m_OverrideState: 0
m_Value: 1
min: 0
desiredLuxValue:
m_OverrideState: 0
m_Value: 20000
updateMode:
m_OverrideState: 0
m_Value: 0
updatePeriod:
m_OverrideState: 0
m_Value: 0
min: 0
includeSunInBaking:
m_OverrideState: 0
m_Value: 0
sunSize:
m_OverrideState: 0
m_Value: 0.04
min: 0
max: 1
sunSizeConvergence:
m_OverrideState: 0
m_Value: 5
min: 1
max: 10
atmosphereThickness:
m_OverrideState: 0
m_Value: 1
min: 0
max: 5
skyTint:
m_OverrideState: 0
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
hdr: 0
showAlpha: 1
showEyeDropper: 1
groundColor:
m_OverrideState: 0
m_Value: {r: 0.369, g: 0.349, b: 0.341, a: 1}
hdr: 0
showAlpha: 1
showEyeDropper: 1
enableSunDisk:
m_OverrideState: 0
m_Value: 1
--- !u!1 &1324214445
GameObject:
m_ObjectHideFlags: 0
@ -1275,7 +1437,7 @@ PrefabInstance:
- target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8,
type: 3}
propertyPath: AddTuioBlobEvent.m_PersistentCalls.m_Calls.Array.size
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8,
type: 3}
@ -1285,7 +1447,7 @@ PrefabInstance:
- target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8,
type: 3}
propertyPath: RemoveTuioBlobEvent.m_PersistentCalls.m_Calls.Array.size
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114540009425154000, guid: 1f68bf7cec2600e49a46d2f0554453c8,
type: 3}
@ -1444,6 +1606,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 71898632}
- {fileID: 159340526}
m_Father: {fileID: 0}
m_RootOrder: 8
@ -1493,8 +1656,8 @@ MonoBehaviour:
Emitter_x: 2.5
Target_x: -2.5
growingSpeed: 0.015
fadeSpeed: 0
smooth: 0
fadeSpeed: 15
smooth: 0.3
--- !u!4 &1482770261
Transform:
m_ObjectHideFlags: 0
@ -1509,6 +1672,51 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1674836082
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1674836084}
- component: {fileID: 1674836083}
m_Layer: 0
m_Name: UnitySpout
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1674836083
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1674836082}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 45099d624c1e6c14e9514f4e5ea1ed9c, type: 3}
m_Name:
m_EditorClassIdentifier:
_sourceTexture: {fileID: 8400000, guid: 50e0f911f359d4746b586e8c5d6cfa82, type: 2}
_alphaSupport: 1
--- !u!4 &1674836084
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1674836082}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1743590121
GameObject:
m_ObjectHideFlags: 0
@ -1869,7 +2077,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Profile: {fileID: 11400000, guid: 61403f0eeedb6b84fafb386b66e1edae, type: 2}
m_StaticLightingSkyUniqueID: 2
m_SkySettings: {fileID: 1279790688}
m_SkySettings: {fileID: 2056071514}
m_SkySettingsFromProfile: {fileID: -3409118194237871670, guid: 61403f0eeedb6b84fafb386b66e1edae,
type: 2}
--- !u!114 &1937584651
@ -1995,3 +2203,79 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2056071514
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3df29e7cc05fbec4aa43e06ea875565d, type: 3}
m_Name:
m_EditorClassIdentifier:
active: 1
m_AdvancedMode: 0
rotation:
m_OverrideState: 0
m_Value: 0
min: 0
max: 360
skyIntensityMode:
m_OverrideState: 0
m_Value: 0
exposure:
m_OverrideState: 0
m_Value: 0
multiplier:
m_OverrideState: 0
m_Value: 1
min: 0
upperHemisphereLuxValue:
m_OverrideState: 0
m_Value: 1
min: 0
desiredLuxValue:
m_OverrideState: 0
m_Value: 20000
updateMode:
m_OverrideState: 0
m_Value: 0
updatePeriod:
m_OverrideState: 0
m_Value: 0
min: 0
includeSunInBaking:
m_OverrideState: 0
m_Value: 0
sunSize:
m_OverrideState: 0
m_Value: 0.04
min: 0
max: 1
sunSizeConvergence:
m_OverrideState: 0
m_Value: 5
min: 1
max: 10
atmosphereThickness:
m_OverrideState: 0
m_Value: 1
min: 0
max: 5
skyTint:
m_OverrideState: 0
m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1}
hdr: 0
showAlpha: 1
showEyeDropper: 1
groundColor:
m_OverrideState: 0
m_Value: {r: 0.369, g: 0.349, b: 0.341, a: 1}
hdr: 0
showAlpha: 1
showEyeDropper: 1
enableSunDisk:
m_OverrideState: 0
m_Value: 1

@ -4,6 +4,7 @@ using UnityEngine;
using UnityEngine.Experimental.VFX;
using UnityEngine.UI;
using UltraCombos.Configuration;
using TUIO;
public class DebugUI : MonoBehaviour
{
@ -24,6 +25,10 @@ public class DebugUI : MonoBehaviour
[Range(-5f, 0f)]
public float Target_x = -2.5f;
[Config]
[Range(-3f, 3f)]
public float Common_z = 0f;
[Config]
[Range(0f, 0.02f)]
public float growingSpeed;
@ -41,6 +46,7 @@ public class DebugUI : MonoBehaviour
float lerp_val;
Vector3 final_pos;
bool showObject;
int cur_blob_count, pre_blob_count;
void Start()
{
@ -50,12 +56,26 @@ public class DebugUI : MonoBehaviour
spawn_t = 0;
total_t = 0;
lerp_val = 0;
cur_blob_count = 0;
}
// Update is called once per frame
void Update()
{
pre_blob_count = cur_blob_count;
cur_blob_count = TUIOManager.Instance.touches.Count;
if(cur_blob_count == 0 && stat == "completed")
{
enterVanish();
}
else if (cur_blob_count > 0 && stat == "wait")
{
enterGrow();
}
updateVFX();
if (Input.GetKeyDown(KeyCode.A))
{
debugMode = !debugMode;
@ -92,7 +112,7 @@ public class DebugUI : MonoBehaviour
else if(stat == "vanishing")
{
vfx.SetBool("isEnteringVanish", false);
lerp_val -= growingSpeed;
lerp_val -= growingSpeed * 0.4f;
if(lerp_val <= 0)
{
lerp_val = 0;
@ -106,11 +126,10 @@ public class DebugUI : MonoBehaviour
lerp_val = Mathf.Clamp(lerp_val, 0, 1);
vfx.SetFloat("_LerpVal", lerp_val);
Transform base_trans = baseEmitter.GetComponent<Transform>();
Transform targ_trans = target.GetComponent<Transform>();
base_trans.position = new Vector3(Emitter_x, 0, 0);
targ_trans.position = new Vector3(Target_x, 0, 0);
base_trans.position = new Vector3(Emitter_x, 0, Common_z);
targ_trans.position = new Vector3(Target_x, 0, Common_z);
emitter.GetComponent<Transform>().position = Vector3.Lerp(base_trans.position, targ_trans.position, lerp_val);
}
@ -130,17 +149,18 @@ public class DebugUI : MonoBehaviour
{
enterVanish();
}
button.GetComponent<Text>().text = stat;
}
public void enterGrow()
{
setButtonInteractable(false);
spawn_t = total_t;
stat = "growing";
vfx.SendEvent("MouseDown");
vfx.SetBool("isGrowing", true);
button.GetComponent<Text>().text = stat;
Debug.Log(stat);
}
@ -151,6 +171,7 @@ public class DebugUI : MonoBehaviour
stat = "vanishing";
vfx.SendEvent("MouseUp");
vfx.SetBool("isGrowing", false);
button.GetComponent<Text>().text = stat;
Debug.Log(stat);
}

@ -0,0 +1,37 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: camera_tex
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1920
m_Height: 1200
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 50e0f911f359d4746b586e8c5d6cfa82
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

@ -1,7 +1,7 @@
{
"dependencies": {
"com.ultracombos.grpc": "file:<project>/../../../_Package/com.ultracombos.grpc",
"com.ultracombos.configuration": "file:<project>/../../../_Package/com.ultracombos.configuration",
"com.ultracombos.configuration": "file:<project>/../../../_Package/com.ultracombos.configuration",
"com.ultracombos.grpc": "file:<project>/../../../_Package/com.ultracombos.grpc",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.1.0",

@ -1,2 +1,2 @@
m_EditorVersion: 2019.2.12f1
m_EditorVersionWithRevision: 2019.2.12f1 (b1a7e1fb4fa5)
m_EditorVersion: 2019.2.13f1
m_EditorVersionWithRevision: 2019.2.13f1 (e20f6c7e5017)

@ -0,0 +1,43 @@
/.vscode/
/Logs/
/Packages/com.ultracombos.template
# Created by https://www.gitignore.io/api/unity
### Unity ###
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
# Visual Studio 2015 cache directory
/.vs/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
# Unity3D generated meta files
*.pidb.meta
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# End of https://www.gitignore.io/api/unity

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 031025b1a4246d34fa19abd547244d14
folderAsset: yes
timeCreated: 1541620985
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: bb52e262d07b2d44d867f77a1be49439
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,52 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: cube360
m_Shader: {fileID: 4800000, guid: 1ca6555d94ddb204c87e9fe549085b3c, type: 3}
m_ShaderKeywords:
- STEREO_NONE
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ChromaTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: Stereo
second: 0
data:
first:
name: _StereoDebug
second: 0
data:
first:
name: _ApplyGamma
second: 0
data:
first:
name: _UseYpCbCr
second: 0
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 528f5620ff3f26b428baf78fbf6ed558
NativeFormatImporter:
userData:

@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: sphere360
m_Shader: {fileID: 4800000, guid: 46b84ca7ab6291e4fb6c57ac48d01e8f, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 17b8b08ed638ac04a9e726c6ec0cea35
NativeFormatImporter:
userData:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 107a33f32a4dd694ab9ed5c0c7a035c6
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,195 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &149002
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 449002}
m_Layer: 0
m_Name: 360CubeVideo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &149004
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 449004}
- 114: {fileID: 11449004}
m_Layer: 0
m_Name: AVPro Video Media Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &149006
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 449006}
- 23: {fileID: 2388718}
- 33: {fileID: 3388718}
- 114: {fileID: 11488718}
m_Layer: 0
m_Name: Cube
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &449002
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149002}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 449006}
- {fileID: 449004}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!4 &449004
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149004}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 449002}
m_RootOrder: 1
--- !u!4 &449006
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149006}
m_LocalRotation: {x: 0, y: 1, z: 0, w: -4.37113883e-08}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 10, z: 10}
m_Children: []
m_Father: {fileID: 449002}
m_RootOrder: 0
--- !u!23 &2388718
Renderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149006}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 2100000, guid: 528f5620ff3f26b428baf78fbf6ed558, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &3388718
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149006}
m_Mesh: {fileID: 0}
--- !u!114 &11449004
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 638c870cac4da414fba921606d504407, type: 3}
m_Name:
m_EditorClassIdentifier:
m_VideoLocation: 2
m_VideoPath:
m_AutoOpen: 1
m_AutoStart: 1
m_Loop: 1
m_Volume: 1
m_Muted: 0
m_PlaybackRate: 1
m_DebugGui: 0
m_Persistent: 0
m_StereoPacking: 0
m_DisplayDebugStereoColorTint: 0
m_FilterMode: 1
m_WrapMode: 1
m_AnisoLevel: 0
m_events:
m_PersistentCalls:
m_Calls: []
m_TypeName: RenderHeads.Media.AVProVideo.MediaPlayerEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
_optionsWindows:
overridePath: 0
pathLocation: 2
path:
forceDirectShowApi: 0
forceAudioOutputDeviceName:
_optionsMacOSX:
overridePath: 0
pathLocation: 2
path:
_optionsIOS:
overridePath: 0
pathLocation: 2
path:
_optionsTVOS:
overridePath: 0
pathLocation: 2
path:
_optionsAndroid:
overridePath: 0
pathLocation: 2
path:
--- !u!114 &11488718
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 149006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 683e7713922f8044c81bf497a0b5887e, type: 3}
m_Name:
m_EditorClassIdentifier:
_material: {fileID: 2100000, guid: 528f5620ff3f26b428baf78fbf6ed558, type: 2}
_mediaPlayer: {fileID: 11449004}
expansion_coeff: 1.00999999
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 149002}
m_IsPrefabParent: 1
m_IsExploded: 1

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 5cc7e20810735fc46ab7b17491990099
NativeFormatImporter:
userData:

@ -0,0 +1,224 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &127526
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 427526}
- 33: {fileID: 3327526}
- 23: {fileID: 2327526}
- 114: {fileID: 11404242}
- 114: {fileID: 11476996}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &198420
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 498420}
m_Layer: 0
m_Name: 360SphereVideo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &198424
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 498424}
- 114: {fileID: 11498420}
m_Layer: 0
m_Name: AVPro Video Media Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &427526
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127526}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5, y: 5, z: 5}
m_Children: []
m_Father: {fileID: 498420}
m_RootOrder: 0
--- !u!4 &498420
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 198420}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 427526}
- {fileID: 498424}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!4 &498424
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 198424}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 498420}
m_RootOrder: 1
--- !u!23 &2327526
Renderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127526}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 2100000, guid: 17b8b08ed638ac04a9e726c6ec0cea35, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &3327526
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127526}
m_Mesh: {fileID: 4300000, guid: c8b055314efcb4b4dbd29f97a847fc4c, type: 2}
--- !u!114 &11404242
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127526}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4ed685e8c5f1f584aa28b32dcf9bdab1, type: 3}
m_Name:
m_EditorClassIdentifier:
_camera: {fileID: 0}
_renderer: {fileID: 2327526}
--- !u!114 &11476996
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 127526}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f6d1977a52888584496b1acc7e998011, type: 3}
m_Name:
m_EditorClassIdentifier:
_offset: {x: 0, y: 0}
_scale: {x: 1, y: 1}
_mesh: {fileID: 2327526}
_media: {fileID: 11498420}
_defaultTexture: {fileID: 0}
--- !u!114 &11498420
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 198424}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 638c870cac4da414fba921606d504407, type: 3}
m_Name:
m_EditorClassIdentifier:
m_VideoLocation: 2
m_VideoPath:
m_AutoOpen: 1
m_AutoStart: 1
m_Loop: 1
m_Volume: 1
m_Muted: 0
m_PlaybackRate: 1
m_DebugGui: 0
m_Persistent: 0
m_StereoPacking: 0
m_AlphaPacking: 0
m_DisplayDebugStereoColorTint: 0
m_FilterMode: 1
m_WrapMode: 1
m_AnisoLevel: 0
m_events:
m_PersistentCalls:
m_Calls: []
m_TypeName: RenderHeads.Media.AVProVideo.MediaPlayerEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
_optionsWindows:
overridePath: 0
pathLocation: 2
path:
forceDirectShowApi: 0
forceAudioOutputDeviceName:
_optionsMacOSX:
overridePath: 0
pathLocation: 2
path:
_optionsIOS:
overridePath: 0
pathLocation: 2
path:
_optionsTVOS:
overridePath: 0
pathLocation: 2
path:
_optionsAndroid:
overridePath: 0
pathLocation: 2
path:
_optionsWindowsPhone:
overridePath: 0
pathLocation: 2
path:
_optionsWindowsUWP:
overridePath: 0
pathLocation: 2
path:
_optionsWebGL:
overridePath: 0
pathLocation: 2
path:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 198420}
m_IsPrefabParent: 1
m_IsExploded: 1

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 5a12218ea7e5b7a4e8b89d25e07d237d
NativeFormatImporter:
userData:

@ -0,0 +1,113 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &162392
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 462392}
- 114: {fileID: 11462392}
- 82: {fileID: 8262392}
m_Layer: 0
m_Name: AudioOutput
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &462392
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 162392}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!82 &8262392
AudioSource:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 162392}
m_Enabled: 1
serializedVersion: 3
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
m_PreInfinity: 2
m_PostInfinity: 2
--- !u!114 &11462392
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 162392}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3b05a64a5de3f8546bf586f42e37b979, type: 3}
m_Name:
m_EditorClassIdentifier:
_mediaPlayer: {fileID: 0}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 162392}
m_IsPrefabParent: 1
m_IsExploded: 1

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 23fac3371501b864a8a2468ac0bef6f3
NativeFormatImporter:
userData:

@ -0,0 +1,174 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &166464
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 466464}
m_Layer: 0
m_Name: BackgroundVideo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &166466
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 466466}
- 33: {fileID: 3366464}
- 23: {fileID: 2366464}
- 114: {fileID: 11466464}
m_Layer: 0
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &166468
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 466468}
- 114: {fileID: 11466466}
m_Layer: 0
m_Name: AVPro Video Media Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &466464
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166464}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 466468}
- {fileID: 466466}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!4 &466466
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166466}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 466464}
m_RootOrder: 1
--- !u!4 &466468
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166468}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 466464}
m_RootOrder: 0
--- !u!23 &2366464
Renderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166466}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 2100000, guid: 7ccf4b555441d554484bbe799cb1c834, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &3366464
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166466}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &11466464
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166466}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f6d1977a52888584496b1acc7e998011, type: 3}
m_Name:
m_EditorClassIdentifier:
_mesh: {fileID: 2366464}
_media: {fileID: 11466466}
_defaultTexture: {fileID: 0}
--- !u!114 &11466466
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 166468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 638c870cac4da414fba921606d504407, type: 3}
m_Name:
m_EditorClassIdentifier:
m_VideoLocation: 2
m_VideoPath:
m_AutoOpen: 1
m_AutoStart: 1
m_Loop: 1
m_Volume: 1
m_Muted: 0
m_DebugGui: 0
m_events:
m_PersistentCalls:
m_Calls: []
m_TypeName: RenderHeads.Media.AVProVideo.MediaPlayerEvent, Assembly-CSharp, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_platformVideoPathOverride: 0000000000
m_platformVideoPath:
-
-
-
-
-
m_platformVideoLocation: 0000000000000000000000000000000000000000
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 166464}
m_IsPrefabParent: 1
m_IsExploded: 1

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 5dbef7d4930a98e4186b12a1b5f2cda6
NativeFormatImporter:
userData:

@ -0,0 +1,82 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &192192
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 492192}
- 114: {fileID: 11492190}
- 114: {fileID: 11492192}
m_Layer: 0
m_Name: FullscreenVideo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &492192
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 192192}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!114 &11492190
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 192192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 638c870cac4da414fba921606d504407, type: 3}
m_Name:
m_EditorClassIdentifier:
m_VideoPath:
m_AutoOpen: 1
m_AutoStart: 1
m_Loop: 0
m_Volume: 1
m_Muted: 0
m_DebugGui: 0
--- !u!114 &11492192
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 192192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 75f3b319d2d69934d8bf545ab45c918d, type: 3}
m_Name:
m_EditorClassIdentifier:
_mediaPlayer: {fileID: 11492190}
_scaleMode: 2
_color: {r: 1, g: 1, b: 1, a: 1}
_alphaBlend: 0
_fullScreen: 1
_depth: 0
_x: 0
_y: 0
_width: 1
_height: 1
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 192192}
m_IsPrefabParent: 1
m_IsExploded: 1

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 84fd971487e311c45a6573a72503271c
NativeFormatImporter:
userData:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 870241155d4fedc4a86fa89eb85ae5c3
folderAsset: yes
timeCreated: 1449047212
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 8bef6179fcd26aa4c89b766c6b95490a
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 2
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: 855eae39e9698944daf581d77f6cef3c
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: 2
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -0,0 +1,47 @@
fileFormatVersion: 2
guid: bb83b41b53a59874692b83eab5873998
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 1
correctGamma: 1
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: e04bc3dc12a5117428fce7e0f1245bd9
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,95 @@
Shader "AVProVideo/Background/Full Screen"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
_ChromaTex ("Chroma", 2D) = "gray" {}
_Color("Main Color", Color) = (1,1,1,1)
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "Queue" = "Background" "RenderType"="Opaque" }
LOD 100
Cull Off
ZWrite Off
ZTest Always
Lighting Off
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it uses non-square matrices
#pragma exclude_renderers gles
#pragma vertex vert
#pragma fragment frag
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform fixed4 _Color;
v2f vert(appdata_img v)
{
v2f o;
float2 scale = ScaleZoomToFit(_ScreenParams.x, _ScreenParams.y, _MainTex_TexelSize.z, _MainTex_TexelSize.w);
float2 pos = ((v.vertex.xy) * scale * 2.0);
// we're rendering with upside-down flipped projection,
// so flip the vertical UV coordinate too
if (_ProjectionParams.x < 0.0)
{
pos.y = (1.0 - pos.y) - 1.0;
}
o.vertex = float4(pos.xy, UNITY_NEAR_CLIP_VALUE, 1.0);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, i.uv).r, tex2D(_ChromaTex, i.uv).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, i.uv).r, tex2D(_ChromaTex, i.uv).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
// Sample the texture
fixed4 col = tex2D(_MainTex, i.uv);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
col *= _Color;
return fixed4(col.rgb, 1.0);
}
ENDCG
}
}
}

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 71eb101954888314ba2a8b9fe74e1cae
timeCreated: 1447418752
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,123 @@
Shader "AVProVideo/Background/Full Screen Transparent"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
_ChromaTex("Chroma", 2D) = "gray" {}
_Color("Main Color", Color) = (1,1,1,1)
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "Queue"="Background+1" "RenderType" = "Transparent" }
LOD 100
Cull Off
ZWrite Off
ZTest Always
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct v2f
{
float4 vertex : SV_POSITION;
float4 uv : TEXCOORD0;
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform fixed4 _Color;
v2f vert (appdata_img v)
{
v2f o;
float2 scale = ScaleZoomToFit(_ScreenParams.x, _ScreenParams.y, _MainTex_TexelSize.z, _MainTex_TexelSize.w);
float2 pos = ((v.vertex.xy) * scale * 2.0);
// we're rendering with upside-down flipped projection,
// so flip the vertical UV coordinate too
if (_ProjectionParams.x < 0.0)
{
pos.y = (1.0 - pos.y) - 1.0;
}
o.vertex = float4(pos.xy, UNITY_NEAR_CLIP_VALUE, 1.0);
o.uv.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
// Horrible hack to undo the scale transform to fit into our UV packing layout logic...
if (_MainTex_ST.y < 0.0)
{
o.uv.y = 1.0 - o.uv.y;
}
o.uv = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, o.uv.xy, _MainTex_ST.y < 0.0);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, i.uv.xy).r, tex2D(_ChromaTex, i.uv.xy).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, i.uv.xy).r, tex2D(_ChromaTex, i.uv.xy).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
// Sample RGB
fixed4 col = tex2D(_MainTex, i.uv.xy);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
// Sample the alpha
#if USE_YPCBCR
col.a = tex2D(_MainTex, i.uv.zw).r;
#else
fixed4 alpha = tex2D(_MainTex, i.uv.zw);
#if APPLY_GAMMA
alpha.rgb = GammaToLinear(alpha.rgb);
#endif
col.a = (alpha.r + alpha.g + alpha.b) / 3.0;
#endif
#endif
col *= _Color;
return col;
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 38b28fc6a6d12d144bf6d6de820d83ce
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,63 @@
//-----------------------------------------------------------------------------
// Copyright 2014-2017 RenderHeads Ltd. All rights reserved.
//-----------------------------------------------------------------------------
Shader "AVProVideo/BlendFrames"
{
Properties
{
_MainTex("Before Texture", 2D) = "white" {}
_AfterTex("After Texture", 2D) = "white" {}
_t("t", Float) = 0.5
}
SubShader
{
Pass
{
ZTest Always Cull Off ZWrite Off
Fog{ Mode off }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma exclude_renderers flash xbox360 ps3 gles
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
uniform sampler2D _MainTex;
uniform sampler2D _AfterTex;
uniform float _t;
struct v2f
{
float4 pos : POSITION;
float4 uv : TEXCOORD0;
};
v2f vert(appdata_img v)
{
v2f o;
o.uv = float4(0.0, 0.0, 0.0, 0.0);
o.pos = XFormObjectToClip(v.vertex);
o.uv.xy = v.texcoord.xy;
return o;
}
float4 frag(v2f i) : COLOR
{
float4 before = tex2D(_MainTex, i.uv.xy);
float4 after = tex2D(_AfterTex, i.uv.xy);
float4 result = ((1.0 -_t) * before) + (_t * after);
return result;
}
ENDCG
}
}
FallBack Off
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 8ebaafdbf44b0b9489f20bc27374d187
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,179 @@
Shader "AVProVideo/Helper/Transition"
{
Properties
{
_MainTex ("Texture To", 2D) = "white" {}
_FromTex ("Texture From", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile LERP_NONE LERP_FADE LERP_BLACK LERP_WHITE LERP_TRANSP LERP_HORIZ LERP_HORIZ_MIRROR LERP_VERT LERP_VERT_MIRROR LERP_DIAG LERP_DIAG_MIRROR LERP_CIRCLE LERP_SCROLL_VERT LERP_SCROLL_HORIZ LERP_DIAMOND LERP_BLINDS LERP_RECTS_VERT LERP_ARROW LERP_SLIDE_HORIZ LERP_SLIDE_VERT LERP_ZOOM_FADE
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
sampler2D _FromTex;
float4 _MainTex_ST;
float4 _FromTex_ST;
float _Fade;
v2f vert (appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv1 = i.uv;
float2 uv2 = i.uv;
#if LERP_FADE
float t = _Fade;
#elif LERP_BLACK
float t = _Fade;
if (t < 0.5)
{
return lerp(tex2D(_FromTex, uv1), float4(0.0, 0.0, 0.0, 1.0), t * 2.0);
}
else
{
return lerp(float4(0.0, 0.0, 0.0, 1.0), tex2D(_MainTex, uv2), 2.0 * (t - 0.5));
}
#elif LERP_WHITE
float t = _Fade;
if (t < 0.5)
{
return lerp(tex2D(_FromTex, uv1), float4(1.0, 1.0, 1.0, 1.0), t * 2.0);
}
else
{
return lerp(float4(1.0, 1.0, 1.0, 1.0), tex2D(_MainTex, uv2), 2.0 * (t - 0.5));
}
#elif LERP_TRANSP
float t = _Fade;
if (t < 0.5)
{
return lerp(tex2D(_FromTex, uv1), float4(0.0, 0.0, 0.0, 0.0), t * 2.0);
}
else
{
return lerp(float4(0.0, 0.0, 0.0, 0.0), tex2D(_MainTex, uv2), 2.0 * (t - 0.5));
}
#elif LERP_HORIZ
float t = step(i.uv.x, _Fade);
#elif LERP_HORIZ_MIRROR
float t = step(abs(i.uv.x - 0.5), _Fade);
#elif LERP_VERT
float t = step(i.uv.y, _Fade);
#elif LERP_VERT_MIRROR
float t = step(abs(i.uv.y - 0.5), _Fade);
#elif LERP_DIAG
float t = step((i.uv.y+i.uv.x)*0.5, _Fade);
#elif LERP_DIAG_MIRROR
float t = step(abs(i.uv.y - i.uv.x), _Fade);
#elif LERP_CIRCLE
float t = distance(float2(i.uv.x*1.777, i.uv.y), float2(0.5*1.7777, 0.5));
t = step(t, _Fade*2.1);
#elif LERP_SCROLL_VERT
float t = _Fade;
uv1.y += _Fade;
t = step(1 - uv1.y, 0);
#elif LERP_SCROLL_HORIZ
float t = _Fade;
uv1.x += _Fade;
t = step(1 - uv1.x, 0);
#elif LERP_DIAMOND
float2 origin = float2(0.5 * 1.7777, 0.5);
float t = abs(uv1.x*1.7777 - origin.x);
t += abs(uv1.y - origin.y);
t = step(t, _Fade*1.4);
#elif LERP_BLINDS
float x = frac(uv1.x*4.0);
float t = step(x, _Fade);
#elif LERP_ARROW
// Arrow
float y = abs(i.uv.y - 0.5) * 0.5;
float x = lerp(0.5, 1.0, i.uv.x);
float t = step(x, y + _Fade);
#elif LERP_SLIDE_HORIZ
// Slide horiz
float t = _Fade;
uv1.x += _Fade;
uv2.x -= 1.0 - _Fade;
t = step(1 - uv1.x, 0);
#elif LERP_SLIDE_VERT
// slide vert
float t = _Fade;
uv1.y += _Fade;
uv2.y -= 1.0 - _Fade;
t = step(1 - uv1.y, 0);
#elif LERP_ZOOM_FADE
// zoom-fade
float scale = lerp(1.0, 0.15, _Fade);
float scale2 = lerp(1.0, 0.15, 1.0-_Fade);
uv1 -= 0.5;
uv2 -= 0.5;
uv1 *= scale;
uv2 *= scale2;
uv1 += 0.5;
uv2 += 0.5;
float t = smoothstep(0.5, 1.0, _Fade);
#elif LERP_RECTS_VERT
float x = uv1.x;
float bf = _Fade / 1.5;
bf = frac(uv1.y * 8.0);
bf = (int)fmod(uv1.y * 8.0, 8.0);
bf += 1.0;
bf *= _Fade / 2.0;
float t = step(abs(x - 0.5), bf);
#endif
#if LERP_NONE
return tex2D(_MainTex, uv1);
#else
float4 cola = tex2D(_FromTex, uv1);
float4 colb = tex2D(_MainTex, uv2);
float4 col = lerp(cola, colb, t);
return col;
#endif
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 73f378cafe7b4a745907b70e76bb3259
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,107 @@
Shader "AVProVideo/IMGUI/Texture Transparent"
{
Properties
{
_MainTex("Texture", any) = "" {}
_ChromaTex("Chroma", any) = "" {}
_VertScale("Vertical Scale", Range(-1, 1)) = 1.0
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "ForceSupported" = "True" "RenderType" = "Overlay" }
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
ZWrite Off
ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct appdata_t
{
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float4 texcoord : TEXCOORD0;
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform float _VertScale;
v2f vert(appdata_t v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
o.color = v.color;
o.texcoord = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, TRANSFORM_TEX(v.texcoord, _MainTex), _VertScale < 0.0);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, i.texcoord.xy).r, tex2D(_ChromaTex, i.texcoord.xy).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, i.texcoord.xy).r, tex2D(_ChromaTex, i.texcoord.xy).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
// Sample RGB
fixed4 col = tex2D(_MainTex, i.texcoord.xy);
#endif
#if APPLY_GAMMA
col.rgb = LinearToGamma(col.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
// Sample the alpha
#if USE_YPCBCR
col.a = tex2D(_MainTex, i.texcoord.zw).r;
#else
fixed4 alpha = tex2D(_MainTex, i.texcoord.zw);
#if APPLY_GAMMA
alpha.rgb = LinearToGamma(alpha.rgb);
#endif
col.a = (alpha.r + alpha.g + alpha.b) / 3.0;
#endif
#endif
return col * i.color;
}
ENDCG
}
}
Fallback off
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: d1085d25f9ef09b4c91188f9f99f37a2
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,91 @@
Shader "AVProVideo/Lit/Diffuse (texture+color+fog+stereo support)"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
_ChromaTex("Chroma", 2D) = "white" {}
[KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo("Stereo Mode", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Geometry" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:VertexFunction
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "AVProVideo.cginc"
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform fixed4 _Color;
uniform float3 _cameraPosition;
struct Input
{
float2 uv_MainTex;
float4 color;
};
void VertexFunction(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
float4 scaleOffset = GetStereoScaleOffset(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz), true);
o.uv_MainTex = v.texcoord.xy *= scaleOffset.xy;
o.uv_MainTex = v.texcoord.xy += scaleOffset.zw;
#elif STEREO_CUSTOM_UV
o.uv_MainTex = v.texcoord.xy;
if (!IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz))
{
o.uv_MainTex = v.texcoord1.xy;
}
#endif
o.color = _Color;
#if STEREO_DEBUG
o.color *= GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
}
void surf(Input IN, inout SurfaceOutput o)
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, IN.uv_MainTex).r, tex2D(_ChromaTex, IN.uv_MainTex).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, IN.uv_MainTex).r, tex2D(_ChromaTex, IN.uv_MainTex).ra);
#endif
fixed4 c = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0f);
#else
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
#endif
#if APPLY_GAMMA
c.rgb = GammaToLinear(c.rgb);
#endif
c *= IN.color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Legacy Shaders/Transparent/VertexLit"
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 06b0cff0150d7eb41b3d269f7e11daa3
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,92 @@
Shader "AVProVideo/Lit/Transparent Diffuse (texture+color+fog+packed alpha)"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "black" {}
_ChromaTex("Chroma", 2D) = "black" {}
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 200
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
CGPROGRAM
#pragma surface surf Lambert vertex:VertexFunction alpha
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "AVProVideo.cginc"
uniform sampler2D _MainTex;
//uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform fixed4 _Color;
uniform float3 _cameraPosition;
struct Input
{
float4 texcoords;
};
void VertexFunction(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
o.texcoords = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, v.texcoord.xy, true);// _MainTex_ST.y < 0.0);
}
void surf(Input IN, inout SurfaceOutput o)
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoords.xy).r, tex2D(_ChromaTex, IN.texcoords.xy).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoords.xy).r, tex2D(_ChromaTex, IN.texcoords.xy).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0f);
#else
fixed4 col = tex2D(_MainTex, IN.texcoords.xy);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
// Sample the alpha
#if USE_YPCBCR
col.a = tex2D(_MainTex, IN.texcoords.zw).r;
#else
fixed4 alpha = tex2D(_MainTex, IN.texcoords.zw);
#if APPLY_GAMMA
alpha.rgb = GammaToLinear(alpha.rgb);
#endif
col.a = (alpha.r + alpha.g + alpha.b) / 3.0;
#endif
#endif
col *= _Color;
o.Albedo = col.rgb;
o.Alpha = col.a;
}
ENDCG
}
Fallback "Legacy Shaders/Transparent/VertexLit"
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 751148eda67f7b34fbd51bfb7951084f
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,140 @@
Shader "AVProVideo/UI/AndroidOES"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
[PerRendererData] _ChromaTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
_StencilComp("Stencil Comparison", Float) = 8
_Stencil("Stencil ID", Float) = 0
_StencilOp("Stencil Operation", Float) = 0
_StencilWriteMask("Stencil Write Mask", Float) = 255
_StencilReadMask("Stencil Read Mask", Float) = 255
_ColorMask("Color Mask", Float) = 15
[KeywordEnum(None, Top_Bottom, Left_Right)] Stereo("Stereo Mode", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Stencil
{
Ref[_Stencil]
Comp[_StencilComp]
Pass[_StencilOp]
ReadMask[_StencilReadMask]
WriteMask[_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest[unity_GUIZTestMode]
Fog{ Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask[_ColorMask]
Pass
{
GLSLPROGRAM
#pragma only_renderers gles gles3
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : enable
precision mediump float;
#ifdef VERTEX
#include "UnityCG.glslinc"
#define SHADERLAB_GLSL
#include "AVProVideo.cginc"
uniform mat4 _ViewMatrix;
uniform vec3 _cameraPosition;
varying vec2 texVal;
#if defined(STEREO_DEBUG)
varying vec4 tint;
#endif
void main()
{
gl_Position = XFormObjectToClip(gl_Vertex);
texVal = gl_MultiTexCoord0.xy;
texVal.y = 1.0 - texVal.y;
#if defined(STEREO_TOP_BOTTOM) | defined(STEREO_LEFT_RIGHT)
bool isLeftEye = IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz);
vec4 scaleOffset = GetStereoScaleOffset(isLeftEye, false);
texVal.xy *= scaleOffset.xy;
texVal.xy += scaleOffset.zw;
#elif defined (STEREO_CUSTOM_UV)
if (!IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz))
{
texVal = gl_MultiTexCoord1.xy;
texVal = vec2(1.0, 1.0) - texVal;
}
#endif
#if defined(STEREO_DEBUG)
tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz));
#endif
}
#endif
#ifdef FRAGMENT
varying vec2 texVal;
#if defined(STEREO_DEBUG)
varying vec4 tint;
#endif
uniform vec4 _Color;
uniform samplerExternalOES _MainTex;
void main()
{
#if defined(SHADER_API_GLES) || defined(SHADER_API_GLES3)
#if __VERSION__ < 300
gl_FragColor = texture2D(_MainTex, texVal.xy) * _Color;
#else
gl_FragColor = texture(_MainTex, texVal.xy) * _Color;
#endif
#else
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
#endif
#if defined(STEREO_DEBUG)
gl_FragColor *= tint;
#endif
}
#endif
ENDGLSL
}
}
Fallback "AVProVideo/UI/Stereo"
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: f9f51999155859b419ff715c8127688a
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,141 @@
Shader "AVProVideo/UI/Stereo"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
[PerRendererData] _ChromaTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
[KeywordEnum(None, Top_Bottom, Left_Right)] Stereo("Stereo Mode", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
uniform fixed4 _Color;
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform float3 _cameraPosition;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = XFormObjectToClip(IN.vertex);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.texcoord.xy = IN.texcoord.xy;
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
float4 scaleOffset = GetStereoScaleOffset(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz), _MainTex_ST.y < 0.0);
OUT.texcoord.xy *= scaleOffset.xy;
OUT.texcoord.xy += scaleOffset.zw;
#endif
OUT.color = IN.color * _Color;
#if STEREO_DEBUG
OUT.color *= GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoord).r, tex2D(_ChromaTex, IN.texcoord).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoord).r, tex2D(_ChromaTex, IN.texcoord).ra);
#endif
half4 color = half4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
half4 color = tex2D(_MainTex, IN.texcoord.xy);
#endif
#if APPLY_GAMMA
color.rgb = GammaToLinear(color.rgb);
#endif
color *= IN.color;
return color;
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 018fe741dec71f14bb43801a31a07303
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,174 @@
Shader "AVProVideo/UI/Transparent Packed"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
[PerRendererData] _ChromaTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
_VertScale("Vertical Scale", Range(-1, 1)) = 1.0
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull Off
Lighting Off
ZWrite Off
ZTest [unity_GUIZTestMode]
Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#if APPLY_GAMMA
//#pragma target 3.0
#endif
#include "UnityCG.cginc"
// TODO: once we drop support for Unity 4.x then we can include this
//#include "UnityUI.cginc"
#include "AVProVideo.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half4 texcoord : TEXCOORD0;
float4 worldPosition : TEXCOORD1;
};
uniform fixed4 _Color;
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_TexelSize;
uniform float _VertScale;
uniform float4 _ClipRect;
#if UNITY_VERSION >= 520
inline float UnityGet2DClipping (in float2 position, in float4 clipRect)
{
float2 inside = step(clipRect.xy, position.xy) * step(position.xy, clipRect.zw);
return inside.x * inside.y;
}
#endif
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.worldPosition = IN.vertex;
OUT.vertex = XFormObjectToClip(IN.vertex);
#ifdef UNITY_HALF_TEXEL_OFFSET
OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
#endif
OUT.texcoord.xy = IN.texcoord.xy;
// Horrible hack to undo the scale transform to fit into our UV packing layout logic...
if (_VertScale < 0.0)
{
OUT.texcoord.y = 1.0 - OUT.texcoord.y;
}
OUT.texcoord = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, OUT.texcoord.xy, _VertScale < 0.0);
OUT.color = IN.color * _Color;
return OUT;
}
fixed4 frag(v2f IN) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoord.xy).r, tex2D(_ChromaTex, IN.texcoord.xy).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, IN.texcoord.xy).r, tex2D(_ChromaTex, IN.texcoord.xy).ra);
#endif
half4 color = half4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0f);
#else
// Sample RGB
half4 color = tex2D(_MainTex, IN.texcoord.xy);
#endif
#if APPLY_GAMMA
color.rgb = GammaToLinear(color.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
#if USE_YPCBCR
color.a = tex2D(_MainTex, IN.texcoord.zw).r;
#else
// Sample the alpha
half4 alpha = tex2D(_MainTex, IN.texcoord.zw);
#if APPLY_GAMMA
alpha.rgb = GammaToLinear(alpha.rgb);
#endif
color.a = (alpha.r + alpha.g + alpha.b) / 3.0;
#endif
#endif
color *= IN.color;
#if UNITY_VERSION >= 520
color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
#endif
clip(color.a - 0.001);
return color;
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: f32079bbb2560394abb63e40e1d53da7
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,74 @@
Shader "AVProVideo/Unlit/Opaque (texture+color support) - Android OES ONLY"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "black" {}
_ChromaTex("Chroma", 2D) = "gray" {}
_Color("Main Color", Color) = (1,1,1,1)
[KeywordEnum(None, Top_Bottom, Left_Right)] Stereo("Stereo Mode", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" "IgnoreProjector"="False" "Queue"="Geometry" }
LOD 100
Lighting Off
Cull Off
Pass
{
GLSLPROGRAM
#pragma only_renderers gles gles3
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : enable
precision mediump float;
#ifdef VERTEX
#include "UnityCG.glslinc"
#define SHADERLAB_GLSL
#include "AVProVideo.cginc"
varying vec2 texVal;
uniform vec4 _MainTex_ST;
/// @fix: explicit TRANSFORM_TEX(); Unity's preprocessor chokes when attempting to use the TRANSFORM_TEX() macro in UnityCG.glslinc
/// (as of Unity 4.5.0f6; issue dates back to 2011 or earlier: http://forum.unity3d.com/threads/glsl-transform_tex-and-tiling.93756/)
vec2 transformTex(vec4 texCoord, vec4 texST)
{
return (texCoord.xy * texST.xy + texST.zw);
}
void main()
{
gl_Position = XFormObjectToClip(gl_Vertex);
texVal = transformTex(gl_MultiTexCoord0, _MainTex_ST);
//texVal.x = 1.0 - texVal.x;
texVal.y = 1.0 - texVal.y;
}
#endif
#ifdef FRAGMENT
varying vec2 texVal;
uniform samplerExternalOES _MainTex;
void main()
{
#if defined(SHADER_API_GLES) || defined(SHADER_API_GLES3)
gl_FragColor = texture2D(_MainTex, texVal.xy);
#else
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
#endif
}
#endif
ENDGLSL
}
}
Fallback "AVProVideo/Unlit/Opaque (texture+color+fog+stereo support)"
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: eb44a525a7e2c6640a8cd90fd7fabce4
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,129 @@
Shader "AVProVideo/Unlit/Transparent (texture+color+fog+packed alpha)"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "black" {}
_Color("Main Color", Color) = (1,1,1,1)
_ChromaTex("Chroma", 2D) = "gray" {}
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "Queue"="Transparent" }
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Lighting Off
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
float4 uv : TEXCOORD0;
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform fixed4 _Color;
v2f vert (appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
// Horrible hack to undo the scale transform to fit into our UV packing layout logic...
if (_MainTex_ST.y < 0.0)
{
o.uv.y = 1.0 - o.uv.y;
}
o.uv = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, o.uv.xy, _MainTex_ST.y < 0.0);
#if UNITY_VERSION >= 500
UNITY_TRANSFER_FOG(o, o.vertex);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, i.uv.xy).r, tex2D(_ChromaTex, i.uv.xy).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, i.uv.xy).r, tex2D(_ChromaTex, i.uv.xy).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
// Sample RGB
fixed4 col = tex2D(_MainTex, i.uv.xy);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
// Sample the alpha
#if USE_YPCBCR
col.a = tex2D(_MainTex, i.uv.zw).r;
#else
fixed4 alpha = tex2D(_MainTex, i.uv.zw);
#if APPLY_GAMMA
alpha.rgb = GammaToLinear(alpha.rgb);
#endif
col.a = (alpha.r + alpha.g + alpha.b) / 3.0;
//col.a = (alpha.r + alpha.g + alpha.g + alpha.b) / 4.0;
//clip(col.a - 0.01);
#endif
#endif
col *= _Color;
#if UNITY_VERSION >= 500
UNITY_APPLY_FOG(i.fogCoord, col);
#endif
return col;
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 0ed1fb9218ad96f49acfdb428d5b5aab
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,128 @@
Shader "AVProVideo/Unlit/Opaque (texture+color+fog+stereo support)"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "black" {}
_ChromaTex ("Chroma", 2D) = "gray" {}
_Color("Main Color", Color) = (1,1,1,1)
[KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo("Stereo Mode", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" "IgnoreProjector"="False" "Queue"="Geometry" }
LOD 100
Lighting Off
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
#if STEREO_CUSTOM_UV
float2 uv2 : TEXCOORD1; // Custom uv set for right eye (left eye is in TEXCOORD0)
#endif
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#if STEREO_DEBUG
float4 tint : COLOR;
#endif
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform fixed4 _Color;
uniform float3 _cameraPosition;
v2f vert (appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
float4 scaleOffset = GetStereoScaleOffset(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz), _MainTex_ST.y < 0.0);
o.uv.xy *= scaleOffset.xy;
o.uv.xy += scaleOffset.zw;
#elif STEREO_CUSTOM_UV
if (!IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz))
{
o.uv.xy = TRANSFORM_TEX(v.uv2, _MainTex);
}
#endif
#if STEREO_DEBUG
o.tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
#if UNITY_VERSION >= 500
UNITY_TRANSFER_FOG(o, o.vertex);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, i.uv).r, tex2D(_ChromaTex, i.uv).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, i.uv).r, tex2D(_ChromaTex, i.uv).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
fixed4 col = tex2D(_MainTex, i.uv.xy);
#endif
col *= _Color;
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if STEREO_DEBUG
col *= i.tint;
#endif
#if UNITY_VERSION >= 500
UNITY_APPLY_FOG(i.fogCoord, col);
#endif
return fixed4(col.rgb, 1.0);
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 1ca6555d94ddb204c87e9fe549085b3c
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,111 @@
Shader "AVProVideo/VR/InsideSphere Unlit (stereo) - Android OES ONLY"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "black" {}
_Color("Color", Color) = (0.0, 1.0, 0.0, 1.0)
[KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo("Stereo Mode", Float) = 0
[KeywordEnum(None, EquiRect180)] Layout("Layout", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug("Stereo Debug Tinting", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
}
SubShader
{
Tags{ "Queue" = "Geometry" }
Pass
{
Cull Front
//ZTest Always
ZWrite On
Lighting Off
GLSLPROGRAM
#pragma only_renderers gles gles3
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
#pragma multi_compile __ STEREO_DEBUG
#pragma multi_compile LAYOUT_NONE LAYOUT_EQUIRECT180
//#pragma multi_compile __ GOOGLEVR
#extension GL_OES_EGL_image_external : require
#extension GL_OES_EGL_image_external_essl3 : enable
precision mediump float;
#ifdef VERTEX
#include "UnityCG.glslinc"
#define SHADERLAB_GLSL
#include "AVProVideo.cginc"
varying vec2 texVal;
uniform vec3 _cameraPosition;
uniform mat4 _ViewMatrix;
#if defined(STEREO_DEBUG)
varying vec4 tint;
#endif
void main()
{
gl_Position = XFormObjectToClip(gl_Vertex);
texVal = gl_MultiTexCoord0.xy;
texVal = vec2(1.0, 1.0) - texVal;
#if defined(EQUIRECT180)
texVal.x = ((texVal.x - 0.5) * 2.0) + 0.5;
#endif
#if defined(STEREO_TOP_BOTTOM) | defined(STEREO_LEFT_RIGHT)
bool isLeftEye = IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz);
vec4 scaleOffset = GetStereoScaleOffset(isLeftEye, false);
texVal.xy *= scaleOffset.xy;
texVal.xy += scaleOffset.zw;
#elif defined (STEREO_CUSTOM_UV)
if (!IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz))
{
texVal = gl_MultiTexCoord1.xy;
texVal = vec2(1.0, 1.0) - texVal;
}
#endif
#if defined(STEREO_DEBUG)
tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, _ViewMatrix[0].xyz));
#endif
}
#endif
#ifdef FRAGMENT
varying vec2 texVal;
#if defined(STEREO_DEBUG)
varying vec4 tint;
#endif
uniform vec4 _Color;
uniform samplerExternalOES _MainTex;
void main()
{
#if defined(SHADER_API_GLES) || defined(SHADER_API_GLES3)
#if __VERSION__ < 300
gl_FragColor = texture2D(_MainTex, texVal.xy) * _Color;
#else
gl_FragColor = texture(_MainTex, texVal.xy) * _Color;
#endif
#else
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
#endif
#if defined(STEREO_DEBUG)
gl_FragColor *= tint;
#endif
}
#endif
ENDGLSL
}
}
Fallback "AVProVideo/VR/InsideSphere Unlit (stereo+fog)"
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: a22a9f37cda6a3b48be178ec57376024
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,114 @@
Shader "AVProVideo/VR/InsideSphere Unlit (stereo+fog) Stereo UV"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
[Toggle(STEREO_DEBUG)] _StereoDebug ("Stereo Debug Tinting", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" "IgnoreProjector" = "True" "Queue" = "Background" }
ZWrite On
//ZTest Always
Cull Front
Lighting Off
Pass
{
CGPROGRAM
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
//#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
//#define STEREO_DEBUG 1
//#define HIGH_QUALITY 1
#pragma multi_compile_fog
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
struct appdata
{
float4 vertex : POSITION; // vertex position
float2 uv : TEXCOORD0; // texture coordinate 1
float2 uv2 : TEXCOORD1; // texture coordinate 2
};
struct v2f
{
float4 vertex : SV_POSITION; // clip space position
float2 uv : TEXCOORD0; // texture coordinate
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#if STEREO_DEBUG
float4 tint : COLOR;
#endif
};
uniform sampler2D _MainTex;
uniform float4 _MainTex_ST;
uniform float3 _cameraPosition;
v2f vert(appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
if (IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz))
{
o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);
}
else
{
o.uv.xy = TRANSFORM_TEX(v.uv2, _MainTex);
o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);
}
#if STEREO_DEBUG
o.tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
#if UNITY_VERSION >= 500
UNITY_TRANSFER_FOG(o, o.vertex);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv;
uv = i.uv;
fixed4 col = tex2D(_MainTex, uv);
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if STEREO_DEBUG
col *= i.tint;
#endif
#if UNITY_VERSION >= 500
UNITY_APPLY_FOG(i.fogCoord, col);
#endif
return fixed4(col.rgb, 1.0);
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 08ccc6021f136814494572dcad0c489d
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,282 @@
Shader "AVProVideo/VR/InsideSphere Unlit Transparent(stereo+color+fog+alpha)"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
_ChromaTex("Chroma", 2D) = "white" {}
_Color("Main Color", Color) = (1,1,1,1)
[KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo ("Stereo Mode", Float) = 0
[KeywordEnum(None, Top_Bottom, Left_Right)] AlphaPack("Alpha Pack", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug ("Stereo Debug Tinting", Float) = 0
[KeywordEnum(None, EquiRect180)] Layout("Layout", Float) = 0
[Toggle(HIGH_QUALITY)] _HighQuality ("High Quality", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
_EdgeFeather("Edge Feather", Range (0, 1)) = 0.02
}
SubShader
{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
ZWrite On
//ZTest Always
Blend SrcAlpha OneMinusSrcAlpha
Cull Front
Lighting Off
Pass
{
CGPROGRAM
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
#if HIGH_QUALITY || APPLY_GAMMA
#pragma target 3.0
#endif
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
#pragma multi_compile ALPHAPACK_NONE ALPHAPACK_TOP_BOTTOM ALPHAPACK_LEFT_RIGHT
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile HIGH_QUALITY_OFF HIGH_QUALITY
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#pragma multi_compile LAYOUT_NONE LAYOUT_EQUIRECT180
struct appdata
{
float4 vertex : POSITION; // vertex position
#if HIGH_QUALITY
float3 normal : NORMAL;
#else
float2 uv : TEXCOORD0; // texture coordinate
#if STEREO_CUSTOM_UV
float2 uv2 : TEXCOORD1; // Custom uv set for right eye (left eye is in TEXCOORD0)
#endif
#endif
};
struct v2f
{
float4 vertex : SV_POSITION; // clip space position
#if HIGH_QUALITY
float3 normal : TEXCOORD0;
#if STEREO_TOP_BOTTOM || STEREO_LEFT_RIGHT
float4 scaleOffset : TEXCOORD1; // texture coordinate
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(2)
#endif
#else
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#endif
#else
float4 uv : TEXCOORD0; // texture coordinate
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#endif
#if STEREO_DEBUG
float4 tint : COLOR;
#endif
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float4 _MainTex_TexelSize;
uniform float3 _cameraPosition;
uniform fixed4 _Color;
uniform float _EdgeFeather;
v2f vert (appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
#if !HIGH_QUALITY
o.uv.zw = 0.0;
o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
#if LAYOUT_EQUIRECT180
o.uv.x = ((o.uv.x - 0.5) * 2.0) + 0.5;
// Set value for clipping if UV area is behind viewer
o.uv.z = -1.0;
if (v.uv.x > 0.25 && v.uv.x < 0.75)
{
o.uv.z = 1.0;
}
#endif
o.uv.xy = float2(1.0-o.uv.x, o.uv.y);
#endif
#if STEREO_TOP_BOTTOM || STEREO_LEFT_RIGHT
float4 scaleOffset = GetStereoScaleOffset(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz), _MainTex_ST.y < 0.0);
#if !HIGH_QUALITY
o.uv.xy *= scaleOffset.xy;
o.uv.xy += scaleOffset.zw;
#else
o.scaleOffset = scaleOffset;
#endif
#elif STEREO_CUSTOM_UV && !HIGH_QUALITY
if (!IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz))
{
o.uv.xy = TRANSFORM_TEX(v.uv2, _MainTex);
o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);
}
#endif
#if !HIGH_QUALITY
#if ALPHAPACK_TOP_BOTTOM || ALPHAPACK_LEFT_RIGHT
o.uv = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, o.uv.xy, _MainTex_ST.y > 0.0);
#endif
#endif
#if HIGH_QUALITY
o.normal = v.normal;
#endif
#if STEREO_DEBUG
o.tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
#if UNITY_VERSION >= 500
UNITY_TRANSFER_FOG(o, o.vertex);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float4 uv = 0;
#if HIGH_QUALITY
float3 n = normalize(i.normal);
#if LAYOUT_EQUIRECT180
clip(-n.z); // Clip pixels on the back of the sphere
#endif
float M_1_PI = 1.0 / 3.1415926535897932384626433832795;
float M_1_2PI = 1.0 / 6.283185307179586476925286766559;
uv.x = 0.5 - atan2(n.z, n.x) * M_1_2PI;
uv.y = 0.5 - asin(-n.y) * M_1_PI;
uv.x += 0.75;
uv.x = fmod(uv.x, 1.0);
//uv.x = uv.x % 1.0;
uv.xy = TRANSFORM_TEX(uv, _MainTex);
#if LAYOUT_EQUIRECT180
uv.x = ((uv.x - 0.5) * 2.0) + 0.5;
#endif
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
uv.xy *= i.scaleOffset.xy;
uv.xy += i.scaleOffset.zw;
#endif
#if ALPHAPACK_TOP_BOTTOM | ALPHAPACK_LEFT_RIGHT
uv = OffsetAlphaPackingUV(_MainTex_TexelSize.xy, uv.xy, _MainTex_ST.y < 0.0);
#endif
#else
uv = i.uv;
#if LAYOUT_EQUIRECT180
clip(i.uv.z); // Clip pixels on the back of the sphere
#endif
#endif
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, uv).r, tex2D(_ChromaTex, uv).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, uv).r, tex2D(_ChromaTex, uv).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
fixed4 col = tex2D(_MainTex, uv);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if ALPHAPACK_TOP_BOTTOM || ALPHAPACK_LEFT_RIGHT
// Sample the alpha
fixed4 alpha = tex2D(_MainTex, uv.zw);
#if APPLY_GAMMA
alpha.rgb = GammaToLinear(alpha.rgb);
#endif
col.a = (alpha.r + alpha.g + alpha.b) / 3.0;
//col.a = (alpha.r + alpha.g + alpha.g + alpha.b) / 4.0;
//clip(col.a - 0.01);
#endif
#if STEREO_DEBUG
col *= i.tint;
#endif
col *= _Color;
#if UNITY_VERSION >= 500
UNITY_APPLY_FOG(i.fogCoord, col);
#endif
#if LAYOUT_EQUIRECT180
// Apply edge feathering based on UV mapping - this is useful if you're using a hemisphere mesh for 180 degree video and want to have soft edges
if (_EdgeFeather > 0.0)
{
float4 featherDirection = float4(0.0, 0.0, 1.0, 1.0);
#if STEREO_TOP_BOTTOM
if (uv.y > 0.5)
{
featherDirection.y = 0.5;
}
else
{
featherDirection.w = 0.5;
}
#endif
#if STEREO_LEFT_RIGHT
if (uv.x > 0.5)
{
featherDirection.x = 0.5;
}
else
{
featherDirection.z = 0.5;
}
#endif
#if ALPHAPACK_TOP_BOTTOM
featherDirection.w *= 0.5;
#endif
#if ALPHAPACK_LEFT_RIGHT
featherDirection.z *= 0.5;
#endif
float d = min(uv.x - featherDirection.x, min((uv.y - featherDirection.y), min(featherDirection.z - uv.x, featherDirection.w - uv.y)));
float a = smoothstep(0.0, _EdgeFeather, d);
col.a *= a;
}
#endif
return col;
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 867ec56bd96e5504a95f991314cd5706
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,201 @@
Shader "AVProVideo/VR/InsideSphere Unlit (stereo+fog)"
{
Properties
{
_MainTex ("Texture", 2D) = "black" {}
_ChromaTex("Chroma", 2D) = "white" {}
[KeywordEnum(None, Top_Bottom, Left_Right, Custom_UV)] Stereo ("Stereo Mode", Float) = 0
[KeywordEnum(None, Left, Right)] ForceEye ("Force Eye Mode", Float) = 0
[Toggle(STEREO_DEBUG)] _StereoDebug ("Stereo Debug Tinting", Float) = 0
[KeywordEnum(None, EquiRect180)] Layout("Layout", Float) = 0
[Toggle(HIGH_QUALITY)] _HighQuality ("High Quality", Float) = 0
[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0
[Toggle(USE_YPCBCR)] _UseYpCbCr("Use YpCbCr", Float) = 0
}
SubShader
{
Tags { "RenderType"="Opaque" "IgnoreProjector" = "True" "Queue" = "Background" }
ZWrite On
//ZTest Always
Cull Front
Lighting Off
Pass
{
CGPROGRAM
#include "UnityCG.cginc"
#include "AVProVideo.cginc"
#if HIGH_QUALITY || APPLY_GAMMA
#pragma target 3.0
#endif
#pragma vertex vert
#pragma fragment frag
//#define STEREO_DEBUG 1
//#define HIGH_QUALITY 1
#pragma multi_compile_fog
#pragma multi_compile MONOSCOPIC STEREO_TOP_BOTTOM STEREO_LEFT_RIGHT STEREO_CUSTOM_UV
// TODO: Change XX_OFF to __ for Unity 5.0 and above
// this was just added for Unity 4.x compatibility as __ causes
// Android and iOS builds to fail the shader
#pragma multi_compile STEREO_DEBUG_OFF STEREO_DEBUG
#pragma multi_compile FORCEEYE_NONE FORCEEYE_LEFT FORCEEYE_RIGHT
#pragma multi_compile HIGH_QUALITY_OFF HIGH_QUALITY
#pragma multi_compile APPLY_GAMMA_OFF APPLY_GAMMA
#pragma multi_compile USE_YPCBCR_OFF USE_YPCBCR
#pragma multi_compile LAYOUT_NONE LAYOUT_EQUIRECT180
struct appdata
{
float4 vertex : POSITION; // vertex position
#if HIGH_QUALITY
float3 normal : NORMAL;
#else
float2 uv : TEXCOORD0; // texture coordinate
#if STEREO_CUSTOM_UV
float2 uv2 : TEXCOORD1; // Custom uv set for right eye (left eye is in TEXCOORD0)
#endif
#endif
};
struct v2f
{
float4 vertex : SV_POSITION; // clip space position
#if HIGH_QUALITY
float3 normal : TEXCOORD0;
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
float4 scaleOffset : TEXCOORD1; // texture coordinate
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(2)
#endif
#else
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#endif
#else
float2 uv : TEXCOORD0; // texture coordinate
#if UNITY_VERSION >= 500
UNITY_FOG_COORDS(1)
#endif
#endif
#if STEREO_DEBUG
float4 tint : COLOR;
#endif
};
uniform sampler2D _MainTex;
#if USE_YPCBCR
uniform sampler2D _ChromaTex;
uniform float4x4 _YpCbCrTransform;
#endif
uniform float4 _MainTex_ST;
uniform float3 _cameraPosition;
v2f vert (appdata v)
{
v2f o;
o.vertex = XFormObjectToClip(v.vertex);
#if !HIGH_QUALITY
o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);
#if LAYOUT_EQUIRECT180
o.uv.x = ((o.uv.x - 0.5) * 2.0) + 0.5;
#endif
o.uv.xy = float2(1.0-o.uv.x, o.uv.y);
#endif
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
float4 scaleOffset = GetStereoScaleOffset(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz), _MainTex_ST.y < 0.0);
#if !HIGH_QUALITY
o.uv.xy *= scaleOffset.xy;
o.uv.xy += scaleOffset.zw;
#else
o.scaleOffset = scaleOffset;
#endif
#elif STEREO_CUSTOM_UV && !HIGH_QUALITY
if (!IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz))
{
o.uv.xy = TRANSFORM_TEX(v.uv2, _MainTex);
o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);
}
#endif
#if HIGH_QUALITY
o.normal = v.normal;
#endif
#if STEREO_DEBUG
o.tint = GetStereoDebugTint(IsStereoEyeLeft(_cameraPosition, UNITY_MATRIX_V[0].xyz));
#endif
#if UNITY_VERSION >= 500
UNITY_TRANSFER_FOG(o, o.vertex);
#endif
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv;
#if HIGH_QUALITY
float3 n = normalize(i.normal);
float M_1_PI = 1.0 / 3.1415926535897932384626433832795;
float M_1_2PI = 1.0 / 6.283185307179586476925286766559;
uv.x = 0.5 - atan2(n.z, n.x) * M_1_2PI;
uv.y = 0.5 - asin(-n.y) * M_1_PI;
uv.x += 0.75;
uv.x = fmod(uv.x, 1.0);
//uv.x = uv.x % 1.0;
uv.xy = TRANSFORM_TEX(uv, _MainTex);
#if LAYOUT_EQUIRECT180
uv.x = ((uv.x - 0.5) * 2.0) + 0.5;
#endif
#if STEREO_TOP_BOTTOM | STEREO_LEFT_RIGHT
uv.xy *= i.scaleOffset.xy;
uv.xy += i.scaleOffset.zw;
#endif
#else
uv = i.uv;
#endif
#if USE_YPCBCR
#if SHADER_API_METAL || SHADER_API_GLES || SHADER_API_GLES3
float3 ypcbcr = float3(tex2D(_MainTex, uv).r, tex2D(_ChromaTex, uv).rg);
#else
float3 ypcbcr = float3(tex2D(_MainTex, uv).r, tex2D(_ChromaTex, uv).ra);
#endif
fixed4 col = fixed4(ConvertYpCbCrToRGB(ypcbcr, _YpCbCrTransform), 1.0);
#else
fixed4 col = tex2D(_MainTex, uv);
#endif
#if APPLY_GAMMA
col.rgb = GammaToLinear(col.rgb);
#endif
#if STEREO_DEBUG
col *= i.tint;
#endif
#if UNITY_VERSION >= 500
UNITY_APPLY_FOG(i.fogCoord, col);
#endif
return fixed4(col.rgb, 1.0);
}
ENDCG
}
}
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 46b84ca7ab6291e4fb6c57ac48d01e8f
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,306 @@
//-----------------------------------------------------------------------------
// Copyright 2015-2017 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
#if defined (SHADERLAB_GLSL)
#define INLINE
#define HALF2 vec2
#define HALF3 vec3
#define HALF4 vec4
#define FLOAT2 vec2
#define FLOAT3 vec3
#define FLOAT4 vec4
#define FLOAT3X3 mat3
#define FLOAT4X4 mat4
#else
#define INLINE inline
#define HALF2 half2
#define HALF3 half3
#define HALF4 half4
#define FLOAT2 float2
#define FLOAT3 float3
#define FLOAT4 float4
#define FLOAT3X3 float3x3
#define FLOAT4X4 float4x4
#endif
// Specify this so Unity doesn't automatically update our shaders.
#define UNITY_SHADER_NO_UPGRADE 1
// We use this method so that when Unity automatically updates the shader from the old
// mul(UNITY_MATRIX_MVP.. to UnityObjectToClipPos that it only changes in one place.
INLINE FLOAT4 XFormObjectToClip(FLOAT4 vertex)
{
#if defined(SHADERLAB_GLSL)
return gl_ModelViewProjectionMatrix * vertex;
#else
#if (UNITY_VERSION >= 560)
return UnityObjectToClipPos(vertex);
#else
return mul(UNITY_MATRIX_MVP, vertex);
#endif
#endif
}
INLINE bool IsStereoEyeLeft(FLOAT3 worldNosePosition, FLOAT3 worldCameraRight)
{
#if defined(FORCEEYE_LEFT)
return true;
#elif defined(FORCEEYE_RIGHT)
return false;
#elif defined(UNITY_SINGLE_PASS_STEREO) || defined (UNITY_STEREO_INSTANCING_ENABLED)
// Unity 5.4 has this new variable
return (unity_StereoEyeIndex == 0);
#elif defined (UNITY_DECLARE_MULTIVIEW)
// OVR_multiview extension
return (UNITY_VIEWID == 0);
#else
//#if (UNITY_VERSION > 540) && defined(GOOGLEVR) && !defined(SHADERLAB_GLSL)
// Daydream support uses the skew component of the projection matrix
// (But unity_CameraProjection doesn't seem to be declared when using GLSL)
// NOTE: we've had to remove this minor optimisationg as it was causing too many isues.
// eg. Unity 5.4.1 in GLSL mode complained UNITY_VERSION and unity_CameraProjection aren't defined
//return (unity_CameraProjection[0][2] > 0.0);
//#else
// worldNosePosition is the camera positon passed in from Unity via script
// We need to determine whether _WorldSpaceCameraPos (Unity shader variable) is to the left or to the right of _cameraPosition
float dRight = distance(worldNosePosition + worldCameraRight, _WorldSpaceCameraPos);
float dLeft = distance(worldNosePosition - worldCameraRight, _WorldSpaceCameraPos);
return (dRight > dLeft);
//#endif
#endif
}
#if defined(STEREO_TOP_BOTTOM) || defined(STEREO_LEFT_RIGHT)
FLOAT4 GetStereoScaleOffset(bool isLeftEye, bool isYFlipped)
{
FLOAT2 scale = FLOAT2(1.0, 1.0);
FLOAT2 offset = FLOAT2(0.0, 0.0);
// Top-Bottom
#if defined(STEREO_TOP_BOTTOM)
scale.y = 0.5;
offset.y = 0.0;
if (!isLeftEye)
{
offset.y = 0.5;
}
#if !defined(SHADERLAB_GLSL)
#if !defined(UNITY_UV_STARTS_AT_TOP) // UNITY_UV_STARTS_AT_TOP is for directx
if (!isYFlipped)
{
// Currently this only runs for Android and Windows using DirectShow
offset.y = 0.5 - offset.y;
}
#endif
#endif
// Left-Right
#elif defined(STEREO_LEFT_RIGHT)
scale.x = 0.5;
offset.x = 0.0;
if (!isLeftEye)
{
offset.x = 0.5;
}
#endif
return FLOAT4(scale, offset);
}
#endif
#if defined(STEREO_DEBUG)
INLINE FLOAT4 GetStereoDebugTint(bool isLeftEye)
{
FLOAT4 tint = FLOAT4(1.0, 1.0, 1.0, 1.0);
#if defined(STEREO_TOP_BOTTOM) || defined(STEREO_LEFT_RIGHT) || defined(STEREO_CUSTOM_UV)
FLOAT4 leftEyeColor = FLOAT4(0.0, 1.0, 0.0, 1.0); // green
FLOAT4 rightEyeColor = FLOAT4(1.0, 0.0, 0.0, 1.0); // red
if (isLeftEye)
{
tint = leftEyeColor;
}
else
{
tint = rightEyeColor;
}
#endif
#if defined(UNITY_UV_STARTS_AT_TOP)
tint.b = 0.5;
#endif
/*#if defined(UNITY_SINGLE_PASS_STEREO) || defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_DECLARE_MULTIVIEW)
tint.b = 1.0;
#endif*/
return tint;
}
#endif
FLOAT2 ScaleZoomToFit(float targetWidth, float targetHeight, float sourceWidth, float sourceHeight)
{
#if defined(ALPHAPACK_TOP_BOTTOM)
sourceHeight *= 0.5;
#elif defined(ALPHAPACK_LEFT_RIGHT)
sourceWidth *= 0.5;
#endif
float targetAspect = targetHeight / targetWidth;
float sourceAspect = sourceHeight / sourceWidth;
FLOAT2 scale = FLOAT2(1.0, sourceAspect / targetAspect);
if (targetAspect < sourceAspect)
{
scale = FLOAT2(targetAspect / sourceAspect, 1.0);
}
return scale;
}
FLOAT4 OffsetAlphaPackingUV(FLOAT2 texelSize, FLOAT2 uv, bool flipVertical)
{
FLOAT4 result = uv.xyxy;
// We don't want bilinear interpolation to cause bleeding
// when reading the pixels at the edge of the packed areas.
// So we shift the UV's by a fraction of a pixel so the edges don't get sampled.
#if defined(ALPHAPACK_TOP_BOTTOM)
float offset = texelSize.y * 1.5;
result.y = lerp(0.0 + offset, 0.5 - offset, uv.y);
result.w = result.y + 0.5;
if (flipVertical)
{
// Flip vertically (and offset to put back in 0..1 range)
result.yw = 1.0 - result.yw;
result.yw = result.wy;
}
else
{
#if !defined(UNITY_UV_STARTS_AT_TOP)
// For opengl we flip
result.yw = result.wy;
#endif
}
#elif defined(ALPHAPACK_LEFT_RIGHT)
float offset = texelSize.x * 1.5;
result.x = lerp(0.0 + offset, 0.5 - offset, uv.x);
result.z = result.x + 0.5;
if (flipVertical)
{
// Flip vertically (and offset to put back in 0..1 range)
result.yw = 1.0 - result.yw;
}
#else
if (flipVertical)
{
// Flip vertically (and offset to put back in 0..1 range)
result.yw = 1.0 - result.yw;
}
#endif
return result;
}
// http://entropymine.com/imageworsener/srgbformula/
INLINE HALF3 GammaToLinear(HALF3 col)
{
// Forced cheap version
#if defined(CHEAP_GAMMATOLINEAR)
#if defined (SHADERLAB_GLSL)
return pow(col, vec3(2.2, 2.2, 2.2));
#else
// Approximate version from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1
return col * (col * (col * 0.305306011h + 0.682171111h) + 0.012522878h);
#endif
#else
#if SHADER_TARGET < 30
// Cheaper approximation
#if defined (SHADERLAB_GLSL)
return col * (col * (col * 0.305306011 + 0.682171111) + 0.012522878);
#else
return col * (col * (col * 0.305306011h + 0.682171111h) + 0.012522878h);
#endif
#else
// Accurate version
if (col.r <= 0.04045)
col.r = col.r / 12.92;
else
col.r = pow((col.r + 0.055) / 1.055, 2.4);
if (col.g <= 0.04045)
col.g = col.g / 12.92;
else
col.g = pow((col.g + 0.055) / 1.055, 2.4);
if (col.b <= 0.04045)
col.b = col.b / 12.92;
else
col.b = pow((col.b + 0.055) / 1.055, 2.4);
#endif
#endif
return col;
}
INLINE HALF3 LinearToGamma(HALF3 col)
{
// Forced cheap version
#if defined(CHEAP_GAMMATOLINEAR)
#if defined (SHADERLAB_GLSL)
return pow(col, vec3(1.0 / 2.2, 1.0 / 2.2, 1.0 / 2.2));
#else
// Approximate version from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1
return max(1.055h * pow(col, 0.416666667h) - 0.055h, 0.0h);
#endif
#else
#if SHADER_TARGET < 30
// Cheaper approximation
#if defined (SHADERLAB_GLSL)
return max(1.055 * pow(col, vec3(0.416666667, 0.416666667, 0.416666667)) - 0.055, 0.0);
#else
return max(1.055h * pow(col, 0.416666667h) - 0.055h, 0.0h);
#endif
#else
// Accurate version
if (col.r <= 0.0031308)
col.r = col.r * 12.92;
else
col.r = 1.055 * pow(col.r, 0.4166667) - 0.055;
if (col.g <= 0.0031308)
col.g = col.g * 12.92;
else
col.g = 1.055 * pow(col.g, 0.4166667) - 0.055;
if (col.b <= 0.0031308)
col.b = col.b * 12.92;
else
col.b = 1.055 * pow(col.b, 0.4166667) - 0.055;
#endif
#endif
return col;
}
INLINE FLOAT3 ConvertYpCbCrToRGB(FLOAT3 YpCbCr, FLOAT4X4 YpCbCrTransform)
{
#if defined(SHADERLAB_GLSL)
return (FLOAT3X3)YpCbCrTransform * (YpCbCr + YpCbCrTransform[3].xyz);
#else
return mul((FLOAT3X3)YpCbCrTransform, YpCbCr + YpCbCrTransform[3].xyz);
#endif
}

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 5bcf2893fead7a14a8c737d1bb6cdd09
ShaderImporter:
defaultTextures: []
userData:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 48d8a0fb8367d5e40b369691646ad6e3
folderAsset: yes
timeCreated: 1438695622
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 40d7664ce355730488a96ff5305f1b5d
folderAsset: yes
timeCreated: 1438698284
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,283 @@
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#elif UNITY_IOS || UNITY_ANDROID
#if UNITY_5_5_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4)
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#endif
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Sets up a material to display the video from a MediaPlayer
/// </summary>
[AddComponentMenu("AVPro Video/Apply To Material", 300)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class ApplyToMaterial : MonoBehaviour
{
public Vector2 _offset = Vector2.zero;
public Vector2 _scale = Vector2.one;
public Material _material;
public string _texturePropertyName;
public MediaPlayer _media;
public Texture2D _defaultTexture;
private Texture _originalTexture;
private Vector2 _originalScale = Vector2.one;
private Vector2 _originalOffset = Vector2.zero;
private static int _propStereo;
private static int _propAlphaPack;
private static int _propApplyGamma;
private static int _propLayout;
private const string PropChromaTexName = "_ChromaTex";
private static int _propChromaTex;
private const string PropYpCbCrTransformName = "_YpCbCrTransform";
private static int _propYpCbCrTransform;
private const string PropUseYpCbCrName = "_UseYpCbCr";
private static int _propUseYpCbCr;
private void Awake()
{
if (_propStereo == 0)
{
_propStereo = Shader.PropertyToID("Stereo");
}
if (_propAlphaPack == 0)
{
_propAlphaPack = Shader.PropertyToID("AlphaPack");
}
if (_propApplyGamma == 0)
{
_propApplyGamma = Shader.PropertyToID("_ApplyGamma");
}
if (_propLayout == 0)
{
_propLayout = Shader.PropertyToID("Layout");
}
if (_propChromaTex == 0)
{
_propChromaTex = Shader.PropertyToID(PropChromaTexName);
}
if (_propYpCbCrTransform == 0)
{
_propYpCbCrTransform = Shader.PropertyToID(PropYpCbCrTransformName);
}
if (_propUseYpCbCr == 0)
{
_propUseYpCbCr = Shader.PropertyToID(PropUseYpCbCrName);
}
}
// We do a LateUpdate() to allow for any changes in the texture that may have happened in Update()
private void LateUpdate()
{
bool applied = false;
if (_media != null && _media.TextureProducer != null)
{
int planeCount = _media.m_Resample ? 1 : _media.TextureProducer.GetTextureCount();
for (int plane = 0; plane < planeCount; ++plane)
{
Texture resamplerTex = _media.FrameResampler == null || _media.FrameResampler.OutputTexture == null ? null : _media.FrameResampler.OutputTexture[plane];
Texture texture = _media.m_Resample ? resamplerTex : _media.TextureProducer.GetTexture(plane);
if (texture != null)
{
ApplyMapping(texture, _media.TextureProducer.RequiresVerticalFlip(), plane);
applied = true;
}
}
}
if (!applied)
{
if (_material != null && _material.HasProperty(_propUseYpCbCr))
{
_material.DisableKeyword("USE_YPCBCR");
}
ApplyMapping(_defaultTexture, false);
}
}
private void ApplyMapping(Texture texture, bool requiresYFlip, int plane = 0)
{
if (_material != null)
{
if (plane == 0)
{
if (string.IsNullOrEmpty(_texturePropertyName))
{
_material.mainTexture = texture;
if (texture != null)
{
if (requiresYFlip)
{
_material.mainTextureScale = new Vector2(_scale.x, -_scale.y);
_material.mainTextureOffset = Vector2.up + _offset;
}
else
{
_material.mainTextureScale = _scale;
_material.mainTextureOffset = _offset;
}
}
}
else
{
_material.SetTexture(_texturePropertyName, texture);
if (texture != null)
{
if (requiresYFlip)
{
_material.SetTextureScale(_texturePropertyName, new Vector2(_scale.x, -_scale.y));
_material.SetTextureOffset(_texturePropertyName, Vector2.up + _offset);
}
else
{
_material.SetTextureScale(_texturePropertyName, _scale);
_material.SetTextureOffset(_texturePropertyName, _offset);
}
}
}
}
else if (plane == 1)
{
if (_material.HasProperty(_propUseYpCbCr))
{
_material.EnableKeyword("USE_YPCBCR");
}
if (_material.HasProperty(_propChromaTex))
{
_material.SetTexture(_propChromaTex, texture);
_material.SetMatrix(_propYpCbCrTransform, _media.TextureProducer.GetYpCbCrTransform());
if (texture != null)
{
#if UNITY_5_6_OR_NEWER
if (requiresYFlip)
{
_material.SetTextureScale(_propChromaTex, new Vector2(_scale.x, -_scale.y));
_material.SetTextureOffset(_propChromaTex, Vector2.up + _offset);
}
else
{
_material.SetTextureScale(_propChromaTex, _scale);
_material.SetTextureOffset(_propChromaTex, _offset);
}
#else
if (requiresYFlip)
{
_material.SetTextureScale(PropChromaTexName, new Vector2(_scale.x, -_scale.y));
_material.SetTextureOffset(PropChromaTexName, Vector2.up + _offset);
}
else
{
_material.SetTextureScale(PropChromaTexName, _scale);
_material.SetTextureOffset(PropChromaTexName, _offset);
}
#endif
}
}
}
if (_media != null)
{
// Apply changes for layout
if (_material.HasProperty(_propLayout))
{
Helper.SetupLayoutMaterial(_material, _media.VideoLayoutMapping);
}
// Apply changes for stereo videos
if (_material.HasProperty(_propStereo))
{
Helper.SetupStereoMaterial(_material, _media.m_StereoPacking, _media.m_DisplayDebugStereoColorTint);
}
// Apply changes for alpha videos
if (_material.HasProperty(_propAlphaPack))
{
Helper.SetupAlphaPackedMaterial(_material, _media.m_AlphaPacking);
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
// Apply gamma
if (_material.HasProperty(_propApplyGamma) && _media.Info != null)
{
Helper.SetupGammaMaterial(_material, _media.Info.PlayerSupportsLinearColorSpace());
}
#else
_propApplyGamma |= 0;
#endif
}
}
}
private void Start()
{
SaveProperties();
LateUpdate();
}
private void OnEnable()
{
SaveProperties();
LateUpdate();
}
private void OnDisable()
{
RestoreProperties();
}
private void SaveProperties()
{
if (_material != null)
{
if (string.IsNullOrEmpty(_texturePropertyName))
{
_originalTexture = _material.mainTexture;
_originalScale = _material.mainTextureScale;
_originalOffset = _material.mainTextureOffset;
}
else
{
_originalTexture = _material.GetTexture(_texturePropertyName);
_originalScale = _material.GetTextureScale(_texturePropertyName);
_originalOffset = _material.GetTextureOffset(_texturePropertyName);
}
}
}
private void RestoreProperties()
{
if (_material != null)
{
if (string.IsNullOrEmpty(_texturePropertyName))
{
_material.mainTexture = _originalTexture;
_material.mainTextureScale = _originalScale;
_material.mainTextureOffset = _originalOffset;
}
else
{
_material.SetTexture(_texturePropertyName, _originalTexture);
_material.SetTextureScale(_texturePropertyName, _originalScale);
_material.SetTextureOffset(_texturePropertyName, _originalOffset);
}
}
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2feedce2e2e63647b8f875ec0894a15
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,384 @@
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#elif UNITY_IOS || UNITY_ANDROID
#if UNITY_5_5_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4)
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#endif
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Sets up a mesh to display the video from a MediaPlayer
/// </summary>
[AddComponentMenu("AVPro Video/Apply To Mesh", 300)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class ApplyToMesh : MonoBehaviour
{
// TODO: add specific material / material index to target in the mesh if there are multiple materials
[Header("Media Source")]
[SerializeField]
private MediaPlayer _media = null;
public MediaPlayer Player
{
get { return _media; }
set { ChangeMediaPlayer(value); }
}
[Tooltip("Default texture to display when the video texture is preparing")]
[SerializeField]
private Texture2D _defaultTexture = null;
public Texture2D DefaultTexture
{
get { return _defaultTexture; }
set { if (_defaultTexture != value) { _defaultTexture = value; _isDirty = true; } }
}
[Space(8f)]
[Header("Renderer Target")]
[SerializeField]
private Renderer _mesh = null;
public Renderer MeshRenderer
{
get { return _mesh; }
set { if (_mesh != value) { _mesh = value; _isDirty = true; } }
}
[SerializeField]
private string _texturePropertyName = "_MainTex";
public string TexturePropertyName
{
get { return _texturePropertyName; }
set
{
if (_texturePropertyName != value)
{
_texturePropertyName = value;
#if UNITY_5_6_OR_NEWER
_propTexture = Shader.PropertyToID(_texturePropertyName);
#endif
_isDirty = true;
}
}
}
[SerializeField]
private Vector2 _offset = Vector2.zero;
public Vector2 Offset
{
get { return _offset; }
set { if (_offset != value) { _offset = value; _isDirty = true; } }
}
[SerializeField]
private Vector2 _scale = Vector2.one;
public Vector2 Scale
{
get { return _scale; }
set { if (_scale != value) { _scale = value; _isDirty = true; } }
}
private bool _isDirty = false;
private Texture _lastTextureApplied;
#if UNITY_5_6_OR_NEWER
private int _propTexture;
#endif
private static int _propStereo;
private static int _propAlphaPack;
private static int _propApplyGamma;
private static int _propLayout;
private const string PropChromaTexName = "_ChromaTex";
private static int _propChromaTex;
private const string PropYpCbCrTransformName = "_YpCbCrTransform";
private static int _propYpCbCrTransform;
private const string PropUseYpCbCrName = "_UseYpCbCr";
private static int _propUseYpCbCr;
private void Awake()
{
if (_propStereo == 0)
{
_propStereo = Shader.PropertyToID("Stereo");
}
if (_propAlphaPack == 0)
{
_propAlphaPack = Shader.PropertyToID("AlphaPack");
}
if (_propApplyGamma == 0)
{
_propApplyGamma = Shader.PropertyToID("_ApplyGamma");
}
if (_propLayout == 0)
{
_propLayout = Shader.PropertyToID("Layout");
}
if (_propChromaTex == 0)
{
_propChromaTex = Shader.PropertyToID(PropChromaTexName);
}
if (_propYpCbCrTransform == 0)
{
_propYpCbCrTransform = Shader.PropertyToID(PropYpCbCrTransformName);
}
if (_propUseYpCbCr == 0)
{
_propUseYpCbCr = Shader.PropertyToID(PropUseYpCbCrName);
}
if (_media != null)
{
_media.Events.AddListener(OnMediaPlayerEvent);
}
}
public void ForceUpdate()
{
_isDirty = true;
LateUpdate();
}
// Callback function to handle events
private void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
switch (et)
{
case MediaPlayerEvent.EventType.FirstFrameReady:
case MediaPlayerEvent.EventType.PropertiesChanged:
ForceUpdate();
break;
}
}
private void ChangeMediaPlayer(MediaPlayer player)
{
if (_media != player)
{
if (_media != null)
{
_media.Events.RemoveListener(OnMediaPlayerEvent);
}
_media = player;
if (_media != null)
{
_media.Events.AddListener(OnMediaPlayerEvent);
}
_isDirty = true;
}
}
// We do a LateUpdate() to allow for any changes in the texture that may have happened in Update()
private void LateUpdate()
{
bool applied = false;
// Try to apply texture from media
if (_media != null && _media.TextureProducer != null)
{
Texture resamplerTex = _media.FrameResampler == null || _media.FrameResampler.OutputTexture == null ? null : _media.FrameResampler.OutputTexture[0];
Texture texture = _media.m_Resample ? resamplerTex : _media.TextureProducer.GetTexture(0);
if (texture != null)
{
// Check for changing texture
if (texture != _lastTextureApplied)
{
_isDirty = true;
}
if (_isDirty)
{
int planeCount = _media.m_Resample ? 1 : _media.TextureProducer.GetTextureCount();
for (int plane = 0; plane < planeCount; plane++)
{
Texture resamplerTexPlane = _media.FrameResampler == null || _media.FrameResampler.OutputTexture == null ? null : _media.FrameResampler.OutputTexture[plane];
texture = _media.m_Resample ? resamplerTexPlane : _media.TextureProducer.GetTexture(plane);
if (texture != null)
{
ApplyMapping(texture, _media.TextureProducer.RequiresVerticalFlip(), plane);
}
}
}
applied = true;
}
}
// If the media didn't apply a texture, then try to apply the default texture
if (!applied)
{
if (_defaultTexture != _lastTextureApplied)
{
_isDirty = true;
}
if (_isDirty)
{
ApplyMapping(_defaultTexture, false);
}
}
}
private void ApplyMapping(Texture texture, bool requiresYFlip, int plane = 0)
{
if (_mesh != null)
{
_isDirty = false;
Material[] meshMaterials = _mesh.materials;
if (meshMaterials != null)
{
for (int i = 0; i < meshMaterials.Length; i++)
{
Material mat = meshMaterials[i];
if (mat != null)
{
if (plane == 0)
{
#if UNITY_5_6_OR_NEWER
mat.SetTexture(_propTexture, texture);
#else
mat.SetTexture(_texturePropertyName, texture);
#endif
_lastTextureApplied = texture;
if (texture != null)
{
#if UNITY_5_6_OR_NEWER
if (requiresYFlip)
{
mat.SetTextureScale(_propTexture, new Vector2(_scale.x, -_scale.y));
mat.SetTextureOffset(_propTexture, Vector2.up + _offset);
}
else
{
mat.SetTextureScale(_propTexture, _scale);
mat.SetTextureOffset(_propTexture, _offset);
}
#else
if (requiresYFlip)
{
mat.SetTextureScale(_texturePropertyName, new Vector2(_scale.x, -_scale.y));
mat.SetTextureOffset(_texturePropertyName, Vector2.up + _offset);
}
else
{
mat.SetTextureScale(_texturePropertyName, _scale);
mat.SetTextureOffset(_texturePropertyName, _offset);
}
#endif
}
}
else if (plane == 1)
{
if (mat.HasProperty(_propUseYpCbCr) && mat.HasProperty(_propChromaTex))
{
mat.EnableKeyword("USE_YPCBCR");
mat.SetTexture(_propChromaTex, texture);
mat.SetMatrix(_propYpCbCrTransform, _media.TextureProducer.GetYpCbCrTransform());
#if UNITY_5_6_OR_NEWER
if (requiresYFlip)
{
mat.SetTextureScale(_propChromaTex, new Vector2(_scale.x, -_scale.y));
mat.SetTextureOffset(_propChromaTex, Vector2.up + _offset);
}
else
{
mat.SetTextureScale(_propChromaTex, _scale);
mat.SetTextureOffset(_propChromaTex, _offset);
}
#else
if (requiresYFlip)
{
mat.SetTextureScale(PropChromaTexName, new Vector2(_scale.x, -_scale.y));
mat.SetTextureOffset(PropChromaTexName, Vector2.up + _offset);
}
else
{
mat.SetTextureScale(PropChromaTexName, _scale);
mat.SetTextureOffset(PropChromaTexName, _offset);
}
#endif
}
}
if (_media != null)
{
// Apply changes for layout
if (mat.HasProperty(_propLayout))
{
Helper.SetupLayoutMaterial(mat, _media.VideoLayoutMapping);
}
// Apply changes for stereo videos
if (mat.HasProperty(_propStereo))
{
Helper.SetupStereoMaterial(mat, _media.m_StereoPacking, _media.m_DisplayDebugStereoColorTint);
}
// Apply changes for alpha videos
if (mat.HasProperty(_propAlphaPack))
{
Helper.SetupAlphaPackedMaterial(mat, _media.m_AlphaPacking);
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
// Apply gamma
if (mat.HasProperty(_propApplyGamma) && _media.Info != null)
{
Helper.SetupGammaMaterial(mat, _media.Info.PlayerSupportsLinearColorSpace());
}
#else
_propApplyGamma |= 0;
#endif
}
}
}
}
}
}
private void OnEnable()
{
if (_mesh == null)
{
_mesh = this.GetComponent<MeshRenderer>();
if (_mesh == null)
{
Debug.LogWarning("[AVProVideo] No mesh renderer set or found in gameobject");
}
}
#if UNITY_5_6_OR_NEWER
_propTexture = Shader.PropertyToID(_texturePropertyName);
#endif
_isDirty = true;
if (_mesh != null)
{
LateUpdate();
}
}
private void OnDisable()
{
ApplyMapping(_defaultTexture, false);
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f6d1977a52888584496b1acc7e998011
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,121 @@
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// This is an experimental feature and only works in Windows currently
/// Audio is grabbed from the MediaPlayer and rendered via Unity
/// This allows audio to have 3D spatial control, effects applied and to be spatialised for VR
/// </summary>
[RequireComponent(typeof(AudioSource))]
[AddComponentMenu("AVPro Video/Audio Output", 400)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class AudioOutput : MonoBehaviour
{
public enum AudioOutputMode
{
Single,
Multiple
}
public AudioOutputMode _audioOutputMode = AudioOutputMode.Multiple;
[SerializeField]
private MediaPlayer _mediaPlayer;
private AudioSource _audioSource;
[HideInInspector]
public int _channelMask = -1;
void Awake()
{
_audioSource = this.GetComponent<AudioSource>();
}
void Start()
{
ChangeMediaPlayer(_mediaPlayer);
#if (!UNITY_5 && !UNITY_5_4_OR_NEWER)
Debug.LogWarning("[AVProVideo] AudioOutput component requires Unity 5.x or above", this);
#endif
}
void OnDestroy()
{
ChangeMediaPlayer(null);
}
void Update()
{
if (_mediaPlayer != null && _mediaPlayer.Control != null && _mediaPlayer.Control.IsPlaying())
{
ApplyAudioSettings(_mediaPlayer, _audioSource);
}
}
public void ChangeMediaPlayer(MediaPlayer newPlayer)
{
// When changing the media player, handle event subscriptions
if (_mediaPlayer != null)
{
_mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent);
_mediaPlayer = null;
}
_mediaPlayer = newPlayer;
if (_mediaPlayer != null)
{
_mediaPlayer.Events.AddListener(OnMediaPlayerEvent);
}
}
// Callback function to handle events
private void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
switch (et)
{
case MediaPlayerEvent.EventType.Closing:
_audioSource.Stop();
break;
case MediaPlayerEvent.EventType.Started:
ApplyAudioSettings(_mediaPlayer, _audioSource);
_audioSource.Play();
break;
}
}
private static void ApplyAudioSettings(MediaPlayer player, AudioSource audioSource)
{
// Apply volume and mute from the MediaPlayer to the AudioSource
if (player != null && player.Control != null)
{
float volume = player.Control.GetVolume();
bool isMuted = player.Control.IsMuted();
float rate = player.Control.GetPlaybackRate();
audioSource.volume = volume;
audioSource.mute = isMuted;
audioSource.pitch = rate;
}
}
#if (UNITY_5 || UNITY_5_4_OR_NEWER)
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN || UNITY_WSA_10_0 || UNITY_WINRT_8_1
void OnAudioFilterRead(float[] data, int channels)
{
AudioOutputManager.Instance.RequestAudio(this, _mediaPlayer, data, _channelMask, channels, _audioOutputMode);
}
#endif
#endif
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b05a64a5de3f8546bf586f42e37b979
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,397 @@
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#elif UNITY_IOS || UNITY_ANDROID
#if UNITY_5_5_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4)
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#endif
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Builds a cube mesh for displaying a 360 degree "Cubemap 3x2 facebook layout" texture in VR
/// </summary>
[RequireComponent(typeof(MeshRenderer))]
[RequireComponent(typeof(MeshFilter))]
//[ExecuteInEditMode]
[AddComponentMenu("AVPro Video/Cubemap Cube (VR)", 400)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class CubemapCube : MonoBehaviour
{
public enum Layout
{
FacebookTransform32, // Layout for Facebooks FFMPEG Transform plugin with 3:2 layout
Facebook360Capture, // Layout for Facebooks 360-Capture-SDK
}
private Mesh _mesh;
protected MeshRenderer _renderer;
[SerializeField]
protected Material _material = null;
[SerializeField]
private MediaPlayer _mediaPlayer = null;
// This value comes from the facebook transform ffmpeg filter and is used to prevent seams appearing along the edges due to bilinear filtering
[SerializeField]
private float expansion_coeff = 1.01f;
[SerializeField]
private Layout _layout = Layout.FacebookTransform32;
private Texture _texture;
private bool _verticalFlip;
private int _textureWidth;
private int _textureHeight;
private static int _propApplyGamma;
private static int _propUseYpCbCr;
private const string PropChromaTexName = "_ChromaTex";
private static int _propChromaTex;
private const string PropYpCbCrTransformName = "_YpCbCrTransform";
private static int _propYpCbCrTransform;
public MediaPlayer Player
{
set { _mediaPlayer = value; }
get { return _mediaPlayer; }
}
void Awake()
{
if (_propApplyGamma == 0)
{
_propApplyGamma = Shader.PropertyToID("_ApplyGamma");
}
if (_propUseYpCbCr == 0)
_propUseYpCbCr = Shader.PropertyToID("_UseYpCbCr");
if (_propChromaTex == 0)
_propChromaTex = Shader.PropertyToID(PropChromaTexName);
if (_propYpCbCrTransform == 0)
_propYpCbCrTransform = Shader.PropertyToID(PropYpCbCrTransformName);
}
void Start()
{
if (_mesh == null)
{
_mesh = new Mesh();
_mesh.MarkDynamic();
MeshFilter filter = this.GetComponent<MeshFilter>();
if (filter != null)
{
filter.mesh = _mesh;
}
_renderer = this.GetComponent<MeshRenderer>();
if (_renderer != null)
{
_renderer.material = _material;
}
BuildMesh();
}
}
void OnDestroy()
{
if (_mesh != null)
{
MeshFilter filter = this.GetComponent<MeshFilter>();
if (filter != null)
{
filter.mesh = null;
}
#if UNITY_EDITOR
Mesh.DestroyImmediate(_mesh);
#else
Mesh.Destroy(_mesh);
#endif
_mesh = null;
}
if (_renderer != null)
{
_renderer.material = null;
_renderer = null;
}
}
// We do a LateUpdate() to allow for any changes in the texture that may have happened in Update()
void LateUpdate()
{
if (Application.isPlaying)
{
Texture texture = null;
bool requiresVerticalFlip = false;
if (_mediaPlayer != null && _mediaPlayer.Control != null)
{
if (_mediaPlayer.TextureProducer != null)
{
Texture resamplerTex = _mediaPlayer.FrameResampler == null || _mediaPlayer.FrameResampler.OutputTexture == null ? null : _mediaPlayer.FrameResampler.OutputTexture[0];
texture = _mediaPlayer.m_Resample ? resamplerTex : _mediaPlayer.TextureProducer.GetTexture();
requiresVerticalFlip = _mediaPlayer.TextureProducer.RequiresVerticalFlip();
// Detect changes that we need to apply to the material/mesh
if (_texture != texture ||
_verticalFlip != requiresVerticalFlip ||
(texture != null && (_textureWidth != texture.width || _textureHeight != texture.height))
)
{
_texture = texture;
if (texture != null)
{
UpdateMeshUV(texture.width, texture.height, requiresVerticalFlip);
}
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
// Apply gamma
if (_renderer.material.HasProperty(_propApplyGamma) && _mediaPlayer.Info != null)
{
Helper.SetupGammaMaterial(_renderer.material, _mediaPlayer.Info.PlayerSupportsLinearColorSpace());
}
#endif
if (_renderer.material.HasProperty(_propUseYpCbCr) && _mediaPlayer.TextureProducer.GetTextureCount() == 2)
{
_renderer.material.EnableKeyword("USE_YPCBCR");
Texture resamplerTexYCRCB = _mediaPlayer.FrameResampler == null || _mediaPlayer.FrameResampler.OutputTexture == null ? null : _mediaPlayer.FrameResampler.OutputTexture[1];
_renderer.material.SetTexture(_propChromaTex, _mediaPlayer.m_Resample ? resamplerTexYCRCB : _mediaPlayer.TextureProducer.GetTexture(1));
_renderer.material.SetMatrix(_propYpCbCrTransform, _mediaPlayer.TextureProducer.GetYpCbCrTransform());
}
}
_renderer.material.mainTexture = _texture;
}
else
{
_renderer.material.mainTexture = null;
}
}
}
private void BuildMesh()
{
Vector3 offset = new Vector3(-0.5f, -0.5f, -0.5f);
Vector3[] v = new Vector3[]
{
// Left
new Vector3(0f,-1f,0f) - offset,
new Vector3(0f,0f,0f) - offset,
new Vector3(0f,0f,-1f) - offset,
new Vector3(0f,-1f,-1f) - offset,
// Front
new Vector3(0f,0f,0f) - offset,
new Vector3(-1f,0f,0f) - offset,
new Vector3(-1f,0f,-1f) - offset,
new Vector3(0f,0f,-1f) - offset,
// Right
new Vector3(-1f,0f,0f) - offset,
new Vector3(-1f,-1f,0f) - offset,
new Vector3(-1f,-1f,-1f) - offset,
new Vector3(-1f,0f,-1f) - offset,
// Back
new Vector3(-1f,-1f,0f) - offset,
new Vector3(0f,-1f,0f) - offset,
new Vector3(0f,-1f,-1f) - offset,
new Vector3(-1f,-1f,-1f) - offset,
// Bottom
new Vector3(0f,-1f,-1f) - offset,
new Vector3(0f,0f,-1f) - offset,
new Vector3(-1f,0f,-1f) - offset,
new Vector3(-1f,-1f,-1f) - offset,
// Top
new Vector3(-1f,-1f,0f) - offset,
new Vector3(-1f,0f,0f) - offset,
new Vector3(0f,0f,0f) - offset,
new Vector3(0f,-1f,0f) - offset,
};
Matrix4x4 rot = Matrix4x4.TRS(Vector3.zero, Quaternion.AngleAxis(-90f, Vector3.right), Vector3.one);
for (int i = 0; i < v.Length; i++)
{
v[i] = rot.MultiplyPoint(v[i]);
}
_mesh.vertices = v;
_mesh.triangles = new int[]
{
0,1,2,
0,2,3,
4,5,6,
4,6,7,
8,9,10,
8,10,11,
12,13,14,
12,14,15,
16,17,18,
16,18,19,
20,21,22,
20,22,23,
};
_mesh.normals = new Vector3[]
{
// Left
new Vector3(-1f,0f,0f),
new Vector3(-1f,0f,0f),
new Vector3(-1f,0f,0f),
new Vector3(-1f,0f,0f),
// Front
new Vector3(0f,-1f,0f),
new Vector3(0f,-1f,0f),
new Vector3(0f,-1f,0f),
new Vector3(0f,-1f,0f),
// Right
new Vector3(1f,0f,0f),
new Vector3(1f,0f,0f),
new Vector3(1f,0f,0f),
new Vector3(1f,0f,0f),
// Back
new Vector3(0f,1f,0f),
new Vector3(0f,1f,0f),
new Vector3(0f,1f,0f),
new Vector3(0f,1f,0f),
// Bottom
new Vector3(0f,0f,1f),
new Vector3(0f,0f,1f),
new Vector3(0f,0f,1f),
new Vector3(0f,0f,1f),
// Top
new Vector3(0f,0f,-1f),
new Vector3(0f,0f,-1f),
new Vector3(0f,0f,-1f),
new Vector3(0f,0f,-1f)
};
UpdateMeshUV(512, 512, false);
}
private void UpdateMeshUV(int textureWidth, int textureHeight, bool flipY)
{
_textureWidth = textureWidth;
_textureHeight = textureHeight;
_verticalFlip = flipY;
float texWidth = textureWidth;
float texHeight = textureHeight;
float blockWidth = texWidth / 3f;
float pixelOffset = Mathf.Floor(((expansion_coeff * blockWidth) - blockWidth) / 2f);
float wO = pixelOffset / texWidth;
float hO = pixelOffset / texHeight;
const float third = 1f / 3f;
const float half = 0.5f;
Vector2[] uv = null;
if (_layout == Layout.Facebook360Capture)
{
uv = new Vector2[]
{
//front (texture middle top) correct left
new Vector2(third+wO, half-hO),
new Vector2((third*2f)-wO, half-hO),
new Vector2((third*2f)-wO, 0f+hO),
new Vector2(third+wO, 0f+hO),
//left (texture middle bottom) correct front
new Vector2(third+wO,1f-hO),
new Vector2((third*2f)-wO, 1f-hO),
new Vector2((third*2f)-wO, half+hO),
new Vector2(third+wO, half+hO),
//bottom (texture left top) correct right
new Vector2(0f+wO, half-hO),
new Vector2(third-wO, half-hO),
new Vector2(third-wO, 0f+hO),
new Vector2(0f+wO, 0f+hO),
//top (texture right top) correct rear
new Vector2((third*2f)+wO, 1f-hO),
new Vector2(1f-wO, 1f-hO),
new Vector2(1f-wO, half+hO),
new Vector2((third*2f)+wO, half+hO),
//back (texture right bottom) correct ground
new Vector2((third*2f)+wO, 0f+hO),
new Vector2((third*2f)+wO, half-hO),
new Vector2(1f-wO, half-hO),
new Vector2(1f-wO, 0f+hO),
//right (texture left bottom) correct sky
new Vector2(third-wO, 1f-hO),
new Vector2(third-wO, half+hO),
new Vector2(0f+wO, half+hO),
new Vector2(0f+wO, 1f-hO),
};
}
else if (_layout == Layout.FacebookTransform32)
{
uv = new Vector2[]
{
//left
new Vector2(third+wO,1f-hO),
new Vector2((third*2f)-wO, 1f-hO),
new Vector2((third*2f)-wO, half+hO),
new Vector2(third+wO, half+hO),
//front
new Vector2(third+wO, half-hO),
new Vector2((third*2f)-wO, half-hO),
new Vector2((third*2f)-wO, 0f+hO),
new Vector2(third+wO, 0f+hO),
//right
new Vector2(0f+wO, 1f-hO),
new Vector2(third-wO, 1f-hO),
new Vector2(third-wO, half+hO),
new Vector2(0f+wO, half+hO),
//back
new Vector2((third*2f)+wO, half-hO),
new Vector2(1f-wO, half-hO),
new Vector2(1f-wO, 0f+hO),
new Vector2((third*2f)+wO, 0f+hO),
//bottom
new Vector2(0f+wO, 0f+hO),
new Vector2(0f+wO, half-hO),
new Vector2(third-wO, half-hO),
new Vector2(third-wO, 0f+hO),
//top
new Vector2(1f-wO, 1f-hO),
new Vector2(1f-wO, half+hO),
new Vector2((third*2f)+wO, half+hO),
new Vector2((third*2f)+wO, 1f-hO)
};
}
if (flipY)
{
for (int i = 0; i < uv.Length; i++)
{
uv[i].y = 1f - uv[i].y;
}
}
_mesh.uv = uv;
_mesh.UploadMeshData(false);
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 683e7713922f8044c81bf497a0b5887e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,271 @@
//#define AVPROVIDEO_DISABLE_DEBUG_GUI // INTERNAL TESTING
//#define AVPROVIDEO_DEBUG_DISPLAY_EVENTS // DEV FEATURE: show event logs in the gui display
//#define AVPROVIDEO_DEBUG_FRAMESYNC // INTERNAL TESTING
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Uses IMGUI to display a UI to show information about the MediaPlayer
/// </summary>
[AddComponentMenu("AVPro Video/Debug Overlay", -99)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class DebugOverlay : MonoBehaviour
{
[SerializeField]
private MediaPlayer _mediaPlayer = null;
#pragma warning disable 414
[SerializeField]
private int _guiDepth = -1000;
[SerializeField]
private float _displaySize = 1f;
private int _debugOverlayCount;
#pragma warning restore 414
[SerializeField]
private bool _displayControls = true;
public bool DisplayControls
{
get { return _displayControls; }
set { _displayControls = value; }
}
public MediaPlayer CurrentMediaPlayer
{
get
{
return _mediaPlayer;
}
set
{
if (_mediaPlayer != value)
{
#if AVPROVIDEO_DEBUG_DISPLAY_EVENTS
if (_mediaPlayer != null)
{
_mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent);
}
#endif
_mediaPlayer = value;
}
}
}
private const int s_GuiStartWidth = 10;
private const int s_GuiWidth = 180;
#if AVPROVIDEO_DISABLE_DEBUG_GUI && !UNITY_EDITOR
#else
private int m_GuiPositionX = s_GuiStartWidth;
#endif
private void SetGuiPositionFromVideoIndex(int index)
{
#if AVPROVIDEO_DISABLE_DEBUG_GUI && !UNITY_EDITOR
#else
m_GuiPositionX = Mathf.FloorToInt((s_GuiStartWidth * _displaySize) + (s_GuiWidth * index * _displaySize));
#endif
}
#if AVPROVIDEO_DEBUG_FRAMESYNC
private int _lastFrameCount = 0;
private int _sameFrameCount = 1;
public int SameFrameCount
{
get { return _sameFrameCount; }
}
private void UpdateFrameSyncDebugging()
{
int frameCount = TextureProducer.GetTextureFrameCount();
if (frameCount == _lastFrameCount)
{
_sameFrameCount++;
}
else
{
_sameFrameCount = 1;
}
_lastFrameCount = frameCount;
}
#endif
#if AVPROVIDEO_DEBUG_DISPLAY_EVENTS
private Queue<string> _eventLog = new Queue<string>(8);
private float _eventTimer = 1f;
private void AddEvent(MediaPlayerEvent.EventType et)
{
Helper.LogInfo("[MediaPlayer] Event: " + et.ToString(), this);
_eventLog.Enqueue(et.ToString());
if (_eventLog.Count > 5)
{
_eventLog.Dequeue();
_eventTimer = 1f;
}
}
private void UpdateEventLogs()
{
if (_eventLog != null && _eventLog.Count > 0)
{
_eventTimer -= Time.deltaTime;
if (_eventTimer < 0f)
{
_eventLog.Dequeue();
_eventTimer = 1f;
}
}
}
// Callback function to handle events
private void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
AddEvent(et);
}
#endif
private void Update()
{
_debugOverlayCount = 0;
#if AVPROVIDEO_DISABLE_DEBUG_GUI
// Stub code so that the variables are used and don't produce a warning
_guiDepth = -1000;
_displaySize = 1f;
_debugOverlayCount = 0;
#endif
}
#if AVPROVIDEO_DISABLE_DEBUG_GUI && !UNITY_EDITOR
#else
void OnGUI()
{
if (Event.current.type == EventType.Layout)
{
SetGuiPositionFromVideoIndex(_debugOverlayCount++);
}
if (_mediaPlayer != null && _mediaPlayer.Info != null)
{
IMediaInfo info = _mediaPlayer.Info;
IMediaControl control = _mediaPlayer.Control;
IMediaProducer textureProducer = _mediaPlayer.TextureProducer;
GUI.depth = _guiDepth;
GUI.matrix = Matrix4x4.TRS(new Vector3(m_GuiPositionX, 10f, 0f), Quaternion.identity, new Vector3(_displaySize, _displaySize, 1.0f));
GUILayout.BeginVertical("box", GUILayout.MaxWidth(s_GuiWidth));
GUILayout.Label(System.IO.Path.GetFileName(_mediaPlayer.m_VideoPath));
GUILayout.Label("Dimensions: " + info.GetVideoWidth() + "x" + info.GetVideoHeight() + "@" + info.GetVideoFrameRate().ToString("F2"));
GUILayout.Label("Time: " + (control.GetCurrentTimeMs() * 0.001f).ToString("F1") + "s / " + (info.GetDurationMs() * 0.001f).ToString("F1") + "s");
GUILayout.Label("Rate: " + info.GetVideoDisplayRate().ToString("F2") + "Hz");
if (_mediaPlayer.m_Resample && _mediaPlayer.FrameResampler != null)
{
Resampler resampler = _mediaPlayer.FrameResampler;
GUILayout.BeginVertical();
GUILayout.Label("Resampler Info:");
GUILayout.Label("Resampler timestamp: " + resampler.TextureTimeStamp);
GUILayout.Label("Resampler frames dropped: " + resampler.DroppedFrames);
GUILayout.Label("Resampler frame displayed timer: " + resampler.FrameDisplayedTimer);
GUILayout.EndVertical();
}
if (textureProducer != null && textureProducer.GetTexture() != null)
{
#if REAL_ANDROID
// In OES mode we can't display the texture without using a special shader, so just don't display it
if (!_optionsAndroid.useFastOesPath)
#endif
{
// Show texture without and with alpha blending
GUILayout.BeginHorizontal();
Rect r1 = GUILayoutUtility.GetRect(32f, 32f);
GUILayout.Space(8f);
Rect r2 = GUILayoutUtility.GetRect(32f, 32f);
Matrix4x4 prevMatrix = GUI.matrix;
if (textureProducer.RequiresVerticalFlip())
{
GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0, r1.y + (r1.height / 2f)));
}
GUI.DrawTexture(r1, textureProducer.GetTexture(), ScaleMode.ScaleToFit, false);
GUI.DrawTexture(r2, textureProducer.GetTexture(), ScaleMode.ScaleToFit, true);
GUI.matrix = prevMatrix;
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}
}
if (_displayControls)
{
GUILayout.BeginHorizontal();
if (control.IsPaused())
{
if (GUILayout.Button("Play", GUILayout.Width(50)))
{
control.Play();
}
}
else
{
if (GUILayout.Button("Pause", GUILayout.Width(50)))
{
control.Pause();
}
}
float duration = info.GetDurationMs();
float time = control.GetCurrentTimeMs();
float newTime = GUILayout.HorizontalSlider(time, 0f, duration);
if (newTime != time)
{
control.Seek(newTime);
}
GUILayout.EndHorizontal();
}
#if AVPROVIDEO_DEBUG_DISPLAY_EVENTS
// Dirty code to hack in an event monitor
if (Event.current.type == EventType.Repaint)
{
_mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent);
_mediaPlayer.Events.AddListener(OnMediaPlayerEvent);
UpdateEventLogs();
}
if (_eventLog != null && _eventLog.Count > 0)
{
GUILayout.Label("Recent Events: ");
GUILayout.BeginVertical("box");
int eventIndex = 0;
foreach (string eventString in _eventLog)
{
GUI.color = Color.white;
if (eventIndex == 0)
{
GUI.color = new Color(1f, 1f, 1f, _eventTimer);
}
GUILayout.Label(eventString);
eventIndex++;
}
GUILayout.EndVertical();
GUI.color = Color.white;
}
#endif
GUILayout.EndVertical();
}
}
#endif
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7954bb33da8af354bbe3cdece033bfdc
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,60 @@
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Draws video over the whole background using the special "background" tag on the shader.
/// Useful for augmented reality.
/// NOTE: This doesn't work with the camera clear mode set to 'skybox'
/// </summary>
[AddComponentMenu("AVPro Video/Display Background", 200)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
[ExecuteInEditMode]
public class DisplayBackground : MonoBehaviour
{
public IMediaProducer _source;
public Texture2D _texture;
public Material _material;
//-------------------------------------------------------------------------
void OnRenderObject()
{
if (_material == null || _texture == null)
return;
Vector4 uv = new Vector4(0f, 0f, 1f, 1f);
_material.SetPass(0);
GL.PushMatrix();
GL.LoadOrtho();
GL.Begin(GL.QUADS);
GL.TexCoord2(uv.x, uv.y);
GL.Vertex3(0.0f, 0.0f, 0.1f);
GL.TexCoord2(uv.z, uv.y);
GL.Vertex3(1.0f, 0.0f, 0.1f);
GL.TexCoord2(uv.z, uv.w);
GL.Vertex3(1.0f, 1.0f, 0.1f);
GL.TexCoord2(uv.x, uv.w);
GL.Vertex3(0.0f, 1.0f, 0.1f);
GL.End();
GL.PopMatrix();
}
}
}

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6265373c6a2e0b24f8cd817d3bb88b51
MonoImporter:
serializedVersion: 2
defaultReferences:
- _texture: {instanceID: 0}
- _material: {fileID: 2100000, guid: 7ccf4b555441d554484bbe799cb1c834, type: 2}
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,314 @@
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#elif UNITY_IOS || UNITY_ANDROID
#if UNITY_5_5_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4)
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#endif
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Displays the video from MediaPlayer component using IMGUI
/// </summary>
[AddComponentMenu("AVPro Video/Display IMGUI", 200)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
[ExecuteInEditMode]
public class DisplayIMGUI : MonoBehaviour
{
private const string PropChromaTexName = "_ChromaTex";
private const string PropYpCbCrTransformName = "_YpCbCrTransform";
public MediaPlayer _mediaPlayer;
public bool _displayInEditor = true;
public ScaleMode _scaleMode = ScaleMode.ScaleToFit;
public Color _color = Color.white;
public bool _alphaBlend = false;
[SerializeField]
private bool _useDepth = false;
public int _depth = 0;
public bool _fullScreen = true;
[Range(0f, 1f)]
public float _x = 0.0f;
[Range(0f, 1f)]
public float _y = 0.0f;
[Range(0f, 1f)]
public float _width = 1.0f;
[Range(0f, 1f)]
public float _height = 1.0f;
private static int _propAlphaPack;
private static int _propVertScale;
private static int _propApplyGamma;
private static int _propChromaTex;
private static int _propYpCbCrTransform;
private static Shader _shaderAlphaPacking;
private Material _material;
void Awake()
{
if (_propAlphaPack == 0)
{
_propAlphaPack = Shader.PropertyToID("AlphaPack");
_propVertScale = Shader.PropertyToID("_VertScale");
_propApplyGamma = Shader.PropertyToID("_ApplyGamma");
_propChromaTex = Shader.PropertyToID(PropChromaTexName);
_propYpCbCrTransform = Shader.PropertyToID(PropYpCbCrTransformName);
}
}
void Start()
{
// Disabling this lets you skip the GUI layout phase which helps performance, but this also breaks the GUI.depth usage.
if (!_useDepth)
{
this.useGUILayout = false;
}
if (_shaderAlphaPacking == null)
{
_shaderAlphaPacking = Shader.Find("AVProVideo/IMGUI/Texture Transparent");
if (_shaderAlphaPacking == null)
{
Debug.LogWarning("[AVProVideo] Missing shader AVProVideo/IMGUI/Transparent Packed");
}
}
}
void OnDestroy()
{
// Destroy existing material
if (_material != null)
{
#if UNITY_EDITOR
Material.DestroyImmediate(_material);
#else
Material.Destroy(_material);
#endif
_material = null;
}
}
private Shader GetRequiredShader()
{
Shader result = null;
switch (_mediaPlayer.m_AlphaPacking)
{
case AlphaPacking.None:
break;
case AlphaPacking.LeftRight:
case AlphaPacking.TopBottom:
result = _shaderAlphaPacking;
break;
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
if (result == null && _mediaPlayer.Info != null)
{
// If the player does support generating sRGB textures then we need to use a shader to convert them for display via IMGUI
if (QualitySettings.activeColorSpace == ColorSpace.Linear && _mediaPlayer.Info.PlayerSupportsLinearColorSpace())
{
result = _shaderAlphaPacking;
}
}
#endif
if (result == null && _mediaPlayer.TextureProducer != null)
{
if (_mediaPlayer.TextureProducer.GetTextureCount() == 2)
{
result = _shaderAlphaPacking;
}
}
return result;
}
void Update()
{
if (_mediaPlayer != null)
{
// Get required shader
Shader currentShader = null;
if (_material != null)
{
currentShader = _material.shader;
}
Shader nextShader = GetRequiredShader();
// If the shader requirement has changed
if (currentShader != nextShader)
{
// Destroy existing material
if (_material != null)
{
#if UNITY_EDITOR
Material.DestroyImmediate(_material);
#else
Material.Destroy(_material);
#endif
_material = null;
}
// Create new material
if (nextShader != null)
{
_material = new Material(nextShader);
}
}
// Apply material changes
if (_material != null)
{
if (_material.HasProperty(_propAlphaPack))
{
Helper.SetupAlphaPackedMaterial(_material, _mediaPlayer.m_AlphaPacking);
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
// Apply gamma
if (_material.HasProperty(_propApplyGamma) && _mediaPlayer.Info != null)
{
Helper.SetupGammaMaterial(_material, !_mediaPlayer.Info.PlayerSupportsLinearColorSpace());
}
#else
_propApplyGamma |= 0;
#endif
}
}
}
void OnGUI()
{
#if UNITY_EDITOR
if (!Application.isPlaying && _displayInEditor)
{
GUI.depth = _depth;
GUI.color = _color;
Rect rect = GetRect();
Texture2D icon = Resources.Load<Texture2D>("AVProVideoIcon");
Rect uv = rect;
uv.x /= Screen.width;
uv.width /= Screen.width;
uv.y /= Screen.height;
uv.height /= Screen.height;
uv.width *= 16f;
uv.height *= 16f;
uv.x += 0.5f;
uv.y += 0.5f;
GUI.DrawTextureWithTexCoords(rect, icon, uv);
return;
}
#endif
if (_mediaPlayer == null)
{
return;
}
bool requiresVerticalFlip = false;
Texture texture = null;
if (_displayInEditor)
{
#if UNITY_EDITOR
texture = Texture2D.whiteTexture;
#endif
}
if (_mediaPlayer.Info != null && !_mediaPlayer.Info.HasVideo())
{
texture = null;
}
if (_mediaPlayer.TextureProducer != null)
{
if (_mediaPlayer.m_Resample)
{
if (_mediaPlayer.FrameResampler.OutputTexture != null && _mediaPlayer.FrameResampler.OutputTexture[0] != null)
{
texture = _mediaPlayer.FrameResampler.OutputTexture[0];
requiresVerticalFlip = _mediaPlayer.TextureProducer.RequiresVerticalFlip();
}
}
else
{
if (_mediaPlayer.TextureProducer.GetTexture() != null)
{
texture = _mediaPlayer.TextureProducer.GetTexture();
requiresVerticalFlip = _mediaPlayer.TextureProducer.RequiresVerticalFlip();
}
}
if (_mediaPlayer.TextureProducer.GetTextureCount() == 2 && _material != null)
{
Texture resamplerTex = _mediaPlayer.FrameResampler == null || _mediaPlayer.FrameResampler.OutputTexture == null ? null : _mediaPlayer.FrameResampler.OutputTexture[1];
Texture chroma = _mediaPlayer.m_Resample ? resamplerTex : _mediaPlayer.TextureProducer.GetTexture(1);
_material.SetTexture(_propChromaTex, chroma);
_material.SetMatrix(_propYpCbCrTransform, _mediaPlayer.TextureProducer.GetYpCbCrTransform());
_material.EnableKeyword("USE_YPCBCR");
}
}
if (texture != null)
{
if (!_alphaBlend || _color.a > 0f)
{
GUI.depth = _depth;
GUI.color = _color;
Rect rect = GetRect();
if (_material != null)
{
if (requiresVerticalFlip)
{
_material.SetFloat(_propVertScale, -1f);
}
else
{
_material.SetFloat(_propVertScale, 1f);
}
Helper.DrawTexture(rect, texture, _scaleMode, _mediaPlayer.m_AlphaPacking, _material);
}
else
{
if (requiresVerticalFlip)
{
GUIUtility.ScaleAroundPivot(new Vector2(1f, -1f), new Vector2(0f, rect.y + (rect.height / 2f)));
}
GUI.DrawTexture(rect, texture, _scaleMode, _alphaBlend);
}
}
}
}
public Rect GetRect()
{
Rect rect;
if (_fullScreen)
{
rect = new Rect(0.0f, 0.0f, Screen.width, Screen.height);
}
else
{
rect = new Rect(_x * (Screen.width - 1), _y * (Screen.height - 1), _width * Screen.width, _height * Screen.height);
}
return rect;
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 75f3b319d2d69934d8bf545ab45c918d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,663 @@
#if UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_5 || UNITY_5_4_OR_NEWER
#define UNITY_FEATURE_UGUI
#endif
#if UNITY_ANDROID && !UNITY_EDITOR
#define REAL_ANDROID
#endif
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#elif UNITY_IOS || UNITY_ANDROID
#if UNITY_5_5_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2 && !UNITY_5_3 && !UNITY_5_4)
#define UNITY_PLATFORM_SUPPORTS_LINEAR
#endif
#endif
// Some older versions of Unity don't set the _TexelSize variable from uGUI so we need to set this manually
#if ((!UNITY_5_4_OR_NEWER && !UNITY_5) || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3_0 || UNITY_5_3_1 || UNITY_5_3_2 || UNITY_5_3_3)
#define UNITY_UGUI_NOSET_TEXELSIZE
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using System.Collections.Generic;
#if UNITY_FEATURE_UGUI
using UnityEngine;
using UnityEngine.UI;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Displays the video from MediaPlayer component using uGUI
/// </summary>
[ExecuteInEditMode]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
[AddComponentMenu("AVPro Video/Display uGUI", 200)]
public class DisplayUGUI : UnityEngine.UI.MaskableGraphic
{
[SerializeField]
public MediaPlayer _mediaPlayer;
[SerializeField]
public Rect m_UVRect = new Rect(0f, 0f, 1f, 1f);
[SerializeField]
public bool _setNativeSize = false;
[SerializeField]
public ScaleMode _scaleMode = ScaleMode.ScaleToFit;
[SerializeField]
public bool _noDefaultDisplay = true;
[SerializeField]
public bool _displayInEditor = true;
[SerializeField]
public Texture _defaultTexture;
private int _lastWidth;
private int _lastHeight;
private bool _flipY;
private Texture _lastTexture;
private static Shader _shaderStereoPacking;
private static Shader _shaderAlphaPacking;
#if REAL_ANDROID
private static Shader _shaderAndroidOES;
#endif
private static int _propAlphaPack;
private static int _propVertScale;
private static int _propStereo;
private static int _propApplyGamma;
private static int _propUseYpCbCr;
private const string PropChromaTexName = "_ChromaTex";
private static int _propChromaTex;
private const string PropYpCbCrTransformName = "_YpCbCrTransform";
private static int _propYpCbCrTransform;
#if UNITY_UGUI_NOSET_TEXELSIZE
private static int _propMainTextureTexelSize;
#endif
private bool _userMaterial = true;
private Material _material;
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2_0 && !UNITY_5_2_1)
private List<UIVertex> _vertices = new List<UIVertex>(4);
private static List<int> QuadIndices = new List<int>(new int[] { 0, 1, 2, 2, 3, 0 });
#endif
protected override void Awake()
{
if (_propAlphaPack == 0)
{
_propStereo = Shader.PropertyToID("Stereo");
_propAlphaPack = Shader.PropertyToID("AlphaPack");
_propVertScale = Shader.PropertyToID("_VertScale");
_propApplyGamma = Shader.PropertyToID("_ApplyGamma");
_propUseYpCbCr = Shader.PropertyToID("_UseYpCbCr");
_propChromaTex = Shader.PropertyToID(PropChromaTexName);
_propUseYpCbCr = Shader.PropertyToID("_UseYpCbCr");
_propYpCbCrTransform = Shader.PropertyToID(PropYpCbCrTransformName);
#if UNITY_UGUI_NOSET_TEXELSIZE
_propMainTextureTexelSize = Shader.PropertyToID("_MainTex_TexelSize");
#endif
}
if (_shaderAlphaPacking == null)
{
_shaderAlphaPacking = Shader.Find("AVProVideo/UI/Transparent Packed");
if (_shaderAlphaPacking == null)
{
Debug.LogWarning("[AVProVideo] Missing shader AVProVideo/UI/Transparent Packed");
}
}
if (_shaderStereoPacking == null)
{
_shaderStereoPacking = Shader.Find("AVProVideo/UI/Stereo");
if (_shaderStereoPacking == null)
{
Debug.LogWarning("[AVProVideo] Missing shader AVProVideo/UI/Stereo");
}
}
#if REAL_ANDROID
if (_shaderAndroidOES == null)
{
_shaderAndroidOES = Shader.Find("AVProVideo/UI/AndroidOES");
if (_shaderAndroidOES == null)
{
Debug.LogWarning("[AVProVideo] Missing shader AVProVideo/UI/AndroidOES");
}
}
#endif
base.Awake();
}
protected override void Start()
{
_userMaterial = (this.m_Material != null);
base.Start();
}
protected override void OnDestroy()
{
// Destroy existing material
if (_material != null)
{
this.material = null;
#if UNITY_EDITOR
Material.DestroyImmediate(_material);
#else
Material.Destroy(_material);
#endif
_material = null;
}
base.OnDestroy();
}
private Shader GetRequiredShader()
{
Shader result = null;
switch (_mediaPlayer.m_StereoPacking)
{
case StereoPacking.None:
break;
case StereoPacking.LeftRight:
case StereoPacking.TopBottom:
result = _shaderStereoPacking;
break;
}
switch (_mediaPlayer.m_AlphaPacking)
{
case AlphaPacking.None:
break;
case AlphaPacking.LeftRight:
case AlphaPacking.TopBottom:
result = _shaderAlphaPacking;
break;
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
if (result == null && _mediaPlayer.Info != null)
{
if (QualitySettings.activeColorSpace == ColorSpace.Linear && !_mediaPlayer.Info.PlayerSupportsLinearColorSpace())
{
result = _shaderAlphaPacking;
}
}
#endif
if (result == null && _mediaPlayer.TextureProducer != null && _mediaPlayer.TextureProducer.GetTextureCount() == 2)
{
result = _shaderAlphaPacking;
}
#if REAL_ANDROID
if (_mediaPlayer.PlatformOptionsAndroid.useFastOesPath)
{
result = _shaderAndroidOES;
}
#endif
return result;
}
/// <summary>
/// Returns the texture used to draw this Graphic.
/// </summary>
public override Texture mainTexture
{
get
{
Texture result = Texture2D.whiteTexture;
if (HasValidTexture())
{
Texture resamplerTex = _mediaPlayer.FrameResampler == null || _mediaPlayer.FrameResampler.OutputTexture == null ? null : _mediaPlayer.FrameResampler.OutputTexture[0];
result = _mediaPlayer.m_Resample ? resamplerTex : _mediaPlayer.TextureProducer.GetTexture();
}
else
{
if (_noDefaultDisplay)
{
result = null;
}
else if (_defaultTexture != null)
{
result = _defaultTexture;
}
#if UNITY_EDITOR
if (result == null && _displayInEditor)
{
result = Resources.Load<Texture2D>("AVProVideoIcon");
}
#endif
}
return result;
}
}
public bool HasValidTexture()
{
return (_mediaPlayer != null && _mediaPlayer.TextureProducer != null && _mediaPlayer.TextureProducer.GetTexture() != null);
}
private void UpdateInternalMaterial()
{
if (_mediaPlayer != null)
{
// Get required shader
Shader currentShader = null;
if (_material != null)
{
currentShader = _material.shader;
}
Shader nextShader = GetRequiredShader();
// If the shader requirement has changed
if (currentShader != nextShader)
{
// Destroy existing material
if (_material != null)
{
this.material = null;
#if UNITY_EDITOR
Material.DestroyImmediate(_material);
#else
Material.Destroy(_material);
#endif
_material = null;
}
// Create new material
if (nextShader != null)
{
_material = new Material(nextShader);
}
}
this.material = _material;
}
}
// We do a LateUpdate() to allow for any changes in the texture that may have happened in Update()
void LateUpdate()
{
if (_setNativeSize)
{
SetNativeSize();
}
if (_lastTexture != mainTexture)
{
_lastTexture = mainTexture;
SetVerticesDirty();
SetMaterialDirty();
}
if (HasValidTexture())
{
if (mainTexture != null)
{
if (mainTexture.width != _lastWidth || mainTexture.height != _lastHeight)
{
_lastWidth = mainTexture.width;
_lastHeight = mainTexture.height;
SetVerticesDirty();
SetMaterialDirty();
}
}
}
if (!_userMaterial && Application.isPlaying)
{
UpdateInternalMaterial();
}
if (material != null && _mediaPlayer != null)
{
// YpCbCr support
if (material.HasProperty(_propUseYpCbCr) && _mediaPlayer.TextureProducer != null && _mediaPlayer.TextureProducer.GetTextureCount() == 2)
{
material.EnableKeyword("USE_YPCBCR");
material.SetMatrix(_propYpCbCrTransform, _mediaPlayer.TextureProducer.GetYpCbCrTransform());
Texture resamplerTex = _mediaPlayer.FrameResampler == null || _mediaPlayer.FrameResampler.OutputTexture == null ? null : _mediaPlayer.FrameResampler.OutputTexture[1];
material.SetTexture(_propChromaTex, _mediaPlayer.m_Resample ? resamplerTex : _mediaPlayer.TextureProducer.GetTexture(1));
}
// Apply changes for alpha videos
if (material.HasProperty(_propAlphaPack))
{
Helper.SetupAlphaPackedMaterial(material, _mediaPlayer.m_AlphaPacking);
if (_flipY && _mediaPlayer.m_AlphaPacking != AlphaPacking.None)
{
material.SetFloat(_propVertScale, -1f);
}
else
{
material.SetFloat(_propVertScale, 1f);
}
#if UNITY_UGUI_NOSET_TEXELSIZE
if (mainTexture != null)
{
material.SetVector(_propMainTextureTexelSize, new Vector4(1.0f / mainTexture.width, 1.0f / mainTexture.height, mainTexture.width, mainTexture.height));
}
#endif
}
// Apply changes for stereo videos
if (material.HasProperty(_propStereo))
{
Helper.SetupStereoMaterial(material, _mediaPlayer.m_StereoPacking, _mediaPlayer.m_DisplayDebugStereoColorTint);
}
#if UNITY_PLATFORM_SUPPORTS_LINEAR
if (material.HasProperty(_propApplyGamma) && _mediaPlayer.Info != null)
{
Helper.SetupGammaMaterial(material, _mediaPlayer.Info.PlayerSupportsLinearColorSpace());
}
#else
_propApplyGamma |= 0;
#endif
}
}
/// <summary>
/// Texture to be used.
/// </summary>
public MediaPlayer CurrentMediaPlayer
{
get
{
return _mediaPlayer;
}
set
{
if (_mediaPlayer != value)
{
_mediaPlayer = value;
//SetVerticesDirty();
SetMaterialDirty();
}
}
}
/// <summary>
/// UV rectangle used by the texture.
/// </summary>
public Rect uvRect
{
get
{
return m_UVRect;
}
set
{
if (m_UVRect == value)
{
return;
}
m_UVRect = value;
SetVerticesDirty();
}
}
/// <summary>
/// Adjust the scale of the Graphic to make it pixel-perfect.
/// </summary>
[ContextMenu("Set Native Size")]
public override void SetNativeSize()
{
Texture tex = mainTexture;
if (tex != null)
{
int w = Mathf.RoundToInt(tex.width * uvRect.width);
int h = Mathf.RoundToInt(tex.height * uvRect.height);
if (_mediaPlayer != null)
{
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
if (_mediaPlayer.Info != null)
{
Orientation ori = Helper.GetOrientation(_mediaPlayer.Info.GetTextureTransform());
if (ori == Orientation.Portrait || ori == Orientation.PortraitFlipped)
{
w = Mathf.RoundToInt(tex.height * uvRect.width);
h = Mathf.RoundToInt(tex.width * uvRect.height);
}
}
#endif
if (_mediaPlayer.m_AlphaPacking == AlphaPacking.LeftRight || _mediaPlayer.m_StereoPacking == StereoPacking.LeftRight)
{
w /= 2;
}
else if (_mediaPlayer.m_AlphaPacking == AlphaPacking.TopBottom || _mediaPlayer.m_StereoPacking == StereoPacking.TopBottom)
{
h /= 2;
}
}
rectTransform.anchorMax = rectTransform.anchorMin;
rectTransform.sizeDelta = new Vector2(w, h);
}
}
/// <summary>
/// Update all renderer data.
/// </summary>
// OnFillVBO deprecated by 5.2
// OnPopulateMesh(Mesh mesh) deprecated by 5.2 patch 1
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1 && !UNITY_5_2_0)
/* protected override void OnPopulateMesh(Mesh mesh)
{
List<UIVertex> verts = new List<UIVertex>();
_OnFillVBO( verts );
var quad = new UIVertex[4];
for (int i = 0; i < vbo.Count; i += 4)
{
vbo.CopyTo(i, quad, 0, 4);
vh.AddUIVertexQuad(quad);
}
vh.FillMesh( toFill );
}*/
#if !UNITY_5_2_1
protected override void OnPopulateMesh(VertexHelper vh)
{
vh.Clear();
_OnFillVBO(_vertices);
vh.AddUIVertexStream(_vertices, QuadIndices );
}
#endif
#endif
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0 && !UNITY_5_1)
[System.Obsolete("This method is not called from Unity 5.2 and above")]
#endif
protected override void OnFillVBO(List<UIVertex> vbo)
{
_OnFillVBO(vbo);
}
private void _OnFillVBO(List<UIVertex> vbo)
{
_flipY = false;
if (HasValidTexture())
{
_flipY = _mediaPlayer.TextureProducer.RequiresVerticalFlip();
}
Rect uvRect = m_UVRect;
Vector4 v = GetDrawingDimensions(_scaleMode, ref uvRect);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
Matrix4x4 m = Matrix4x4.identity;
if (HasValidTexture())
{
m = Helper.GetMatrixForOrientation(Helper.GetOrientation(_mediaPlayer.Info.GetTextureTransform()));
}
#endif
vbo.Clear();
var vert = UIVertex.simpleVert;
vert.color = color;
vert.position = new Vector2(v.x, v.y);
vert.uv0 = new Vector2(uvRect.xMin, uvRect.yMin);
if (_flipY)
{
vert.uv0 = new Vector2(uvRect.xMin, 1.0f - uvRect.yMin);
}
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
vert.uv0 = m.MultiplyPoint3x4(vert.uv0);
#endif
vbo.Add(vert);
vert.position = new Vector2(v.x, v.w);
vert.uv0 = new Vector2(uvRect.xMin, uvRect.yMax);
if (_flipY)
{
vert.uv0 = new Vector2(uvRect.xMin, 1.0f - uvRect.yMax);
}
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
vert.uv0 = m.MultiplyPoint3x4(vert.uv0);
#endif
vbo.Add(vert);
vert.position = new Vector2(v.z, v.w);
vert.uv0 = new Vector2(uvRect.xMax, uvRect.yMax);
if (_flipY)
{
vert.uv0 = new Vector2(uvRect.xMax, 1.0f - uvRect.yMax);
}
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
vert.uv0 = m.MultiplyPoint3x4(vert.uv0);
#endif
vbo.Add(vert);
vert.position = new Vector2(v.z, v.y);
vert.uv0 = new Vector2(uvRect.xMax, uvRect.yMin);
if (_flipY)
{
vert.uv0 = new Vector2(uvRect.xMax, 1.0f - uvRect.yMin);
}
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
vert.uv0 = m.MultiplyPoint3x4(vert.uv0);
#endif
vbo.Add(vert);
}
private Vector4 GetDrawingDimensions(ScaleMode scaleMode, ref Rect uvRect)
{
Vector4 returnSize = Vector4.zero;
if (mainTexture != null)
{
var padding = Vector4.zero;
var textureSize = new Vector2(mainTexture.width, mainTexture.height);
{
// Adjust textureSize based on orientation
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_IPHONE || UNITY_IOS || UNITY_TVOS
if (HasValidTexture())
{
Matrix4x4 m = Helper.GetMatrixForOrientation(Helper.GetOrientation(_mediaPlayer.Info.GetTextureTransform()));
textureSize = m.MultiplyVector(textureSize);
textureSize.x = Mathf.Abs(textureSize.x);
textureSize.y = Mathf.Abs(textureSize.y);
}
#endif
// Adjust textureSize based on alpha packing
if (_mediaPlayer != null)
{
if (_mediaPlayer.m_AlphaPacking == AlphaPacking.LeftRight || _mediaPlayer.m_StereoPacking == StereoPacking.LeftRight)
{
textureSize.x /= 2f;
}
else if (_mediaPlayer.m_AlphaPacking == AlphaPacking.TopBottom || _mediaPlayer.m_StereoPacking == StereoPacking.TopBottom)
{
textureSize.y /= 2f;
}
}
}
Rect r = GetPixelAdjustedRect();
// Fit the above textureSize into rectangle r
int spriteW = Mathf.RoundToInt( textureSize.x );
int spriteH = Mathf.RoundToInt( textureSize.y );
var size = new Vector4( padding.x / spriteW,
padding.y / spriteH,
(spriteW - padding.z) / spriteW,
(spriteH - padding.w) / spriteH );
{
if (textureSize.sqrMagnitude > 0.0f)
{
if (scaleMode == ScaleMode.ScaleToFit)
{
float spriteRatio = textureSize.x / textureSize.y;
float rectRatio = r.width / r.height;
if (spriteRatio > rectRatio)
{
float oldHeight = r.height;
r.height = r.width * (1.0f / spriteRatio);
r.y += (oldHeight - r.height) * rectTransform.pivot.y;
}
else
{
float oldWidth = r.width;
r.width = r.height * spriteRatio;
r.x += (oldWidth - r.width) * rectTransform.pivot.x;
}
}
else if (scaleMode == ScaleMode.ScaleAndCrop)
{
float aspectRatio = textureSize.x / textureSize.y;
float screenRatio = r.width / r.height;
if (screenRatio > aspectRatio)
{
float adjust = aspectRatio / screenRatio;
uvRect = new Rect(0f, (1f - adjust) * 0.5f, 1f, adjust);
}
else
{
float adjust = screenRatio / aspectRatio;
uvRect = new Rect(0.5f - adjust * 0.5f, 0f, adjust, 1f);
}
}
}
}
returnSize = new Vector4( r.x + r.width * size.x,
r.y + r.height * size.y,
r.x + r.width * size.z,
r.y + r.height * size.w );
}
return returnSize;
}
}
}
#endif

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0f17cdc186456a4469a139a104d2ca72
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 638c870cac4da414fba921606d504407
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,901 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
[System.Serializable]
public class MediaPlaylist
{
[System.Serializable]
public class MediaItem
{
/*public enum SourceType
{
AVProMediaPlayer,
Texture2D,
}
[SerializeField]
public SourceType sourceType;*/
[SerializeField]
public MediaPlayer.FileLocation fileLocation = MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder;
[SerializeField]
public string filePath;
/*[SerializeField]
public Texture2D texture;
[SerializeField]
public float textureDuration;*/
[SerializeField]
public bool loop = false;
[SerializeField]
public PlaylistMediaPlayer.StartMode startMode = PlaylistMediaPlayer.StartMode.Immediate;
[SerializeField]
public PlaylistMediaPlayer.ProgressMode progressMode = PlaylistMediaPlayer.ProgressMode.OnFinish;
[SerializeField]
public float progressTimeSeconds = 0.5f;
[SerializeField]
public bool autoPlay = true;
[SerializeField]
public StereoPacking stereoPacking = StereoPacking.None;
[SerializeField]
public AlphaPacking alphaPacking = AlphaPacking.None;
[SerializeField]
public bool isOverrideTransition = false;
[SerializeField]
public PlaylistMediaPlayer.Transition overrideTransition = PlaylistMediaPlayer.Transition.None;
[SerializeField]
public float overrideTransitionDuration = 1f;
[SerializeField]
public PlaylistMediaPlayer.Easing overrideTransitionEasing;
}
[SerializeField]
private List<MediaItem> _items = new List<MediaItem>(8);
public List<MediaItem> Items { get { return _items; } }
public bool HasItemAt(int index)
{
return (index >= 0 && index < _items.Count);
}
}
/// <summary>
/// This is a BETA component
/// </summary>
[AddComponentMenu("AVPro Video/Playlist Media Player (BETA)", -100)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class PlaylistMediaPlayer : MediaPlayer, IMediaProducer
{
public enum Transition
{
None,
Fade,
Black,
White,
Transparent,
Horiz,
Vert,
Diag,
MirrorH,
MirrorV,
MirrorD,
ScrollV,
ScrollH,
Circle,
Diamond,
Blinds,
Arrows,
SlideH,
SlideV,
Zoom,
RectV,
Random,
}
public enum PlaylistLoopMode
{
None,
Loop,
}
public enum StartMode
{
Immediate,
//AfterSeconds,
Manual,
}
public enum ProgressMode
{
OnFinish,
BeforeFinish,
//AfterTime,
Manual,
}
[SerializeField]
private MediaPlayer _playerA;
[SerializeField]
private MediaPlayer _playerB;
[SerializeField]
private bool _playlistAutoProgress = true;
[SerializeField]
private PlaylistLoopMode _playlistLoopMode = PlaylistLoopMode.None;
[SerializeField]
private MediaPlaylist _playlist = new MediaPlaylist();
[SerializeField]
[Tooltip("Pause the previously playing video. This is useful for systems that will struggle to play 2 videos at once")]
private bool _pausePreviousOnTransition = true;
[SerializeField]
private Transition _nextTransition = Transition.None;
[SerializeField]
private float _transitionDuration = 1f;
[SerializeField]
private Easing _transitionEasing;
private static int _propFromTex;
private static int _propT;
private int _playlistIndex = 0;
private MediaPlayer _nextPlayer;
private Shader _shader;
private Material _material;
private Transition _currentTransition = Transition.None;
private string _currentTransitionName = "LERP_NONE";
private float _currentTransitionDuration = 1f;
private Easing.Preset _currentTransitionEasing;
private float _textureTimer;
private float _transitionTimer;
private System.Func<float, float> _easeFunc;
private RenderTexture _rt;
private MediaPlaylist.MediaItem _currentItem;
private MediaPlaylist.MediaItem _nextItem;
public MediaPlayer CurrentPlayer
{
get
{
if (NextPlayer == _playerA)
{
return _playerB;
}
return _playerA;
}
}
public MediaPlayer NextPlayer
{
get
{
return _nextPlayer;
}
}
public MediaPlaylist Playlist { get { return _playlist; } }
public int PlaylistIndex { get { return _playlistIndex; } }
public MediaPlaylist.MediaItem PlaylistItem { get { if (_playlist.HasItemAt(_playlistIndex)) return _playlist.Items[_playlistIndex]; return null; } }
public PlaylistLoopMode LoopMode { get { return _playlistLoopMode; } set { _playlistLoopMode = value; } }
public bool AutoProgress { get { return _playlistAutoProgress; } set { _playlistAutoProgress = value; } }
public override IMediaInfo Info
{
get { if (CurrentPlayer != null) return CurrentPlayer.Info; return null; }
}
public override IMediaControl Control
{
get { if (CurrentPlayer != null) return CurrentPlayer.Control; return null; }
}
public override IMediaProducer TextureProducer
{
get
{
if (CurrentPlayer != null)
{
if (IsTransitioning())
{
return this;
}
/*if (_currentItem != null && _currentItem.sourceType == MediaPlaylist.MediaItem.SourceType.Texture2D && _currentItem.texture != null)
{
return this;
}*/
return CurrentPlayer.TextureProducer;
}
return null;
}
}
private void SwapPlayers()
{
// Pause the previously playing video
// This is useful for systems that will struggle to play 2 videos at once
if (_pausePreviousOnTransition)
{
CurrentPlayer.Pause();
}
// Tell listeners that the playlist item has changed
Events.Invoke(this, MediaPlayerEvent.EventType.PlaylistItemChanged, ErrorCode.None);
// Start the transition
if (_currentTransition != Transition.None)
{
// Create a new transition texture if required
Texture currentTexture = GetCurrentTexture();
Texture nextTexture = GetNextTexture();
if (currentTexture != null && nextTexture != null)
{
int maxWidth = Mathf.Max(nextTexture.width, currentTexture.width);
int maxHeight = Mathf.Max(nextTexture.height, currentTexture.height);
if (_rt != null)
{
if (_rt.width != maxWidth || _rt.height != maxHeight)
{
RenderTexture.ReleaseTemporary(_rt = null);
}
}
if (_rt == null)
{
_rt = RenderTexture.GetTemporary(maxWidth, maxHeight, 0, RenderTextureFormat.Default, RenderTextureReadWrite.Default, 1);
Graphics.Blit(currentTexture, _rt);
}
_material.SetTexture(_propFromTex, currentTexture);
_easeFunc = Easing.GetFunction(_currentTransitionEasing);
_transitionTimer = 0f;
}
else
{
_transitionTimer = _currentTransitionDuration;
}
}
// Swap the videos
if (NextPlayer == _playerA)
{
_nextPlayer = _playerB;
}
else
{
_nextPlayer = _playerA;
}
// Swap the items
_currentItem = _nextItem;
_nextItem = null;
}
private Texture GetCurrentTexture()
{
/*if (_currentItem != null && _currentItem.sourceType == MediaPlaylist.MediaItem.SourceType.Texture2D && _currentItem.texture != null)
{
return _currentItem.texture;
}*/
if (CurrentPlayer != null && CurrentPlayer.TextureProducer != null)
{
return CurrentPlayer.TextureProducer.GetTexture();
}
return null;
}
private Texture GetNextTexture()
{
/*if (_nextItem != null && _nextItem.sourceType == MediaPlaylist.MediaItem.SourceType.Texture2D && _nextItem.texture != null)
{
return _nextItem.texture;
}*/
if (_nextPlayer != null && _nextPlayer.TextureProducer != null)
{
return _nextPlayer.TextureProducer.GetTexture();
}
return null;
}
private void Awake()
{
_nextPlayer = _playerA;
_shader = Shader.Find("AVProVideo/Helper/Transition");
_material = new Material(_shader);
_propFromTex = Shader.PropertyToID("_FromTex");
_propT = Shader.PropertyToID("_Fade");
_easeFunc = Easing.GetFunction(_transitionEasing.preset);
}
protected override void OnDestroy()
{
if (_rt != null)
{
RenderTexture.ReleaseTemporary(_rt);
_rt = null;
}
if (_material != null)
{
Material.Destroy(_material);
_material = null;
}
base.OnDestroy();
}
private void Start()
{
if (CurrentPlayer)
{
CurrentPlayer.Events.AddListener(OnVideoEvent);
if (NextPlayer)
{
NextPlayer.Events.AddListener(OnVideoEvent);
}
}
JumpToItem(0);
}
public void OnVideoEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
if (mp == CurrentPlayer)
{
Events.Invoke(mp, et, errorCode);
}
switch (et)
{
case MediaPlayerEvent.EventType.FirstFrameReady:
if (mp == NextPlayer)
{
SwapPlayers();
Events.Invoke(mp, et, errorCode);
}
break;
case MediaPlayerEvent.EventType.FinishedPlaying:
if (_playlistAutoProgress && mp == CurrentPlayer && _currentItem.progressMode == ProgressMode.OnFinish)
{
NextItem();
}
break;
}
}
public bool PrevItem()
{
return JumpToItem(_playlistIndex - 1);
}
public bool NextItem()
{
bool result = JumpToItem(_playlistIndex + 1);
if (!result)
{
Events.Invoke(this, MediaPlayerEvent.EventType.PlaylistFinished, ErrorCode.None);
}
return result;
}
public bool CanJumpToItem(int index)
{
if (_playlistLoopMode == PlaylistLoopMode.Loop)
{
if (_playlist.Items.Count > 0)
{
index %= _playlist.Items.Count;
if (index < 0)
{
index += _playlist.Items.Count;
}
}
}
return _playlist.HasItemAt(index);
}
public bool JumpToItem(int index)
{
if (_playlistLoopMode == PlaylistLoopMode.Loop)
{
if (_playlist.Items.Count > 0)
{
index %= _playlist.Items.Count;
if (index < 0)
{
index += _playlist.Items.Count;
}
}
}
if (_playlist.HasItemAt(index))
{
_playlistIndex = index;
_nextItem = _playlist.Items[_playlistIndex];
OpenVideoFile(_nextItem);
return true;
}
return false;
}
public void OpenVideoFile(MediaPlaylist.MediaItem mediaItem)
{
bool isMediaAlreadyLoaded = false;
if (NextPlayer.m_VideoPath == mediaItem.filePath && NextPlayer.m_VideoLocation == mediaItem.fileLocation)
{
isMediaAlreadyLoaded = true;
}
if (mediaItem.isOverrideTransition)
{
SetTransition(mediaItem.overrideTransition, mediaItem.overrideTransitionDuration, mediaItem.overrideTransitionEasing.preset);
}
else
{
SetTransition(_nextTransition, _transitionDuration, _transitionEasing.preset);
}
this.m_Loop = NextPlayer.m_Loop = mediaItem.loop;
this.m_AutoStart = NextPlayer.m_AutoStart = mediaItem.autoPlay;
this.m_VideoLocation = NextPlayer.m_VideoLocation = mediaItem.fileLocation;
this.m_VideoPath = NextPlayer.m_VideoPath = mediaItem.filePath;
this.m_StereoPacking = NextPlayer.m_StereoPacking = mediaItem.stereoPacking;
this.m_AlphaPacking = NextPlayer.m_AlphaPacking = mediaItem.alphaPacking;
if (isMediaAlreadyLoaded)
{
NextPlayer.Rewind(false);
if (_nextItem.startMode == StartMode.Immediate)
{
NextPlayer.Play();
}
// TODO: We probably want to wait until the new frame arrives before swapping after a Rewind()
SwapPlayers();
}
else
{
if (string.IsNullOrEmpty(NextPlayer.m_VideoPath))
{
NextPlayer.CloseVideo();
}
else
{
//NextPlayer.m_AutoStart = false;
NextPlayer.OpenVideoFromFile(NextPlayer.m_VideoLocation, NextPlayer.m_VideoPath, _nextItem.startMode == StartMode.Immediate);
}
}
}
private bool IsTransitioning()
{
if (_rt != null && _transitionTimer < _currentTransitionDuration && _currentTransition != Transition.None)
{
return true;
}
return false;
}
private void SetTransition(Transition transition, float duration, Easing.Preset easing)
{
if (transition == Transition.Random)
{
transition = (Transition)Random.Range(0, (int)Transition.Random);
}
if (transition != _currentTransition)
{
// Disable the previous transition
if (!string.IsNullOrEmpty(_currentTransitionName))
{
_material.DisableKeyword(_currentTransitionName);
}
// Enable the next transition
_currentTransition = transition;
_currentTransitionName = GetTransitionName(transition);
_material.EnableKeyword(_currentTransitionName);
}
_currentTransitionDuration = duration;
_currentTransitionEasing = easing;
}
protected override void Update()
{
if (IsTransitioning())
{
_transitionTimer += Time.deltaTime;
float t = _easeFunc(Mathf.Clamp01(_transitionTimer / _currentTransitionDuration));
// Fade the audio volume
NextPlayer.Control.SetVolume(1f - t);
CurrentPlayer.Control.SetVolume(t);
// TODO: support going from mono to stereo
// TODO: support videos of different aspect ratios by rendering with scaling to fit
// This can be done by blitting twice, once for each eye
// If the stereo mode is different for playera/b then both should be set to stereo during the transition
// if (CurrentPlayer.m_StereoPacking == StereoPacking.TopBottom)....
_material.SetFloat(_propT, t);
_rt.DiscardContents();
Graphics.Blit(GetCurrentTexture(), _rt, _material);
// After the transition is complete, pause the previous video
if (!_pausePreviousOnTransition && !IsTransitioning())
{
if (NextPlayer != null && NextPlayer.Control.IsPlaying())
{
NextPlayer.Pause();
}
}
}
else
{
if (_playlistAutoProgress && _nextItem == null && _currentItem != null && _currentItem.progressMode == ProgressMode.BeforeFinish && Control != null && Control.GetCurrentTimeMs() >= (Info.GetDurationMs() - (_currentItem.progressTimeSeconds * 1000f)))
{
this.NextItem();
}
}
base.Update();
}
public Texture GetTexture(int index = 0)
{
// TODO: support iOS YCbCr by supporting multiple textures
/*if (!IsTransitioning())
{
if (_currentItem != null && _currentItem.sourceType == MediaPlaylist.MediaItem.SourceType.Texture2D && _currentItem.texture != null)
{
return _currentItem.texture;
}
}*/
return _rt;
}
public int GetTextureCount()
{
return CurrentPlayer.TextureProducer.GetTextureCount();
}
public int GetTextureFrameCount()
{
return CurrentPlayer.TextureProducer.GetTextureFrameCount();
}
public bool SupportsTextureFrameCount()
{
return CurrentPlayer.TextureProducer.SupportsTextureFrameCount();
}
public long GetTextureTimeStamp()
{
return CurrentPlayer.TextureProducer.GetTextureTimeStamp();
}
public bool RequiresVerticalFlip()
{
return CurrentPlayer.TextureProducer.RequiresVerticalFlip();
}
public Matrix4x4 GetYpCbCrTransform()
{
return CurrentPlayer.TextureProducer.GetYpCbCrTransform();
}
private static string GetTransitionName(Transition transition)
{
switch (transition)
{
case Transition.None: return "LERP_NONE";
case Transition.Fade: return "LERP_FADE";
case Transition.Black: return "LERP_BLACK";
case Transition.White: return "LERP_WHITE";
case Transition.Transparent:return "LERP_TRANSP";
case Transition.Horiz: return "LERP_HORIZ";
case Transition.Vert: return "LERP_VERT";
case Transition.Diag: return "LERP_DIAG";
case Transition.MirrorH: return "LERP_HORIZ_MIRROR";
case Transition.MirrorV: return "LERP_VERT_MIRROR";
case Transition.MirrorD: return "LERP_DIAG_MIRROR";
case Transition.ScrollV: return "LERP_SCROLL_VERT";
case Transition.ScrollH: return "LERP_SCROLL_HORIZ";
case Transition.Circle: return "LERP_CIRCLE";
case Transition.Diamond: return "LERP_DIAMOND";
case Transition.Blinds: return "LERP_BLINDS";
case Transition.Arrows: return "LERP_ARROW";
case Transition.SlideH: return "LERP_SLIDE_HORIZ";
case Transition.SlideV: return "LERP_SLIDE_VERT";
case Transition.Zoom: return "LERP_ZOOM_FADE";
case Transition.RectV: return "LERP_RECTS_VERT";
}
return string.Empty;
}
#region Easing
/// <summary>
/// Easing functions
/// </summary>
[System.Serializable]
public class Easing
{
public Preset preset = Preset.Linear;
public enum Preset
{
Step,
Linear,
InQuad,
OutQuad,
InOutQuad,
InCubic,
OutCubic,
InOutCubic,
InQuint,
OutQuint,
InOutQuint,
InQuart,
OutQuart,
InOutQuart,
InExpo,
OutExpo,
InOutExpo,
Random,
RandomNotStep,
}
public static System.Func<float, float> GetFunction(Preset preset)
{
System.Func<float, float> result = null;
switch (preset)
{
case Preset.Step:
result = Step;
break;
case Preset.Linear:
result = Linear;
break;
case Preset.InQuad:
result = InQuad;
break;
case Preset.OutQuad:
result = OutQuad;
break;
case Preset.InOutQuad:
result = InOutQuad;
break;
case Preset.InCubic:
result = InCubic;
break;
case Preset.OutCubic:
result = OutCubic;
break;
case Preset.InOutCubic:
result = InOutCubic;
break;
case Preset.InQuint:
result = InQuint;
break;
case Preset.OutQuint:
result = OutQuint;
break;
case Preset.InOutQuint:
result = InOutQuint;
break;
case Preset.InQuart:
result = InQuart;
break;
case Preset.OutQuart:
result = OutQuart;
break;
case Preset.InOutQuart:
result = InOutQuart;
break;
case Preset.InExpo:
result = InExpo;
break;
case Preset.OutExpo:
result = OutExpo;
break;
case Preset.InOutExpo:
result = InOutExpo;
break;
case Preset.Random:
result = GetFunction((Preset)Random.Range(0, (int)Preset.Random));
break;
case Preset.RandomNotStep:
result = GetFunction((Preset)Random.Range((int)Preset.Step+1, (int)Preset.Random));
break;
}
return result;
}
public static float PowerEaseIn(float t, float power)
{
return Mathf.Pow(t, power);
}
public static float PowerEaseOut(float t, float power)
{
return 1f - Mathf.Abs(Mathf.Pow(t - 1f, power));
}
public static float PowerEaseInOut(float t, float power)
{
float result;
if (t < 0.5f)
{
result = PowerEaseIn(t * 2f, power) / 2f;
}
else
{
result = PowerEaseOut(t * 2f - 1f, power) / 2f + 0.5f;
}
return result;
}
public static float Step(float t)
{
float result = 0f;
if (t >= 0.5f)
{
result = 1f;
}
return result;
}
public static float Linear(float t)
{
return t;
}
public static float InQuad(float t)
{
return PowerEaseIn(t, 2f);
}
public static float OutQuad(float t)
{
return PowerEaseOut(t, 2f);
//return t * (2f - t);
}
public static float InOutQuad(float t)
{
return PowerEaseInOut(t, 2f);
//return t < 0.5 ? (2f * t * t) : (-1f + (4f - 2f * t) * t);
}
public static float InCubic(float t)
{
return PowerEaseIn(t, 3f);
//return t * t * t;
}
public static float OutCubic(float t)
{
return PowerEaseOut(t, 3f);
//return (--t) * t * t + 1f;
}
public static float InOutCubic(float t)
{
return PowerEaseInOut(t, 3f);
//return t < .5f ? (4f * t * t * t) : ((t - 1f) * (2f * t - 2f) * (2f * t - 2f) + 1f);
}
public static float InQuart(float t)
{
return PowerEaseIn(t, 4f);
//return t * t * t * t;
}
public static float OutQuart(float t)
{
return PowerEaseOut(t, 4f);
//return 1f - (--t) * t * t * t;
}
public static float InOutQuart(float t)
{
return PowerEaseInOut(t, 4f);
//return t < 0.5f ? (8f * t * t * t * t) : (1f - 8f * (--t) * t * t * t);
}
public static float InQuint(float t)
{
return PowerEaseIn(t, 5f);
//return t * t * t * t * t;
}
public static float OutQuint(float t)
{
return PowerEaseOut(t, 5f);
//return 1f + (--t) * t * t * t * t;
}
public static float InOutQuint(float t)
{
return PowerEaseInOut(t, 5f);
//return t < 0.5f ? (16f * t * t * t * t * t) : (1f + 16f * (--t) * t * t * t * t);
}
public static float InExpo(float t)
{
float result = 0f;
if (t != 0f)
{
result = Mathf.Pow(2f, 10f * (t - 1f));
}
return result;
}
public static float OutExpo(float t)
{
float result = 1f;
if (t != 1f)
{
result = -Mathf.Pow(2f, -10f * t) + 1f;
}
return result;
}
public static float InOutExpo(float t)
{
float result = 0f;
if (t > 0f)
{
result = 1f;
if (t < 1f)
{
t *= 2f;
if (t < 1f)
{
result = 0.5f * Mathf.Pow(2f, 10f * (t - 1f));
}
else
{
t--;
result = 0.5f * (-Mathf.Pow(2f, -10f * t) + 2f);
}
}
}
return result;
}
}
#endregion Easing
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e9ea31f33222f4b418e4e051a8a5ed24
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,129 @@
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
using System.Threading;
using System.Collections.Generic;
using UnityEngine;
using System;
namespace RenderHeads.Media.AVProVideo
{
[System.Serializable]
public class StreamParserEvent : UnityEngine.Events.UnityEvent<StreamParser, StreamParserEvent.EventType>
{
public enum EventType
{
Success,
Failed
}
}
/// <summary>
/// Utility class for parsing adaptive media streams, such as HLS
/// A URL is specified, loaded and then the hierarchy of the stream elements are exposed
/// </summary>
public class StreamParser : MonoBehaviour // TODO: make this not a component
{
public enum StreamType { HLS }
public string _url;
public StreamType _streamType;
public bool _autoLoad = true;
private Stream _parser;
private bool _loaded = false;
private List<Stream> _substreams;
private List<Stream.Chunk> _chunks;
private StreamParserEvent _events;
public StreamParserEvent Events
{
get
{
if (_events == null)
{
_events = new StreamParserEvent();
}
return _events;
}
}
private void LoadFile()
{
try
{
switch(_streamType)
{
case StreamType.HLS:
_parser = new HLSStream(_url);
break;
default:
_parser = new HLSStream(_url);
break;
}
_substreams = _parser.GetAllStreams();
_chunks = _parser.GetAllChunks();
_loaded = true;
Debug.Log("[AVProVideo] Stream parser completed parsing stream file " + _url);
if (_events != null)
{
_events.Invoke(this, StreamParserEvent.EventType.Success);
}
}
catch (Exception e)
{
_loaded = false;
Debug.LogError("[AVProVideo] Parser unable to read stream " + e.Message);
if (_events != null)
{
_events.Invoke(this, StreamParserEvent.EventType.Failed);
}
}
}
public bool Loaded
{
get { return _loaded; }
}
public Stream Root
{
get { return _loaded ? _parser : null; }
}
public List<Stream> SubStreams
{
get { return _loaded ? _substreams : null; }
}
public List<Stream.Chunk> Chunks
{
get { return _loaded ? _chunks : null; }
}
public void ParseStream()
{
#if UNITY_WSA_10_0 || UNITY_WINRT_8_1 || UNITY_WSA
LoadFile();
#else
Thread loadThread = new Thread(new ThreadStart(LoadFile));
loadThread.Start();
#endif
}
void Start()
{
if(_autoLoad)
{
ParseStream();
}
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0a25ab4952e3b924c8d193758f43e236
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,76 @@
#if UNITY_5_4_OR_NEWER || (UNITY_5 && !UNITY_5_0)
#define UNITY_HELPATTRIB
#endif
using UnityEngine;
using UnityEngine.UI;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Update a standard uGUI Text element with subtitle text as it plays from the MediaPlayer
/// </summary>
[AddComponentMenu("AVPro Video/Subtitles uGUI", 201)]
#if UNITY_HELPATTRIB
[HelpURL("http://renderheads.com/product/avpro-video/")]
#endif
public class SubtitlesUGUI : MonoBehaviour
{
[SerializeField]
private MediaPlayer _mediaPlayer = null;
[SerializeField]
private Text _text = null;
void Start()
{
ChangeMediaPlayer(_mediaPlayer);
}
void OnDestroy()
{
ChangeMediaPlayer(null);
}
public void ChangeMediaPlayer(MediaPlayer newPlayer)
{
// When changing the media player, handle event subscriptions
if (_mediaPlayer != null)
{
_mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent);
_mediaPlayer = null;
}
if (newPlayer != null)
{
newPlayer.Events.AddListener(OnMediaPlayerEvent);
_mediaPlayer = newPlayer;
}
}
// Callback function to handle events
private void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
switch (et)
{
case MediaPlayerEvent.EventType.SubtitleChange:
{
string text = _mediaPlayer.Subtitles.GetSubtitleText();
// Change RichText for Unity uGUI Text
text = text.Replace("<font color=", "<color=");
text = text.Replace("</font>", "</color>");
text = text.Replace("<u>", string.Empty);
text = text.Replace("</u>", string.Empty);
_text.text = text;
}
break;
}
}
}
}

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2d4bbe43657314a49a5f730e66dafebd
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 1d0986c1ab4c9b24fae2420421f4463f
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 2cdcd5c0df033154a8ee88d8ef66a304
folderAsset: yes
DefaultImporter:
userData:

@ -0,0 +1,182 @@
//#define NGUI
using UnityEngine;
using System.Collections;
//-----------------------------------------------------------------------------
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd.
//-----------------------------------------------------------------------------
#if NGUI
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Integrates AVPro Video with NGUI
/// Applies the video texture to the NGUI UITexture component
/// </summary>
[AddComponentMenu("AVPro Video/Display NGUI")]
public class ApplyToTextureWidgetNGUI : MonoBehaviour
{
#region Fields
[SerializeField]
private UITexture _uiTexture = null;
[SerializeField]
private MediaPlayer _mediaPlayer = null;
public MediaPlayer Player
{
get { return _mediaPlayer; }
set { if (_mediaPlayer != value) { ChangeMediaPlayer(value); _isDirty = true; } }
}
[SerializeField]
private Texture2D _defaultTexture;
public Texture2D DefaultTexture
{
get { return _defaultTexture; }
set { if (_defaultTexture != value) { _defaultTexture = value; _isDirty = true; } }
}
[SerializeField]
private bool _makePixelPerfect = false;
public bool MakePixelPerfect
{
get { return _makePixelPerfect; }
set { if (_makePixelPerfect != value) { _makePixelPerfect = value; _isDirty = true; } }
}
private bool _isDirty;
private Texture _lastTextureApplied;
#endregion
private void TryUpdateTexture()
{
bool applied = false;
// Try to apply texture from media
if (_mediaPlayer != null && _mediaPlayer.TextureProducer != null)
{
Texture texture = _mediaPlayer.TextureProducer.GetTexture();
if (texture != null)
{
// Check for changing texture
if (texture != _lastTextureApplied)
{
_isDirty = true;
}
if (_isDirty)
{
Apply(texture, _mediaPlayer.TextureProducer.RequiresVerticalFlip());
}
applied = true;
}
}
// If the media didn't apply a texture, then try to apply the default texture
if (!applied)
{
if (_defaultTexture != _lastTextureApplied)
{
_isDirty = true;
}
if (_isDirty)
{
Apply(_defaultTexture, false);
}
}
}
private void Apply(Texture texture, bool requiresYFlip)
{
if (_uiTexture != null)
{
_isDirty = false;
if (requiresYFlip)
{
_uiTexture.flip = UITexture.Flip.Vertically;
}
else
{
_uiTexture.flip = UITexture.Flip.Nothing;
}
_lastTextureApplied = _uiTexture.mainTexture = texture;
if (_makePixelPerfect)
{
_uiTexture.MakePixelPerfect();
}
}
}
private void ChangeMediaPlayer(MediaPlayer newPlayer)
{
// When changing the media player, handle event subscriptions
if (_mediaPlayer != null)
{
_mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent);
_mediaPlayer = null;
}
_mediaPlayer = newPlayer;
if (_mediaPlayer != null)
{
_mediaPlayer.Events.AddListener(OnMediaPlayerEvent);
}
}
// Callback function to handle events
private void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
{
switch (et)
{
case MediaPlayerEvent.EventType.Closing:
Apply(_defaultTexture, false);
break;
case MediaPlayerEvent.EventType.Started:
case MediaPlayerEvent.EventType.FirstFrameReady:
TryUpdateTexture();
break;
}
}
void Start()
{
if (_defaultTexture == null)
{
_defaultTexture = Texture2D.blackTexture;
}
ChangeMediaPlayer(_mediaPlayer);
}
void Update()
{
TryUpdateTexture();
}
// We do a LateUpdate() to allow for any changes in the texture that may have happened in Update()
void LateUpdate()
{
TryUpdateTexture();
}
void OnEnable()
{
TryUpdateTexture();
}
void OnDisable()
{
Apply(_defaultTexture, false);
}
void OnDestroy()
{
ChangeMediaPlayer(null);
}
}
}
#endif

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 706300e4503130449aa3a10d0b54516d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3}
userData:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save