Merge branch 'master' of http://nas.ultracombos.com:3400/19050-Frozen2/Develop-19050-Frozen2
# Conflicts: # Unity-19050-05-BallPool/Assets/Frozen/Character.prefab # Unity-19050-05-BallPool/Assets/Frozen/Frozen.unity # Unity-19050-05-BallPool/Assets/Frozen/Script/CharacterBehaviour.cs # Unity-19050-05-BallPool/Assets/Frozen/Script/SceneController.csmaster
commit
1ffc91ce1a
52 changed files with 6472 additions and 6283 deletions
|
After Width: | Height: | Size: 841 KiB |
@ -0,0 +1,91 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 958cfbda296458c4faf115404e562d73 |
||||
TextureImporter: |
||||
internalIDToNameTable: [] |
||||
externalObjects: {} |
||||
serializedVersion: 10 |
||||
mipmaps: |
||||
mipMapMode: 0 |
||||
enableMipMap: 1 |
||||
sRGBTexture: 1 |
||||
linearTexture: 0 |
||||
fadeOut: 0 |
||||
borderMipMap: 0 |
||||
mipMapsPreserveCoverage: 0 |
||||
alphaTestReferenceValue: 0.5 |
||||
mipMapFadeDistanceStart: 1 |
||||
mipMapFadeDistanceEnd: 3 |
||||
bumpmap: |
||||
convertToNormalMap: 0 |
||||
externalNormalMap: 0 |
||||
heightScale: 0.25 |
||||
normalMapFilter: 0 |
||||
isReadable: 0 |
||||
streamingMipmaps: 0 |
||||
streamingMipmapsPriority: 0 |
||||
grayScaleToAlpha: 0 |
||||
generateCubemap: 6 |
||||
cubemapConvolution: 0 |
||||
seamlessCubemap: 0 |
||||
textureFormat: 1 |
||||
maxTextureSize: 2048 |
||||
textureSettings: |
||||
serializedVersion: 2 |
||||
filterMode: -1 |
||||
aniso: -1 |
||||
mipBias: -100 |
||||
wrapU: -1 |
||||
wrapV: -1 |
||||
wrapW: -1 |
||||
nPOTScale: 1 |
||||
lightmap: 0 |
||||
compressionQuality: 50 |
||||
spriteMode: 0 |
||||
spriteExtrude: 1 |
||||
spriteMeshType: 1 |
||||
alignment: 0 |
||||
spritePivot: {x: 0.5, y: 0.5} |
||||
spritePixelsToUnits: 100 |
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
||||
spriteGenerateFallbackPhysicsShape: 1 |
||||
alphaUsage: 1 |
||||
alphaIsTransparency: 0 |
||||
spriteTessellationDetail: -1 |
||||
textureType: 0 |
||||
textureShape: 1 |
||||
singleChannelComponent: 0 |
||||
maxTextureSizeSet: 0 |
||||
compressionQualitySet: 0 |
||||
textureFormatSet: 0 |
||||
platformSettings: |
||||
- serializedVersion: 3 |
||||
buildTarget: DefaultTexturePlatform |
||||
maxTextureSize: 2048 |
||||
resizeAlgorithm: 0 |
||||
textureFormat: -1 |
||||
textureCompression: 1 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
androidETC2FallbackOverride: 0 |
||||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
||||
spriteSheet: |
||||
serializedVersion: 2 |
||||
sprites: [] |
||||
outline: [] |
||||
physicsShape: [] |
||||
bones: [] |
||||
spriteID: |
||||
internalID: 0 |
||||
vertices: [] |
||||
indices: |
||||
edges: [] |
||||
weights: [] |
||||
secondaryTextures: [] |
||||
spritePackingTag: |
||||
pSDRemoveMatte: 0 |
||||
pSDShowRemoveMatteOption: 0 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,70 +0,0 @@ |
||||
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt) |
||||
|
||||
// Unlit alpha-blended shader. |
||||
// - no lighting |
||||
// - no lightmap support |
||||
// - no per-material color |
||||
|
||||
Shader "Unlit/ColorTransparent" { |
||||
Properties { |
||||
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} |
||||
_Color("Color",Color) = (1,1,1,1) |
||||
} |
||||
|
||||
SubShader { |
||||
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} |
||||
LOD 100 |
||||
|
||||
ZWrite Off |
||||
// Blend SrcAlpha OneMinusSrcAlpha |
||||
Blend SrcAlpha OneMinusSrcAlpha, Zero One |
||||
|
||||
Pass { |
||||
CGPROGRAM |
||||
#pragma vertex vert |
||||
#pragma fragment frag |
||||
#pragma target 2.0 |
||||
#pragma multi_compile_fog |
||||
|
||||
#include "UnityCG.cginc" |
||||
|
||||
struct appdata_t { |
||||
float4 vertex : POSITION; |
||||
float2 texcoord : TEXCOORD0; |
||||
UNITY_VERTEX_INPUT_INSTANCE_ID |
||||
}; |
||||
|
||||
struct v2f { |
||||
float4 vertex : SV_POSITION; |
||||
float2 texcoord : TEXCOORD0; |
||||
UNITY_FOG_COORDS(1) |
||||
UNITY_VERTEX_OUTPUT_STEREO |
||||
}; |
||||
|
||||
sampler2D _MainTex; |
||||
float4 _MainTex_ST; |
||||
float4 _Color; |
||||
|
||||
v2f vert (appdata_t v) |
||||
{ |
||||
v2f o; |
||||
UNITY_SETUP_INSTANCE_ID(v); |
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); |
||||
o.vertex = UnityObjectToClipPos(v.vertex); |
||||
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); |
||||
UNITY_TRANSFER_FOG(o,o.vertex); |
||||
return o; |
||||
} |
||||
|
||||
fixed4 frag (v2f i) : SV_Target |
||||
{ |
||||
fixed4 col = tex2D(_MainTex, i.texcoord) * _Color; |
||||
|
||||
UNITY_APPLY_FOG(i.fogCoord, col); |
||||
return col; |
||||
} |
||||
ENDCG |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -1,43 +0,0 @@ |
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!78 &1 |
||||
TagManager: |
||||
serializedVersion: 2 |
||||
tags: [] |
||||
layers: |
||||
- Default |
||||
- TransparentFX |
||||
- Ignore Raycast |
||||
- |
||||
- Water |
||||
- UI |
||||
- |
||||
- |
||||
- Scene |
||||
- Particle |
||||
- Post |
||||
- Post2 |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
- |
||||
m_SortingLayers: |
||||
- name: Default |
||||
uniqueID: 0 |
||||
locked: 0 |
||||
@ -1 +0,0 @@ |
||||
Subproject commit a0096e3172c22009678fc94cbd8c8f549a0149f1 |
||||
@ -0,0 +1,9 @@ |
||||
* -text |
||||
|
||||
*.cs text eol=lf diff=csharp |
||||
*.shader text eol=lf |
||||
*.cginc text eol=lf |
||||
*.hlsl text eol=lf |
||||
*.compute text eol=lf |
||||
|
||||
*.meta text eol=lf |
||||
@ -0,0 +1,20 @@ |
||||
# Windows |
||||
Thumbs.db |
||||
Desktop.ini |
||||
|
||||
# macOS |
||||
.DS_Store |
||||
|
||||
# Code Editors |
||||
.idea |
||||
.vscode |
||||
*.csproj |
||||
*.sln |
||||
*.swp |
||||
|
||||
# Unity |
||||
/Library |
||||
/Temp |
||||
|
||||
Assets/Plugins |
||||
Assets/Plugins.meta |
||||
@ -0,0 +1,4 @@ |
||||
.git |
||||
.gitignore |
||||
.gitattributes |
||||
.gitmodules |
||||
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: bfb9850bc5423b54c862ff4b58e1ea25 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,125 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace Klak.Spout |
||||
{ |
||||
[CanEditMultipleObjects] |
||||
[CustomEditor(typeof(SpoutReceiver))] |
||||
public class SpoutReceiverEditor : Editor |
||||
{ |
||||
SerializedProperty _nameFilter; |
||||
SerializedProperty _targetTexture; |
||||
SerializedProperty _targetRenderer; |
||||
SerializedProperty _targetMaterialProperty; |
||||
|
||||
static GUIContent _labelProperty = new GUIContent("Property"); |
||||
|
||||
string[] _propertyList; // cached property list |
||||
Shader _cachedShader; // shader used to cache the list |
||||
|
||||
// Retrieve shader from a target renderer. |
||||
Shader RetrieveTargetShader(UnityEngine.Object target) |
||||
{ |
||||
var renderer = target as Renderer; |
||||
if (renderer == null) return null; |
||||
|
||||
var material = renderer.sharedMaterial; |
||||
if (material == null) return null; |
||||
|
||||
return material.shader; |
||||
} |
||||
|
||||
// Cache properties of a given shader if it's |
||||
// different from a previously given one. |
||||
void CachePropertyList(Shader shader) |
||||
{ |
||||
if (_cachedShader == shader) return; |
||||
|
||||
var temp = new List<string>(); |
||||
|
||||
var count = ShaderUtil.GetPropertyCount(shader); |
||||
for (var i = 0; i < count; i++) |
||||
{ |
||||
var propType = ShaderUtil.GetPropertyType(shader, i); |
||||
if (propType == ShaderUtil.ShaderPropertyType.TexEnv) |
||||
temp.Add(ShaderUtil.GetPropertyName(shader, i)); |
||||
} |
||||
|
||||
_propertyList = temp.ToArray(); |
||||
_cachedShader = shader; |
||||
} |
||||
|
||||
// Material property drop-down list. |
||||
void ShowMaterialPropertyDropDown() |
||||
{ |
||||
// Try to retrieve the target shader. |
||||
var shader = RetrieveTargetShader(_targetRenderer.objectReferenceValue); |
||||
|
||||
if (shader != null) |
||||
{ |
||||
// Cache the property list of the target shader. |
||||
CachePropertyList(shader); |
||||
|
||||
// If there are suitable candidates... |
||||
if (_propertyList.Length > 0) |
||||
{ |
||||
// Show the drop-down list. |
||||
var index = Array.IndexOf(_propertyList, _targetMaterialProperty.stringValue); |
||||
var newIndex = EditorGUILayout.Popup("Property", index, _propertyList); |
||||
|
||||
// Update the property if the selection was changed. |
||||
if (index != newIndex) |
||||
_targetMaterialProperty.stringValue = _propertyList[newIndex]; |
||||
} |
||||
else |
||||
_targetMaterialProperty.stringValue = ""; // reset on failure |
||||
} |
||||
else |
||||
_targetMaterialProperty.stringValue = ""; // reset on failure |
||||
} |
||||
|
||||
void OnEnable() |
||||
{ |
||||
_nameFilter = serializedObject.FindProperty("_nameFilter"); |
||||
_targetTexture = serializedObject.FindProperty("_targetTexture"); |
||||
_targetRenderer = serializedObject.FindProperty("_targetRenderer"); |
||||
_targetMaterialProperty = serializedObject.FindProperty("_targetMaterialProperty"); |
||||
} |
||||
|
||||
void OnDisable() |
||||
{ |
||||
_propertyList = null; |
||||
_cachedShader = null; |
||||
} |
||||
|
||||
public override void OnInspectorGUI() |
||||
{ |
||||
serializedObject.Update(); |
||||
|
||||
EditorGUILayout.PropertyField(_nameFilter); |
||||
EditorGUILayout.PropertyField(_targetTexture); |
||||
EditorGUILayout.PropertyField(_targetRenderer); |
||||
|
||||
EditorGUI.indentLevel++; |
||||
|
||||
if (_targetRenderer.hasMultipleDifferentValues) |
||||
{ |
||||
// Show a simple text field if there are multiple values. |
||||
EditorGUILayout.PropertyField(_targetMaterialProperty, _labelProperty); |
||||
} |
||||
else if (_targetRenderer.objectReferenceValue != null) |
||||
{ |
||||
// Show the material property drop-down list. |
||||
ShowMaterialPropertyDropDown(); |
||||
} |
||||
|
||||
EditorGUI.indentLevel--; |
||||
|
||||
serializedObject.ApplyModifiedProperties(); |
||||
} |
||||
} |
||||
} |
||||
@ -1,7 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: a68e2dc3e3b971e44a78a9b57bc67337 |
||||
guid: e66c46a000456b34e95a2661f5d5391b |
||||
timeCreated: 1492008499 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
@ -0,0 +1,28 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
|
||||
namespace Klak.Spout |
||||
{ |
||||
[CanEditMultipleObjects] |
||||
[CustomEditor(typeof(SpoutSender))] |
||||
public class SpoutSenderEditor : Editor |
||||
{ |
||||
SerializedProperty _clearAlpha; |
||||
|
||||
void OnEnable() |
||||
{ |
||||
_clearAlpha = serializedObject.FindProperty("_clearAlpha"); |
||||
} |
||||
|
||||
public override void OnInspectorGUI() |
||||
{ |
||||
serializedObject.Update(); |
||||
|
||||
EditorGUILayout.PropertyField(_clearAlpha); |
||||
|
||||
serializedObject.ApplyModifiedProperties(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 4d54f6c4c801e1148b465b8fb9d50412 |
||||
timeCreated: 1492008196 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,46 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
|
||||
namespace Klak.Spout |
||||
{ |
||||
// Spout sender list window |
||||
public class SpoutSenderListWindow : EditorWindow |
||||
{ |
||||
[MenuItem("Window/Klak/Spout Sender List")] |
||||
static void Init() |
||||
{ |
||||
EditorWindow.GetWindow<SpoutSenderListWindow>("Spout Senders").Show(); |
||||
} |
||||
|
||||
int _updateCount; |
||||
|
||||
void OnInspectorUpdate() |
||||
{ |
||||
// Update once per eight calls. |
||||
if ((_updateCount++ & 7) == 0) Repaint(); |
||||
} |
||||
|
||||
void OnGUI() |
||||
{ |
||||
var count = PluginEntry.CountSharedObjects(); |
||||
|
||||
EditorGUILayout.Space(); |
||||
EditorGUI.indentLevel++; |
||||
|
||||
if (count == 0) |
||||
EditorGUILayout.LabelField("No sender detected."); |
||||
else |
||||
EditorGUILayout.LabelField(count + " sender(s) detected."); |
||||
|
||||
for (var i = 0; i < count; i++) |
||||
{ |
||||
var name = PluginEntry.GetSharedObjectNameString(i); |
||||
if (name != null) EditorGUILayout.LabelField("- " + name); |
||||
} |
||||
|
||||
EditorGUI.indentLevel--; |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 66d9365756bb8784faa1774081cc4a3e |
||||
timeCreated: 1492007252 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,12 @@ |
||||
{ |
||||
"name": "jp.keijiro.klak.spout.Editor", |
||||
"references": [ |
||||
"jp.keijiro.klak.spout.Runtime" |
||||
], |
||||
"optionalUnityReferences": [], |
||||
"includePlatforms": [ |
||||
"Editor" |
||||
], |
||||
"excludePlatforms": [], |
||||
"allowUnsafeCode": false |
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 21435214e6169c649985b5540a63188a |
||||
AssemblyDefinitionImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,21 @@ |
||||
MIT License |
||||
|
||||
Copyright (c) 2017 Keijiro Takahashi |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
||||
SOFTWARE. |
||||
@ -1,6 +1,6 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 39491758eb9e12c4eabfd1587027ca77 |
||||
PrefabImporter: |
||||
guid: a3a09c268502f7746810f38992bd70b2 |
||||
TextScriptImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
@ -0,0 +1,94 @@ |
||||
KlakSpout |
||||
========= |
||||
|
||||
 |
||||
|
||||
**KlakSpout** is a Unity plugin that allows sharing rendered frames with other |
||||
applications with using the [Spout] protocol. |
||||
|
||||
The Spout protocol is supported by several frameworks (Processing, |
||||
openFrameworks, etc.) and software packages (Resolume, AfterEffects, etc.). |
||||
The plugin allows Unity to interoperate with them in real time without |
||||
incurring much overhead. |
||||
|
||||
[Spout]: http://spout.zeal.co/ |
||||
|
||||
System Requirements and Compatibilities |
||||
--------------------------------------- |
||||
|
||||
- KlakSpout requires Unity 5.6.0 or later. |
||||
- KlakSpout only supports Direct3D 11 (DX11) graphics API mode. Other APIs |
||||
(DX9, DX12, OpenGL core, etc.) are not supported at the moment. |
||||
|
||||
Features |
||||
-------- |
||||
|
||||
### Sending frames from a camera |
||||
|
||||
You can send rendered frames from a camera in a scene with attaching the |
||||
**SpoutSender** component to it. |
||||
|
||||
### Receiving frames from other applications |
||||
|
||||
You can receive frames from other applications and store them into a render |
||||
texture, or set them to a material property as an animating texture. |
||||
|
||||
Installation |
||||
------------ |
||||
|
||||
Download one of the unitypackage files from the [Releases] page and import it |
||||
to a project. |
||||
|
||||
[Releases]: https://github.com/keijiro/KlakSpout/releases |
||||
|
||||
Component Reference |
||||
------------------- |
||||
|
||||
### SpoutSender component |
||||
|
||||
 |
||||
|
||||
**SpoutSender** is a component for sending rendered frames to other |
||||
Spout-compatible applications. |
||||
|
||||
SpoutSender has only one property. **Clear Alpha** controls whether if contents |
||||
of the alpha channel are to be shared or discarded. When it's set to true, it |
||||
clears up the contents of the alpha channel with 1.0 (100% opacity). It's |
||||
useful when the alpha channel doesn't have any particular use. |
||||
|
||||
### SpoutReceiver component |
||||
|
||||
 |
||||
|
||||
**SpoutReceiver** is a component for receiving frames sent from other |
||||
Spout-compatible applications. |
||||
|
||||
**Name Filter** is used to select which Spout sender to connect to. The |
||||
receiver only tries to connect to a sender that has the given string in its |
||||
name. For instance, when Name Filter is set to "resolume", it doesn't connect |
||||
to "Processing 1" nor "maxSender", but "resolumeOut". When Name Filter is kept |
||||
empty, it tries to connect to the first found sender without name filtering. |
||||
|
||||
SpoutReceiver supports two ways of storing received frames. When a render |
||||
texture is set to **Target Texture**, it updates the render texture with the |
||||
received frames. When Target Texture is kept null, it automatically allocates |
||||
a temporary render texture for storing frames. These render textures are |
||||
accessible from scripts with the `sharedTexture` property. |
||||
|
||||
Received frames can be rendered with using material overriding. To override a |
||||
material, set a renderer to **Target Renderer**, then select a property to be |
||||
overridden from the drop-down list. |
||||
|
||||
Sender List Window |
||||
------------------ |
||||
|
||||
 |
||||
|
||||
The **Spout Sender List** window is available from the menu "Window" -> "Spout" |
||||
-> "Spout Sender List". It shows the names of the senders that are currently |
||||
available. |
||||
|
||||
License |
||||
------- |
||||
|
||||
[MIT](LICENSE.md) |
||||
@ -0,0 +1,7 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 4825f67de1ac6914bb329d527edf03bb |
||||
TextScriptImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: c3a1c3646309d4f469c999381310b88c |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,24 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
#include "UnityCG.cginc" |
||||
|
||||
sampler2D _MainTex; |
||||
fixed _ClearAlpha; |
||||
|
||||
v2f_img vert(appdata_img v) |
||||
{ |
||||
v2f_img o; |
||||
o.pos = UnityObjectToClipPos(v.vertex); |
||||
o.uv = float2(v.texcoord.x, 1 - v.texcoord.y); |
||||
return o; |
||||
} |
||||
|
||||
fixed4 frag(v2f_img i) : SV_Target |
||||
{ |
||||
fixed4 col = tex2D(_MainTex, i.uv); |
||||
#if defined(SPOUT_RECEIVER) && !defined(UNITY_COLORSPACE_GAMMA) |
||||
col.rgb = GammaToLinearSpace(col.rgb); |
||||
#endif |
||||
col.a = saturate(col.a + _ClearAlpha); |
||||
return col; |
||||
} |
||||
@ -0,0 +1,9 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 35d67d62b7c939d4e8fdb1c3bed59a83 |
||||
timeCreated: 1491926074 |
||||
licenseType: Pro |
||||
ShaderImporter: |
||||
defaultTextures: [] |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,9 @@ |
||||
fileFormatVersion: 2 |
||||
guid: eb56c59e60b76874692c486f3bdd860d |
||||
timeCreated: 1491925542 |
||||
licenseType: Pro |
||||
ShaderImporter: |
||||
defaultTextures: [] |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: a9ca729c9d09d03428ab5e26dc0170b2 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,9 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 82c81c4751c9a7145a4d491944d132ab |
||||
folderAsset: yes |
||||
timeCreated: 1491924284 |
||||
licenseType: Pro |
||||
DefaultImporter: |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
Binary file not shown.
@ -0,0 +1,139 @@ |
||||
fileFormatVersion: 2 |
||||
guid: dc935766d7c9fd44181cb4b58ef3627e |
||||
timeCreated: 1491793810 |
||||
licenseType: Pro |
||||
PluginImporter: |
||||
serializedVersion: 2 |
||||
iconMap: {} |
||||
executionOrder: {} |
||||
isPreloaded: 0 |
||||
isOverridable: 0 |
||||
platformData: |
||||
data: |
||||
first: |
||||
'': Any |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
Exclude Editor: 0 |
||||
Exclude Linux: 0 |
||||
Exclude Linux64: 0 |
||||
Exclude LinuxUniversal: 0 |
||||
Exclude OSXIntel: 0 |
||||
Exclude OSXIntel64: 0 |
||||
Exclude OSXUniversal: 0 |
||||
Exclude PS4: 1 |
||||
Exclude Win: 1 |
||||
Exclude Win64: 0 |
||||
Exclude WindowsStoreApps: 1 |
||||
data: |
||||
first: |
||||
'': Editor |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
CPU: x86_64 |
||||
OS: Windows |
||||
data: |
||||
first: |
||||
Any: |
||||
second: |
||||
enabled: 0 |
||||
settings: {} |
||||
data: |
||||
first: |
||||
Editor: Editor |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
DefaultValueInitialized: true |
||||
data: |
||||
first: |
||||
Facebook: Win |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
CPU: None |
||||
data: |
||||
first: |
||||
Facebook: Win64 |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
PS4: PS4 |
||||
second: |
||||
enabled: 0 |
||||
settings: {} |
||||
data: |
||||
first: |
||||
Standalone: Linux |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: x86 |
||||
data: |
||||
first: |
||||
Standalone: Linux64 |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: x86_64 |
||||
data: |
||||
first: |
||||
Standalone: LinuxUniversal |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
Standalone: OSXIntel |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
Standalone: OSXIntel64 |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
Standalone: OSXUniversal |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
Standalone: Win |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
CPU: None |
||||
data: |
||||
first: |
||||
Standalone: Win64 |
||||
second: |
||||
enabled: 1 |
||||
settings: |
||||
CPU: AnyCPU |
||||
data: |
||||
first: |
||||
Windows Store Apps: WindowsStoreApps |
||||
second: |
||||
enabled: 0 |
||||
settings: |
||||
CPU: AnyCPU |
||||
DontProcess: False |
||||
PlaceholderPath: |
||||
SDK: AnySDK |
||||
ScriptingBackend: AnyScriptingBackend |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,74 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
using UnityEngine; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
namespace Klak.Spout |
||||
{ |
||||
public static class PluginEntry |
||||
{ |
||||
#region Plugin polling |
||||
|
||||
static int _lastUpdateFrame = -1; |
||||
|
||||
public static void Poll() |
||||
{ |
||||
if (Time.frameCount != _lastUpdateFrame) |
||||
{ |
||||
GL.IssuePluginEvent(GetRenderEventFunc(), 0); |
||||
_lastUpdateFrame = Time.frameCount; |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Native plugin interface |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr GetRenderEventFunc(); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr CreateSender(string name, int width, int height); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr CreateReceiver(string name); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern void DestroySharedObject(System.IntPtr ptr); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern bool DetectDisconnection(System.IntPtr ptr); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr GetTexturePointer(System.IntPtr ptr); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern int GetTextureWidth(System.IntPtr ptr); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern int GetTextureHeight(System.IntPtr ptr); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern int CountSharedObjects(); |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr GetSharedObjectName(int index); |
||||
|
||||
public static string GetSharedObjectNameString(int index) |
||||
{ |
||||
var ptr = GetSharedObjectName(index); |
||||
return ptr != System.IntPtr.Zero ? Marshal.PtrToStringAnsi(ptr) : null; |
||||
} |
||||
|
||||
[DllImport("KlakSpout")] |
||||
public static extern System.IntPtr SearchSharedObjectName(string keyword); |
||||
|
||||
public static string SearchSharedObjectNameString(string keyword) |
||||
{ |
||||
var ptr = SearchSharedObjectName(keyword); |
||||
return ptr != System.IntPtr.Zero ? Marshal.PtrToStringAnsi(ptr) : null; |
||||
} |
||||
|
||||
#endregion |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 5833bfa0ae0a90e478f1f90a455ee667 |
||||
timeCreated: 1491903743 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,161 @@ |
||||
// KlakSpout - Spout realtime video sharing plugin for Unity |
||||
// https://github.com/keijiro/KlakSpout |
||||
using UnityEngine; |
||||
|
||||
namespace Klak.Spout |
||||
{ |
||||
/// Spout receiver class |
||||
[AddComponentMenu("Klak/Spout/Spout Receiver")] |
||||
public class SpoutReceiver : MonoBehaviour |
||||
{ |
||||
#region Editable properties |
||||
|
||||
[SerializeField] string _nameFilter; |
||||
|
||||
public string nameFilter { |
||||
get { return _nameFilter; } |
||||
set { _nameFilter = value; } |
||||
} |
||||
|
||||
[SerializeField] RenderTexture _targetTexture; |
||||
|
||||
public RenderTexture targetTexture { |
||||
get { return _targetTexture; } |
||||
set { _targetTexture = value; } |
||||
} |
||||
|
||||
[SerializeField] Renderer _targetRenderer; |
||||
|
||||
public Renderer targetRenderer { |
||||
get { return _targetRenderer; } |
||||
set { _targetRenderer = value; } |
||||
} |
||||
|
||||
[SerializeField] string _targetMaterialProperty; |
||||
|
||||
public string targetMaterialProperty { |
||||
get { return _targetMaterialProperty; } |
||||
set { targetMaterialProperty = value; } |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Public property |
||||
|
||||
Texture2D _sharedTexture; |
||||
RenderTexture _fixedTexture; |
||||
|
||||
public Texture receivedTexture { |
||||
get { return _targetTexture != null ? _targetTexture : _fixedTexture; } |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Private variables |
||||
|
||||
System.IntPtr _receiver; |
||||
Material _fixupMaterial; |
||||
MaterialPropertyBlock _propertyBlock; |
||||
|
||||
// Search the texture list and create a receiver when found one. |
||||
void SearchAndCreateTexture() |
||||
{ |
||||
var name = PluginEntry.SearchSharedObjectNameString(_nameFilter); |
||||
if (name != null) _receiver = PluginEntry.CreateReceiver(name); |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region MonoBehaviour functions |
||||
|
||||
void Start() |
||||
{ |
||||
_fixupMaterial = new Material(Shader.Find("Hidden/Spout/Fixup")); |
||||
_propertyBlock = new MaterialPropertyBlock(); |
||||
|
||||
// Initial search. |
||||
SearchAndCreateTexture(); |
||||
} |
||||
|
||||
void OnDestroy() |
||||
{ |
||||
if (_receiver != System.IntPtr.Zero) |
||||
{ |
||||
PluginEntry.DestroySharedObject(_receiver); |
||||
_receiver = System.IntPtr.Zero; |
||||
} |
||||
|
||||
if (_sharedTexture != null) |
||||
{ |
||||
Destroy(_sharedTexture); |
||||
_sharedTexture = null; |
||||
} |
||||
|
||||
if (_fixedTexture != null) |
||||
{ |
||||
Destroy(_fixedTexture); |
||||
_fixedTexture = null; |
||||
} |
||||
} |
||||
|
||||
void Update() |
||||
{ |
||||
PluginEntry.Poll(); |
||||
|
||||
if (_receiver == System.IntPtr.Zero) |
||||
{ |
||||
// The receiver hasn't been set up yet; try to get one. |
||||
SearchAndCreateTexture(); |
||||
} |
||||
else |
||||
{ |
||||
// We've received textures via this receiver |
||||
// but now it's disconnected from the sender -> Destroy it. |
||||
if (PluginEntry.GetTexturePointer(_receiver) != System.IntPtr.Zero && |
||||
PluginEntry.DetectDisconnection(_receiver)) |
||||
{ |
||||
OnDestroy(); |
||||
} |
||||
} |
||||
|
||||
if (_receiver != System.IntPtr.Zero) |
||||
{ |
||||
if (_sharedTexture == null) |
||||
{ |
||||
// Try to initialize the shared texture. |
||||
var ptr = PluginEntry.GetTexturePointer(_receiver); |
||||
if (ptr != System.IntPtr.Zero) |
||||
{ |
||||
_sharedTexture = Texture2D.CreateExternalTexture( |
||||
PluginEntry.GetTextureWidth(_receiver), |
||||
PluginEntry.GetTextureHeight(_receiver), |
||||
TextureFormat.ARGB32, false, false, ptr |
||||
); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
// Update external objects. |
||||
if (_targetTexture != null) |
||||
{ |
||||
Graphics.Blit(_sharedTexture, _targetTexture, _fixupMaterial, 1); |
||||
} |
||||
else |
||||
{ |
||||
if (_fixedTexture == null) |
||||
_fixedTexture = new RenderTexture(_sharedTexture.width, _sharedTexture.height, 0); |
||||
Graphics.Blit(_sharedTexture, _fixedTexture, _fixupMaterial, 1); |
||||
} |
||||
|
||||
if (_targetRenderer != null) |
||||
{ |
||||
_propertyBlock.SetTexture(_targetMaterialProperty, receivedTexture); |
||||
_targetRenderer.SetPropertyBlock(_propertyBlock); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
#endregion |
||||
} |
||||
} |
||||
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 62f7dec0b00674947bc631624c21970a |
||||
timeCreated: 1491895289 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 45099d624c1e6c14e9514f4e5ea1ed9c |
||||
timeCreated: 1491793847 |
||||
licenseType: Pro |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,7 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 7cdfac5ef1f961d4ebfe51361a2020bd |
||||
AssemblyDefinitionImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
@ -0,0 +1,8 @@ |
||||
{ |
||||
"name": "jp.keijiro.klak.spout", |
||||
"displayName": "KlakSpout", |
||||
"version": "0.0.1", |
||||
"unity": "2018.1", |
||||
"description": "KlakSpout is a Unity plugin that allows sharing rendered frames with other applications with using the Spout protocol.", |
||||
"dependencies": { } |
||||
} |
||||
@ -0,0 +1,7 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 46d658811c8e74d42a9b9d2ee0dd286a |
||||
TextScriptImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
Loading…
Reference in new issue