shitty spice v2 cause i lost the first one :(
This commit is contained in:
1 parent
c62f6d6a3a
commit
5d3cbd99c5
10 files changed
+10706
-2687
No files matched your search
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e46cc55072153064f9b06de7b39c22bd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine.VFX.Utility;
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
|
||||
namespace Assets.WasapiAudio.Scripts.Unity
|
||||
{
|
||||
[AddComponentMenu("VFX/Property Binders/Spectre - VFX Binder")]
|
||||
[VFXBinder("Audio/Audio Spectrum Data to AttributeMap")]
|
||||
public class SpectreVfxBinder : VfxAudioVisualizationEffect
|
||||
{
|
||||
[VFXPropertyBinding("System.UInt32"), SerializeField]
|
||||
protected ExposedProperty SpectrumSizeParameter = "SpectrumSize";
|
||||
|
||||
[VFXPropertyBinding("UnityEngine.Texture2D"), SerializeField]
|
||||
protected ExposedProperty SpectrumDataTextureParameter = "SpectrumDataTexture";
|
||||
|
||||
public bool symmetric = false;
|
||||
|
||||
private Texture2D _texture;
|
||||
private Color[] _colorCache;
|
||||
|
||||
private void InitialiseTexture() {
|
||||
Debug.Log("Reinitialising spectrum texture...");
|
||||
if (symmetric) {
|
||||
_texture = new Texture2D(SpectrumSize * 2, 1, TextureFormat.RFloat, false);
|
||||
_colorCache = new Color[SpectrumSize * 2];
|
||||
} else {
|
||||
_texture = new Texture2D(SpectrumSize, 1, TextureFormat.RFloat, false);
|
||||
_colorCache = new Color[SpectrumSize];
|
||||
}
|
||||
|
||||
_texture.name = $"AudioSpectrumData{SpectrumSize}";
|
||||
}
|
||||
|
||||
private void UpdateTexture() {
|
||||
// init
|
||||
if (_texture == null) InitialiseTexture();
|
||||
|
||||
// has symmetric been toggled and the texture needs updating?
|
||||
if (symmetric && _texture.width != SpectrumSize * 2) InitialiseTexture();
|
||||
if (!symmetric && _texture.width != SpectrumSize) InitialiseTexture();
|
||||
|
||||
var spectrumData = GetSpectrumData();
|
||||
|
||||
if (symmetric) {
|
||||
for (int i = 0; i < SpectrumSize; i++) {
|
||||
_colorCache[SpectrumSize + i] = new Color(spectrumData[i], 0, 0, 0);
|
||||
_colorCache[SpectrumSize - (i + 1)] = new Color(spectrumData[i], 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < SpectrumSize; i++) {
|
||||
_colorCache[i] = new Color(spectrumData[i], 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
_texture.SetPixels(_colorCache);
|
||||
_texture.Apply();
|
||||
}
|
||||
|
||||
public override void UpdateBinding(VisualEffect component) {
|
||||
base.UpdateBinding(component);
|
||||
UpdateTexture();
|
||||
if (symmetric) {
|
||||
component.SetUInt(SpectrumSizeParameter, (uint) SpectrumSize * 2);
|
||||
} else {
|
||||
component.SetUInt(SpectrumSizeParameter, (uint) SpectrumSize);
|
||||
}
|
||||
component.SetTexture(SpectrumDataTextureParameter, _texture);
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return "Audio Spectrum Data";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 666ed31c9f08cb94ca07ec698efa8240
|
||||
guid: d2c94a50cf5c1d2449fe8305e8a79075
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
+19
-16
@@ -4,9 +4,9 @@ using UnityEngine.VFX.Utility;
|
||||
|
||||
namespace Assets.WasapiAudio.Scripts.Unity
|
||||
{
|
||||
[AddComponentMenu("VFX/Property Binders/VFX Audio Spectrum Data Binder SDF")]
|
||||
[VFXBinder("Audio/Audio Spectrum Data to 3d AttributeMap")]
|
||||
public class VfxAudioSpectrumDataBinder3d : VfxAudioVisualizationEffect
|
||||
[AddComponentMenu("VFX/Property Binders/Spectre - VFX SDF Binder")]
|
||||
[VFXBinder("Audio/Audio Spectrum Data to 3d SDF AttributeMap")]
|
||||
public class SpectreVfxSdfBinder : VfxAudioVisualizationEffect
|
||||
{
|
||||
[VFXPropertyBinding("System.UInt32"), SerializeField]
|
||||
protected ExposedProperty SpectrumSizeParameter = "SpectrumSize";
|
||||
@@ -23,31 +23,34 @@ namespace Assets.WasapiAudio.Scripts.Unity
|
||||
{
|
||||
if (_texture == null)
|
||||
{
|
||||
_texture = new Texture3D(SpectrumSize, SpectrumSize, SpectrumSize, TextureFormat.RFloat, false);
|
||||
_texture = new Texture3D(SpectrumSize * 2, SpectrumSize * 2, SpectrumSize * 2, TextureFormat.RFloat, false);
|
||||
_texture.name = $"AudioSpectrumDataSDF{SpectrumSize}";
|
||||
_colorCache = new Color[SpectrumSize * SpectrumSize * SpectrumSize];
|
||||
_colorCache = new Color[
|
||||
SpectrumSize * 2 *
|
||||
SpectrumSize * 2 *
|
||||
SpectrumSize * 2
|
||||
];
|
||||
}
|
||||
|
||||
var spectrumData = GetSpectrumData();
|
||||
|
||||
// go from 0 to end of spectrum
|
||||
for (int x = 0; x < SpectrumSize; x++) {
|
||||
float height = spectrumData[x] * SpectrumSize;
|
||||
float height = spectrumData[x] * SpectrumSize * 2;
|
||||
|
||||
// go from 0 to the height of the spectrum
|
||||
for (int y = 0; y < SpectrumSize; y++) {
|
||||
float distance = y - height;
|
||||
// go from 0 to double the spectrum height
|
||||
for (int y = 0; y < SpectrumSize * 2; y++) {
|
||||
float distance = (y - height);
|
||||
|
||||
_colorCache[(z * SpectrumSize * SpectrumSize) + (y * SpectrumSize) + x] = new Color(distance, 0, 0, 0);
|
||||
// if (x == SpectrumSize - 1) {
|
||||
// _colorCache[(z * SpectrumSize * SpectrumSize) + (y * SpectrumSize) + x] = new Color(Mathf.Infinity, 0, 0, 0);
|
||||
// } else {
|
||||
// _colorCache[(z * SpectrumSize * SpectrumSize) + (y * SpectrumSize) + x] = new Color(distance, 0, 0, 0);
|
||||
// }
|
||||
var z_part = z * (SpectrumSize * 2 * SpectrumSize * 2);
|
||||
var y_part = y * SpectrumSize * 2;
|
||||
|
||||
_colorCache[z_part + y_part + (SpectrumSize + x)] = new Color(distance, 0, 0, 0);
|
||||
_colorCache[z_part + y_part + (SpectrumSize - (x + 1))] = new Color(distance, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
z = (z + 1) % SpectrumSize;
|
||||
z = (z + 1) % (SpectrumSize * 2);
|
||||
|
||||
// Debug.Log($"{z}");
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42ceea4a053d2f244b3c6dd469a1fdfb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+5374
-1084
File diff suppressed because it is too large.
Load diff
+118
-31
@@ -100,15 +100,15 @@ MonoBehaviour:
|
||||
- model: {fileID: 8926484042661615243}
|
||||
id: 0
|
||||
isStickyNote: 0
|
||||
- model: {fileID: 8926484042661615346}
|
||||
id: 4
|
||||
isStickyNote: 0
|
||||
- model: {fileID: 8926484042661615350}
|
||||
id: 1
|
||||
isStickyNote: 0
|
||||
- model: {fileID: 8926484042661615350}
|
||||
id: 2
|
||||
isStickyNote: 0
|
||||
- model: {fileID: 8926484042661615355}
|
||||
id: 0
|
||||
isStickyNote: 0
|
||||
stickyNoteInfos:
|
||||
- title: Have to index into the texture as a float
|
||||
position:
|
||||
@@ -181,6 +181,7 @@ MonoBehaviour:
|
||||
- {fileID: 8926484042661615346}
|
||||
- {fileID: 8926484042661615348}
|
||||
- {fileID: 8926484042661615350}
|
||||
- {fileID: 8926484042661615355}
|
||||
m_UIPosition: {x: 0, y: 0}
|
||||
m_UICollapsed: 1
|
||||
m_UISuperCollapsed: 0
|
||||
@@ -237,8 +238,8 @@ MonoBehaviour:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_SerializableObject: 1
|
||||
min: 1
|
||||
m_SerializableObject: 100
|
||||
min: 0.1
|
||||
max: 100
|
||||
enumValues: []
|
||||
descendantCount: 0
|
||||
@@ -270,6 +271,20 @@ MonoBehaviour:
|
||||
max: 300
|
||||
enumValues: []
|
||||
descendantCount: 0
|
||||
- name: Depth
|
||||
path: Depth
|
||||
tooltip:
|
||||
sheetType: m_Float
|
||||
realType: Single
|
||||
defaultValue:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_SerializableObject: 100
|
||||
min: -Infinity
|
||||
max: Infinity
|
||||
enumValues: []
|
||||
descendantCount: 0
|
||||
m_ImportDependencies: []
|
||||
m_GraphVersion: 6
|
||||
m_ResourceVersion: 1
|
||||
@@ -1388,7 +1403,7 @@ MonoBehaviour:
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615347}
|
||||
- {fileID: 8926484042661615356}
|
||||
--- !u!114 &8926484042661614865
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3131,7 +3146,7 @@ MonoBehaviour:
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615347}
|
||||
- {fileID: 8926484042661615356}
|
||||
--- !u!114 &8926484042661615162
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3808,7 +3823,7 @@ MonoBehaviour:
|
||||
m_Parent: {fileID: 114350483966674976}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 660, y: 380}
|
||||
m_UICollapsed: 1
|
||||
m_UICollapsed: 0
|
||||
m_UISuperCollapsed: 0
|
||||
m_InputSlots:
|
||||
- {fileID: 8926484042661615311}
|
||||
@@ -3858,7 +3873,7 @@ MonoBehaviour:
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615347}
|
||||
- {fileID: 8926484042661615356}
|
||||
--- !u!114 &8926484042661615312
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -3944,7 +3959,7 @@ MonoBehaviour:
|
||||
m_Parent: {fileID: 114350483966674976}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 660, y: 287}
|
||||
m_UICollapsed: 1
|
||||
m_UICollapsed: 0
|
||||
m_UISuperCollapsed: 0
|
||||
m_InputSlots:
|
||||
- {fileID: 8926484042661615315}
|
||||
@@ -4297,7 +4312,7 @@ MonoBehaviour:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_SerializableObject: 1
|
||||
m_SerializableObject: 0.1
|
||||
m_Max:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
@@ -4340,7 +4355,7 @@ MonoBehaviour:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_SerializableObject: 1
|
||||
m_SerializableObject: 100
|
||||
m_Space: 2147483647
|
||||
m_Property:
|
||||
name: o
|
||||
@@ -4390,15 +4405,6 @@ MonoBehaviour:
|
||||
m_ValueFilter: 1
|
||||
m_Tooltip:
|
||||
m_Nodes:
|
||||
- m_Id: 0
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615347}
|
||||
inputSlot: {fileID: 8926484042661615311}
|
||||
- outputSlot: {fileID: 8926484042661615347}
|
||||
inputSlot: {fileID: 8926484042661614864}
|
||||
position: {x: 460, y: 364}
|
||||
expandedSlots: []
|
||||
expanded: 0
|
||||
- m_Id: 1
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615347}
|
||||
@@ -4424,13 +4430,6 @@ MonoBehaviour:
|
||||
position: {x: -601, y: 413}
|
||||
expandedSlots: []
|
||||
expanded: 0
|
||||
- m_Id: 4
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615347}
|
||||
inputSlot: {fileID: 8926484042661615160}
|
||||
position: {x: -368, y: 1310}
|
||||
expandedSlots: []
|
||||
expanded: 0
|
||||
- m_Id: 5
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615347}
|
||||
@@ -4472,14 +4471,11 @@ MonoBehaviour:
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 1
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615311}
|
||||
- {fileID: 8926484042661614864}
|
||||
- {fileID: 8926484042661615315}
|
||||
- {fileID: 8926484042661614863}
|
||||
- {fileID: 8926484042661615307}
|
||||
- {fileID: 8926484042661614862}
|
||||
- {fileID: 8926484042661615060}
|
||||
- {fileID: 8926484042661615160}
|
||||
- {fileID: 8926484042661614886}
|
||||
--- !u!114 &8926484042661615348
|
||||
MonoBehaviour:
|
||||
@@ -4766,3 +4762,94 @@ MonoBehaviour:
|
||||
m_Direction: 0
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615351}
|
||||
--- !u!114 &8926484042661615355
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 330e0fca1717dde4aaa144f48232aa64, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UIIgnoredErrors: []
|
||||
m_Parent: {fileID: 114350483966674976}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 0, y: 0}
|
||||
m_UICollapsed: 0
|
||||
m_UISuperCollapsed: 0
|
||||
m_InputSlots: []
|
||||
m_OutputSlots:
|
||||
- {fileID: 8926484042661615356}
|
||||
m_ExposedName: Depth
|
||||
m_Exposed: 1
|
||||
m_Order: 6
|
||||
m_Category:
|
||||
m_Min:
|
||||
m_Type:
|
||||
m_SerializableType:
|
||||
m_SerializableObject:
|
||||
m_Max:
|
||||
m_Type:
|
||||
m_SerializableType:
|
||||
m_SerializableObject:
|
||||
m_IsOutput: 0
|
||||
m_EnumValues: []
|
||||
m_ValueFilter: 0
|
||||
m_Tooltip:
|
||||
m_Nodes:
|
||||
- m_Id: 0
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615356}
|
||||
inputSlot: {fileID: 8926484042661615160}
|
||||
position: {x: -377, y: 1310}
|
||||
expandedSlots: []
|
||||
expanded: 0
|
||||
- m_Id: 1
|
||||
linkedSlots:
|
||||
- outputSlot: {fileID: 8926484042661615356}
|
||||
inputSlot: {fileID: 8926484042661615311}
|
||||
- outputSlot: {fileID: 8926484042661615356}
|
||||
inputSlot: {fileID: 8926484042661614864}
|
||||
position: {x: 451, y: 364}
|
||||
expandedSlots: []
|
||||
expanded: 0
|
||||
--- !u!114 &8926484042661615356
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f780aa281814f9842a7c076d436932e7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UIIgnoredErrors: []
|
||||
m_Parent: {fileID: 0}
|
||||
m_Children: []
|
||||
m_UIPosition: {x: 0, y: 0}
|
||||
m_UICollapsed: 1
|
||||
m_UISuperCollapsed: 0
|
||||
m_MasterSlot: {fileID: 8926484042661615356}
|
||||
m_MasterData:
|
||||
m_Owner: {fileID: 8926484042661615355}
|
||||
m_Value:
|
||||
m_Type:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_SerializableObject: 100
|
||||
m_Space: 2147483647
|
||||
m_Property:
|
||||
name: o
|
||||
m_serializedType:
|
||||
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
m_Direction: 1
|
||||
m_LinkedSlots:
|
||||
- {fileID: 8926484042661615160}
|
||||
- {fileID: 8926484042661615311}
|
||||
- {fileID: 8926484042661614864}
|
||||
+1297
-1555
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f4d1b3c66d22884aa1e76876e302e59
|
||||
VisualEffectImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user