parent
0c7e78026d
commit
4cfcdd146a
636 changed files with 106962 additions and 1 deletions
@ -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 |
||||||
@ -1 +0,0 @@ |
|||||||
#gitkeep file |
|
||||||
@ -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: |
||||||
|
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: |
||||||
|
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: |
||||||
|
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,9 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 71eb101954888314ba2a8b9fe74e1cae |
||||||
|
timeCreated: 1447418752 |
||||||
|
licenseType: Store |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 38b28fc6a6d12d144bf6d6de820d83ce |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8ebaafdbf44b0b9489f20bc27374d187 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 73f378cafe7b4a745907b70e76bb3259 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d1085d25f9ef09b4c91188f9f99f37a2 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 06b0cff0150d7eb41b3d269f7e11daa3 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 751148eda67f7b34fbd51bfb7951084f |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -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,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: eb44a525a7e2c6640a8cd90fd7fabce4 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 0ed1fb9218ad96f49acfdb428d5b5aab |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1ca6555d94ddb204c87e9fe549085b3c |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a22a9f37cda6a3b48be178ec57376024 |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 08ccc6021f136814494572dcad0c489d |
||||||
|
ShaderImporter: |
||||||
|
defaultTextures: [] |
||||||
|
userData: |
||||||
@ -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,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,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,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: |
||||||
File diff suppressed because it is too large
Load Diff
@ -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,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: e9ea31f33222f4b418e4e051a8a5ed24 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3} |
||||||
|
userData: |
||||||
@ -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,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: |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 9d82b8b5ea0494b3992233eb5e47a12f |
||||||
|
folderAsset: yes |
||||||
|
timeCreated: 1490962214 |
||||||
|
licenseType: Store |
||||||
|
DefaultImporter: |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: e534f83f7f15547868b8cbc8ce335151 |
||||||
|
folderAsset: yes |
||||||
|
timeCreated: 1490962219 |
||||||
|
licenseType: Store |
||||||
|
DefaultImporter: |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 3cff8309e08b7e844a0d84f74b6dc6ad |
||||||
|
timeCreated: 1495729132 |
||||||
|
licenseType: Store |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {fileID: 2800000, guid: bb83b41b53a59874692b83eab5873998, type: 3} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
||||||
@ -0,0 +1,65 @@ |
|||||||
|
//----------------------------------------------------------------------------- |
||||||
|
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd. |
||||||
|
//----------------------------------------------------------------------------- |
||||||
|
|
||||||
|
#if PLAYMAKER |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
using HutongGames.PlayMaker; |
||||||
|
using HutongGames.PlayMaker.Actions; |
||||||
|
using Tooltip = HutongGames.PlayMaker.TooltipAttribute; |
||||||
|
|
||||||
|
using RenderHeads.Media.AVProVideo; |
||||||
|
|
||||||
|
namespace RenderHeads.Media.AVProVideo.PlayMaker.Actions |
||||||
|
{ |
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Gets the MediaPlayer of a DisplayUGUI Component.")] |
||||||
|
public class AVProVideoDisplayUGUIGetMediaPlayer : ComponentAction<DisplayUGUI> |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(DisplayUGUI))] |
||||||
|
[Tooltip("The GameObject with a DisplayUGUI component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip(“The MediaPlayer GameObject.”)] |
||||||
|
[UIHint(UIHint.Variable)] |
||||||
|
public FsmGameObject mediaPlayerGameObject; |
||||||
|
|
||||||
|
[Tooltip("Event Sent if no MediaPlayer is referenced on the DisplayUGUI component")] |
||||||
|
public FsmEvent missingMediaPlayerEvent; |
||||||
|
|
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
mediaPlayerGameObject = null; |
||||||
|
missingMediaPlayerEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
ExecuteAction(); |
||||||
|
} |
||||||
|
|
||||||
|
Finish(); |
||||||
|
} |
||||||
|
|
||||||
|
void ExecuteAction() |
||||||
|
{ |
||||||
|
mediaPlayerGameObject.Value = this.cachedComponent._mediaPlayer ? this.cachedComponent._mediaPlayer.gameObject : null; |
||||||
|
|
||||||
|
if (missingMediaPlayerEvent != null && this.cachedComponent._mediaPlayer == null) |
||||||
|
{ |
||||||
|
Fsm.Event(missingMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endif |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 62092c03003fbff4ab67d7eeef490d23 |
||||||
|
MonoImporter: |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
@ -0,0 +1,563 @@ |
|||||||
|
//----------------------------------------------------------------------------- |
||||||
|
// Copyright 2015-2018 RenderHeads Ltd. All rights reserverd. |
||||||
|
//----------------------------------------------------------------------------- |
||||||
|
|
||||||
|
#if PLAYMAKER |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
using HutongGames.PlayMaker; |
||||||
|
using HutongGames.PlayMaker.Actions; |
||||||
|
using Tooltip = HutongGames.PlayMaker.TooltipAttribute; |
||||||
|
|
||||||
|
using RenderHeads.Media.AVProVideo; |
||||||
|
|
||||||
|
namespace RenderHeads.Media.AVProVideo.PlayMaker.Actions |
||||||
|
{ |
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the Closing Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventClosing: AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a Closing event")] |
||||||
|
public FsmEvent closingEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
closingEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.Closing: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget (gameObject); |
||||||
|
Fsm.Event (closingEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache (Fsm.GetOwnerDefaultTarget (gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener (OnMediaPlayerEvent); |
||||||
|
} else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer!=null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the Error Event of a MediaPlayer and sends an event. Error Code is passed in the event data as an int. 100 = loadFailed 200 = decodeFailed")] |
||||||
|
public class AVProVideoEventError : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a Error event")] |
||||||
|
public FsmEvent errorEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
errorEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.Error: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.EventData.IntData = (int)errorCode; |
||||||
|
Fsm.Event(errorEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the FinishedPlaying Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventFinishedPlaying : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a FinishedPlaying event")] |
||||||
|
public FsmEvent finishedPlayingEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
finishedPlayingEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.FinishedPlaying: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(finishedPlayingEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the FirstFrameReady Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventFirstFrameReady : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a FirstFrameReady event")] |
||||||
|
public FsmEvent firstFrameReadyEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
firstFrameReadyEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.FirstFrameReady: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(firstFrameReadyEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
|
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the MetaDataReady Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventMetaDataReady : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a metaDataReady event")] |
||||||
|
public FsmEvent metaDataReadyEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
metaDataReadyEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.MetaDataReady: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(metaDataReadyEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the ReadytoPlay Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventReadyToPlay : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a ReadyToPlay event")] |
||||||
|
public FsmEvent readyToPlayEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
readyToPlayEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.ReadyToPlay: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(readyToPlayEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the Stalled Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventStalled : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a Stalled event")] |
||||||
|
public FsmEvent stalledEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
stalledEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.Stalled: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(stalledEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the ReadytoPlay Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventStarted : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a Started event")] |
||||||
|
public FsmEvent startedEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
startedEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.Started: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(startedEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the SubtitleChange Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventSubtitleChange : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a SubtitleChange event")] |
||||||
|
public FsmEvent subtitleChangeEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
subtitleChangeEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.SubtitleChange: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(subtitleChangeEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ActionCategory("AVProVideo")] |
||||||
|
[Tooltip("Listen to the Unstalled Event of a MediaPlayer and sends an event.")] |
||||||
|
public class AVProVideoEventUnstalled : AVProVideoActionBase |
||||||
|
{ |
||||||
|
public AVProVideoActionHeader headerImage; |
||||||
|
|
||||||
|
[RequiredField] |
||||||
|
[CheckForComponent(typeof(MediaPlayer))] |
||||||
|
[Tooltip("The GameObject with a MediaPlayer component.")] |
||||||
|
public FsmOwnerDefault gameObject; |
||||||
|
|
||||||
|
[Tooltip("Event fired when MediaPlayer sends a Unstalled event")] |
||||||
|
public FsmEvent unstalledEvent; |
||||||
|
|
||||||
|
public override void Reset() |
||||||
|
{ |
||||||
|
gameObject = null; |
||||||
|
unstalledEvent = null; |
||||||
|
} |
||||||
|
|
||||||
|
// Callback function to handle events |
||||||
|
public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode) |
||||||
|
{ |
||||||
|
switch (et) |
||||||
|
{ |
||||||
|
case MediaPlayerEvent.EventType.Unstalled: |
||||||
|
Fsm.EventData.GameObjectData = Fsm.GetOwnerDefaultTarget(gameObject); |
||||||
|
Fsm.Event(unstalledEvent); |
||||||
|
Finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (this.UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.AddListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
Finish(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnExit() |
||||||
|
{ |
||||||
|
if (this.mediaPlayer != null) |
||||||
|
{ |
||||||
|
this.mediaPlayer.Events.RemoveListener(OnMediaPlayerEvent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
#endif |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue