add spectrogram texture generator
This commit is contained in:
parent
d00d95859f
commit
67eeb972e6
13 changed files with 1279 additions and 805 deletions
File diff suppressed because it is too large
Load diff
242
UnityProject/Assets/Materials/TextureMap.mat
Normal file
242
UnityProject/Assets/Materials/TextureMap.mat
Normal file
|
@ -0,0 +1,242 @@
|
|||
%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: TextureMap
|
||||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _AnisotropyMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BaseColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BentNormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _CoatMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DistortionVectorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissiveColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _HeightMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _IridescenceThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _NormalMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecularColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SubsurfaceMaskMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TangentMapOS:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ThicknessMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _TransmittanceColorMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _AORemapMax: 1
|
||||
- _AORemapMin: 0
|
||||
- _ATDistance: 1
|
||||
- _AlbedoAffectEmissive: 0
|
||||
- _AlphaCutoff: 0.5
|
||||
- _AlphaCutoffEnable: 0
|
||||
- _AlphaCutoffPostpass: 0.5
|
||||
- _AlphaCutoffPrepass: 0.5
|
||||
- _AlphaCutoffShadow: 0.5
|
||||
- _AlphaDstBlend: 0
|
||||
- _AlphaSrcBlend: 1
|
||||
- _Anisotropy: 0
|
||||
- _BlendMode: 0
|
||||
- _CoatMask: 0
|
||||
- _CullMode: 2
|
||||
- _CullModeForward: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DepthOffsetEnable: 0
|
||||
- _DetailAlbedoScale: 1
|
||||
- _DetailNormalScale: 1
|
||||
- _DetailSmoothnessScale: 1
|
||||
- _DiffusionProfile: 0
|
||||
- _DiffusionProfileHash: 0
|
||||
- _DisplacementLockObjectScale: 1
|
||||
- _DisplacementLockTilingScale: 1
|
||||
- _DisplacementMode: 0
|
||||
- _DistortionBlendMode: 0
|
||||
- _DistortionBlurBlendMode: 0
|
||||
- _DistortionBlurDstBlend: 0
|
||||
- _DistortionBlurRemapMax: 1
|
||||
- _DistortionBlurRemapMin: 0
|
||||
- _DistortionBlurScale: 1
|
||||
- _DistortionBlurSrcBlend: 0
|
||||
- _DistortionDepthTest: 1
|
||||
- _DistortionDstBlend: 0
|
||||
- _DistortionEnable: 0
|
||||
- _DistortionScale: 1
|
||||
- _DistortionSrcBlend: 0
|
||||
- _DistortionVectorBias: -1
|
||||
- _DistortionVectorScale: 2
|
||||
- _DoubleSidedEnable: 0
|
||||
- _DoubleSidedNormalMode: 1
|
||||
- _DstBlend: 0
|
||||
- _EmissiveColorMode: 1
|
||||
- _EmissiveExposureWeight: 1
|
||||
- _EmissiveIntensity: 1
|
||||
- _EmissiveIntensityUnit: 0
|
||||
- _EnableBlendModePreserveSpecularLighting: 1
|
||||
- _EnableFogOnTransparent: 1
|
||||
- _EnableGeometricSpecularAA: 0
|
||||
- _EnableSpecularOcclusion: 0
|
||||
- _EnergyConservingSpecularColor: 1
|
||||
- _HdrpVersion: 2
|
||||
- _HeightAmplitude: 0.02
|
||||
- _HeightCenter: 0.5
|
||||
- _HeightMapParametrization: 0
|
||||
- _HeightMax: 1
|
||||
- _HeightMin: -1
|
||||
- _HeightOffset: 0
|
||||
- _HeightPoMAmplitude: 2
|
||||
- _HeightTessAmplitude: 2
|
||||
- _HeightTessCenter: 0.5
|
||||
- _InvTilingScale: 1
|
||||
- _Ior: 1
|
||||
- _IridescenceMask: 1
|
||||
- _IridescenceThickness: 1
|
||||
- _LinkDetailsWithBase: 1
|
||||
- _MaterialID: 1
|
||||
- _Metallic: 0
|
||||
- _NormalMapSpace: 0
|
||||
- _NormalScale: 1
|
||||
- _PPDLodThreshold: 5
|
||||
- _PPDMaxSamples: 15
|
||||
- _PPDMinSamples: 5
|
||||
- _PPDPrimitiveLength: 1
|
||||
- _PPDPrimitiveWidth: 1
|
||||
- _ReceivesSSR: 1
|
||||
- _RefractionModel: 0
|
||||
- _SSRefractionProjectionModel: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessRemapMax: 1
|
||||
- _SmoothnessRemapMin: 0
|
||||
- _SpecularAAScreenSpaceVariance: 0.1
|
||||
- _SpecularAAThreshold: 0.2
|
||||
- _SrcBlend: 1
|
||||
- _StencilRef: 2
|
||||
- _StencilRefDepth: 0
|
||||
- _StencilRefDistortionVec: 64
|
||||
- _StencilRefGBuffer: 2
|
||||
- _StencilRefMV: 128
|
||||
- _StencilWriteMask: 3
|
||||
- _StencilWriteMaskDepth: 32
|
||||
- _StencilWriteMaskDistortionVec: 64
|
||||
- _StencilWriteMaskGBuffer: 3
|
||||
- _StencilWriteMaskMV: 128
|
||||
- _SubsurfaceMask: 1
|
||||
- _SupportDecals: 1
|
||||
- _SurfaceType: 0
|
||||
- _TexWorldScale: 1
|
||||
- _TexWorldScaleEmissive: 1
|
||||
- _Thickness: 1
|
||||
- _ThicknessMultiplier: 1
|
||||
- _TransmissionEnable: 1
|
||||
- _TransparentBackfaceEnable: 0
|
||||
- _TransparentCullMode: 2
|
||||
- _TransparentDepthPostpassEnable: 0
|
||||
- _TransparentDepthPrepassEnable: 0
|
||||
- _TransparentSortPriority: 0
|
||||
- _TransparentWritingMotionVec: 0
|
||||
- _UVBase: 0
|
||||
- _UVDetail: 0
|
||||
- _UVEmissive: 0
|
||||
- _UseEmissiveIntensity: 0
|
||||
- _UseShadowThreshold: 0
|
||||
- _ZTestDepthEqualForOpaque: 4
|
||||
- _ZTestGBuffer: 4
|
||||
- _ZTestModeDistortion: 8
|
||||
- _ZTestTransparent: 4
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
|
||||
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
|
||||
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
|
||||
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
|
||||
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
|
8
UnityProject/Assets/Materials/TextureMap.mat.meta
Normal file
8
UnityProject/Assets/Materials/TextureMap.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 416cd1054fe561246b9c57b0f3b4ad15
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -139,20 +139,19 @@ GameObject:
|
|||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!64 &90124697
|
||||
MeshCollider:
|
||||
--- !u!114 &90124697
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 90124696}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Convex: 0
|
||||
m_CookingOptions: 14
|
||||
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 126d8ce7fcb65564f97a02ec1f5d7fde, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
spectrogram: {fileID: 130019220}
|
||||
--- !u!23 &90124698
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -170,7 +169,7 @@ MeshRenderer:
|
|||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2}
|
||||
- {fileID: 2100000, guid: 416cd1054fe561246b9c57b0f3b4ad15, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
|
@ -243,6 +242,9 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 3ba69cee3466a304d9d570268f717413, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
onControlMessageReceived:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
samplePlayback: 0
|
||||
--- !u!4 &130019219
|
||||
Transform:
|
||||
|
@ -267,10 +269,10 @@ MonoBehaviour:
|
|||
m_GameObject: {fileID: 130019217}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 773d4bc755fe4e4a9ddf830af14ff758, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: a725a1321c35328439b3d1ac5ece95c3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
PdBackend: {fileID: 0}
|
||||
pdBackend: {fileID: 130019218}
|
||||
channel: 1
|
||||
--- !u!1 &404245778
|
||||
GameObject:
|
||||
|
@ -591,6 +593,8 @@ GameObject:
|
|||
m_Component:
|
||||
- component: {fileID: 1967946579}
|
||||
- component: {fileID: 1967946578}
|
||||
- component: {fileID: 1967946581}
|
||||
- component: {fileID: 1967946580}
|
||||
m_Layer: 0
|
||||
m_Name: Directional Light
|
||||
m_TagString: Untagged
|
||||
|
@ -609,7 +613,7 @@ Light:
|
|||
serializedVersion: 9
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Intensity: 3.1415927
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
|
@ -649,7 +653,7 @@ Light:
|
|||
m_Bits: 4294967295
|
||||
m_RenderingLayerMask: 1
|
||||
m_Lightmapping: 4
|
||||
m_LightShadowCasterMode: 0
|
||||
m_LightShadowCasterMode: 2
|
||||
m_AreaSize: {x: 1, y: 1}
|
||||
m_BounceIntensity: 1
|
||||
m_ColorTemperature: 6570
|
||||
|
@ -672,6 +676,107 @@ Transform:
|
|||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
|
||||
--- !u!114 &1967946580
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967946577}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c6c2871f720b2af4e9210febdac74517, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Version: 1
|
||||
shadowResolution: 512
|
||||
shadowDimmer: 1
|
||||
volumetricShadowDimmer: 1
|
||||
shadowFadeDistance: 10000
|
||||
contactShadows: 0
|
||||
shadowTint: {r: 0, g: 0, b: 0, a: 1}
|
||||
viewBiasMin: 0.2
|
||||
viewBiasMax: 100
|
||||
viewBiasScale: 1
|
||||
normalBiasMin: 0.5
|
||||
normalBiasMax: 0.5
|
||||
normalBiasScale: 1
|
||||
sampleBiasScale: 0
|
||||
edgeLeakFixup: 0
|
||||
edgeToleranceNormal: 1
|
||||
edgeTolerance: 1
|
||||
shadowCascadeCount: 4
|
||||
shadowCascadeRatios:
|
||||
- 0.05
|
||||
- 0.2
|
||||
- 0.3
|
||||
shadowCascadeBorders:
|
||||
- 0.2
|
||||
- 0.2
|
||||
- 0.2
|
||||
- 0.2
|
||||
shadowAlgorithm: 0
|
||||
shadowVariant: 0
|
||||
shadowPrecision: 0
|
||||
--- !u!114 &1967946581
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967946577}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 5
|
||||
m_Version: 5
|
||||
directionalIntensity: 3.1415927
|
||||
punctualIntensity: 600
|
||||
areaIntensity: 200
|
||||
enableSpotReflector: 0
|
||||
luxAtDistance: 1
|
||||
m_InnerSpotPercent: 0
|
||||
lightDimmer: 1
|
||||
m_VolumetricDimmer: 1
|
||||
lightUnit: 2
|
||||
fadeDistance: 10000
|
||||
affectDiffuse: 1
|
||||
affectSpecular: 1
|
||||
nonLightmappedOnly: 0
|
||||
lightTypeExtent: 0
|
||||
m_SpotLightShape: 0
|
||||
shapeWidth: 0.5
|
||||
shapeHeight: 0.5
|
||||
aspectRatio: 1
|
||||
shapeRadius: 0
|
||||
maxSmoothness: 0.99
|
||||
applyRangeAttenuation: 1
|
||||
useOldInspector: 0
|
||||
useVolumetric: 1
|
||||
featuresFoldout: 1
|
||||
showAdditionalSettings: 0
|
||||
displayLightIntensity: 3.1415927
|
||||
displayAreaLightEmissiveMesh: 0
|
||||
areaLightCookie: {fileID: 0}
|
||||
areaLightShadowCone: 120
|
||||
useScreenSpaceShadows: 0
|
||||
evsmExponent: 15
|
||||
evsmLightLeakBias: 0
|
||||
evsmVarianceBias: 0.00001
|
||||
evsmBlurPasses: 0
|
||||
lightLayers: 1
|
||||
lightlayersMask: 1
|
||||
linkShadowLayers: 1
|
||||
shadowNearPlane: 0.1
|
||||
shadowSoftness: 0.5
|
||||
blockerSampleCount: 24
|
||||
filterSampleCount: 16
|
||||
minFilterSize: 0.00001
|
||||
kernelSize: 5
|
||||
lightAngle: 1
|
||||
maxDepthBias: 0.001
|
||||
--- !u!1 &2147024058
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
23
UnityProject/Assets/Scenes/Examples/Texture/TextureMapper.cs
Normal file
23
UnityProject/Assets/Scenes/Examples/Texture/TextureMapper.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace cylvester
|
||||
{
|
||||
public class TextureMapper : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Spectrogram spectrogram;
|
||||
private Renderer renderer_;
|
||||
private static readonly int baseColorMap_ = Shader.PropertyToID("_BaseColorMap");
|
||||
|
||||
void Start()
|
||||
{
|
||||
renderer_ = GetComponent<Renderer>();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
renderer_.material.SetTexture(baseColorMap_, spectrogram.Texture);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 126d8ce7fcb65564f97a02ec1f5d7fde
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
52
UnityProject/Assets/Scripts/PdConnection/Spectrogram.cs
Normal file
52
UnityProject/Assets/Scripts/PdConnection/Spectrogram.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace cylvester
|
||||
{
|
||||
public interface ISpectrogram
|
||||
{
|
||||
Texture2D Texture { get; }
|
||||
}
|
||||
|
||||
public class Spectrogram : MonoBehaviour, ISpectrogram
|
||||
{
|
||||
[SerializeField] private PdBackend pdBackend;
|
||||
[SerializeField, Range(1, 16)] private int channel = 1;
|
||||
|
||||
private SpectrumArraySelector spectrumArraySelector_;
|
||||
private Texture2D texture_;
|
||||
private int index_;
|
||||
|
||||
void Start()
|
||||
{
|
||||
spectrumArraySelector_ = new SpectrumArraySelector(pdBackend.SpectrumArrayContainer);
|
||||
texture_ = new Texture2D(PdConstant.FftSize, PdConstant.FftSize, TextureFormat.R8, false);
|
||||
|
||||
var pixels = texture_.GetPixels();
|
||||
for (var i = 0;i < pixels.Length; ++i)
|
||||
pixels[i] = Color.black;
|
||||
texture_.SetPixels(pixels);
|
||||
texture_.Apply();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
spectrumArraySelector_.Selection = channel - 1;
|
||||
var array = spectrumArraySelector_.SelectedArray;
|
||||
for (var i = 0; i < PdConstant.FftSize; i++)
|
||||
{
|
||||
texture_.SetPixel(i, index_, new Color(array[i], 0f, 0f));
|
||||
}
|
||||
|
||||
texture_.Apply();
|
||||
|
||||
index_++;
|
||||
index_ %= PdConstant.FftSize;
|
||||
}
|
||||
|
||||
public Texture2D Texture => texture_;
|
||||
}
|
||||
|
||||
|
||||
}
|
11
UnityProject/Assets/Scripts/PdConnection/Spectrogram.cs.meta
Normal file
11
UnityProject/Assets/Scripts/PdConnection/Spectrogram.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a725a1321c35328439b3d1ac5ece95c3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -4,7 +4,7 @@ namespace cylvester
|
|||
{
|
||||
public class WaveformTexture : MonoBehaviour
|
||||
{
|
||||
[SerializeField] PdBackend PdBackend;
|
||||
[SerializeField] PdBackend PdBackend = null;
|
||||
[SerializeField, Range(1, 16)] private int channel = 1;
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ namespace cylvester
|
|||
|
||||
private void Update()
|
||||
{
|
||||
var spectrum = PdBackend.SpectrumArrayContainer[channel];
|
||||
|
||||
|
||||
texture2D_.Apply();
|
||||
|
|
8
UnityProject/Assets/Scripts/UnitTest.meta
Normal file
8
UnityProject/Assets/Scripts/UnitTest.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 14b20e54517dff5419ed18c623ac9653
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -21,4 +21,5 @@ namespace Visualizer
|
|||
renderer_.material.SetTexture(BaseColorMap, kinectManagerBehaviour.KinectSensor.InfraredCamera.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
UnityProject/Assets/Shader.meta
Normal file
8
UnityProject/Assets/Shader.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a136572b1ed0a3d4baf99141901819b6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,10 +1,13 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{44FB577D-A191-A45C-C159-30222C80D6CB}"
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.705
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{5B580621-09B4-68CB-B5F4-5B9DD210A60F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest.csproj", "{37CA0EC1-EC99-91AA-7DD8-65B57E5E5258}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest.csproj", "{7449DEC9-8E4D-BE43-C884-91467088ABED}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{16164DC1-A27D-76C5-94A1-007A2D8E952C}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -12,22 +15,25 @@ Global
|
|||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{44FB577D-A191-A45C-C159-30222C80D6CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{44FB577D-A191-A45C-C159-30222C80D6CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{44FB577D-A191-A45C-C159-30222C80D6CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{44FB577D-A191-A45C-C159-30222C80D6CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37CA0EC1-EC99-91AA-7DD8-65B57E5E5258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37CA0EC1-EC99-91AA-7DD8-65B57E5E5258}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37CA0EC1-EC99-91AA-7DD8-65B57E5E5258}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37CA0EC1-EC99-91AA-7DD8-65B57E5E5258}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{16164DC1-A27D-76C5-94A1-007A2D8E952C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{16164DC1-A27D-76C5-94A1-007A2D8E952C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{16164DC1-A27D-76C5-94A1-007A2D8E952C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{16164DC1-A27D-76C5-94A1-007A2D8E952C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5B580621-09B4-68CB-B5F4-5B9DD210A60F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5B580621-09B4-68CB-B5F4-5B9DD210A60F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5B580621-09B4-68CB-B5F4-5B9DD210A60F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5B580621-09B4-68CB-B5F4-5B9DD210A60F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5D5A7002-CD46-4C87-9CF9-02F5C9B7FCA0}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Assembly-CSharp.csproj
|
||||
EndGlobalSection
|
||||
|
|
Loading…
Reference in a new issue