diff options
Diffstat (limited to 'examples/UnityExample/Assets')
37 files changed, 2437 insertions, 2437 deletions
diff --git a/examples/UnityExample/Assets/Materials.meta b/examples/UnityExample/Assets/Materials.meta index df23794..784a85f 100644..100755 --- a/examples/UnityExample/Assets/Materials.meta +++ b/examples/UnityExample/Assets/Materials.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: d31aa341fef8dc847b06afe139915599 -folderAsset: yes -timeCreated: 1481726695 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: d31aa341fef8dc847b06afe139915599
+folderAsset: yes
+timeCreated: 1481726695
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Materials/CubeMaterial.mat b/examples/UnityExample/Assets/Materials/CubeMaterial.mat index d5b3782..09d453c 100644..100755 --- a/examples/UnityExample/Assets/Materials/CubeMaterial.mat +++ b/examples/UnityExample/Assets/Materials/CubeMaterial.mat @@ -1,127 +1,127 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: CubeMaterial - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: _EMISSION - m_LightmapFlags: 1 - m_CustomRenderQueue: -1 - stringTagMap: {} - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - - first: - name: _BumpMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailAlbedoMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailMask - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailNormalMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _EmissionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MainTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MetallicGlossMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _OcclusionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _ParallaxMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - first: - name: _BumpScale - second: 1 - - first: - name: _Cutoff - second: 0.5 - - first: - name: _DetailNormalMapScale - second: 1 - - first: - name: _DstBlend - second: 0 - - first: - name: _GlossMapScale - second: 1 - - first: - name: _Glossiness - second: 0.5 - - first: - name: _GlossyReflections - second: 1 - - first: - name: _Metallic - second: 0 - - first: - name: _Mode - second: 0 - - first: - name: _OcclusionStrength - second: 1 - - first: - name: _Parallax - second: 0.02 - - first: - name: _SmoothnessTextureChannel - second: 0 - - first: - name: _SpecularHighlights - second: 1 - - first: - name: _SrcBlend - second: 1 - - first: - name: _UVSec - second: 0 - - first: - name: _ZWrite - second: 1 - m_Colors: - - first: - name: _Color - second: {r: 1, g: 1, b: 1, a: 1} - - first: - name: _EmissionColor - second: {r: 0, g: 0, b: 0, a: 1} +%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: CubeMaterial
+ m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+ m_ShaderKeywords: _EMISSION
+ m_LightmapFlags: 1
+ m_CustomRenderQueue: -1
+ stringTagMap: {}
+ m_SavedProperties:
+ serializedVersion: 2
+ m_TexEnvs:
+ - first:
+ name: _BumpMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailAlbedoMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailMask
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailNormalMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _EmissionMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _MainTex
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _MetallicGlossMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _OcclusionMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _ParallaxMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - first:
+ name: _BumpScale
+ second: 1
+ - first:
+ name: _Cutoff
+ second: 0.5
+ - first:
+ name: _DetailNormalMapScale
+ second: 1
+ - first:
+ name: _DstBlend
+ second: 0
+ - first:
+ name: _GlossMapScale
+ second: 1
+ - first:
+ name: _Glossiness
+ second: 0.5
+ - first:
+ name: _GlossyReflections
+ second: 1
+ - first:
+ name: _Metallic
+ second: 0
+ - first:
+ name: _Mode
+ second: 0
+ - first:
+ name: _OcclusionStrength
+ second: 1
+ - first:
+ name: _Parallax
+ second: 0.02
+ - first:
+ name: _SmoothnessTextureChannel
+ second: 0
+ - first:
+ name: _SpecularHighlights
+ second: 1
+ - first:
+ name: _SrcBlend
+ second: 1
+ - first:
+ name: _UVSec
+ second: 0
+ - first:
+ name: _ZWrite
+ second: 1
+ m_Colors:
+ - first:
+ name: _Color
+ second: {r: 1, g: 1, b: 1, a: 1}
+ - first:
+ name: _EmissionColor
+ second: {r: 0, g: 0, b: 0, a: 1}
diff --git a/examples/UnityExample/Assets/Materials/CubeMaterial.mat.meta b/examples/UnityExample/Assets/Materials/CubeMaterial.mat.meta index c09f976..9a44c37 100644..100755 --- a/examples/UnityExample/Assets/Materials/CubeMaterial.mat.meta +++ b/examples/UnityExample/Assets/Materials/CubeMaterial.mat.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 737d44acaf66b744197a3bf85c73a150 -timeCreated: 1483016941 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 737d44acaf66b744197a3bf85c73a150
+timeCreated: 1483016941
+licenseType: Free
+NativeFormatImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Materials/HitToolMaterial.mat b/examples/UnityExample/Assets/Materials/HitToolMaterial.mat index 8fe71b4..38afd09 100644..100755 --- a/examples/UnityExample/Assets/Materials/HitToolMaterial.mat +++ b/examples/UnityExample/Assets/Materials/HitToolMaterial.mat @@ -1,128 +1,128 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 6 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: HitToolMaterial - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION - m_LightmapFlags: 1 - m_CustomRenderQueue: 3000 - stringTagMap: - RenderType: Transparent - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - - first: - name: _BumpMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailAlbedoMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailMask - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _DetailNormalMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _EmissionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MainTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _MetallicGlossMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _OcclusionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - - first: - name: _ParallaxMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - - first: - name: _BumpScale - second: 1 - - first: - name: _Cutoff - second: 0.5 - - first: - name: _DetailNormalMapScale - second: 1 - - first: - name: _DstBlend - second: 10 - - first: - name: _GlossMapScale - second: 1 - - first: - name: _Glossiness - second: 0 - - first: - name: _GlossyReflections - second: 1 - - first: - name: _Metallic - second: 0.156 - - first: - name: _Mode - second: 3 - - first: - name: _OcclusionStrength - second: 1 - - first: - name: _Parallax - second: 0.02 - - first: - name: _SmoothnessTextureChannel - second: 0 - - first: - name: _SpecularHighlights - second: 1 - - first: - name: _SrcBlend - second: 1 - - first: - name: _UVSec - second: 0 - - first: - name: _ZWrite - second: 0 - m_Colors: - - first: - name: _Color - second: {r: 1, g: 0, b: 0, a: 0.259} - - first: - name: _EmissionColor - second: {r: 0, g: 0, b: 0, a: 1} +%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_Name: HitToolMaterial
+ m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
+ m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION
+ m_LightmapFlags: 1
+ m_CustomRenderQueue: 3000
+ stringTagMap:
+ RenderType: Transparent
+ m_SavedProperties:
+ serializedVersion: 2
+ m_TexEnvs:
+ - first:
+ name: _BumpMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailAlbedoMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailMask
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _DetailNormalMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _EmissionMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _MainTex
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _MetallicGlossMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _OcclusionMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - first:
+ name: _ParallaxMap
+ second:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - first:
+ name: _BumpScale
+ second: 1
+ - first:
+ name: _Cutoff
+ second: 0.5
+ - first:
+ name: _DetailNormalMapScale
+ second: 1
+ - first:
+ name: _DstBlend
+ second: 10
+ - first:
+ name: _GlossMapScale
+ second: 1
+ - first:
+ name: _Glossiness
+ second: 0
+ - first:
+ name: _GlossyReflections
+ second: 1
+ - first:
+ name: _Metallic
+ second: 0.156
+ - first:
+ name: _Mode
+ second: 3
+ - first:
+ name: _OcclusionStrength
+ second: 1
+ - first:
+ name: _Parallax
+ second: 0.02
+ - first:
+ name: _SmoothnessTextureChannel
+ second: 0
+ - first:
+ name: _SpecularHighlights
+ second: 1
+ - first:
+ name: _SrcBlend
+ second: 1
+ - first:
+ name: _UVSec
+ second: 0
+ - first:
+ name: _ZWrite
+ second: 0
+ m_Colors:
+ - first:
+ name: _Color
+ second: {r: 1, g: 0, b: 0, a: 0.259}
+ - first:
+ name: _EmissionColor
+ second: {r: 0, g: 0, b: 0, a: 1}
diff --git a/examples/UnityExample/Assets/Materials/HitToolMaterial.mat.meta b/examples/UnityExample/Assets/Materials/HitToolMaterial.mat.meta index da8036a..352af1f 100644..100755 --- a/examples/UnityExample/Assets/Materials/HitToolMaterial.mat.meta +++ b/examples/UnityExample/Assets/Materials/HitToolMaterial.mat.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 680819e140a18024bba58e6fdc3651d2 -timeCreated: 1483016941 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 680819e140a18024bba58e6fdc3651d2
+timeCreated: 1483016941
+licenseType: Free
+NativeFormatImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins.meta b/examples/UnityExample/Assets/Plugins.meta index cb9f934..6f89902 100644..100755 --- a/examples/UnityExample/Assets/Plugins.meta +++ b/examples/UnityExample/Assets/Plugins.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: 92d69ff37d33e1c48959dc367d045c85 -folderAsset: yes -timeCreated: 1481019334 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 92d69ff37d33e1c48959dc367d045c85
+folderAsset: yes
+timeCreated: 1481019334
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast.meta b/examples/UnityExample/Assets/Plugins/Blast.meta index 2413c51..8958724 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast.meta +++ b/examples/UnityExample/Assets/Plugins/Blast.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: ba11cec7e53a49943b7e620c809850c9 -folderAsset: yes -timeCreated: 1483018139 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: ba11cec7e53a49943b7e620c809850c9
+folderAsset: yes
+timeCreated: 1483018139
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs index 68b311d..21e208c 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs @@ -1,42 +1,42 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using UnityEngine; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastExtRadialDamageDesc -{ - public float compressive; //!< compressive (radial) damage component - public float p0; - public float p1; - public float p2; - public float minRadius; //!< inner radius of damage action - public float maxRadius; //!< outer radius of damage action -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastExtMaterial -{ - public float singleChunkThreshold; //!< subsupport chunks only take damage surpassing this value - public float graphChunkThreshold; //!< support chunks only take damage surpassing this value - public float bondTangentialThreshold; //!< bond only take damage surpassing this value - public float bondNormalThreshold; //!< currently unused - forward damage propagation - public float damageAttenuation; //!< factor of damage attenuation while forwarding -}; - - -public static class NvBlastExtShadersWrapper -{ - public const string DLL_NAME = "NvBlastExtShaders" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM; - - #region Dll - [DllImport(DLL_NAME)] - private static extern bool NvBlastExtDamageActorRadialFalloff(IntPtr actor, NvBlastFractureBuffers buffers, NvBlastExtRadialDamageDesc damageDescBuffer, UInt32 damageDescCount, NvBlastExtMaterial material, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers); - #endregion - - public static bool DamageRadialFalloff(this NvBlastActor actor, NvBlastFractureBuffers buffers, NvBlastExtRadialDamageDesc damageDescBuffer, UInt32 damageDescCount, NvBlastExtMaterial material) - { - return NvBlastExtDamageActorRadialFalloff(actor.ptr, buffers, damageDescBuffer, damageDescCount, material, NvBlastWrapper.Log, null); - } +using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using UnityEngine;
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastExtRadialDamageDesc
+{
+ public float compressive; //!< compressive (radial) damage component
+ public float p0;
+ public float p1;
+ public float p2;
+ public float minRadius; //!< inner radius of damage action
+ public float maxRadius; //!< outer radius of damage action
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastExtMaterial
+{
+ public float singleChunkThreshold; //!< subsupport chunks only take damage surpassing this value
+ public float graphChunkThreshold; //!< support chunks only take damage surpassing this value
+ public float bondTangentialThreshold; //!< bond only take damage surpassing this value
+ public float bondNormalThreshold; //!< currently unused - forward damage propagation
+ public float damageAttenuation; //!< factor of damage attenuation while forwarding
+};
+
+
+public static class NvBlastExtShadersWrapper
+{
+ public const string DLL_NAME = "NvBlastExtShaders" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM;
+
+ #region Dll
+ [DllImport(DLL_NAME)]
+ private static extern bool NvBlastExtDamageActorRadialFalloff(IntPtr actor, NvBlastFractureBuffers buffers, NvBlastExtRadialDamageDesc damageDescBuffer, UInt32 damageDescCount, NvBlastExtMaterial material, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
+ #endregion
+
+ public static bool DamageRadialFalloff(this NvBlastActor actor, NvBlastFractureBuffers buffers, NvBlastExtRadialDamageDesc damageDescBuffer, UInt32 damageDescCount, NvBlastExtMaterial material)
+ {
+ return NvBlastExtDamageActorRadialFalloff(actor.ptr, buffers, damageDescBuffer, damageDescCount, material, NvBlastWrapper.Log, null);
+ }
}
\ No newline at end of file diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs.meta b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs.meta index edf8ac2..d4ad7e2 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 47339a6d798176c41969193e9b3ecb30 -timeCreated: 1481725762 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 47339a6d798176c41969193e9b3ecb30
+timeCreated: 1481725762
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs index 8f81a2e..94ca399 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs @@ -1,21 +1,21 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using UnityEngine; - - -public static class NvBlastExtUtilsWrapper -{ - public const string DLL_NAME = "NvBlastExtUtils" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM; - - #region Dll - [DllImport(DLL_NAME)] - private static extern void NvBlastReorderAssetDescChunks([In, Out] NvBlastChunkDesc[] chunkDescs, uint chunkCount, [In, Out] NvBlastBondDesc[] bondDescs, uint bondCount, [In, Out] uint[] chunkReorderMap); - #endregion - - public static void ReorderAssetDescChunks(NvBlastAssetDesc assetDesc, uint[] chunkReorderMap) - { - NvBlastReorderAssetDescChunks(assetDesc.chunkDescs, assetDesc.chunkCount, assetDesc.bondDescs, assetDesc.bondCount, chunkReorderMap); - } +using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using UnityEngine;
+
+
+public static class NvBlastExtUtilsWrapper
+{
+ public const string DLL_NAME = "NvBlastExtUtils" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM;
+
+ #region Dll
+ [DllImport(DLL_NAME)]
+ private static extern void NvBlastReorderAssetDescChunks([In, Out] NvBlastChunkDesc[] chunkDescs, uint chunkCount, [In, Out] NvBlastBondDesc[] bondDescs, uint bondCount, [In, Out] uint[] chunkReorderMap);
+ #endregion
+
+ public static void ReorderAssetDescChunks(NvBlastAssetDesc assetDesc, uint[] chunkReorderMap)
+ {
+ NvBlastReorderAssetDescChunks(assetDesc.chunkDescs, assetDesc.chunkCount, assetDesc.bondDescs, assetDesc.bondCount, chunkReorderMap);
+ }
}
\ No newline at end of file diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs.meta b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs.meta index caf4278..5e49418 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 79da9e4b8c3adf543b406ce704084d62 -timeCreated: 1481725762 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 79da9e4b8c3adf543b406ce704084d62
+timeCreated: 1481725762
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs index ccda6c4..13822f8 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs @@ -1,587 +1,587 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using UnityEngine; -using UnityEngine.Assertions; - -public struct NvBlastChunkDesc -{ - public enum Flags - { - NoFlags = 0, - SupportFlag = (1 << 0) - }; - - /** Central position in chunk. */ - public Single c0; - public Single c1; - public Single c2; - - - /** Volume of chunk. */ - public Single volume; - - /** Index of this chunk's parent. If this is a root chunk, then this value must be UINT32_MAX. */ - public UInt32 parentChunkIndex; - - /** See Flags enum for possible flags. */ - public UInt32 flags; - - /** User-supplied data which will be accessible to the user in chunk fracture events. */ - public UInt32 userData; -} - -public struct NvBlastBond -{ - public Single n0; - public Single n1; - public Single n2; - - public Single area; - - public Single c0; - public Single c1; - public Single c2; - - UInt32 userData; -}; - -public struct NvBlastBondDesc -{ - /** The indices of the chunks linked by this bond. They must be different support chunk indices. */ - public UInt32 chunk0; - public UInt32 chunk1; - - /** Bond data (see NvBlastBond). */ - public NvBlastBond bond; -} - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastAssetDesc -{ - public UInt32 chunkCount; - public NvBlastChunkDesc[] chunkDescs; - public UInt32 bondCount; - public NvBlastBondDesc[] bondDescs; -} - -/** -Actor descriptor, used to create an instance of an NvBlastAsset with NvBlastActorCreate - 6 -See NvBlastActorCreate. -*/ -[StructLayout(LayoutKind.Sequential)] -public class NvBlastActorDesc -{ - /** - Initial health of all bonds, if initialBondHealths is NULL (see initialBondHealths). - */ - public Single uniformInitialBondHealth; - - /** - Initial bond healths. If not NULL, this array must be of length NvBlastAssetGetChunkCount(asset, ... ). - If NULL, uniformInitialBondHealth must be set. - */ - public Single[] initialBondHealths = null; - - /** - Initial health of all lower-support chunks, if initialSupportChunkHealths is NULL (see initialSupportChunkHealths). - */ - public Single uniformInitialLowerSupportChunkHealth; - - /** - Initial health of all support chunks. If not NULL, this must be of length - NvBlastAssetGetSupportGraph(asset, ... ).nodeCount. The elements in the initialSupportChunkHealth - array will correspond to the chunk indices in the NvBlastAssetGetSupportGraph(asset, ... ).chunkIndices - array. Every descendent of a support chunk will have its health initialized to its ancestor support - chunk's health, so this initializes all lower-support chunk healths. - If NULL, uniformInitialLowerSupportChunkHealth must be set. - */ - public Single[] initialSupportChunkHealths = null; -}; - - -public struct NvBlastChunk -{ - /** - Central position for the chunk's volume - */ - public Single c0; - public Single c1; - public Single c2; - - /** - Volume of the chunk - */ - public Single volume; - - /** - Index of parent (UINT32_MAX denotes no parent) - */ - public UInt32 parentChunkIndex; - - /** - Index of first child - */ - public UInt32 firstChildIndex; - - /** - Stop for child indices - */ - public UInt32 childIndexStop; - - /** - Field for user to associate with external data - */ - public UInt32 userData; -}; - -public struct NvBlastChunkGraph -{ - UInt32 nodeCount; - public IntPtr chunkIndices; - public IntPtr adjacencyPartition; - public IntPtr adjacentNodeIndices; - public IntPtr adjacentBondIndices; -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastTimers -{ - public Int64 material; //!< Time spent in material function - public Int64 fracture; //!< Time spent applying damage - public Int64 island; //!< Time spent discovering islands - public Int64 partition; //!< Time spent partitioning the graph - public Int64 visibility; //!< Time spent updating visibility -}; - - -/////////////////////////////////////////////////////////////////////////////// -// Types used for damage and fracturing -/////////////////////////////////////////////////////////////////////////////// - -public struct NvBlastChunkFractureData -{ - public UInt32 userdata; //!< chunk's user data - public UInt32 chunkIndex; //!< asset chunk index - public Single health; //!< health value (damage or remains) -}; - -public struct NvBlastBondFractureData -{ - public UInt32 userdata; //!< bond's user data - public UInt32 nodeIndex0; //!< graph node index of bond - public UInt32 nodeIndex1; //!< pair graph node index of bond - public Single health; //!< health value (damage or remains) -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastFractureBuffers -{ - public UInt32 bondFractureCount; - public UInt32 chunkFractureCount; - public IntPtr bondFractures; // NvBlastBondFractureData[] - public IntPtr chunkFractures; // NvBlastChunkFractureData[] -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastActorSplitEvent -{ - public IntPtr deletedActor; //!< deleted actor or nullptr if actor has not changed - public IntPtr newActors; //!< list of created actors -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastGraphShaderActor -{ - UInt32 firstGraphNodeIndex; //<! Entry index for graphNodeIndexLinks - public UInt32[] graphNodeIndexLinks; //<! Linked index list of connected nodes. Traversable with nextIndex = graphNodeIndexLinks[currentIndex], terminates with 0xFFFFFFFF. - public UInt32[] chunkIndices; //<! Graph's map from node index to support chunk index. - public UInt32[] adjacencyPartition; //<! See NvBlastChunkGraph::adjacencyPartition. - public UInt32[] adjacentNodeIndices; //<! See NvBlastChunkGraph::adjacentNodeIndices. - public UInt32[] adjacentBondIndices; //<! See NvBlastChunkGraph::adjacentBondIndices. - public NvBlastBond[] assetBonds; //<! NvBlastBonds geometry in the NvBlastAsset. - public Single[] familyBondHealths; //<! Actual bond health values for broken bond detection. -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastProgramParams -{ - public IntPtr damageDescBuffer; //!< array of damage descriptions - public UInt32 damageDescCount; //!< number of damage descriptions in array - public IntPtr material; //!< pointer to material -}; - -[StructLayout(LayoutKind.Sequential)] -public class NvBlastSubgraphShaderActor -{ - public UInt32 chunkIndex; //<! Index of chunk represented by this actor. - public NvBlastChunk[] assetChunks; //<! NvBlastChunks geometry in the NvBlastAsset. -}; - -public struct NvBlastDamageProgram -{ - public delegate void NvBlastGraphShaderFunction(System.IntPtr commandBuffers, System.IntPtr actor, System.IntPtr p); - public delegate void NvBlastSubgraphShaderFunction(NvBlastFractureBuffers commandBuffers, NvBlastSubgraphShaderActor actor, NvBlastProgramParams p); - - public NvBlastGraphShaderFunction graphShaderFunction; - public NvBlastSubgraphShaderFunction subgraphShaderFunction; -}; - - -public class NvBlastWrapper -{ - //////// DLL //////// - - public const string DLL_POSTFIX = "DEBUG"; //DEBUG - public const string DLL_PLATFORM = "x64"; - public const string DLL_NAME = "NvBlast" + DLL_POSTFIX + "_" + DLL_PLATFORM; - - - //////// Internal Types //////// - - public delegate IntPtr NvBlastAlloc(Int64 size); - public delegate void NvBlastFree(IntPtr ptr); - public delegate void NvBlastLog(Int32 type, string msg, string file, Int32 line); - - - //////// Public Types //////// - - - - //////// Helpers //////// - - public static IntPtr Alloc(Int64 size) - { - return Marshal.AllocHGlobal((Int32)size); - } - - public static void Free(IntPtr ptr) - { - Marshal.FreeHGlobal(ptr); - } - - public static void Log(Int32 type, string msg, string file, Int32 line) - { - Debug.Log(DLL_NAME + ": [" + type + "] " + msg + "(" + file + ":" + line + ")"); - } - - public static IntPtr GetScratch(int size) - { - return _greedyScratch.GetScratch(size); - } - - private static GreedyScratch _greedyScratch = new GreedyScratch(); -} - - -public class GreedyScratch : IDisposable -{ - public IntPtr GetScratch(int size) - { - if (_size < size) - { - releaseScratch(); - _scratch = Marshal.AllocHGlobal(size); - _size = size; - } - - return _scratch; - } - - private void releaseScratch() - { - if (_size > 0) - { - Marshal.FreeHGlobal(_scratch); - _scratch = IntPtr.Zero; - } - } - - public void Dispose() - { - Dispose(true); - } - - protected virtual void Dispose(bool bDisposing) - { - releaseScratch(); - - if (bDisposing) - { - GC.SuppressFinalize(this); - } - } - - ~GreedyScratch() - { - Dispose(false); - } - - private int _size = 0; - private IntPtr _scratch = IntPtr.Zero; -} - - -public abstract class DisposablePtr : IDisposable -{ - protected void Initialize(IntPtr ptr) - { - Assert.IsTrue(this._ptr == IntPtr.Zero); - this._ptr = ptr; - } - - protected void ResetPtr() - { - this._ptr = IntPtr.Zero; - } - - protected abstract void Release(); - - public IntPtr ptr - { - get { return _ptr; } - } - - - public void Dispose() - { - Dispose(true); - } - - protected virtual void Dispose(bool bDisposing) - { - if (_ptr != IntPtr.Zero) - { - Release(); - _ptr = IntPtr.Zero; - } - - if (bDisposing) - { - GC.SuppressFinalize(this); - } - } - - ~DisposablePtr() - { - Dispose(false); - } - - private IntPtr _ptr = IntPtr.Zero; -} - - -public class NvBlastAsset : DisposablePtr -{ - #region Dll - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt64 NvBlastAssetCreateRequiredScratch(NvBlastAssetDesc desc); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern IntPtr NvBlastAssetCreate(NvBlastAssetDesc desc, NvBlastWrapper.NvBlastAlloc allocFn, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern void NvBlastAssetRelease(IntPtr asset, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastAssetGetLeafChunkCount(IntPtr asset, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern NvBlastChunkGraph NvBlastAssetGetSupportGraph(IntPtr asset, NvBlastWrapper.NvBlastLog logFn); - #endregion - - public NvBlastAsset(NvBlastAssetDesc desc) - { - var scratchSize = NvBlastAssetCreateRequiredScratch(desc); - var asset = NvBlastAssetCreate(desc, NvBlastWrapper.Alloc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log); - Initialize(asset); - } - - protected override void Release() - { - NvBlastAssetRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log); - } - - public UInt32 leafChunkCount - { - get - { - return NvBlastAssetGetLeafChunkCount(ptr, NvBlastWrapper.Log); - } - } - - public NvBlastChunkGraph chunkGraph - { - get - { - if (!_graph.HasValue) - { - _graph = NvBlastAssetGetSupportGraph(ptr, NvBlastWrapper.Log); - } - return _graph.Value; - } - } - - private NvBlastChunkGraph? _graph = null; -} - - -public class NvBlastFamily : DisposablePtr -{ - #region Dll - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern IntPtr NvBlastFamilyCreate(IntPtr asset, NvBlastWrapper.NvBlastAlloc allocFn, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern void NvBlastFamilyRelease(IntPtr family, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn); - #endregion - - public NvBlastAsset asset - { - get; - private set; - } - - public NvBlastFamily(NvBlastAsset asset_) - { - asset = asset_; - var family = NvBlastFamilyCreate(asset.ptr, NvBlastWrapper.Alloc, NvBlastWrapper.Log); - Initialize(family); - } - - protected override void Release() - { - NvBlastFamilyRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log); - } -} - - -public class NvBlastActor : DisposablePtr -{ - #region Dll - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt64 NvBlastActorCreateRequiredScratch(IntPtr asset); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern IntPtr NvBlastActorCreate(IntPtr family, NvBlastActorDesc desc, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern void NvBlastActorRelease(IntPtr actor); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastActorGetVisibleChunkCount(IntPtr actor, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastActorGetVisibleChunkIndices([In, Out] UInt32[] visibleChunkIndices, UInt32 visibleChunkIndicesSize, IntPtr actor, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastActorGetGraphNodeCount(IntPtr actor, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastActorGetGraphNodeIndices([In, Out] UInt32[] graphNodeIndices, UInt32 graphNodeIndicesSize, IntPtr actor, NvBlastWrapper.NvBlastLog logFn); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern void NvBlastActorGenerateFracture(NvBlastFractureBuffers commandBuffers, IntPtr actor, NvBlastDamageProgram program, NvBlastProgramParams programParams, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern void NvBlastActorApplyFracture(IntPtr eventBuffers, IntPtr actor, NvBlastFractureBuffers commands, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt64 NvBlastActorSplitRequiredScratch(IntPtr actor); - - [DllImport(NvBlastWrapper.DLL_NAME)] - static extern UInt32 NvBlastActorSplit([In, Out] NvBlastActorSplitEvent result, UInt32 newActorsMaxCount, IntPtr actor, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers); - #endregion - - public NvBlastFamily family - { - get; - private set; - } - - public object userData = null; - - public NvBlastActor(NvBlastFamily family_, NvBlastActorDesc desc) - { - family = family_; - - var scratchSize = NvBlastActorCreateRequiredScratch(family_.asset.ptr); - var actor = NvBlastActorCreate(family.ptr, desc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log); - Initialize(actor); - } - - public NvBlastActor(NvBlastFamily family_, IntPtr ptr) - { - family = family_; - - Initialize(ptr); - } - - protected override void Release() - { - NvBlastActorRelease(ptr); - } - - public UInt32 visibleChunkCount - { - get { return NvBlastActorGetVisibleChunkCount(ptr, NvBlastWrapper.Log); } - } - - public UInt32[] visibleChunkIndices - { - get - { - if(_visibleChunkIndices == null) - { - _visibleChunkIndices = new UInt32[visibleChunkCount]; - NvBlastActorGetVisibleChunkIndices(_visibleChunkIndices, visibleChunkCount, ptr, NvBlastWrapper.Log); - } - return _visibleChunkIndices; - } - } - - public UInt32 graphNodeCount - { - get { return NvBlastActorGetGraphNodeCount(ptr, NvBlastWrapper.Log); } - } - - public UInt32[] graphNodeIndices - { - get - { - if (_graphNodeIndices == null) - { - _graphNodeIndices = new UInt32[graphNodeCount]; - NvBlastActorGetGraphNodeIndices(_graphNodeIndices, graphNodeCount, ptr, NvBlastWrapper.Log); - } - return _graphNodeIndices; - } - } - - public void GenerateFracture(NvBlastFractureBuffers buffers, NvBlastDamageProgram program, NvBlastProgramParams programParams) - { - NvBlastActorGenerateFracture(buffers, ptr, program, programParams, NvBlastWrapper.Log, null); - } - - public void ApplyFracture(NvBlastFractureBuffers commands) - { - NvBlastActorApplyFracture(IntPtr.Zero, ptr, commands, NvBlastWrapper.Log, null); - } - - public UInt32 Split(NvBlastActorSplitEvent result, UInt32 newActorsMaxCount) - { - var scratchSize = NvBlastActorSplitRequiredScratch(ptr); - UInt32 newActorsCount = NvBlastActorSplit(result, newActorsMaxCount, ptr, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log, null); - if(result.deletedActor != IntPtr.Zero) - { - ResetPtr(); - } - return newActorsCount; - } - - private UInt32[] _visibleChunkIndices = null; - private UInt32[] _graphNodeIndices = null; -} - +using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using UnityEngine;
+using UnityEngine.Assertions;
+
+public struct NvBlastChunkDesc
+{
+ public enum Flags
+ {
+ NoFlags = 0,
+ SupportFlag = (1 << 0)
+ };
+
+ /** Central position in chunk. */
+ public Single c0;
+ public Single c1;
+ public Single c2;
+
+
+ /** Volume of chunk. */
+ public Single volume;
+
+ /** Index of this chunk's parent. If this is a root chunk, then this value must be UINT32_MAX. */
+ public UInt32 parentChunkIndex;
+
+ /** See Flags enum for possible flags. */
+ public UInt32 flags;
+
+ /** User-supplied data which will be accessible to the user in chunk fracture events. */
+ public UInt32 userData;
+}
+
+public struct NvBlastBond
+{
+ public Single n0;
+ public Single n1;
+ public Single n2;
+
+ public Single area;
+
+ public Single c0;
+ public Single c1;
+ public Single c2;
+
+ UInt32 userData;
+};
+
+public struct NvBlastBondDesc
+{
+ /** The indices of the chunks linked by this bond. They must be different support chunk indices. */
+ public UInt32 chunk0;
+ public UInt32 chunk1;
+
+ /** Bond data (see NvBlastBond). */
+ public NvBlastBond bond;
+}
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastAssetDesc
+{
+ public UInt32 chunkCount;
+ public NvBlastChunkDesc[] chunkDescs;
+ public UInt32 bondCount;
+ public NvBlastBondDesc[] bondDescs;
+}
+
+/**
+Actor descriptor, used to create an instance of an NvBlastAsset with NvBlastActorCreate
+ 6
+See NvBlastActorCreate.
+*/
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastActorDesc
+{
+ /**
+ Initial health of all bonds, if initialBondHealths is NULL (see initialBondHealths).
+ */
+ public Single uniformInitialBondHealth;
+
+ /**
+ Initial bond healths. If not NULL, this array must be of length NvBlastAssetGetChunkCount(asset, ... ).
+ If NULL, uniformInitialBondHealth must be set.
+ */
+ public Single[] initialBondHealths = null;
+
+ /**
+ Initial health of all lower-support chunks, if initialSupportChunkHealths is NULL (see initialSupportChunkHealths).
+ */
+ public Single uniformInitialLowerSupportChunkHealth;
+
+ /**
+ Initial health of all support chunks. If not NULL, this must be of length
+ NvBlastAssetGetSupportGraph(asset, ... ).nodeCount. The elements in the initialSupportChunkHealth
+ array will correspond to the chunk indices in the NvBlastAssetGetSupportGraph(asset, ... ).chunkIndices
+ array. Every descendent of a support chunk will have its health initialized to its ancestor support
+ chunk's health, so this initializes all lower-support chunk healths.
+ If NULL, uniformInitialLowerSupportChunkHealth must be set.
+ */
+ public Single[] initialSupportChunkHealths = null;
+};
+
+
+public struct NvBlastChunk
+{
+ /**
+ Central position for the chunk's volume
+ */
+ public Single c0;
+ public Single c1;
+ public Single c2;
+
+ /**
+ Volume of the chunk
+ */
+ public Single volume;
+
+ /**
+ Index of parent (UINT32_MAX denotes no parent)
+ */
+ public UInt32 parentChunkIndex;
+
+ /**
+ Index of first child
+ */
+ public UInt32 firstChildIndex;
+
+ /**
+ Stop for child indices
+ */
+ public UInt32 childIndexStop;
+
+ /**
+ Field for user to associate with external data
+ */
+ public UInt32 userData;
+};
+
+public struct NvBlastChunkGraph
+{
+ UInt32 nodeCount;
+ public IntPtr chunkIndices;
+ public IntPtr adjacencyPartition;
+ public IntPtr adjacentNodeIndices;
+ public IntPtr adjacentBondIndices;
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastTimers
+{
+ public Int64 material; //!< Time spent in material function
+ public Int64 fracture; //!< Time spent applying damage
+ public Int64 island; //!< Time spent discovering islands
+ public Int64 partition; //!< Time spent partitioning the graph
+ public Int64 visibility; //!< Time spent updating visibility
+};
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Types used for damage and fracturing
+///////////////////////////////////////////////////////////////////////////////
+
+public struct NvBlastChunkFractureData
+{
+ public UInt32 userdata; //!< chunk's user data
+ public UInt32 chunkIndex; //!< asset chunk index
+ public Single health; //!< health value (damage or remains)
+};
+
+public struct NvBlastBondFractureData
+{
+ public UInt32 userdata; //!< bond's user data
+ public UInt32 nodeIndex0; //!< graph node index of bond
+ public UInt32 nodeIndex1; //!< pair graph node index of bond
+ public Single health; //!< health value (damage or remains)
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastFractureBuffers
+{
+ public UInt32 bondFractureCount;
+ public UInt32 chunkFractureCount;
+ public IntPtr bondFractures; // NvBlastBondFractureData[]
+ public IntPtr chunkFractures; // NvBlastChunkFractureData[]
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastActorSplitEvent
+{
+ public IntPtr deletedActor; //!< deleted actor or nullptr if actor has not changed
+ public IntPtr newActors; //!< list of created actors
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastGraphShaderActor
+{
+ UInt32 firstGraphNodeIndex; //<! Entry index for graphNodeIndexLinks
+ public UInt32[] graphNodeIndexLinks; //<! Linked index list of connected nodes. Traversable with nextIndex = graphNodeIndexLinks[currentIndex], terminates with 0xFFFFFFFF.
+ public UInt32[] chunkIndices; //<! Graph's map from node index to support chunk index.
+ public UInt32[] adjacencyPartition; //<! See NvBlastChunkGraph::adjacencyPartition.
+ public UInt32[] adjacentNodeIndices; //<! See NvBlastChunkGraph::adjacentNodeIndices.
+ public UInt32[] adjacentBondIndices; //<! See NvBlastChunkGraph::adjacentBondIndices.
+ public NvBlastBond[] assetBonds; //<! NvBlastBonds geometry in the NvBlastAsset.
+ public Single[] familyBondHealths; //<! Actual bond health values for broken bond detection.
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastProgramParams
+{
+ public IntPtr damageDescBuffer; //!< array of damage descriptions
+ public UInt32 damageDescCount; //!< number of damage descriptions in array
+ public IntPtr material; //!< pointer to material
+};
+
+[StructLayout(LayoutKind.Sequential)]
+public class NvBlastSubgraphShaderActor
+{
+ public UInt32 chunkIndex; //<! Index of chunk represented by this actor.
+ public NvBlastChunk[] assetChunks; //<! NvBlastChunks geometry in the NvBlastAsset.
+};
+
+public struct NvBlastDamageProgram
+{
+ public delegate void NvBlastGraphShaderFunction(System.IntPtr commandBuffers, System.IntPtr actor, System.IntPtr p);
+ public delegate void NvBlastSubgraphShaderFunction(NvBlastFractureBuffers commandBuffers, NvBlastSubgraphShaderActor actor, NvBlastProgramParams p);
+
+ public NvBlastGraphShaderFunction graphShaderFunction;
+ public NvBlastSubgraphShaderFunction subgraphShaderFunction;
+};
+
+
+public class NvBlastWrapper
+{
+ //////// DLL ////////
+
+ public const string DLL_POSTFIX = "DEBUG"; //DEBUG
+ public const string DLL_PLATFORM = "x64";
+ public const string DLL_NAME = "NvBlast" + DLL_POSTFIX + "_" + DLL_PLATFORM;
+
+
+ //////// Internal Types ////////
+
+ public delegate IntPtr NvBlastAlloc(Int64 size);
+ public delegate void NvBlastFree(IntPtr ptr);
+ public delegate void NvBlastLog(Int32 type, string msg, string file, Int32 line);
+
+
+ //////// Public Types ////////
+
+
+
+ //////// Helpers ////////
+
+ public static IntPtr Alloc(Int64 size)
+ {
+ return Marshal.AllocHGlobal((Int32)size);
+ }
+
+ public static void Free(IntPtr ptr)
+ {
+ Marshal.FreeHGlobal(ptr);
+ }
+
+ public static void Log(Int32 type, string msg, string file, Int32 line)
+ {
+ Debug.Log(DLL_NAME + ": [" + type + "] " + msg + "(" + file + ":" + line + ")");
+ }
+
+ public static IntPtr GetScratch(int size)
+ {
+ return _greedyScratch.GetScratch(size);
+ }
+
+ private static GreedyScratch _greedyScratch = new GreedyScratch();
+}
+
+
+public class GreedyScratch : IDisposable
+{
+ public IntPtr GetScratch(int size)
+ {
+ if (_size < size)
+ {
+ releaseScratch();
+ _scratch = Marshal.AllocHGlobal(size);
+ _size = size;
+ }
+
+ return _scratch;
+ }
+
+ private void releaseScratch()
+ {
+ if (_size > 0)
+ {
+ Marshal.FreeHGlobal(_scratch);
+ _scratch = IntPtr.Zero;
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose(bool bDisposing)
+ {
+ releaseScratch();
+
+ if (bDisposing)
+ {
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ ~GreedyScratch()
+ {
+ Dispose(false);
+ }
+
+ private int _size = 0;
+ private IntPtr _scratch = IntPtr.Zero;
+}
+
+
+public abstract class DisposablePtr : IDisposable
+{
+ protected void Initialize(IntPtr ptr)
+ {
+ Assert.IsTrue(this._ptr == IntPtr.Zero);
+ this._ptr = ptr;
+ }
+
+ protected void ResetPtr()
+ {
+ this._ptr = IntPtr.Zero;
+ }
+
+ protected abstract void Release();
+
+ public IntPtr ptr
+ {
+ get { return _ptr; }
+ }
+
+
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+
+ protected virtual void Dispose(bool bDisposing)
+ {
+ if (_ptr != IntPtr.Zero)
+ {
+ Release();
+ _ptr = IntPtr.Zero;
+ }
+
+ if (bDisposing)
+ {
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ ~DisposablePtr()
+ {
+ Dispose(false);
+ }
+
+ private IntPtr _ptr = IntPtr.Zero;
+}
+
+
+public class NvBlastAsset : DisposablePtr
+{
+ #region Dll
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt64 NvBlastAssetCreateRequiredScratch(NvBlastAssetDesc desc);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern IntPtr NvBlastAssetCreate(NvBlastAssetDesc desc, NvBlastWrapper.NvBlastAlloc allocFn, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern void NvBlastAssetRelease(IntPtr asset, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastAssetGetLeafChunkCount(IntPtr asset, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern NvBlastChunkGraph NvBlastAssetGetSupportGraph(IntPtr asset, NvBlastWrapper.NvBlastLog logFn);
+ #endregion
+
+ public NvBlastAsset(NvBlastAssetDesc desc)
+ {
+ var scratchSize = NvBlastAssetCreateRequiredScratch(desc);
+ var asset = NvBlastAssetCreate(desc, NvBlastWrapper.Alloc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log);
+ Initialize(asset);
+ }
+
+ protected override void Release()
+ {
+ NvBlastAssetRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log);
+ }
+
+ public UInt32 leafChunkCount
+ {
+ get
+ {
+ return NvBlastAssetGetLeafChunkCount(ptr, NvBlastWrapper.Log);
+ }
+ }
+
+ public NvBlastChunkGraph chunkGraph
+ {
+ get
+ {
+ if (!_graph.HasValue)
+ {
+ _graph = NvBlastAssetGetSupportGraph(ptr, NvBlastWrapper.Log);
+ }
+ return _graph.Value;
+ }
+ }
+
+ private NvBlastChunkGraph? _graph = null;
+}
+
+
+public class NvBlastFamily : DisposablePtr
+{
+ #region Dll
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern IntPtr NvBlastFamilyCreate(IntPtr asset, NvBlastWrapper.NvBlastAlloc allocFn, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern void NvBlastFamilyRelease(IntPtr family, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn);
+ #endregion
+
+ public NvBlastAsset asset
+ {
+ get;
+ private set;
+ }
+
+ public NvBlastFamily(NvBlastAsset asset_)
+ {
+ asset = asset_;
+ var family = NvBlastFamilyCreate(asset.ptr, NvBlastWrapper.Alloc, NvBlastWrapper.Log);
+ Initialize(family);
+ }
+
+ protected override void Release()
+ {
+ NvBlastFamilyRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log);
+ }
+}
+
+
+public class NvBlastActor : DisposablePtr
+{
+ #region Dll
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt64 NvBlastActorCreateRequiredScratch(IntPtr asset);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern IntPtr NvBlastActorCreate(IntPtr family, NvBlastActorDesc desc, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern void NvBlastActorRelease(IntPtr actor);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastActorGetVisibleChunkCount(IntPtr actor, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastActorGetVisibleChunkIndices([In, Out] UInt32[] visibleChunkIndices, UInt32 visibleChunkIndicesSize, IntPtr actor, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastActorGetGraphNodeCount(IntPtr actor, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastActorGetGraphNodeIndices([In, Out] UInt32[] graphNodeIndices, UInt32 graphNodeIndicesSize, IntPtr actor, NvBlastWrapper.NvBlastLog logFn);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern void NvBlastActorGenerateFracture(NvBlastFractureBuffers commandBuffers, IntPtr actor, NvBlastDamageProgram program, NvBlastProgramParams programParams, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern void NvBlastActorApplyFracture(IntPtr eventBuffers, IntPtr actor, NvBlastFractureBuffers commands, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt64 NvBlastActorSplitRequiredScratch(IntPtr actor);
+
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt32 NvBlastActorSplit([In, Out] NvBlastActorSplitEvent result, UInt32 newActorsMaxCount, IntPtr actor, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
+ #endregion
+
+ public NvBlastFamily family
+ {
+ get;
+ private set;
+ }
+
+ public object userData = null;
+
+ public NvBlastActor(NvBlastFamily family_, NvBlastActorDesc desc)
+ {
+ family = family_;
+
+ var scratchSize = NvBlastActorCreateRequiredScratch(family_.asset.ptr);
+ var actor = NvBlastActorCreate(family.ptr, desc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log);
+ Initialize(actor);
+ }
+
+ public NvBlastActor(NvBlastFamily family_, IntPtr ptr)
+ {
+ family = family_;
+
+ Initialize(ptr);
+ }
+
+ protected override void Release()
+ {
+ NvBlastActorRelease(ptr);
+ }
+
+ public UInt32 visibleChunkCount
+ {
+ get { return NvBlastActorGetVisibleChunkCount(ptr, NvBlastWrapper.Log); }
+ }
+
+ public UInt32[] visibleChunkIndices
+ {
+ get
+ {
+ if(_visibleChunkIndices == null)
+ {
+ _visibleChunkIndices = new UInt32[visibleChunkCount];
+ NvBlastActorGetVisibleChunkIndices(_visibleChunkIndices, visibleChunkCount, ptr, NvBlastWrapper.Log);
+ }
+ return _visibleChunkIndices;
+ }
+ }
+
+ public UInt32 graphNodeCount
+ {
+ get { return NvBlastActorGetGraphNodeCount(ptr, NvBlastWrapper.Log); }
+ }
+
+ public UInt32[] graphNodeIndices
+ {
+ get
+ {
+ if (_graphNodeIndices == null)
+ {
+ _graphNodeIndices = new UInt32[graphNodeCount];
+ NvBlastActorGetGraphNodeIndices(_graphNodeIndices, graphNodeCount, ptr, NvBlastWrapper.Log);
+ }
+ return _graphNodeIndices;
+ }
+ }
+
+ public void GenerateFracture(NvBlastFractureBuffers buffers, NvBlastDamageProgram program, NvBlastProgramParams programParams)
+ {
+ NvBlastActorGenerateFracture(buffers, ptr, program, programParams, NvBlastWrapper.Log, null);
+ }
+
+ public void ApplyFracture(NvBlastFractureBuffers commands)
+ {
+ NvBlastActorApplyFracture(IntPtr.Zero, ptr, commands, NvBlastWrapper.Log, null);
+ }
+
+ public UInt32 Split(NvBlastActorSplitEvent result, UInt32 newActorsMaxCount)
+ {
+ var scratchSize = NvBlastActorSplitRequiredScratch(ptr);
+ UInt32 newActorsCount = NvBlastActorSplit(result, newActorsMaxCount, ptr, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log, null);
+ if(result.deletedActor != IntPtr.Zero)
+ {
+ ResetPtr();
+ }
+ return newActorsCount;
+ }
+
+ private UInt32[] _visibleChunkIndices = null;
+ private UInt32[] _graphNodeIndices = null;
+}
+
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs.meta b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs.meta index 6cb40de..6a5ccd6 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 50e876cfa58ea5a46935955772ce78d6 -timeCreated: 1481552179 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 50e876cfa58ea5a46935955772ce78d6
+timeCreated: 1481552179
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64.meta b/examples/UnityExample/Assets/Plugins/Blast/x64.meta index 1d8c5b7..051c1a6 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/x64.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: 7efc8ea30a371b14b9de21b07f5666b1 -folderAsset: yes -timeCreated: 1481552179 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 7efc8ea30a371b14b9de21b07f5666b1
+folderAsset: yes
+timeCreated: 1481552179
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll Binary files differindex 323acb4..323acb4 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll.meta index 3b289f8..8388fbf 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastDEBUG_x64.dll.meta @@ -1,68 +1,68 @@ -fileFormatVersion: 2 -guid: 5fc0a2604d2987b4680e41464be1c22e -timeCreated: 1482762574 -licenseType: Free -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - Any: - enabled: 1 - settings: - Exclude Editor: 0 - Exclude Linux: 0 - Exclude Linux64: 0 - Exclude LinuxUniversal: 0 - Exclude OSXIntel: 0 - Exclude OSXIntel64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 0 - Exclude Win: 1 - Exclude Win64: 0 - Editor: - enabled: 1 - settings: - CPU: x86_64 - DefaultValueInitialized: true - OS: AnyOS - Linux: - enabled: 1 - settings: - CPU: None - Linux64: - enabled: 1 - settings: - CPU: x86_64 - LinuxUniversal: - enabled: 1 - settings: - CPU: AnyCPU - OSXIntel: - enabled: 1 - settings: - CPU: None - OSXIntel64: - enabled: 1 - settings: - CPU: AnyCPU - OSXUniversal: - enabled: 1 - settings: - CPU: AnyCPU - WebGL: - enabled: 1 - settings: {} - Win: - enabled: 0 - settings: - CPU: None - Win64: - enabled: 1 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 5fc0a2604d2987b4680e41464be1c22e
+timeCreated: 1482762574
+licenseType: Free
+PluginImporter:
+ serializedVersion: 1
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ Any:
+ enabled: 1
+ settings:
+ Exclude Editor: 0
+ Exclude Linux: 0
+ Exclude Linux64: 0
+ Exclude LinuxUniversal: 0
+ Exclude OSXIntel: 0
+ Exclude OSXIntel64: 0
+ Exclude OSXUniversal: 0
+ Exclude WebGL: 0
+ Exclude Win: 1
+ Exclude Win64: 0
+ Editor:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ DefaultValueInitialized: true
+ OS: AnyOS
+ Linux:
+ enabled: 1
+ settings:
+ CPU: None
+ Linux64:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ LinuxUniversal:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXIntel:
+ enabled: 1
+ settings:
+ CPU: None
+ OSXIntel64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXUniversal:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ WebGL:
+ enabled: 1
+ settings: {}
+ Win:
+ enabled: 0
+ settings:
+ CPU: None
+ Win64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll Binary files differindex 9000d94..9000d94 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta index fd62927..cda3e53 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta @@ -1,54 +1,54 @@ -fileFormatVersion: 2 -guid: 819acd10daddc114cb79447732a44ff3 -timeCreated: 1482926953 -licenseType: Free -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - Any: - enabled: 1 - settings: {} - Editor: - enabled: 0 - settings: - CPU: x86_64 - DefaultValueInitialized: true - Linux: - enabled: 0 - settings: - CPU: None - Linux64: - enabled: 1 - settings: - CPU: x86_64 - LinuxUniversal: - enabled: 1 - settings: - CPU: x86_64 - OSXIntel: - enabled: 0 - settings: - CPU: None - OSXIntel64: - enabled: 1 - settings: - CPU: AnyCPU - OSXUniversal: - enabled: 0 - settings: - CPU: x86_64 - Win: - enabled: 0 - settings: - CPU: None - Win64: - enabled: 1 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 819acd10daddc114cb79447732a44ff3
+timeCreated: 1482926953
+licenseType: Free
+PluginImporter:
+ serializedVersion: 1
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ Any:
+ enabled: 1
+ settings: {}
+ Editor:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ DefaultValueInitialized: true
+ Linux:
+ enabled: 0
+ settings:
+ CPU: None
+ Linux64:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ LinuxUniversal:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ OSXIntel:
+ enabled: 0
+ settings:
+ CPU: None
+ OSXIntel64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXUniversal:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ Win:
+ enabled: 0
+ settings:
+ CPU: None
+ Win64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll Binary files differindex 401cd04..401cd04 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll.meta index e35fbdc..560b07a 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShadersDEBUG_x64.dll.meta @@ -1,68 +1,68 @@ -fileFormatVersion: 2 -guid: 52823d20a4352e84d84af3b61814dc42 -timeCreated: 1482762574 -licenseType: Free -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - Any: - enabled: 1 - settings: - Exclude Editor: 0 - Exclude Linux: 0 - Exclude Linux64: 0 - Exclude LinuxUniversal: 0 - Exclude OSXIntel: 0 - Exclude OSXIntel64: 0 - Exclude OSXUniversal: 0 - Exclude WebGL: 0 - Exclude Win: 1 - Exclude Win64: 0 - Editor: - enabled: 1 - settings: - CPU: x86_64 - DefaultValueInitialized: true - OS: AnyOS - Linux: - enabled: 1 - settings: - CPU: None - Linux64: - enabled: 1 - settings: - CPU: x86_64 - LinuxUniversal: - enabled: 1 - settings: - CPU: AnyCPU - OSXIntel: - enabled: 1 - settings: - CPU: None - OSXIntel64: - enabled: 1 - settings: - CPU: AnyCPU - OSXUniversal: - enabled: 1 - settings: - CPU: AnyCPU - WebGL: - enabled: 1 - settings: {} - Win: - enabled: 0 - settings: - CPU: None - Win64: - enabled: 1 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 52823d20a4352e84d84af3b61814dc42
+timeCreated: 1482762574
+licenseType: Free
+PluginImporter:
+ serializedVersion: 1
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ Any:
+ enabled: 1
+ settings:
+ Exclude Editor: 0
+ Exclude Linux: 0
+ Exclude Linux64: 0
+ Exclude LinuxUniversal: 0
+ Exclude OSXIntel: 0
+ Exclude OSXIntel64: 0
+ Exclude OSXUniversal: 0
+ Exclude WebGL: 0
+ Exclude Win: 1
+ Exclude Win64: 0
+ Editor:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ DefaultValueInitialized: true
+ OS: AnyOS
+ Linux:
+ enabled: 1
+ settings:
+ CPU: None
+ Linux64:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ LinuxUniversal:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXIntel:
+ enabled: 1
+ settings:
+ CPU: None
+ OSXIntel64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXUniversal:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ WebGL:
+ enabled: 1
+ settings: {}
+ Win:
+ enabled: 0
+ settings:
+ CPU: None
+ Win64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll Binary files differindex b24c4fa..b24c4fa 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta index 4423045..ccb6a94 100644..100755 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta @@ -1,54 +1,54 @@ -fileFormatVersion: 2 -guid: 26135af3d3f04804dbaebd13245d00ce -timeCreated: 1482926953 -licenseType: Free -PluginImporter: - serializedVersion: 1 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - Any: - enabled: 1 - settings: {} - Editor: - enabled: 0 - settings: - CPU: x86_64 - DefaultValueInitialized: true - Linux: - enabled: 0 - settings: - CPU: None - Linux64: - enabled: 1 - settings: - CPU: x86_64 - LinuxUniversal: - enabled: 1 - settings: - CPU: x86_64 - OSXIntel: - enabled: 0 - settings: - CPU: None - OSXIntel64: - enabled: 1 - settings: - CPU: AnyCPU - OSXUniversal: - enabled: 0 - settings: - CPU: x86_64 - Win: - enabled: 0 - settings: - CPU: None - Win64: - enabled: 1 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 26135af3d3f04804dbaebd13245d00ce
+timeCreated: 1482926953
+licenseType: Free
+PluginImporter:
+ serializedVersion: 1
+ iconMap: {}
+ executionOrder: {}
+ isPreloaded: 0
+ isOverridable: 0
+ platformData:
+ Any:
+ enabled: 1
+ settings: {}
+ Editor:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ DefaultValueInitialized: true
+ Linux:
+ enabled: 0
+ settings:
+ CPU: None
+ Linux64:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ LinuxUniversal:
+ enabled: 1
+ settings:
+ CPU: x86_64
+ OSXIntel:
+ enabled: 0
+ settings:
+ CPU: None
+ OSXIntel64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ OSXUniversal:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ Win:
+ enabled: 0
+ settings:
+ CPU: None
+ Win64:
+ enabled: 1
+ settings:
+ CPU: AnyCPU
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Resources.meta b/examples/UnityExample/Assets/Resources.meta index 4f939db..cb660be 100644..100755 --- a/examples/UnityExample/Assets/Resources.meta +++ b/examples/UnityExample/Assets/Resources.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: 71f2224643a5f3d4fa31d3d53571d22d -folderAsset: yes -timeCreated: 1481710917 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 71f2224643a5f3d4fa31d3d53571d22d
+folderAsset: yes
+timeCreated: 1481710917
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Resources/CubePrefab.prefab b/examples/UnityExample/Assets/Resources/CubePrefab.prefab index e7e13c1..9118d8e 100644..100755 --- a/examples/UnityExample/Assets/Resources/CubePrefab.prefab +++ b/examples/UnityExample/Assets/Resources/CubePrefab.prefab @@ -1,94 +1,94 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !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: 1794769123409596} - m_IsPrefabParent: 1 ---- !u!1 &1794769123409596 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - serializedVersion: 5 - m_Component: - - component: {fileID: 4401640667841860} - - component: {fileID: 33951265812587310} - - component: {fileID: 65730351288524680} - - component: {fileID: 23414374623188592} - m_Layer: 0 - m_Name: CubePrefab - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &4401640667841860 -Transform: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1794769123409596} - 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 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!23 &23414374623188592 -MeshRenderer: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1794769123409596} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_Materials: - - {fileID: 2100000, guid: 737d44acaf66b744197a3bf85c73a150, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &33951265812587310 -MeshFilter: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1794769123409596} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!65 &65730351288524680 -BoxCollider: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1794769123409596} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} +%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !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: 1794769123409596}
+ m_IsPrefabParent: 1
+--- !u!1 &1794769123409596
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 4401640667841860}
+ - component: {fileID: 33951265812587310}
+ - component: {fileID: 65730351288524680}
+ - component: {fileID: 23414374623188592}
+ m_Layer: 0
+ m_Name: CubePrefab
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &4401640667841860
+Transform:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1794769123409596}
+ 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
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!23 &23414374623188592
+MeshRenderer:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1794769123409596}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 737d44acaf66b744197a3bf85c73a150, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+--- !u!33 &33951265812587310
+MeshFilter:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1794769123409596}
+ m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!65 &65730351288524680
+BoxCollider:
+ m_ObjectHideFlags: 1
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 100100000}
+ m_GameObject: {fileID: 1794769123409596}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
diff --git a/examples/UnityExample/Assets/Resources/CubePrefab.prefab.meta b/examples/UnityExample/Assets/Resources/CubePrefab.prefab.meta index 0c1036b..73ec792 100644..100755 --- a/examples/UnityExample/Assets/Resources/CubePrefab.prefab.meta +++ b/examples/UnityExample/Assets/Resources/CubePrefab.prefab.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 94b4444853fb8ab48bbf65be8101f9ec -timeCreated: 1481710929 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 94b4444853fb8ab48bbf65be8101f9ec
+timeCreated: 1481710929
+licenseType: Free
+NativeFormatImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scenes.meta b/examples/UnityExample/Assets/Scenes.meta index deb5063..3bc6ecf 100644..100755 --- a/examples/UnityExample/Assets/Scenes.meta +++ b/examples/UnityExample/Assets/Scenes.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: cf46863e64ac2db4994ac4df55ad7bde -folderAsset: yes -timeCreated: 1481021055 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: cf46863e64ac2db4994ac4df55ad7bde
+folderAsset: yes
+timeCreated: 1481021055
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scenes/Test.unity b/examples/UnityExample/Assets/Scenes/Test.unity index 7091f7c..5fbb3fc 100644..100755 --- a/examples/UnityExample/Assets/Scenes/Test.unity +++ b/examples/UnityExample/Assets/Scenes/Test.unity @@ -1,452 +1,452 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!29 &1 -OcclusionCullingSettings: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_OcclusionBakeSettings: - smallestOccluder: 5 - smallestHole: 0.25 - backfaceThreshold: 100 - m_SceneGUID: 00000000000000000000000000000000 - m_OcclusionCullingData: {fileID: 0} ---- !u!104 &2 -RenderSettings: - m_ObjectHideFlags: 0 - serializedVersion: 7 - m_Fog: 0 - m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} - m_FogMode: 3 - m_FogDensity: 0.01 - m_LinearFogStart: 0 - m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} - m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} - m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 1 - m_AmbientMode: 0 - m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} - m_HaloStrength: 0.5 - m_FlareStrength: 1 - m_FlareFadeSpeed: 3 - m_HaloTexture: {fileID: 0} - m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} - m_DefaultReflectionMode: 0 - m_DefaultReflectionResolution: 128 - m_ReflectionBounces: 1 - m_ReflectionIntensity: 1 - m_CustomReflection: {fileID: 0} - m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} ---- !u!157 &3 -LightmapSettings: - m_ObjectHideFlags: 0 - serializedVersion: 7 - m_GIWorkflowMode: 0 - m_GISettings: - serializedVersion: 2 - m_BounceScale: 1 - m_IndirectOutputScale: 1 - m_AlbedoBoost: 1 - m_TemporalCoherenceThreshold: 1 - m_EnvironmentLightingMode: 0 - m_EnableBakedLightmaps: 1 - m_EnableRealtimeLightmaps: 1 - m_LightmapEditorSettings: - serializedVersion: 4 - m_Resolution: 2 - m_BakeResolution: 40 - m_TextureWidth: 1024 - m_TextureHeight: 1024 - m_AO: 0 - m_AOMaxDistance: 1 - m_CompAOExponent: 1 - m_CompAOExponentDirect: 0 - m_Padding: 2 - m_LightmapParameters: {fileID: 0} - m_LightmapsBakeMode: 1 - m_TextureCompression: 1 - m_DirectLightInLightProbes: 1 - m_FinalGather: 0 - m_FinalGatherFiltering: 1 - m_FinalGatherRayCount: 256 - m_ReflectionCompression: 2 - m_LightingDataAsset: {fileID: 0} - m_RuntimeCPUUsage: 25 ---- !u!196 &4 -NavMeshSettings: - serializedVersion: 2 - m_ObjectHideFlags: 0 - m_BuildSettings: - serializedVersion: 2 - agentTypeID: 0 - agentRadius: 0.5 - agentHeight: 2 - agentSlope: 45 - agentClimb: 0.4 - ledgeDropHeight: 0 - maxJumpAcrossDistance: 0 - minRegionArea: 2 - manualCellSize: 0 - cellSize: 0.16666667 - accuratePlacement: 0 - m_NavMeshData: {fileID: 0} ---- !u!1 &1097545995 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1097545997} - - component: {fileID: 1097545996} - m_Layer: 0 - m_Name: Directional Light - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!108 &1097545996 -Light: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1097545995} - m_Enabled: 1 - serializedVersion: 7 - m_Type: 1 - m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} - m_Intensity: 1 - m_Range: 10 - m_SpotAngle: 30 - m_CookieSize: 10 - m_Shadows: - m_Type: 2 - m_Resolution: -1 - m_CustomResolution: -1 - m_Strength: 1 - m_Bias: 0.05 - m_NormalBias: 0.4 - m_NearPlane: 0.2 - m_Cookie: {fileID: 0} - m_DrawHalo: 0 - m_Flare: {fileID: 0} - m_RenderMode: 0 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_Lightmapping: 4 - m_AreaSize: {x: 1, y: 1} - m_BounceIntensity: 1 - m_ShadowRadius: 0 - m_ShadowAngle: 0 ---- !u!4 &1097545997 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1097545995} - m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} - m_LocalPosition: {x: 0, y: 3, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &1231262489 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1231262494} - - component: {fileID: 1231262493} - - component: {fileID: 1231262492} - - component: {fileID: 1231262491} - - component: {fileID: 1231262490} - - component: {fileID: 1231262495} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &1231262490 -AudioListener: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_Enabled: 1 ---- !u!124 &1231262491 -Behaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_Enabled: 1 ---- !u!92 &1231262492 -Behaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_Enabled: 1 ---- !u!20 &1231262493 -Camera: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 - m_StereoMirrorMode: 0 ---- !u!4 &1231262494 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_LocalRotation: {x: 0.26193652, y: 0, z: 0, w: 0.96508515} - m_LocalPosition: {x: 0, y: 180, z: -455} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 30.37, y: 0, z: 0} ---- !u!114 &1231262495 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1231262489} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 29f022fb3768b8c4196631a9526aebcc, type: 3} - m_Name: - m_EditorClassIdentifier: - cameraSensitivity: 180 - climbSpeed: 40 - normalMoveSpeed: 100 - slowMoveFactor: 0.25 - fastMoveFactor: 3 ---- !u!1 &1755768756 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1755768758} - - component: {fileID: 1755768757} - m_Layer: 0 - m_Name: Demo - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1755768757 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1755768756} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7a62789bffb0bef4e9757f9848620e3f, type: 3} - m_Name: - m_EditorClassIdentifier: - hitSphere: {fileID: 1828855647} ---- !u!4 &1755768758 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1755768756} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 22.74558, y: 0.29925728, z: 67.52241} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1828855647 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1828855651} - - component: {fileID: 1828855650} - - component: {fileID: 1828855648} - m_Layer: 0 - m_Name: HitSphere - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!23 &1828855648 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1828855647} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_Materials: - - {fileID: 2100000, guid: 680819e140a18024bba58e6fdc3651d2, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!33 &1828855650 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1828855647} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &1828855651 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1828855647} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 1.4304204, y: 4.4981146, z: -0.2158227} - m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2120916518 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 2120916522} - - component: {fileID: 2120916521} - - component: {fileID: 2120916520} - - component: {fileID: 2120916519} - m_Layer: 0 - m_Name: Plane - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 4294967295 - m_IsActive: 1 ---- !u!23 &2120916519 -MeshRenderer: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2120916518} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 1 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingOrder: 0 ---- !u!64 &2120916520 -MeshCollider: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2120916518} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Convex: 0 - m_InflateMesh: 0 - m_SkinWidth: 0.01 - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!33 &2120916521 -MeshFilter: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2120916518} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} ---- !u!4 &2120916522 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 2120916518} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 100, y: 1, z: 100} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 7
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 7
+ m_GIWorkflowMode: 0
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_TemporalCoherenceThreshold: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 4
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_TextureWidth: 1024
+ m_TextureHeight: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_DirectLightInLightProbes: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_LightingDataAsset: {fileID: 0}
+ m_RuntimeCPUUsage: 25
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ accuratePlacement: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &1097545995
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1097545997}
+ - component: {fileID: 1097545996}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &1097545996
+Light:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1097545995}
+ m_Enabled: 1
+ serializedVersion: 7
+ m_Type: 1
+ m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_Lightmapping: 4
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &1097545997
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1097545995}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 0, y: 3, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1 &1231262489
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1231262494}
+ - component: {fileID: 1231262493}
+ - component: {fileID: 1231262492}
+ - component: {fileID: 1231262491}
+ - component: {fileID: 1231262490}
+ - component: {fileID: 1231262495}
+ m_Layer: 0
+ m_Name: Main Camera
+ m_TagString: MainCamera
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!81 &1231262490
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_Enabled: 1
+--- !u!124 &1231262491
+Behaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_Enabled: 1
+--- !u!92 &1231262492
+Behaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_Enabled: 1
+--- !u!20 &1231262493
+Camera:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+ near clip plane: 0.3
+ far clip plane: 1000
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: -1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 0}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+ m_StereoMirrorMode: 0
+--- !u!4 &1231262494
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_LocalRotation: {x: 0.26193652, y: 0, z: 0, w: 0.96508515}
+ m_LocalPosition: {x: 0, y: 180, z: -455}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 30.37, y: 0, z: 0}
+--- !u!114 &1231262495
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1231262489}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 29f022fb3768b8c4196631a9526aebcc, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ cameraSensitivity: 180
+ climbSpeed: 40
+ normalMoveSpeed: 100
+ slowMoveFactor: 0.25
+ fastMoveFactor: 3
+--- !u!1 &1755768756
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1755768758}
+ - component: {fileID: 1755768757}
+ m_Layer: 0
+ m_Name: Demo
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1755768757
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1755768756}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 7a62789bffb0bef4e9757f9848620e3f, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ hitSphere: {fileID: 1828855647}
+--- !u!4 &1755768758
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1755768756}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 22.74558, y: 0.29925728, z: 67.52241}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1828855647
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 1828855651}
+ - component: {fileID: 1828855650}
+ - component: {fileID: 1828855648}
+ m_Layer: 0
+ m_Name: HitSphere
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!23 &1828855648
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1828855647}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 2100000, guid: 680819e140a18024bba58e6fdc3651d2, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+--- !u!33 &1828855650
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1828855647}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &1828855651
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 1828855647}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 1.4304204, y: 4.4981146, z: -0.2158227}
+ m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &2120916518
+GameObject:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ serializedVersion: 5
+ m_Component:
+ - component: {fileID: 2120916522}
+ - component: {fileID: 2120916521}
+ - component: {fileID: 2120916520}
+ - component: {fileID: 2120916519}
+ m_Layer: 0
+ m_Name: Plane
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 4294967295
+ m_IsActive: 1
+--- !u!23 &2120916519
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2120916518}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_Materials:
+ - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_PreserveUVs: 1
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+--- !u!64 &2120916520
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2120916518}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Convex: 0
+ m_InflateMesh: 0
+ m_SkinWidth: 0.01
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!33 &2120916521
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2120916518}
+ m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!4 &2120916522
+Transform:
+ m_ObjectHideFlags: 0
+ m_PrefabParentObject: {fileID: 0}
+ m_PrefabInternal: {fileID: 0}
+ m_GameObject: {fileID: 2120916518}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 100, y: 1, z: 100}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
diff --git a/examples/UnityExample/Assets/Scenes/Test.unity.meta b/examples/UnityExample/Assets/Scenes/Test.unity.meta index 21dc2d9..24945a4 100644..100755 --- a/examples/UnityExample/Assets/Scenes/Test.unity.meta +++ b/examples/UnityExample/Assets/Scenes/Test.unity.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 0daa4f0291a2d794cb9066dd6bc74061 -timeCreated: 1481021055 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 0daa4f0291a2d794cb9066dd6bc74061
+timeCreated: 1481021055
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scripts.meta b/examples/UnityExample/Assets/Scripts.meta index aad561f..56ee3f9 100644..100755 --- a/examples/UnityExample/Assets/Scripts.meta +++ b/examples/UnityExample/Assets/Scripts.meta @@ -1,9 +1,9 @@ -fileFormatVersion: 2 -guid: c68a13922b97bab4da262a0e7422de7f -folderAsset: yes -timeCreated: 1481018329 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: c68a13922b97bab4da262a0e7422de7f
+folderAsset: yes
+timeCreated: 1481018329
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs b/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs index fdb6fa0..55f50fb 100644..100755 --- a/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs +++ b/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs @@ -1,183 +1,183 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class CubeAsset -{ - public struct DepthInfo - { - public DepthInfo(Vector3 slices, NvBlastChunkDesc.Flags flag_ = NvBlastChunkDesc.Flags.NoFlags) - { - this.slicesPerAxis = slices; - this.flag = flag_; - } - - public Vector3 slicesPerAxis; - public NvBlastChunkDesc.Flags flag; - }; - - public enum BondFlags - { - NO_BONDS = 0, - X_BONDS = 1, - Y_BONDS = 2, - Z_BONDS = 4, - ALL_BONDS = X_BONDS | Y_BONDS | Z_BONDS - }; - - public class Settings - { - public List<DepthInfo> depths = new List<DepthInfo>(); - public Vector3 extents; - public BondFlags bondFlags = BondFlags.ALL_BONDS; - public float staticHeight = float.NegativeInfinity; - }; - - public struct BlastChunkCube - { - public BlastChunkCube(Vector3 position_, Vector3 extents_, bool isStatic_) - { - this.position = position_; - this.extents = extents_; - this.isStatic = isStatic_; - } - - public Vector3 position; - public Vector3 extents; - public bool isStatic; - }; - - public List<BlastChunkCube> chunks = new List<BlastChunkCube>(); - public NvBlastAssetDesc solverAssetDesc = new NvBlastAssetDesc(); - public Vector3 extents { get; private set; } - - public static CubeAsset generate(Settings settings) - { - CubeAsset asset = new CubeAsset(); - asset.extents = settings.extents; - - List<NvBlastChunkDesc> solverChunks = new List<NvBlastChunkDesc>(); - List<NvBlastBondDesc> solverBonds = new List<NvBlastBondDesc>(); - - // initial params - List<uint> depthStartIDs = new List<uint>(); - List<Vector3> depthSlicesPerAxisTotal = new List<Vector3>(); - uint currentID = 0; - Vector3 extents = settings.extents; - - // Iterate over depths and create children - for (int depth = 0; depth<settings.depths.Count; depth++) - { - Vector3 slicesPerAxis = settings.depths[depth].slicesPerAxis; - Vector3 slicesPerAxisTotal = (depth == 0) ? slicesPerAxis : Vector3.Scale(slicesPerAxis, (depthSlicesPerAxisTotal[depth - 1])); - depthSlicesPerAxisTotal.Add(slicesPerAxisTotal); - - depthStartIDs.Add(currentID); - - extents.x /= slicesPerAxis.x; - extents.y /= slicesPerAxis.y; - extents.z /= slicesPerAxis.z; - - for (uint z = 0; z< (uint)slicesPerAxisTotal.z; ++z) - { - uint parent_z = z / (uint)slicesPerAxis.z; - for (uint y = 0; y< (uint)slicesPerAxisTotal.y; ++y) - { - uint parent_y = y / (uint)slicesPerAxis.y; - for (uint x = 0; x< (uint)slicesPerAxisTotal.x; ++x) - { - uint parent_x = x / (uint)slicesPerAxis.x; - uint parentID = depth == 0 ? uint.MaxValue : - depthStartIDs[depth - 1] + parent_x + (uint)depthSlicesPerAxisTotal[depth - 1].x * (parent_y + (uint)depthSlicesPerAxisTotal[depth - 1].y * parent_z); - - Vector3 position; - position.x = ((float)x - (slicesPerAxisTotal.x / 2) + 0.5f) * extents.x; - position.y = ((float)y - (slicesPerAxisTotal.y / 2) + 0.5f) * extents.y; - position.z = ((float)z - (slicesPerAxisTotal.z / 2) + 0.5f) * extents.z; - - NvBlastChunkDesc chunkDesc; - - chunkDesc.c0 = position.x; - chunkDesc.c1 = position.y; - chunkDesc.c2 = position.z; - chunkDesc.volume = extents.x * extents.y * extents.z; - chunkDesc.flags = (uint)settings.depths[depth].flag; - chunkDesc.userData = currentID++; - chunkDesc.parentChunkIndex = parentID; - solverChunks.Add(chunkDesc); - - bool isStatic = false; - - if (settings.depths[depth].flag == NvBlastChunkDesc.Flags.SupportFlag) - { - isStatic = position.y - (extents.y - asset.extents.y) / 2 <= settings.staticHeight; - - // x-neighbor - if (x > 0 && (settings.bondFlags & BondFlags.X_BONDS) != 0) - { - Vector3 xNeighborPosition = position - new Vector3(extents.x, 0, 0); - uint neighborID = chunkDesc.userData - 1; - - fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, xNeighborPosition, extents, extents.y* extents.z); - } - - // y-neighbor - if (y > 0 && (settings.bondFlags & BondFlags.Y_BONDS) != 0) - { - Vector3 yNeighborPosition = position - new Vector3(0, extents.y, 0); - uint neighborID = chunkDesc.userData - (uint)slicesPerAxisTotal.x; - - fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, yNeighborPosition, extents, extents.z* extents.x); - } - - // z-neighbor - if (z > 0 && (settings.bondFlags & BondFlags.Z_BONDS) != 0) - { - Vector3 zNeighborPosition = position - new Vector3(0, 0, extents.z); - uint neighborID = chunkDesc.userData - (uint)slicesPerAxisTotal.x * (uint)slicesPerAxisTotal.y; - - fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, zNeighborPosition, extents, extents.x* extents.y); - } - } - - asset.chunks.Add(new BlastChunkCube(position, extents, isStatic)); - } - } - } - } - - // Prepare solver asset desc - asset.solverAssetDesc.chunkCount = (uint)solverChunks.Count; - asset.solverAssetDesc.chunkDescs = solverChunks.ToArray(); - asset.solverAssetDesc.bondCount = (uint)solverBonds.Count; - asset.solverAssetDesc.bondDescs = solverBonds.ToArray(); - - // Reorder chunks - uint[] chunkReorderMap = new uint[asset.solverAssetDesc.chunkCount]; - NvBlastExtUtilsWrapper.ReorderAssetDescChunks(asset.solverAssetDesc, chunkReorderMap); - BlastChunkCube[] chunksTemp = asset.chunks.ToArray(); - for (uint i = 0; i < chunkReorderMap.Length; ++i) - { - asset.chunks[(int)chunkReorderMap[i]] = chunksTemp[i]; - } - - return asset; - } - - static void fillBondDesc(List<NvBlastBondDesc> bondDescs, uint id0, uint id1, Vector3 pos0, Vector3 pos1, Vector3 size, float area) - { - NvBlastBondDesc bondDesc = new NvBlastBondDesc(); - bondDesc.chunk0 = id0; - bondDesc.chunk1 = id1; - bondDesc.bond.area = area; - Vector3 centroid = (pos0 + pos1) * 0.5f; - bondDesc.bond.c0 = centroid.x; - bondDesc.bond.c1 = centroid.y; - bondDesc.bond.c2 = centroid.z; - Vector3 normal = (pos0 - pos1).normalized; - bondDesc.bond.n0 = normal.x; - bondDesc.bond.n1= normal.y; - bondDesc.bond.n2 = normal.z; - bondDescs.Add(bondDesc); - } -} +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class CubeAsset
+{
+ public struct DepthInfo
+ {
+ public DepthInfo(Vector3 slices, NvBlastChunkDesc.Flags flag_ = NvBlastChunkDesc.Flags.NoFlags)
+ {
+ this.slicesPerAxis = slices;
+ this.flag = flag_;
+ }
+
+ public Vector3 slicesPerAxis;
+ public NvBlastChunkDesc.Flags flag;
+ };
+
+ public enum BondFlags
+ {
+ NO_BONDS = 0,
+ X_BONDS = 1,
+ Y_BONDS = 2,
+ Z_BONDS = 4,
+ ALL_BONDS = X_BONDS | Y_BONDS | Z_BONDS
+ };
+
+ public class Settings
+ {
+ public List<DepthInfo> depths = new List<DepthInfo>();
+ public Vector3 extents;
+ public BondFlags bondFlags = BondFlags.ALL_BONDS;
+ public float staticHeight = float.NegativeInfinity;
+ };
+
+ public struct BlastChunkCube
+ {
+ public BlastChunkCube(Vector3 position_, Vector3 extents_, bool isStatic_)
+ {
+ this.position = position_;
+ this.extents = extents_;
+ this.isStatic = isStatic_;
+ }
+
+ public Vector3 position;
+ public Vector3 extents;
+ public bool isStatic;
+ };
+
+ public List<BlastChunkCube> chunks = new List<BlastChunkCube>();
+ public NvBlastAssetDesc solverAssetDesc = new NvBlastAssetDesc();
+ public Vector3 extents { get; private set; }
+
+ public static CubeAsset generate(Settings settings)
+ {
+ CubeAsset asset = new CubeAsset();
+ asset.extents = settings.extents;
+
+ List<NvBlastChunkDesc> solverChunks = new List<NvBlastChunkDesc>();
+ List<NvBlastBondDesc> solverBonds = new List<NvBlastBondDesc>();
+
+ // initial params
+ List<uint> depthStartIDs = new List<uint>();
+ List<Vector3> depthSlicesPerAxisTotal = new List<Vector3>();
+ uint currentID = 0;
+ Vector3 extents = settings.extents;
+
+ // Iterate over depths and create children
+ for (int depth = 0; depth<settings.depths.Count; depth++)
+ {
+ Vector3 slicesPerAxis = settings.depths[depth].slicesPerAxis;
+ Vector3 slicesPerAxisTotal = (depth == 0) ? slicesPerAxis : Vector3.Scale(slicesPerAxis, (depthSlicesPerAxisTotal[depth - 1]));
+ depthSlicesPerAxisTotal.Add(slicesPerAxisTotal);
+
+ depthStartIDs.Add(currentID);
+
+ extents.x /= slicesPerAxis.x;
+ extents.y /= slicesPerAxis.y;
+ extents.z /= slicesPerAxis.z;
+
+ for (uint z = 0; z< (uint)slicesPerAxisTotal.z; ++z)
+ {
+ uint parent_z = z / (uint)slicesPerAxis.z;
+ for (uint y = 0; y< (uint)slicesPerAxisTotal.y; ++y)
+ {
+ uint parent_y = y / (uint)slicesPerAxis.y;
+ for (uint x = 0; x< (uint)slicesPerAxisTotal.x; ++x)
+ {
+ uint parent_x = x / (uint)slicesPerAxis.x;
+ uint parentID = depth == 0 ? uint.MaxValue :
+ depthStartIDs[depth - 1] + parent_x + (uint)depthSlicesPerAxisTotal[depth - 1].x * (parent_y + (uint)depthSlicesPerAxisTotal[depth - 1].y * parent_z);
+
+ Vector3 position;
+ position.x = ((float)x - (slicesPerAxisTotal.x / 2) + 0.5f) * extents.x;
+ position.y = ((float)y - (slicesPerAxisTotal.y / 2) + 0.5f) * extents.y;
+ position.z = ((float)z - (slicesPerAxisTotal.z / 2) + 0.5f) * extents.z;
+
+ NvBlastChunkDesc chunkDesc;
+
+ chunkDesc.c0 = position.x;
+ chunkDesc.c1 = position.y;
+ chunkDesc.c2 = position.z;
+ chunkDesc.volume = extents.x * extents.y * extents.z;
+ chunkDesc.flags = (uint)settings.depths[depth].flag;
+ chunkDesc.userData = currentID++;
+ chunkDesc.parentChunkIndex = parentID;
+ solverChunks.Add(chunkDesc);
+
+ bool isStatic = false;
+
+ if (settings.depths[depth].flag == NvBlastChunkDesc.Flags.SupportFlag)
+ {
+ isStatic = position.y - (extents.y - asset.extents.y) / 2 <= settings.staticHeight;
+
+ // x-neighbor
+ if (x > 0 && (settings.bondFlags & BondFlags.X_BONDS) != 0)
+ {
+ Vector3 xNeighborPosition = position - new Vector3(extents.x, 0, 0);
+ uint neighborID = chunkDesc.userData - 1;
+
+ fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, xNeighborPosition, extents, extents.y* extents.z);
+ }
+
+ // y-neighbor
+ if (y > 0 && (settings.bondFlags & BondFlags.Y_BONDS) != 0)
+ {
+ Vector3 yNeighborPosition = position - new Vector3(0, extents.y, 0);
+ uint neighborID = chunkDesc.userData - (uint)slicesPerAxisTotal.x;
+
+ fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, yNeighborPosition, extents, extents.z* extents.x);
+ }
+
+ // z-neighbor
+ if (z > 0 && (settings.bondFlags & BondFlags.Z_BONDS) != 0)
+ {
+ Vector3 zNeighborPosition = position - new Vector3(0, 0, extents.z);
+ uint neighborID = chunkDesc.userData - (uint)slicesPerAxisTotal.x * (uint)slicesPerAxisTotal.y;
+
+ fillBondDesc(solverBonds, chunkDesc.userData, neighborID, position, zNeighborPosition, extents, extents.x* extents.y);
+ }
+ }
+
+ asset.chunks.Add(new BlastChunkCube(position, extents, isStatic));
+ }
+ }
+ }
+ }
+
+ // Prepare solver asset desc
+ asset.solverAssetDesc.chunkCount = (uint)solverChunks.Count;
+ asset.solverAssetDesc.chunkDescs = solverChunks.ToArray();
+ asset.solverAssetDesc.bondCount = (uint)solverBonds.Count;
+ asset.solverAssetDesc.bondDescs = solverBonds.ToArray();
+
+ // Reorder chunks
+ uint[] chunkReorderMap = new uint[asset.solverAssetDesc.chunkCount];
+ NvBlastExtUtilsWrapper.ReorderAssetDescChunks(asset.solverAssetDesc, chunkReorderMap);
+ BlastChunkCube[] chunksTemp = asset.chunks.ToArray();
+ for (uint i = 0; i < chunkReorderMap.Length; ++i)
+ {
+ asset.chunks[(int)chunkReorderMap[i]] = chunksTemp[i];
+ }
+
+ return asset;
+ }
+
+ static void fillBondDesc(List<NvBlastBondDesc> bondDescs, uint id0, uint id1, Vector3 pos0, Vector3 pos1, Vector3 size, float area)
+ {
+ NvBlastBondDesc bondDesc = new NvBlastBondDesc();
+ bondDesc.chunk0 = id0;
+ bondDesc.chunk1 = id1;
+ bondDesc.bond.area = area;
+ Vector3 centroid = (pos0 + pos1) * 0.5f;
+ bondDesc.bond.c0 = centroid.x;
+ bondDesc.bond.c1 = centroid.y;
+ bondDesc.bond.c2 = centroid.z;
+ Vector3 normal = (pos0 - pos1).normalized;
+ bondDesc.bond.n0 = normal.x;
+ bondDesc.bond.n1= normal.y;
+ bondDesc.bond.n2 = normal.z;
+ bondDescs.Add(bondDesc);
+ }
+}
diff --git a/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs.meta b/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs.meta index 0a37254..a7da492 100644..100755 --- a/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs.meta +++ b/examples/UnityExample/Assets/Scripts/CubeAssetGenerator.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: efa082786df108947a6fb5d672c1fb1a -timeCreated: 1481121968 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: efa082786df108947a6fb5d672c1fb1a
+timeCreated: 1481121968
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scripts/CubeFamily.cs b/examples/UnityExample/Assets/Scripts/CubeFamily.cs index fda0760..0d77853 100644..100755 --- a/examples/UnityExample/Assets/Scripts/CubeFamily.cs +++ b/examples/UnityExample/Assets/Scripts/CubeFamily.cs @@ -1,202 +1,202 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using UnityEngine; - - -public class CubeFamily : MonoBehaviour -{ - public void Initialize(CubeAsset asset) - { - // Blast asset creation - _cubeAsset = asset; - - NvBlastAssetDesc desc = _cubeAsset.solverAssetDesc; - _blastAsset = new NvBlastAsset(desc); - Debug.Log(_blastAsset.leafChunkCount); - - // Actual Cubes - var cubePrefab = Resources.Load<GameObject>("CubePrefab"); - _cubes = new GameObject[desc.chunkCount]; - for (int i = 0; i < desc.chunkCount; ++i) - { - GameObject cube = GameObject.Instantiate<GameObject>(cubePrefab); - cube.transform.parent = transform; - cube.transform.localScale = _cubeAsset.chunks[i].extents; - cube.transform.localPosition = _cubeAsset.chunks[i].position; - cube.transform.localRotation = Quaternion.identity; - cube.SetActive(false); - Color color = Color.HSVToRGB(UnityEngine.Random.Range(0f, 1f), 0.42f, 1.0f); - cube.GetComponent<Renderer>().material.color = color; - _cubes[i] = cube; - } - - // First actor - _blastFamily = new NvBlastFamily(_blastAsset); - - NvBlastActorDesc actorDesc = new NvBlastActorDesc(); - actorDesc.uniformInitialBondHealth = 1.0f; - actorDesc.uniformInitialLowerSupportChunkHealth = 1.0f; - var actor = new NvBlastActor(_blastFamily, actorDesc); - Debug.Log(actor.visibleChunkCount); - - OnActorCreated(actor, Vector3.zero, Quaternion.identity); - - // Reserved buffers - _fractureBuffers = new NvBlastFractureBuffers(); - _fractureBuffers.chunkFractures = Marshal.AllocHGlobal((int)desc.chunkCount * Marshal.SizeOf(typeof(NvBlastChunkFractureData))); - _fractureBuffers.bondFractures = Marshal.AllocHGlobal((int)desc.bondCount * Marshal.SizeOf(typeof(NvBlastBondFractureData))); - _leafChunkCount = (uint)_blastAsset.leafChunkCount; - _newActorsBuffer = Marshal.AllocHGlobal((int)_leafChunkCount * Marshal.SizeOf(typeof(IntPtr))); - } - - private void OnActorCreated(NvBlastActor actor, Vector3 localPosition, Quaternion localRotation) - { - var rigidBodyGO = new GameObject("RigidActor"); - rigidBodyGO.transform.SetParent(this.transform, false); - var rigidbody = rigidBodyGO.AddComponent<Rigidbody>(); - rigidbody.transform.localPosition = localPosition; - rigidbody.transform.localRotation = localRotation; - - // chunks - var chunkIndices = actor.visibleChunkIndices; - foreach (var chunkIndex in chunkIndices) - { - var chunkCube = _cubes[chunkIndex]; - chunkCube.transform.SetParent(rigidbody.transform, false); - chunkCube.SetActive(true); - } - - // search for static chunks - var graphNodeIndices = actor.graphNodeIndices; - var chunkGraph = _blastAsset.chunkGraph; - foreach(var node in graphNodeIndices) - { - var chunkIndex = Marshal.ReadInt32(chunkGraph.chunkIndices, Marshal.SizeOf(typeof(UInt32)) * (int)node); - var chunkCube = _cubeAsset.chunks[chunkIndex]; - if(chunkCube.isStatic) - { - rigidbody.isKinematic = true; - break; - } - } - - actor.userData = rigidbody; - _actors.Add(rigidbody, actor); - } - - private void OnActorDestroyed(NvBlastActor actor) - { - var chunkIndices = actor.visibleChunkIndices; - foreach (var chunkIndex in chunkIndices) - { - var chunkCube = _cubes[chunkIndex]; - chunkCube.transform.SetParent(transform, false); - chunkCube.SetActive(false); - } - - var rigidbody = (actor.userData as Rigidbody); - _actors.Remove(rigidbody); - Destroy(rigidbody.gameObject); - actor.userData = null; - } - - public void ApplyRadialDamage(Vector3 position, float minRadius, float maxRadius, float compressive) - { - var hits = Physics.OverlapSphere(position, maxRadius); - foreach (var hit in hits) - { - var rb = hit.GetComponentInParent<Rigidbody>(); - if (rb != null) - { - ApplyRadialDamage(rb, position, minRadius, maxRadius, compressive); - } - } - } - - public bool ApplyRadialDamage(Rigidbody rb, Vector3 position, float minRadius, float maxRadius, float compressive) - { - if (_actors.ContainsKey(rb)) - { - Vector3 localPosition = rb.transform.InverseTransformPoint(position); - ApplyRadialDamage(_actors[rb], localPosition, minRadius, maxRadius, compressive); - return true; - } - return false; - } - - private void ApplyRadialDamage(NvBlastActor actor, Vector3 localPosition, float minRadius, float maxRadius, float compressive) - { - _fractureBuffers.chunkFractureCount = _cubeAsset.solverAssetDesc.chunkCount; - _fractureBuffers.bondFractureCount = _cubeAsset.solverAssetDesc.bondCount; - - NvBlastExtRadialDamageDesc desc = new NvBlastExtRadialDamageDesc(); - desc.minRadius = minRadius; - desc.maxRadius = maxRadius; - desc.compressive = compressive; - desc.p0 = localPosition.x; - desc.p1 = localPosition.y; - desc.p2 = localPosition.z; - - if (actor.DamageRadialFalloff(_fractureBuffers, desc, 1, null)) - { - Split(actor); - } - } - - private void Split(NvBlastActor actor) - { - NvBlastActorSplitEvent split = new NvBlastActorSplitEvent(); - split.newActors = _newActorsBuffer; - var count = actor.Split(split, _leafChunkCount); - - Vector3 localPosition = Vector3.zero; - Quaternion localRotation = Quaternion.identity; - - if (split.deletedActor != IntPtr.Zero) - { - if (actor.userData != null) - { - var parentRigidbody = (actor.userData as Rigidbody); - localPosition = parentRigidbody.transform.localPosition; - localRotation = parentRigidbody.transform.localRotation; - } - OnActorDestroyed(actor); - } - for (int i = 0; i < count; i++) - { - int elementSize = Marshal.SizeOf(typeof(IntPtr)); - var ptr = Marshal.ReadIntPtr(split.newActors, elementSize * i); - OnActorCreated(new NvBlastActor(_blastFamily, ptr), localPosition, localRotation); - } - } - - private void OnDestroy() - { - if (_fractureBuffers != null) - { - Marshal.FreeHGlobal(_fractureBuffers.chunkFractures); - Marshal.FreeHGlobal(_fractureBuffers.bondFractures); - _fractureBuffers = null; - } - - if (_newActorsBuffer != IntPtr.Zero) - { - Marshal.FreeHGlobal(_newActorsBuffer); - } - - _actors.Clear(); - _blastFamily = null; - _blastAsset = null; - } - - private CubeAsset _cubeAsset; - private NvBlastAsset _blastAsset; - private NvBlastFamily _blastFamily; - private Dictionary<Rigidbody, NvBlastActor> _actors = new Dictionary<Rigidbody, NvBlastActor>(); - private GameObject[] _cubes; - private NvBlastFractureBuffers _fractureBuffers; - private IntPtr _newActorsBuffer; - private uint _leafChunkCount; +using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using UnityEngine;
+
+
+public class CubeFamily : MonoBehaviour
+{
+ public void Initialize(CubeAsset asset)
+ {
+ // Blast asset creation
+ _cubeAsset = asset;
+
+ NvBlastAssetDesc desc = _cubeAsset.solverAssetDesc;
+ _blastAsset = new NvBlastAsset(desc);
+ Debug.Log(_blastAsset.leafChunkCount);
+
+ // Actual Cubes
+ var cubePrefab = Resources.Load<GameObject>("CubePrefab");
+ _cubes = new GameObject[desc.chunkCount];
+ for (int i = 0; i < desc.chunkCount; ++i)
+ {
+ GameObject cube = GameObject.Instantiate<GameObject>(cubePrefab);
+ cube.transform.parent = transform;
+ cube.transform.localScale = _cubeAsset.chunks[i].extents;
+ cube.transform.localPosition = _cubeAsset.chunks[i].position;
+ cube.transform.localRotation = Quaternion.identity;
+ cube.SetActive(false);
+ Color color = Color.HSVToRGB(UnityEngine.Random.Range(0f, 1f), 0.42f, 1.0f);
+ cube.GetComponent<Renderer>().material.color = color;
+ _cubes[i] = cube;
+ }
+
+ // First actor
+ _blastFamily = new NvBlastFamily(_blastAsset);
+
+ NvBlastActorDesc actorDesc = new NvBlastActorDesc();
+ actorDesc.uniformInitialBondHealth = 1.0f;
+ actorDesc.uniformInitialLowerSupportChunkHealth = 1.0f;
+ var actor = new NvBlastActor(_blastFamily, actorDesc);
+ Debug.Log(actor.visibleChunkCount);
+
+ OnActorCreated(actor, Vector3.zero, Quaternion.identity);
+
+ // Reserved buffers
+ _fractureBuffers = new NvBlastFractureBuffers();
+ _fractureBuffers.chunkFractures = Marshal.AllocHGlobal((int)desc.chunkCount * Marshal.SizeOf(typeof(NvBlastChunkFractureData)));
+ _fractureBuffers.bondFractures = Marshal.AllocHGlobal((int)desc.bondCount * Marshal.SizeOf(typeof(NvBlastBondFractureData)));
+ _leafChunkCount = (uint)_blastAsset.leafChunkCount;
+ _newActorsBuffer = Marshal.AllocHGlobal((int)_leafChunkCount * Marshal.SizeOf(typeof(IntPtr)));
+ }
+
+ private void OnActorCreated(NvBlastActor actor, Vector3 localPosition, Quaternion localRotation)
+ {
+ var rigidBodyGO = new GameObject("RigidActor");
+ rigidBodyGO.transform.SetParent(this.transform, false);
+ var rigidbody = rigidBodyGO.AddComponent<Rigidbody>();
+ rigidbody.transform.localPosition = localPosition;
+ rigidbody.transform.localRotation = localRotation;
+
+ // chunks
+ var chunkIndices = actor.visibleChunkIndices;
+ foreach (var chunkIndex in chunkIndices)
+ {
+ var chunkCube = _cubes[chunkIndex];
+ chunkCube.transform.SetParent(rigidbody.transform, false);
+ chunkCube.SetActive(true);
+ }
+
+ // search for static chunks
+ var graphNodeIndices = actor.graphNodeIndices;
+ var chunkGraph = _blastAsset.chunkGraph;
+ foreach(var node in graphNodeIndices)
+ {
+ var chunkIndex = Marshal.ReadInt32(chunkGraph.chunkIndices, Marshal.SizeOf(typeof(UInt32)) * (int)node);
+ var chunkCube = _cubeAsset.chunks[chunkIndex];
+ if(chunkCube.isStatic)
+ {
+ rigidbody.isKinematic = true;
+ break;
+ }
+ }
+
+ actor.userData = rigidbody;
+ _actors.Add(rigidbody, actor);
+ }
+
+ private void OnActorDestroyed(NvBlastActor actor)
+ {
+ var chunkIndices = actor.visibleChunkIndices;
+ foreach (var chunkIndex in chunkIndices)
+ {
+ var chunkCube = _cubes[chunkIndex];
+ chunkCube.transform.SetParent(transform, false);
+ chunkCube.SetActive(false);
+ }
+
+ var rigidbody = (actor.userData as Rigidbody);
+ _actors.Remove(rigidbody);
+ Destroy(rigidbody.gameObject);
+ actor.userData = null;
+ }
+
+ public void ApplyRadialDamage(Vector3 position, float minRadius, float maxRadius, float compressive)
+ {
+ var hits = Physics.OverlapSphere(position, maxRadius);
+ foreach (var hit in hits)
+ {
+ var rb = hit.GetComponentInParent<Rigidbody>();
+ if (rb != null)
+ {
+ ApplyRadialDamage(rb, position, minRadius, maxRadius, compressive);
+ }
+ }
+ }
+
+ public bool ApplyRadialDamage(Rigidbody rb, Vector3 position, float minRadius, float maxRadius, float compressive)
+ {
+ if (_actors.ContainsKey(rb))
+ {
+ Vector3 localPosition = rb.transform.InverseTransformPoint(position);
+ ApplyRadialDamage(_actors[rb], localPosition, minRadius, maxRadius, compressive);
+ return true;
+ }
+ return false;
+ }
+
+ private void ApplyRadialDamage(NvBlastActor actor, Vector3 localPosition, float minRadius, float maxRadius, float compressive)
+ {
+ _fractureBuffers.chunkFractureCount = _cubeAsset.solverAssetDesc.chunkCount;
+ _fractureBuffers.bondFractureCount = _cubeAsset.solverAssetDesc.bondCount;
+
+ NvBlastExtRadialDamageDesc desc = new NvBlastExtRadialDamageDesc();
+ desc.minRadius = minRadius;
+ desc.maxRadius = maxRadius;
+ desc.compressive = compressive;
+ desc.p0 = localPosition.x;
+ desc.p1 = localPosition.y;
+ desc.p2 = localPosition.z;
+
+ if (actor.DamageRadialFalloff(_fractureBuffers, desc, 1, null))
+ {
+ Split(actor);
+ }
+ }
+
+ private void Split(NvBlastActor actor)
+ {
+ NvBlastActorSplitEvent split = new NvBlastActorSplitEvent();
+ split.newActors = _newActorsBuffer;
+ var count = actor.Split(split, _leafChunkCount);
+
+ Vector3 localPosition = Vector3.zero;
+ Quaternion localRotation = Quaternion.identity;
+
+ if (split.deletedActor != IntPtr.Zero)
+ {
+ if (actor.userData != null)
+ {
+ var parentRigidbody = (actor.userData as Rigidbody);
+ localPosition = parentRigidbody.transform.localPosition;
+ localRotation = parentRigidbody.transform.localRotation;
+ }
+ OnActorDestroyed(actor);
+ }
+ for (int i = 0; i < count; i++)
+ {
+ int elementSize = Marshal.SizeOf(typeof(IntPtr));
+ var ptr = Marshal.ReadIntPtr(split.newActors, elementSize * i);
+ OnActorCreated(new NvBlastActor(_blastFamily, ptr), localPosition, localRotation);
+ }
+ }
+
+ private void OnDestroy()
+ {
+ if (_fractureBuffers != null)
+ {
+ Marshal.FreeHGlobal(_fractureBuffers.chunkFractures);
+ Marshal.FreeHGlobal(_fractureBuffers.bondFractures);
+ _fractureBuffers = null;
+ }
+
+ if (_newActorsBuffer != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(_newActorsBuffer);
+ }
+
+ _actors.Clear();
+ _blastFamily = null;
+ _blastAsset = null;
+ }
+
+ private CubeAsset _cubeAsset;
+ private NvBlastAsset _blastAsset;
+ private NvBlastFamily _blastFamily;
+ private Dictionary<Rigidbody, NvBlastActor> _actors = new Dictionary<Rigidbody, NvBlastActor>();
+ private GameObject[] _cubes;
+ private NvBlastFractureBuffers _fractureBuffers;
+ private IntPtr _newActorsBuffer;
+ private uint _leafChunkCount;
}
\ No newline at end of file diff --git a/examples/UnityExample/Assets/Scripts/CubeFamily.cs.meta b/examples/UnityExample/Assets/Scripts/CubeFamily.cs.meta index f61e39a..5992474 100644..100755 --- a/examples/UnityExample/Assets/Scripts/CubeFamily.cs.meta +++ b/examples/UnityExample/Assets/Scripts/CubeFamily.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 0fe5c9affaa641644b99cb8e384234d4 -timeCreated: 1481725814 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 0fe5c9affaa641644b99cb8e384234d4
+timeCreated: 1481725814
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scripts/Demo.cs b/examples/UnityExample/Assets/Scripts/Demo.cs index eb60d26..725229e 100644..100755 --- a/examples/UnityExample/Assets/Scripts/Demo.cs +++ b/examples/UnityExample/Assets/Scripts/Demo.cs @@ -1,120 +1,120 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class Demo : MonoBehaviour -{ - public GameObject hitSphere; - - void Awake () - { - generateCity(); - } - - private void generateCity() - { - const int BUILDING_TYPE_COUNT = 5; - Vector3 BUILDING_MIN_SIZE = new Vector3(10, 10, 10); - Vector3 BUILDING_MAX_SIZE = new Vector3(50, 200, 50); - - List<CubeAsset> buildingTypes = new List<CubeAsset>(BUILDING_TYPE_COUNT); - for (int i = 0; i < BUILDING_TYPE_COUNT; ++i) - { - CubeAsset.Settings settings = new CubeAsset.Settings(); - settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(1, 1, 1), NvBlastChunkDesc.Flags.NoFlags)); - settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(1, 2, 1), NvBlastChunkDesc.Flags.NoFlags)); - settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(2, 3, 2), NvBlastChunkDesc.Flags.NoFlags)); - settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(2, 2, 2), NvBlastChunkDesc.Flags.SupportFlag)); - settings.extents = new Vector3(Random.Range(BUILDING_MIN_SIZE.x, BUILDING_MAX_SIZE.x), Random.Range(BUILDING_MIN_SIZE.y, BUILDING_MAX_SIZE.y), Random.Range(BUILDING_MIN_SIZE.z, BUILDING_MAX_SIZE.z)); - settings.staticHeight = 10.0f; - - CubeAsset cubeAsset = CubeAsset.generate(settings); - - buildingTypes.Add(cubeAsset); - } - - int totalBuildings = 0; - - const float CITY_HALF_SIZE = 200.0f; - const float SPARSITY = 30.0f; - const int BUILDING_COUNT_MAX = 20; - Vector2 pos = new Vector2(-CITY_HALF_SIZE, -CITY_HALF_SIZE); - float buildingYMax = 0.0f; - while (pos.y < CITY_HALF_SIZE && totalBuildings < BUILDING_COUNT_MAX) - { - // random jump - pos.x += Random.Range(0.0f, SPARSITY); - if(pos.x > CITY_HALF_SIZE) - { - pos.x = -CITY_HALF_SIZE; - pos.y += buildingYMax + Random.Range(0.0f, SPARSITY); - buildingYMax = 0.0f; - continue; - } - - // random bulding type spawn - int type = Random.Range(0, buildingTypes.Count); - var cubeFamily = (new GameObject("Cube Actor #" + type)).AddComponent<CubeFamily>(); - CubeAsset asset = buildingTypes[type]; - cubeFamily.transform.localPosition = new Vector3(pos.x, asset.extents.y / 2.0f, pos.y); - pos.x += asset.extents.x; - buildingYMax = Mathf.Max(buildingYMax, asset.extents.z); - cubeFamily.Initialize(asset); - totalBuildings++; - } - } - - private IEnumerator applyRadialDamage(Vector3 position, float minRadius, float maxRadius, float compressive, float explosive = 3000.0f) - { - var hits = Physics.OverlapSphere(position, maxRadius); - foreach (var hit in hits) - { - var rb = hit.GetComponentInParent<Rigidbody>(); - var family = hit.GetComponentInParent<CubeFamily>(); - if (rb != null && family != null) - { - family.ApplyRadialDamage(rb, position, minRadius, maxRadius, compressive); - } - } - - yield return new WaitForEndOfFrame(); - - hits = Physics.OverlapSphere(position, maxRadius); - foreach (var hit in hits) - { - var rb = hit.GetComponentInParent<Rigidbody>(); - if(rb != null) - { - rb.AddExplosionForce(explosive, position, maxRadius, 3.0f); - } - } - } - - private void Update() - { - hitSphere.SetActive(false); - bool isActive = false; - if (true) - { - var ray = Camera.main.ScreenPointToRay(Input.mousePosition); - RaycastHit hit; - if(Physics.Raycast(ray, out hit)) - { - hitSphere.transform.position = hit.point; - isActive = true; - } - } - - _hitSphereSize += Input.GetAxis("Mouse ScrollWheel") * 10.0f; - - if (Input.GetMouseButton(0)) - { - StartCoroutine(applyRadialDamage(hitSphere.transform.position, 0.0f, _hitSphereSize, 10.0f)); - } - - hitSphere.SetActive(isActive); - hitSphere.transform.localScale = new Vector3(_hitSphereSize, _hitSphereSize, _hitSphereSize); - } - - private float _hitSphereSize = 25.0f; -} +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class Demo : MonoBehaviour
+{
+ public GameObject hitSphere;
+
+ void Awake ()
+ {
+ generateCity();
+ }
+
+ private void generateCity()
+ {
+ const int BUILDING_TYPE_COUNT = 5;
+ Vector3 BUILDING_MIN_SIZE = new Vector3(10, 10, 10);
+ Vector3 BUILDING_MAX_SIZE = new Vector3(50, 200, 50);
+
+ List<CubeAsset> buildingTypes = new List<CubeAsset>(BUILDING_TYPE_COUNT);
+ for (int i = 0; i < BUILDING_TYPE_COUNT; ++i)
+ {
+ CubeAsset.Settings settings = new CubeAsset.Settings();
+ settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(1, 1, 1), NvBlastChunkDesc.Flags.NoFlags));
+ settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(1, 2, 1), NvBlastChunkDesc.Flags.NoFlags));
+ settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(2, 3, 2), NvBlastChunkDesc.Flags.NoFlags));
+ settings.depths.Add(new CubeAsset.DepthInfo(new Vector3(2, 2, 2), NvBlastChunkDesc.Flags.SupportFlag));
+ settings.extents = new Vector3(Random.Range(BUILDING_MIN_SIZE.x, BUILDING_MAX_SIZE.x), Random.Range(BUILDING_MIN_SIZE.y, BUILDING_MAX_SIZE.y), Random.Range(BUILDING_MIN_SIZE.z, BUILDING_MAX_SIZE.z));
+ settings.staticHeight = 10.0f;
+
+ CubeAsset cubeAsset = CubeAsset.generate(settings);
+
+ buildingTypes.Add(cubeAsset);
+ }
+
+ int totalBuildings = 0;
+
+ const float CITY_HALF_SIZE = 200.0f;
+ const float SPARSITY = 30.0f;
+ const int BUILDING_COUNT_MAX = 20;
+ Vector2 pos = new Vector2(-CITY_HALF_SIZE, -CITY_HALF_SIZE);
+ float buildingYMax = 0.0f;
+ while (pos.y < CITY_HALF_SIZE && totalBuildings < BUILDING_COUNT_MAX)
+ {
+ // random jump
+ pos.x += Random.Range(0.0f, SPARSITY);
+ if(pos.x > CITY_HALF_SIZE)
+ {
+ pos.x = -CITY_HALF_SIZE;
+ pos.y += buildingYMax + Random.Range(0.0f, SPARSITY);
+ buildingYMax = 0.0f;
+ continue;
+ }
+
+ // random bulding type spawn
+ int type = Random.Range(0, buildingTypes.Count);
+ var cubeFamily = (new GameObject("Cube Actor #" + type)).AddComponent<CubeFamily>();
+ CubeAsset asset = buildingTypes[type];
+ cubeFamily.transform.localPosition = new Vector3(pos.x, asset.extents.y / 2.0f, pos.y);
+ pos.x += asset.extents.x;
+ buildingYMax = Mathf.Max(buildingYMax, asset.extents.z);
+ cubeFamily.Initialize(asset);
+ totalBuildings++;
+ }
+ }
+
+ private IEnumerator applyRadialDamage(Vector3 position, float minRadius, float maxRadius, float compressive, float explosive = 3000.0f)
+ {
+ var hits = Physics.OverlapSphere(position, maxRadius);
+ foreach (var hit in hits)
+ {
+ var rb = hit.GetComponentInParent<Rigidbody>();
+ var family = hit.GetComponentInParent<CubeFamily>();
+ if (rb != null && family != null)
+ {
+ family.ApplyRadialDamage(rb, position, minRadius, maxRadius, compressive);
+ }
+ }
+
+ yield return new WaitForEndOfFrame();
+
+ hits = Physics.OverlapSphere(position, maxRadius);
+ foreach (var hit in hits)
+ {
+ var rb = hit.GetComponentInParent<Rigidbody>();
+ if(rb != null)
+ {
+ rb.AddExplosionForce(explosive, position, maxRadius, 3.0f);
+ }
+ }
+ }
+
+ private void Update()
+ {
+ hitSphere.SetActive(false);
+ bool isActive = false;
+ if (true)
+ {
+ var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
+ RaycastHit hit;
+ if(Physics.Raycast(ray, out hit))
+ {
+ hitSphere.transform.position = hit.point;
+ isActive = true;
+ }
+ }
+
+ _hitSphereSize += Input.GetAxis("Mouse ScrollWheel") * 10.0f;
+
+ if (Input.GetMouseButton(0))
+ {
+ StartCoroutine(applyRadialDamage(hitSphere.transform.position, 0.0f, _hitSphereSize, 10.0f));
+ }
+
+ hitSphere.SetActive(isActive);
+ hitSphere.transform.localScale = new Vector3(_hitSphereSize, _hitSphereSize, _hitSphereSize);
+ }
+
+ private float _hitSphereSize = 25.0f;
+}
diff --git a/examples/UnityExample/Assets/Scripts/Demo.cs.meta b/examples/UnityExample/Assets/Scripts/Demo.cs.meta index edd0d3b..5e49416 100644..100755 --- a/examples/UnityExample/Assets/Scripts/Demo.cs.meta +++ b/examples/UnityExample/Assets/Scripts/Demo.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 7a62789bffb0bef4e9757f9848620e3f -timeCreated: 1481120125 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 7a62789bffb0bef4e9757f9848620e3f
+timeCreated: 1481120125
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/examples/UnityExample/Assets/Scripts/FreeCamera.cs b/examples/UnityExample/Assets/Scripts/FreeCamera.cs index 1e9fd67..552ed3b 100644..100755 --- a/examples/UnityExample/Assets/Scripts/FreeCamera.cs +++ b/examples/UnityExample/Assets/Scripts/FreeCamera.cs @@ -1,61 +1,61 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class FreeCamera : MonoBehaviour -{ - public float cameraSensitivity = 90; - public float climbSpeed = 4; - public float normalMoveSpeed = 10; - public float slowMoveFactor = 0.25f; - public float fastMoveFactor = 3; - - private float rotationX = 0.0f; - private float rotationY = 0.0f; - - void Start() - { - Cursor.lockState = CursorLockMode.Confined; - rotationX = transform.localRotation.eulerAngles.y; - rotationY = -transform.localRotation.eulerAngles.x; - } - - void Update() - { - if(!Input.GetMouseButton(1)) - { - return; - } - - rotationX += Input.GetAxis("Mouse X") * cameraSensitivity * Time.deltaTime; - rotationY += Input.GetAxis("Mouse Y") * cameraSensitivity * Time.deltaTime; - rotationY = Mathf.Clamp(rotationY, -90, 90); - - transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up); - transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left); - - if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) - { - transform.position += transform.forward * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime; - transform.position += transform.right * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime; - } - else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) - { - transform.position += transform.forward * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime; - transform.position += transform.right * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime; - } - else - { - transform.position += transform.forward * normalMoveSpeed * Input.GetAxis("Vertical") * Time.deltaTime; - transform.position += transform.right * normalMoveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime; - } - - if (Input.GetKey(KeyCode.Q)) { transform.position -= transform.up * climbSpeed * Time.deltaTime; } - if (Input.GetKey(KeyCode.E)) { transform.position += transform.up * climbSpeed * Time.deltaTime; } - - //if (Input.GetKeyDown(KeyCode.End)) - //{ - // Cursor.lockState = (Cursor.lockState == CursorLockMode.Confined) ? CursorLockMode.None : CursorLockMode.Confined; - //} - } -} +using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class FreeCamera : MonoBehaviour
+{
+ public float cameraSensitivity = 90;
+ public float climbSpeed = 4;
+ public float normalMoveSpeed = 10;
+ public float slowMoveFactor = 0.25f;
+ public float fastMoveFactor = 3;
+
+ private float rotationX = 0.0f;
+ private float rotationY = 0.0f;
+
+ void Start()
+ {
+ Cursor.lockState = CursorLockMode.Confined;
+ rotationX = transform.localRotation.eulerAngles.y;
+ rotationY = -transform.localRotation.eulerAngles.x;
+ }
+
+ void Update()
+ {
+ if(!Input.GetMouseButton(1))
+ {
+ return;
+ }
+
+ rotationX += Input.GetAxis("Mouse X") * cameraSensitivity * Time.deltaTime;
+ rotationY += Input.GetAxis("Mouse Y") * cameraSensitivity * Time.deltaTime;
+ rotationY = Mathf.Clamp(rotationY, -90, 90);
+
+ transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up);
+ transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);
+
+ if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
+ {
+ transform.position += transform.forward * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime;
+ transform.position += transform.right * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime;
+ }
+ else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
+ {
+ transform.position += transform.forward * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime;
+ transform.position += transform.right * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime;
+ }
+ else
+ {
+ transform.position += transform.forward * normalMoveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;
+ transform.position += transform.right * normalMoveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime;
+ }
+
+ if (Input.GetKey(KeyCode.Q)) { transform.position -= transform.up * climbSpeed * Time.deltaTime; }
+ if (Input.GetKey(KeyCode.E)) { transform.position += transform.up * climbSpeed * Time.deltaTime; }
+
+ //if (Input.GetKeyDown(KeyCode.End))
+ //{
+ // Cursor.lockState = (Cursor.lockState == CursorLockMode.Confined) ? CursorLockMode.None : CursorLockMode.Confined;
+ //}
+ }
+}
diff --git a/examples/UnityExample/Assets/Scripts/FreeCamera.cs.meta b/examples/UnityExample/Assets/Scripts/FreeCamera.cs.meta index 081cae7..f9f0486 100644..100755 --- a/examples/UnityExample/Assets/Scripts/FreeCamera.cs.meta +++ b/examples/UnityExample/Assets/Scripts/FreeCamera.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 29f022fb3768b8c4196631a9526aebcc -timeCreated: 1482928025 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2
+guid: 29f022fb3768b8c4196631a9526aebcc
+timeCreated: 1482928025
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
|