master
uc-hoba 8 years ago
parent 5d553bff6e
commit d502f77a5b
  1. 99
      Unity_2018_Frozen/Assets/Frozen/Frozen.unity
  2. 11
      Unity_2018_Frozen/Assets/Frozen/Script/SnowflakeParticleUpdater.cs
  3. 25
      Unity_2018_Frozen/Assets/Frozen/Script/SpaceHomography.cs
  4. 2
      Unity_2018_Frozen/Assets/Frozen/Shader/FrozenParticleUnlitPoint.shader
  5. 24
      Unity_2018_Frozen/Assets/Frozen/Shader/SpaceMapping.shader
  6. 23
      Unity_2018_Frozen/Assets/UnityUtilityNativePlugin/Script/DebugInformation.cs
  7. 13
      Unity_2018_Frozen/Assets/UnityUtilityNativePlugin/Script/DebugInformation.cs.meta
  8. 8
      Unity_2018_Frozen/ProjectSettings/ProjectSettings.asset
  9. 4
      Unity_2018_Frozen/ProjectSettings/TimeManager.asset

@ -547,6 +547,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
reset: 0
fps: 30
maxParticles: 262144
particleBuffer: {fileID: 438615022}
shader: {fileID: 7200000, guid: d6604fabdbb13e9428c849c59feccdac, type: 3}
@ -1305,7 +1306,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &618046639
MonoBehaviour:
m_ObjectHideFlags: 0
@ -2019,7 +2020,7 @@ RectTransform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 957254312}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 10.065701}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 1}
m_Children: []
m_Father: {fileID: 1765914297}
@ -2027,7 +2028,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: -0.00012207031}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 5040, y: 3200}
m_Pivot: {x: 0, y: 1}
--- !u!114 &957254314
@ -2327,7 +2328,7 @@ MonoBehaviour:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1283180266}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
@ -2633,6 +2634,7 @@ GameObject:
- component: {fileID: 1765914296}
- component: {fileID: 1765914295}
- component: {fileID: 1765914294}
- component: {fileID: 1765914298}
m_Layer: 5
m_Name: Debug Canvas
m_TagString: Untagged
@ -2708,6 +2710,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 957254313}
- {fileID: 2084135710}
m_Father: {fileID: 0}
m_RootOrder: 20
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -2716,6 +2719,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1765914298
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1765914293}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 69c0f378d0dcf504980865e62df80079, type: 3}
m_Name:
m_EditorClassIdentifier:
fpsText: {fileID: 2084135711}
--- !u!1 &1774693141
GameObject:
m_ObjectHideFlags: 0
@ -2926,6 +2941,82 @@ MonoBehaviour:
colorize: 1
debugMaterial: {fileID: 2100000, guid: 95b4d9b25b7a7e3449627228b10d9009, type: 2}
debugInfo:
--- !u!1 &2084135709
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2084135710}
- component: {fileID: 2084135712}
- component: {fileID: 2084135711}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2084135710
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2084135709}
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: 1765914297}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -646, y: -14}
m_SizeDelta: {x: 250, y: 250}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2084135711
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2084135709}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 18
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 1
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: '30.0
'
--- !u!222 &2084135712
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2084135709}
--- !u!1 &2129467936
GameObject:
m_ObjectHideFlags: 0

@ -7,6 +7,8 @@ namespace UltraCombos.Frozen
public class SnowflakeParticleUpdater : MonoBehaviour
{
public bool reset = false;
[SerializeField] int fps = 30;
float stamp = 0.0f;
[Range(1, 1 << 20)]
public int maxParticles = 1 << 15;
public StructuredBuffer particleBuffer = null;
@ -44,18 +46,23 @@ namespace UltraCombos.Frozen
StartCoroutine(Initialize());
}
private void FixedUpdate()
private void Update()
{
if (is_initialized == false)
return;
float time_step = 1.0f / fps;
if (Time.time - stamp < time_step)
return;
stamp = Time.time;
if (reset)
{
reset = false;
OnReset();
}
UpdateParticle(Time.fixedDeltaTime);
UpdateParticle(time_step);
}
private void OnDestroy()

