Make Spectrogram Scrollable (Expose Index)

Also, write Reusable Shader for Spectrogram
This commit is contained in:
max 2019-11-18 12:37:32 +01:00
parent aaf398cd61
commit f51764016f
16 changed files with 2019 additions and 1493 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -9,13 +9,18 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: TextureMap
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
m_ShaderKeywords:
m_ShaderKeywords: _NORMALMAP_TANGENT_SPACE
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
disabledShaderPasses:
- DistortionVectors
- MOTIONVECTORS
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
@ -132,16 +137,16 @@ Material:
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 0
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 0
- _DistortionDstBlend: 1
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 0
- _DistortionSrcBlend: 1
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 0
@ -195,10 +200,10 @@ Material:
- _StencilRefGBuffer: 2
- _StencilRefMV: 128
- _StencilWriteMask: 3
- _StencilWriteMaskDepth: 32
- _StencilWriteMaskDepth: 48
- _StencilWriteMaskDistortionVec: 64
- _StencilWriteMaskGBuffer: 3
- _StencilWriteMaskMV: 128
- _StencilWriteMaskGBuffer: 51
- _StencilWriteMaskMV: 176
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _SurfaceType: 0
@ -218,9 +223,9 @@ Material:
- _UVEmissive: 0
- _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 4
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestModeDistortion: 8
- _ZTestModeDistortion: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:

View file

@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Chikashi
m_Shader: {fileID: -6465566751694194690, guid: 7c4fb62383d9e1a4e92bfb5939d1e04e,
m_Shader: {fileID: -6465566751694194690, guid: dba87f2457ea73049a3530f73e8006e2,
type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
@ -84,7 +84,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MyTexture:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 965d36ee5de48ea459184ffdd20071a1, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:

View file

@ -0,0 +1,71 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Spectrogram
m_Shader: {fileID: -6465566751694194690, guid: 7ca0c6c1f8af98c4c8cf0c119c1d6f4c,
type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
MotionVector: User
disabledShaderPasses:
- MOTIONVECTORS
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- Boolean_711EFCED: 1
- Vector1_62375FAB: 0
- Vector1_8A058030: 100
- Vector1_F0147E8A: 0
- Vector1_F3CA62BF: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _BlendMode: 0
- _CullMode: 2
- _CullModeForward: 2
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 2
- _DstBlend: 0
- _Index: 0
- _ReceivesSSR: 1
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 0
- _StencilRefDistortionVec: 64
- _StencilRefGBuffer: 2
- _StencilRefMV: 128
- _StencilWriteMask: 3
- _StencilWriteMaskDepth: 32
- _StencilWriteMaskDistortionVec: 64
- _StencilWriteMaskGBuffer: 3
- _StencilWriteMaskMV: 128
- _SurfaceType: 0
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentSortPriority: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 4
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 0
m_Colors:
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bc011735a2ae26747abeb14ea34f7289
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7ca0c6c1f8af98c4c8cf0c119c1d6f4c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View file

@ -155,7 +155,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 416cd1054fe561246b9c57b0f3b4ad15, type: 2}
- {fileID: 2100000, guid: bc011735a2ae26747abeb14ea34f7289, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -229,7 +229,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3ba69cee3466a304d9d570268f717413, type: 3}
m_Name:
m_EditorClassIdentifier:
onControlMessageReceived:
midiMessageReceived:
m_PersistentCalls:
m_Calls: []
midiSyncReceived:
m_PersistentCalls:
m_Calls: []
samplePlayback: 0

View file

@ -18,6 +18,7 @@ namespace cylvester
private Renderer spectroGramRenderer_;
private Renderer chikashiRenderer_;
private static readonly int baseColorMap_ = Shader.PropertyToID("_BaseColorMap");
private static readonly int spectrogramIndex_ = Shader.PropertyToID("_Index");
private static readonly int myTexture_ = Shader.PropertyToID("_MyTexture");
void Start()
@ -31,6 +32,7 @@ namespace cylvester
{
waveFormRenderer_.material.SetTexture(baseColorMap_, waveform.Texture);
spectroGramRenderer_.material.SetTexture(baseColorMap_, spectrogram.Texture);
spectroGramRenderer_.material.SetInt(spectrogramIndex_, spectrogram.Index);
chikashiRenderer_.material.SetTexture(myTexture_, waveform.Texture);
}
}

View file

@ -7,6 +7,7 @@ namespace cylvester
public interface ISpectrogram
{
Texture2D Texture { get; }
int Index { get; }
}
public class Spectrogram : MonoBehaviour, ISpectrogram
@ -46,6 +47,7 @@ namespace cylvester
}
public Texture2D Texture => texture_;
public int Index => index_;
}

View file

@ -9,7 +9,7 @@ namespace cylvester
Texture2D Texture { get; }
}
public class Waveform : MonoBehaviour, ISpectrogram
public class Waveform : MonoBehaviour, IWaveform
{
[SerializeField] private PdBackend pdBackend;
[SerializeField, Range(1, 16)] private int channel = 1;

View file

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{5B580621-09B4-68CB-B5F4-5B9DD210A60F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}"