diff options
Diffstat (limited to 'examples/UnityExample')
23 files changed, 285 insertions, 200 deletions
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs index 21e208c..7b4c5d1 100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtShadersWrapper.cs @@ -7,36 +7,33 @@ using UnityEngine; [StructLayout(LayoutKind.Sequential)]
public class NvBlastExtRadialDamageDesc
{
- public float compressive; //!< compressive (radial) damage component
+ public float damage; //!< normalized damage amount, range: [0, 1] (maximum health value to be reduced)
public float p0;
public float p1;
public float p2;
- public float minRadius; //!< inner radius of damage action
+ 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 float health; //!< health
+ public float minDamageThreshold; //!< min damage fraction threshold to be applied. Range [0, 1]. For example 0.1 filters all damage below 10% of health.
+ public float maxDamageThreshold; //!< max damage fraction threshold to be applied. Range [0, 1]. For example 0.8 won't allow more then 80% of health damage to be applied.
};
-
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 extern void NvBlastExtFalloffGraphShader( NvBlastFractureBuffers buffers, NvBlastGraphShaderActor actor, NvBlastExtProgramParams p ); // System.IntPtr xparams
+
+ [DllImport(DLL_NAME)]
+ public static extern void NvBlastExtFalloffSubgraphShader( NvBlastFractureBuffers buffers, NvBlastSubgraphShaderActor actor, NvBlastExtProgramParams p ); // NvBlastExtProgramParams
+ #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/NvBlastExtUtilsWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs index 94ca399..c902192 100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastExtUtilsWrapper.cs @@ -7,15 +7,29 @@ using UnityEngine; public static class NvBlastExtUtilsWrapper
{
- public const string DLL_NAME = "NvBlastExtUtils" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM;
+ //!AJB 20180809 Function was moved to a different plug in
+ public const string DLL_NAME = "NvBlast" + NvBlastWrapper.DLL_POSTFIX + "_" + NvBlastWrapper.DLL_PLATFORM; // NvBlastExtAssetUtils
- #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
+ #region Dll
+ [DllImport(DLL_NAME)]
+ private static extern void NvBlastReorderAssetDescChunks
+ (
+ [In, Out] NvBlastChunkDesc[] chunkDescs,
+ UInt32 chunkCount,
+ [In, Out] NvBlastBondDesc[] bondDescs,
+ UInt32 bondCount,
+ UInt32[] chunkReorderMap,
+ bool keepBondNormalChunkOrder,
+ System.IntPtr scratch,
+ System.UIntPtr logFn // NvBlastLog, may be null
+ );
+ #endregion
- public static void ReorderAssetDescChunks(NvBlastAssetDesc assetDesc, uint[] chunkReorderMap)
+ public static void ReorderAssetDescChunks(NvBlastAssetDesc assetDesc, uint[] chunkReorderMap)
{
- NvBlastReorderAssetDescChunks(assetDesc.chunkDescs, assetDesc.chunkCount, assetDesc.bondDescs, assetDesc.bondCount, chunkReorderMap);
- }
-}
\ No newline at end of file + System.IntPtr scratchPtr = NvBlastWrapper.GetScratch( (int)( assetDesc.chunkCount * Marshal.SizeOf( typeof(NvBlastChunkDesc) ) ) );
+ NvBlastReorderAssetDescChunks(assetDesc.chunkDescs, assetDesc.chunkCount, assetDesc.bondDescs, assetDesc.bondCount, chunkReorderMap, true, scratchPtr, System.UIntPtr.Zero);
+ }
+}
+
+
diff --git a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs index 13822f8..41b4f68 100755 --- a/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs +++ b/examples/UnityExample/Assets/Plugins/Blast/NvBlastWrapper.cs @@ -13,8 +13,8 @@ public struct NvBlastChunkDesc SupportFlag = (1 << 0)
};
- /** Central position in chunk. */
- public Single c0;
+ /** Central position in chunk. */
+ public Single c0;
public Single c1;
public Single c2;
@@ -49,12 +49,12 @@ public struct NvBlastBond 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;
- /** Bond data (see NvBlastBond). */
- public NvBlastBond bond;
+ /** The indices of the chunks linked by this bond. They must be different support chunk indices. */
+ public UInt32 chunk0;
+ public UInt32 chunk1;
}
[StructLayout(LayoutKind.Sequential)]
@@ -137,7 +137,8 @@ public struct NvBlastChunk public UInt32 userData;
};
-public struct NvBlastChunkGraph
+
+public struct NvBlastSupportGraph
{
UInt32 nodeCount;
public IntPtr chunkIndices;
@@ -189,28 +190,34 @@ public class NvBlastFractureBuffers public class NvBlastActorSplitEvent
{
public IntPtr deletedActor; //!< deleted actor or nullptr if actor has not changed
- public IntPtr newActors; //!< list of created actors
+ public IntPtr newActors; //!< list of created actors ( NvBlastActor** )
};
[StructLayout(LayoutKind.Sequential)]
public class NvBlastGraphShaderActor
{
- UInt32 firstGraphNodeIndex; //<! Entry index for graphNodeIndexLinks
+ UInt32 actorIndex; //!< Actor's index.
+ UInt32 graphNodeCount; //!< Actor's graph node count.
+ UInt32 assetNodeCount; //!< Asset node count.
+ 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.
+ public NvBlastBond[] assetBonds; //<! NvBlastBonds geometry in the NvBlastAsset.
+ public NvBlastChunk[] assetChunks; //!< NvBlastChunks geometry in the NvBlastAsset.
+ public Single[] familyBondHealths; //<! Actual bond health values for broken bond detection.
+ public Single[] supportChunkHealths; //!< Actual chunk health values for dead chunk detection.
+ public UInt32[] nodeActorIndices; //!< Family's map from node index to actor index.
};
[StructLayout(LayoutKind.Sequential)]
-public class NvBlastProgramParams
+public struct NvBlastExtProgramParams
{
- public IntPtr damageDescBuffer; //!< array of damage descriptions
- public UInt32 damageDescCount; //!< number of damage descriptions in array
- public IntPtr material; //!< pointer to material
+ public IntPtr damageDescBuffer; //!< array of damage descriptions // (NvBlastExtRadialDamageDesc)
+ public IntPtr material; //!< pointer to material
+ public IntPtr accelerator; //!< //NvBlastExtDamageAccelerator* accelerator;
};
[StructLayout(LayoutKind.Sequential)]
@@ -222,10 +229,10 @@ public class NvBlastSubgraphShaderActor 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 delegate void NvBlastGraphShaderFunction( NvBlastFractureBuffers commandBuffers, NvBlastGraphShaderActor actor, NvBlastExtProgramParams p ); // System.IntPtr p
+ public delegate void NvBlastSubgraphShaderFunction( NvBlastFractureBuffers commandBuffers, NvBlastSubgraphShaderActor actor, NvBlastExtProgramParams p);
- public NvBlastGraphShaderFunction graphShaderFunction;
+ public NvBlastGraphShaderFunction graphShaderFunction;
public NvBlastSubgraphShaderFunction subgraphShaderFunction;
};
@@ -234,8 +241,9 @@ public class NvBlastWrapper {
//////// DLL ////////
- public const string DLL_POSTFIX = "DEBUG"; //DEBUG
- public const string DLL_PLATFORM = "x64";
+// public const string DLL_POSTFIX = "DEBUG";
+ public const string DLL_POSTFIX = "";
+ public const string DLL_PLATFORM = "x64";
public const string DLL_NAME = "NvBlast" + DLL_POSTFIX + "_" + DLL_PLATFORM;
@@ -377,31 +385,37 @@ public class NvBlastAsset : DisposablePtr {
#region Dll
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern UInt64 NvBlastAssetCreateRequiredScratch(NvBlastAssetDesc desc);
+ static extern UInt64 NvBlastGetRequiredScratchForCreateAsset(NvBlastAssetDesc desc, NvBlastWrapper.NvBlastLog logFn);
- [DllImport(NvBlastWrapper.DLL_NAME)]
- static extern IntPtr NvBlastAssetCreate(NvBlastAssetDesc desc, NvBlastWrapper.NvBlastAlloc allocFn, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn);
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt64 NvBlastGetAssetMemorySize( NvBlastAssetDesc desc, NvBlastWrapper.NvBlastLog logFn );
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern void NvBlastAssetRelease(IntPtr asset, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn);
+ static extern IntPtr NvBlastCreateAsset( System.IntPtr mem, NvBlastAssetDesc desc, 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);
+ static extern NvBlastSupportGraph NvBlastAssetGetSupportGraph(IntPtr asset, NvBlastWrapper.NvBlastLog logFn);
#endregion
- public NvBlastAsset(NvBlastAssetDesc desc)
+ public NvBlastAsset( NvBlastAssetDesc desc )
{
- var scratchSize = NvBlastAssetCreateRequiredScratch(desc);
- var asset = NvBlastAssetCreate(desc, NvBlastWrapper.Alloc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log);
- Initialize(asset);
+ var scratchSize = NvBlastGetRequiredScratchForCreateAsset( desc, NvBlastWrapper.Log );
+ var assetSize = NvBlastGetAssetMemorySize(desc, NvBlastWrapper.Log);
+ IntPtr mem = NvBlastWrapper.Alloc( (long)assetSize);
+ var asset = NvBlastCreateAsset( mem, desc, NvBlastWrapper.GetScratch( (int)scratchSize ), NvBlastWrapper.Log );
+ Initialize( asset );
}
+ // asset = mem, or NULL on failure
- protected override void Release()
+ protected override void Release()
{
- NvBlastAssetRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log);
+ //NvBlastAssetRelease( ptr, NvBlastWrapper.Free, NvBlastWrapper.Log );
}
public UInt32 leafChunkCount
@@ -412,7 +426,7 @@ public class NvBlastAsset : DisposablePtr }
}
- public NvBlastChunkGraph chunkGraph
+ public NvBlastSupportGraph chunkGraph
{
get
{
@@ -424,7 +438,7 @@ public class NvBlastAsset : DisposablePtr }
}
- private NvBlastChunkGraph? _graph = null;
+ private NvBlastSupportGraph? _graph = null;
}
@@ -432,13 +446,16 @@ public class NvBlastFamily : DisposablePtr {
#region Dll
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern IntPtr NvBlastFamilyCreate(IntPtr asset, NvBlastWrapper.NvBlastAlloc allocFn, NvBlastWrapper.NvBlastLog logFn);
+ static extern IntPtr NvBlastAssetCreateFamily( IntPtr mem, IntPtr asset, NvBlastWrapper.NvBlastLog logFn );
- [DllImport(NvBlastWrapper.DLL_NAME)]
- static extern void NvBlastFamilyRelease(IntPtr family, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn);
- #endregion
+// [DllImport(NvBlastWrapper.DLL_NAME)]
+// static extern void NvBlastFamilyRelease(IntPtr family, NvBlastWrapper.NvBlastFree freeFn, NvBlastWrapper.NvBlastLog logFn);
- public NvBlastAsset asset
+ [DllImport(NvBlastWrapper.DLL_NAME)]
+ static extern UInt64 NvBlastAssetGetFamilyMemorySize( IntPtr asset, NvBlastWrapper.NvBlastLog logFn );
+ #endregion
+
+ public NvBlastAsset asset
{
get;
private set;
@@ -446,14 +463,16 @@ public class NvBlastFamily : DisposablePtr public NvBlastFamily(NvBlastAsset asset_)
{
- asset = asset_;
- var family = NvBlastFamilyCreate(asset.ptr, NvBlastWrapper.Alloc, NvBlastWrapper.Log);
- Initialize(family);
+ var memSize = NvBlastAssetGetFamilyMemorySize(asset_.ptr, NvBlastWrapper.Log);
+ IntPtr mem = NvBlastWrapper.Alloc((long)memSize );
+ asset = asset_;
+ var family = NvBlastAssetCreateFamily( mem, asset.ptr, NvBlastWrapper.Log );
+ Initialize( family );
}
- protected override void Release()
+ protected override void Release()
{
- NvBlastFamilyRelease(ptr, NvBlastWrapper.Free, NvBlastWrapper.Log);
+ //NvBlastFamilyRelease( ptr, NvBlastWrapper.Free, NvBlastWrapper.Log );
}
}
@@ -462,10 +481,10 @@ public class NvBlastActor : DisposablePtr {
#region Dll
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern UInt64 NvBlastActorCreateRequiredScratch(IntPtr asset);
+ static extern UInt64 NvBlastFamilyGetRequiredScratchForCreateFirstActor(IntPtr asset, NvBlastWrapper.NvBlastLog logFn);
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern IntPtr NvBlastActorCreate(IntPtr family, NvBlastActorDesc desc, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn);
+ static extern IntPtr NvBlastFamilyCreateFirstActor(IntPtr family, NvBlastActorDesc desc, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn);
[DllImport(NvBlastWrapper.DLL_NAME)]
static extern void NvBlastActorRelease(IntPtr actor);
@@ -483,16 +502,16 @@ public class NvBlastActor : DisposablePtr 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);
+ static extern void NvBlastActorGenerateFracture(NvBlastFractureBuffers commandBuffers, IntPtr actor, NvBlastDamageProgram program, NvBlastExtProgramParams 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);
+ static extern UInt64 NvBlastActorGetRequiredScratchForSplit(IntPtr actor, NvBlastWrapper.NvBlastLog logFn);
[DllImport(NvBlastWrapper.DLL_NAME)]
- static extern UInt32 NvBlastActorSplit([In, Out] NvBlastActorSplitEvent result, UInt32 newActorsMaxCount, IntPtr actor, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
+ static extern UInt32 NvBlastActorSplit([In, Out] NvBlastActorSplitEvent result, IntPtr actor, UInt32 newActorsMaxCount, IntPtr scratch, NvBlastWrapper.NvBlastLog logFn, NvBlastTimers timers);
#endregion
public NvBlastFamily family
@@ -507,9 +526,9 @@ public class NvBlastActor : DisposablePtr {
family = family_;
- var scratchSize = NvBlastActorCreateRequiredScratch(family_.asset.ptr);
- var actor = NvBlastActorCreate(family.ptr, desc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log);
- Initialize(actor);
+ var scratchSize = NvBlastFamilyGetRequiredScratchForCreateFirstActor( family.ptr, NvBlastWrapper.Log);
+ var actor = NvBlastFamilyCreateFirstActor( family.ptr, desc, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log );
+ Initialize(actor);
}
public NvBlastActor(NvBlastFamily family_, IntPtr ptr)
@@ -560,9 +579,9 @@ public class NvBlastActor : DisposablePtr }
}
- public void GenerateFracture(NvBlastFractureBuffers buffers, NvBlastDamageProgram program, NvBlastProgramParams programParams)
+ public void GenerateFracture( NvBlastFractureBuffers buffers, NvBlastDamageProgram program, NvBlastExtProgramParams programParams )
{
- NvBlastActorGenerateFracture(buffers, ptr, program, programParams, NvBlastWrapper.Log, null);
+ NvBlastActorGenerateFracture( buffers, ptr, program, programParams, NvBlastWrapper.Log, null );
}
public void ApplyFracture(NvBlastFractureBuffers commands)
@@ -570,11 +589,11 @@ public class NvBlastActor : DisposablePtr NvBlastActorApplyFracture(IntPtr.Zero, ptr, commands, NvBlastWrapper.Log, null);
}
- public UInt32 Split(NvBlastActorSplitEvent result, UInt32 newActorsMaxCount)
+ 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)
+ var scratchSize = NvBlastActorGetRequiredScratchForSplit(ptr, NvBlastWrapper.Log);
+ UInt32 newActorsCount = NvBlastActorSplit( result, ptr, newActorsMaxCount, NvBlastWrapper.GetScratch((int)scratchSize), NvBlastWrapper.Log, null);
+ if( result.deletedActor != IntPtr.Zero )
{
ResetPtr();
}
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..053c1eb 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/NvBlastExtAssetUtilsDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtilsDEBUG_x64.dll Binary files differnew file mode 100644 index 0000000..687da50 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtilsDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtilsDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtilsDEBUG_x64.dll.meta new file mode 100644 index 0000000..1e63451 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtilsDEBUG_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 088af6213d27b33488e83883ab80ddbf +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll Binary files differnew file mode 100644 index 0000000..a33ea16 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll.meta new file mode 100644 index 0000000..1763e69 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtAssetUtils_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 9ecf364add0e0c342a12ed86e36ffebf +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + 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 differdeleted file mode 100755 index 9000d94..0000000 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll +++ /dev/null diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta deleted file mode 100755 index cda3e53..0000000 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtCommonDEBUG_x64.dll.meta +++ /dev/null @@ -1,54 +0,0 @@ -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..0d21f00 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/NvBlastExtShaders_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShaders_x64.dll Binary files differnew file mode 100644 index 0000000..b21d758 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShaders_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShaders_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShaders_x64.dll.meta new file mode 100644 index 0000000..4fa6fe6 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtShaders_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 6c10d1683220a7c46b28c4e98f10aa05 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + 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 differdeleted file mode 100755 index b24c4fa..0000000 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll +++ /dev/null diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta deleted file mode 100755 index ccb6a94..0000000 --- a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastExtUtilsDEBUG_x64.dll.meta +++ /dev/null @@ -1,54 +0,0 @@ -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/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll Binary files differnew file mode 100644 index 0000000..ebff1a2 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll.meta new file mode 100644 index 0000000..d7c2605 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobalsDEBUG_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 2250d69db141dc54bb8062c9cc0bc7a0 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll Binary files differnew file mode 100644 index 0000000..d3a1887 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll.meta new file mode 100644 index 0000000..f940e8b --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlastGlobals_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: 8f19936d17663b4459005d2272b39d83 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll Binary files differnew file mode 100644 index 0000000..a6696a4 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll diff --git a/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll.meta b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll.meta new file mode 100644 index 0000000..5bd0070 --- /dev/null +++ b/examples/UnityExample/Assets/Plugins/Blast/x64/NvBlast_x64.dll.meta @@ -0,0 +1,24 @@ +fileFormatVersion: 2 +guid: d4d685ec2feb3a44cbe25c63b769a3b6 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + userData: + assetBundleName: + assetBundleVariant: diff --git a/examples/UnityExample/Assets/Scripts/CubeFamily.cs b/examples/UnityExample/Assets/Scripts/CubeFamily.cs index 0d77853..1139078 100755 --- a/examples/UnityExample/Assets/Scripts/CubeFamily.cs +++ b/examples/UnityExample/Assets/Scripts/CubeFamily.cs @@ -14,7 +14,7 @@ public class CubeFamily : MonoBehaviour NvBlastAssetDesc desc = _cubeAsset.solverAssetDesc;
_blastAsset = new NvBlastAsset(desc);
- Debug.Log(_blastAsset.leafChunkCount);
+// Debug.Log(_blastAsset.leafChunkCount);
// Actual Cubes
var cubePrefab = Resources.Load<GameObject>("CubePrefab");
@@ -39,7 +39,7 @@ public class CubeFamily : MonoBehaviour actorDesc.uniformInitialBondHealth = 1.0f;
actorDesc.uniformInitialLowerSupportChunkHealth = 1.0f;
var actor = new NvBlastActor(_blastFamily, actorDesc);
- Debug.Log(actor.visibleChunkCount);
+// Debug.Log(actor.visibleChunkCount);
OnActorCreated(actor, Vector3.zero, Quaternion.identity);
@@ -126,7 +126,7 @@ public class CubeFamily : MonoBehaviour return false;
}
- private void ApplyRadialDamage(NvBlastActor actor, Vector3 localPosition, float minRadius, float maxRadius, float compressive)
+ private void ApplyRadialDamage( NvBlastActor actor, Vector3 localPosition, float minRadius, float maxRadius, float compressive )
{
_fractureBuffers.chunkFractureCount = _cubeAsset.solverAssetDesc.chunkCount;
_fractureBuffers.bondFractureCount = _cubeAsset.solverAssetDesc.bondCount;
@@ -134,18 +134,35 @@ public class CubeFamily : MonoBehaviour NvBlastExtRadialDamageDesc desc = new NvBlastExtRadialDamageDesc();
desc.minRadius = minRadius;
desc.maxRadius = maxRadius;
- desc.compressive = compressive;
+ desc.damage = compressive;
desc.p0 = localPosition.x;
desc.p1 = localPosition.y;
desc.p2 = localPosition.z;
- if (actor.DamageRadialFalloff(_fractureBuffers, desc, 1, null))
- {
- Split(actor);
- }
+ IntPtr dam = Marshal.AllocHGlobal( Marshal.SizeOf( typeof(NvBlastExtRadialDamageDesc) ) );
+ Marshal.StructureToPtr( desc, dam, false );
+
+ var damP = new NvBlastDamageProgram() {
+ graphShaderFunction = NvBlastExtShadersWrapper.NvBlastExtFalloffGraphShader,
+ subgraphShaderFunction = NvBlastExtShadersWrapper.NvBlastExtFalloffSubgraphShader
+ };
+ var programParams = new NvBlastExtProgramParams() {
+ damageDescBuffer = dam,
+ material = IntPtr.Zero,
+ accelerator = IntPtr.Zero
+ };
+
+ actor.GenerateFracture( _fractureBuffers, damP, programParams );
+ actor.ApplyFracture( _fractureBuffers );
+ if ( _fractureBuffers.bondFractureCount + _fractureBuffers.chunkFractureCount > 0 )
+ {
+ Split( actor );
+ }
+
+ Marshal.FreeHGlobal(dam);
}
- private void Split(NvBlastActor actor)
+ private void Split( NvBlastActor actor )
{
NvBlastActorSplitEvent split = new NvBlastActorSplitEvent();
split.newActors = _newActorsBuffer;
diff --git a/examples/UnityExample/Assets/Scripts/Demo.cs b/examples/UnityExample/Assets/Scripts/Demo.cs index 725229e..cfb2570 100755 --- a/examples/UnityExample/Assets/Scripts/Demo.cs +++ b/examples/UnityExample/Assets/Scripts/Demo.cs @@ -8,7 +8,9 @@ public class Demo : MonoBehaviour void Awake ()
{
- generateCity();
+ //NativeLoader.Load();
+
+ generateCity();
}
private void generateCity()
|