@ -6,10 +6,6 @@ public class SpaceHomography : MonoBehaviour
{
public Vector3 space;
Matrix4x4 front_homo;
Matrix4x4 left_homo;
Matrix4x4 right_homo;
Vector2 texture_size;
private void Start()
@ -24,6 +20,8 @@ public class SpaceHomography : MonoBehaviour
var src = new List<Vector2>();
var dst = new List<Vector2>();
var homos = new List<Matrix4x4>();
// front
{
src.Clear();
@ -42,8 +40,9 @@ public class SpaceHomography : MonoBehaviour
for (int i = 0; i < dst.Count; i++)
dst[i] += Vector2.one * offset;
front_homo = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref front_homo);
var matrix = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref matrix);
homos.Add(matrix);
}
// left
@ -64,8 +63,9 @@ public class SpaceHomography : MonoBehaviour
for (int i = 0; i < dst.Count; i++)
dst[i] += Vector2.one * offset;
left_homo = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref left_homo);
var matrix = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref matrix);
homos.Add(matrix);
}
// right
@ -86,13 +86,12 @@ public class SpaceHomography : MonoBehaviour
for (int i = 0; i < dst.Count; i++)
dst[i] += Vector2.one * offset;
right_homo = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref right_homo);
var matrix = Matrix4x4.identity;
FindHomography(dst.ToArray(), src.ToArray(), ref matrix);
homos.Add(matrix);
}
Shader.SetGlobalMatrix("front_homo", front_homo);
Shader.SetGlobalMatrix("left_homo", left_homo);
Shader.SetGlobalMatrix("right_homo", right_homo);
Shader.SetGlobalMatrixArray("homography", homos);
Shader.SetGlobalVector("homo_space", space);
Shader.SetGlobalVector("texture_size", texture_size);
}

@ -58,7 +58,7 @@
return o;
}
[maxvertexcount(4)]
[maxvertexcount(3)]
void geom(point v2g input[1], inout TriangleStream<g2f> OutputStream)
{
float3 position = input[0].vertex.xyz;

@ -17,8 +17,6 @@
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
@ -46,9 +44,7 @@
return o;
}
float4x4 front_homo;
float4x4 left_homo;
float4x4 right_homo;
float4x4 homography[3];
float3 homo_space;
float2 texture_size;
@ -68,19 +64,27 @@
if (pos.y <= space.z)
{
float4 homo_pos = mul(front_homo, float4(pos, 0, 1));
pos = homo_pos.xy / homo_pos.w;
if (pos.x < space.z || pos.x > space.z + space.x)
{
pos = float2(0, 0);
}
else
{
float4 homo_pos = mul(homography[0], float4(pos, 0, 1));
pos = homo_pos.xy / homo_pos.w;
}
if (pos.x < space.z || pos.x > space.z + space.x) pos = float2(0, 0);
//if (pos.x < space.z || pos.x > space.z + space.x) pos = float2(0, 0);
}
else if (pos.x <= space.z)
{
float4 homo_pos = mul(left_homo, float4(pos, 0, 1));
float4 homo_pos = mul(homography[1], float4(pos, 0, 1));
pos = homo_pos.xy / homo_pos.w;
}
else if (pos.x >= space.z + space.x)
{
float4 homo_pos = mul(right_homo, float4(pos, 0, 1));
float4 homo_pos = mul(homography[2], float4(pos, 0, 1));
pos = homo_pos.xy / homo_pos.w;
}

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DebugInformation : MonoBehaviour
{
[SerializeField] Text fpsText;
float fps = 30.0f;
float stamp = -0.1f;
private void Start()
{
}
private void Update()
{
fps = Mathf.Lerp(fps, 1.0f / (Time.time - stamp), 0.02f);
stamp = Time.time;
fpsText.text = string.Format("fps: {0}", fps);
}
}

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 69c0f378d0dcf504980865e62df80079
timeCreated: 1523610448
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -82,7 +82,7 @@ PlayerSettings:
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 0
graphicsJobs: 0
graphicsJobs: 1
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0
@ -257,7 +257,10 @@ PlayerSettings:
resolutionDialogBanner: {fileID: 0}
m_BuildTargetIcons: []
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: WindowsStandaloneSupport
m_APIs: 02000000
m_Automatic: 1
m_BuildTargetVRSettings: []
m_BuildTargetEnableVuforiaSettings: []
openGLRequireES31: 0
@ -638,6 +641,7 @@ PlayerSettings:
XboxOneSplashScreen: {fileID: 0}
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
xboxOneScriptCompiler: 0
vrEditorSettings:
daydream:

@ -3,7 +3,7 @@
--- !u!5 &1
TimeManager:
m_ObjectHideFlags: 0
Fixed Timestep: 0.0333333
Fixed Timestep: 0.02
Maximum Allowed Timestep: 0.33333334
m_TimeScale: 1
Maximum Particle Timestep: 0.0333333
Maximum Particle Timestep: 0.03

Loading…
Cancel
Save