移除postprocess方式的滤镜实现,改为graphics.Blit方式

This commit is contained in:
ALIENJACK 2024-12-25 01:03:00 +08:00
parent 4fbfd2cfc1
commit 34c7eef257
20 changed files with 298 additions and 419 deletions

View File

@ -25,12 +25,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9760340517325694} m_GameObject: {fileID: 9760340517325694}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 4232056521131536011} m_Father: {fileID: 4232056521131536011}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9003897287163669553 --- !u!114 &9003897287163669553
MonoBehaviour: MonoBehaviour:
@ -56,6 +57,7 @@ AudioSource:
serializedVersion: 4 serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0} OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0} m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1 m_PlayOnAwake: 1
m_Volume: 1 m_Volume: 1
m_Pitch: 1 m_Pitch: 1
@ -169,9 +171,9 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: -1, z: 1} m_LocalScale: {x: 1, y: -1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1038087993597378172} m_Father: {fileID: 1038087993597378172}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@ -240,11 +242,11 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3430872171738201552} - {fileID: 3430872171738201552}
- {fileID: 5684774662137182450} - {fileID: 5684774662137182450}
m_Father: {fileID: 4232056520494431727} m_Father: {fileID: 4232056520494431727}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
@ -289,12 +291,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4232056520112715746} m_GameObject: {fileID: 4232056520112715746}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 4232056521131536011} m_Father: {fileID: 4232056521131536011}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4232056520112715744 --- !u!114 &4232056520112715744
MonoBehaviour: MonoBehaviour:
@ -311,6 +314,8 @@ MonoBehaviour:
NesEmu: {fileID: 4232056521131536012} NesEmu: {fileID: 4232056521131536012}
DrawCanvas: {fileID: 4232056520494431724} DrawCanvas: {fileID: 4232056520494431724}
Image: {fileID: 4232056521759880274} Image: {fileID: 4232056521759880274}
GPUTurboMat_gpu: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2}
GPUTurbo: 1
--- !u!1 &4232056520494431712 --- !u!1 &4232056520494431712
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -322,7 +327,6 @@ GameObject:
- component: {fileID: 4232056520494431727} - component: {fileID: 4232056520494431727}
- component: {fileID: 4232056520494431724} - component: {fileID: 4232056520494431724}
- component: {fileID: 4232056520494431725} - component: {fileID: 4232056520494431725}
- component: {fileID: 4232056520494431726}
m_Layer: 5 m_Layer: 5
m_Name: Canvas m_Name: Canvas
m_TagString: Untagged m_TagString: Untagged
@ -340,11 +344,11 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 4232056521759880275} - {fileID: 4232056521759880275}
- {fileID: 1038087993597378172} - {fileID: 1038087993597378172}
m_Father: {fileID: 4232056521131536011} m_Father: {fileID: 4232056521131536011}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
@ -368,7 +372,9 @@ Canvas:
m_OverrideSorting: 0 m_OverrideSorting: 0
m_OverridePixelPerfect: 0 m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0 m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0 m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_TargetDisplay: 0 m_TargetDisplay: 0
@ -395,23 +401,6 @@ MonoBehaviour:
m_DefaultSpriteDPI: 96 m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1 m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0 m_PresetInfoIsWorld: 0
--- !u!114 &4232056520494431726
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4232056520494431712}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &4232056521131536013 --- !u!1 &4232056521131536013
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -436,15 +425,16 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4232056521131536013} m_GameObject: {fileID: 4232056521131536013}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 4232056520112715745} - {fileID: 4232056520112715745}
- {fileID: 4785916497946256520} - {fileID: 4785916497946256520}
- {fileID: 4232056520494431727} - {fileID: 4232056520494431727}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4232056521131536012 --- !u!114 &4232056521131536012
MonoBehaviour: MonoBehaviour:
@ -458,10 +448,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3} m_Script: {fileID: 11500000, guid: 39557e19783acee499ace6c68549e8f8, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
InputTemplate: {fileID: 0}
VideoProvider: {fileID: 4232056520112715744} VideoProvider: {fileID: 4232056520112715744}
AudioProvider: {fileID: 9003897287163669553} AudioProvider: {fileID: 9003897287163669553}
m_bPause: 0
--- !u!1 &4232056521759880276 --- !u!1 &4232056521759880276
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -490,9 +478,9 @@ RectTransform:
m_LocalRotation: {x: 1, y: 0, z: 0, w: 0} m_LocalRotation: {x: 1, y: 0, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 4232056520494431727} m_Father: {fileID: 4232056520494431727}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
@ -519,7 +507,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 07e28fcb992bc124e986f9d8ff3beb97, type: 2} m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1 m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
@ -562,9 +550,9 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1038087993597378172} m_Father: {fileID: 1038087993597378172}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}

View File

@ -353,7 +353,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
propertyPath: m_SizeDelta.x propertyPath: m_SizeDelta.x
value: 0 value: -0.97058296
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
propertyPath: m_SizeDelta.y propertyPath: m_SizeDelta.y
@ -389,7 +389,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
propertyPath: m_AnchoredPosition.x propertyPath: m_AnchoredPosition.x
value: 0 value: -0.48529053
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
@ -1092,7 +1092,7 @@ Canvas:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 serializedVersion: 3
m_RenderMode: 1 m_RenderMode: 1
m_Camera: {fileID: 1475480931} m_Camera: {fileID: 0}
m_PlaneDistance: 100 m_PlaneDistance: 100
m_PixelPerfect: 0 m_PixelPerfect: 0
m_ReceivesEvents: 1 m_ReceivesEvents: 1
@ -1153,7 +1153,6 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1639312037} - {fileID: 1639312037}
- {fileID: 1475480929}
- {fileID: 74796459} - {fileID: 74796459}
- {fileID: 1427887270} - {fileID: 1427887270}
- {fileID: 1599240741} - {fileID: 1599240741}
@ -1172,7 +1171,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 980f937ad27ad8540afeb8b7f100997e, type: 3} m_Script: {fileID: 11500000, guid: 980f937ad27ad8540afeb8b7f100997e, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_filterVolume: {fileID: 1475480930}
m_filterPreview: {fileID: 1124446961} m_filterPreview: {fileID: 1124446961}
m_xmbBg: {fileID: 730698712} m_xmbBg: {fileID: 730698712}
bTest: 0 bTest: 0
@ -1884,174 +1882,6 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
imgUI: {fileID: 1471857116} imgUI: {fileID: 1471857116}
--- !u!1 &1475480928
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1475480929}
- component: {fileID: 1475480931}
- component: {fileID: 1475480932}
- component: {fileID: 1475480930}
m_Layer: 5
m_Name: GameCamera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1475480929
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.98, y: 20.14, z: 6.23}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1335662459}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1475480930
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3}
m_Name:
m_EditorClassIdentifier:
sharedProfile: {fileID: 11400000, guid: 17060e2d2f9e5c340a526f08317e5a98, type: 2}
isGlobal: 1
blendDistance: 0
weight: 1
priority: 0
--- !u!20 &1475480931
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 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: 1
orthographic size: 5
m_Depth: -2
m_CullingMask:
serializedVersion: 2
m_Bits: 32
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!114 &1475480932
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1475480928}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3}
m_Name:
m_EditorClassIdentifier:
volumeTrigger: {fileID: 0}
volumeLayer:
serializedVersion: 2
m_Bits: 32
stopNaNPropagation: 1
finalBlitToCameraTarget: 0
antialiasingMode: 0
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
fastMode: 0
keepAlpha: 0
fog:
enabled: 1
excludeSkybox: 1
debugLayer:
lightMeter:
width: 512
height: 256
showCurves: 1
histogram:
width: 512
height: 256
channel: 3
waveform:
exposure: 0.12
height: 256
vectorscope:
size: 256
exposure: 0.12
overlaySettings:
linearDepth: 0
motionColorIntensity: 4
motionGridSize: 64
colorBlindnessType: 0
colorBlindnessStrength: 1
m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2}
m_ShowToolkit: 0
m_ShowCustomSorter: 0
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeStackBundles:
- assemblyQualifiedName: FixingPixelArtGrille, AxibugEmuOnline.Client, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
- assemblyQualifiedName: MattiasCRT, AxibugEmuOnline.Client, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null
- assemblyQualifiedName: LCDPostEffect, AxibugEmuOnline.Client, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=null
m_AfterStackBundles: []
--- !u!1 &1498586261 --- !u!1 &1498586261
GameObject: GameObject:
m_ObjectHideFlags: 3 m_ObjectHideFlags: 3
@ -2214,7 +2044,7 @@ GameObject:
- component: {fileID: 1639312035} - component: {fileID: 1639312035}
m_Layer: 0 m_Layer: 0
m_Name: UICamera m_Name: UICamera
m_TagString: Untagged m_TagString: MainCamera
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
@ -2263,7 +2093,7 @@ Camera:
field of view: 60 field of view: 60
orthographic: 1 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: -1 m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 32 m_Bits: 32

View File

@ -43,8 +43,6 @@ namespace AxibugEmuOnline.Client.ClientCore
#endif #endif
public static void Init(Initer initer, bool isTest = false, string testSrvIP = "") public static void Init(Initer initer, bool isTest = false, string testSrvIP = "")
{ {
PlayerPrefs.DeleteAll();
if (UnityEngine.Application.platform == RuntimePlatform.PSP2) if (UnityEngine.Application.platform == RuntimePlatform.PSP2)
{ {
//PSV 等平台需要手动创建目录 //PSV 等平台需要手动创建目录
@ -66,7 +64,7 @@ namespace AxibugEmuOnline.Client.ClientCore
CacheMgr = new CacheManager(); CacheMgr = new CacheManager();
roomMgr = new AppRoom(); roomMgr = new AppRoom();
share = new AppShare(); share = new AppShare();
filter = new FilterManager(initer.m_filterVolume, initer.m_filterPreview, initer.m_xmbBg); filter = new FilterManager(initer.m_filterPreview, initer.m_xmbBg);
bTest = isTest; bTest = isTest;
mTestSrvIP = testSrvIP; mTestSrvIP = testSrvIP;
var go = new GameObject("[AppAxibugEmuOnline]"); var go = new GameObject("[AppAxibugEmuOnline]");

View File

@ -1,28 +1,33 @@
using System; using Assets.Script.AppMain.Filter;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing; using UnityEngine.Rendering;
namespace AxibugEmuOnline.Client namespace AxibugEmuOnline.Client
{ {
public abstract class FilterEffect : PostProcessEffectSettings public abstract class FilterEffect
{ {
private List<EditableParamerter> m_editableParamList; public BoolParameter Enable = new BoolParameter(false);
public abstract string Name { get; }
public IReadOnlyCollection<EditableParamerter> EditableParam => m_editableParamList.AsReadOnly(); public IReadOnlyCollection<EditableParamerter> EditableParam => m_editableParamList.AsReadOnly();
public abstract string Name { get; } List<EditableParamerter> m_editableParamList;
Material m_material;
protected abstract string ShaderName { get; }
public FilterEffect() public FilterEffect()
{ {
GetEditableFilterParamters(); GetEditableFilterParamters();
m_material = new Material(Shader.Find(ShaderName));
} }
protected void GetEditableFilterParamters() void GetEditableFilterParamters()
{ {
var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public) var parameters = (from t in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public)
where t.FieldType.IsSubclassOf(typeof(ParameterOverride)) where t.FieldType.IsSubclassOf(typeof(FilterParameter))
where t.DeclaringType.IsSubclassOf(typeof(FilterEffect)) where t.DeclaringType.IsSubclassOf(typeof(FilterEffect))
orderby t.MetadataToken orderby t.MetadataToken
select t); select t);
@ -30,7 +35,7 @@ namespace AxibugEmuOnline.Client
m_editableParamList = new List<EditableParamerter>(); m_editableParamList = new List<EditableParamerter>();
foreach (var param in parameters) foreach (var param in parameters)
{ {
var paramObj = (ParameterOverride)param.GetValue(this); var paramObj = (FilterParameter)param.GetValue(this);
var rangeAtt = param.GetCustomAttribute<RangeAttribute>(); var rangeAtt = param.GetCustomAttribute<RangeAttribute>();
float min = 0; float min = 0;
float max = 10; float max = 10;
@ -44,47 +49,41 @@ namespace AxibugEmuOnline.Client
} }
} }
public void Render(RenderTexture rt, RenderTexture result)
{
m_material.SetTexture("_MainTex", rt);
OnRenderer(m_material, rt, result);
}
protected abstract void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result);
public class EditableParamerter public class EditableParamerter
{ {
private ParameterOverride m_paramObject; private FilterParameter m_paramObject;
private FieldInfo valueFieldInfo;
public Type ValueType { get; private set; } public Type ValueType => m_paramObject.ValueType;
public string Name { get; private set; } public string Name { get; private set; }
public object Value public object Value
{ {
get => valueFieldInfo.GetValue(m_paramObject); get => m_paramObject.Value;
set set => m_paramObject.Value = value;
{
valueFieldInfo.SetValue(m_paramObject, value);
m_paramObject.overrideState = true;
}
} }
public object MinValue { get; private set; } public object MinValue { get; private set; }
public object MaxValue { get; private set; } public object MaxValue { get; private set; }
public EditableParamerter(string name, ParameterOverride paramObject, object minValue, object maxValue) public EditableParamerter(string name, FilterParameter paramObject, object minValue, object maxValue)
{ {
m_paramObject = paramObject; m_paramObject = paramObject;
Name = name; Name = name;
var paramType = paramObject.GetType(); var paramType = paramObject.GetType();
valueFieldInfo = paramType.GetField("value", BindingFlags.Public | BindingFlags.Instance);
if (valueFieldInfo != null)
{
ValueType = valueFieldInfo.FieldType;
}
else
{
ValueType = typeof(object);
}
MinValue = minValue; MinValue = minValue;
MaxValue = maxValue; MaxValue = maxValue;
} }
public void ResetToDefault() => m_paramObject.overrideState = false; public void ResetToDefault() => m_paramObject.Value = null;
public void Apply(object overrideValue) public void Apply(object overrideValue)

View File

@ -3,14 +3,13 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using static AxibugEmuOnline.Client.FilterEffect; using static AxibugEmuOnline.Client.FilterEffect;
using static AxibugEmuOnline.Client.FilterManager;
namespace AxibugEmuOnline.Client namespace AxibugEmuOnline.Client
{ {
public class FilterManager public class FilterManager
{ {
private PostProcessProfile m_filterPorfile;
private List<Filter> m_filters; private List<Filter> m_filters;
private Dictionary<EnumPlatform, Filter> m_filterPlatforms = new Dictionary<EnumPlatform, Filter>(); private Dictionary<EnumPlatform, Filter> m_filterPlatforms = new Dictionary<EnumPlatform, Filter>();
private AlphaWraper m_previewFilterWraper; private AlphaWraper m_previewFilterWraper;
@ -20,18 +19,42 @@ namespace AxibugEmuOnline.Client
/// </summary> /// </summary>
public IReadOnlyList<Filter> Filters => m_filters; public IReadOnlyList<Filter> Filters => m_filters;
public FilterManager(PostProcessVolume filterVolume, CanvasGroup filterPreview, CanvasGroup mainBg) public FilterManager(CanvasGroup filterPreview, CanvasGroup mainBg)
{ {
if (filterVolume == null) m_filters = new List<Filter>
return; {
m_filterPorfile = filterVolume.profile; new Filter(new FixingPixelArtGrille()),
m_filters = m_filterPorfile.settings.Where(setting => setting is FilterEffect).Select(setting => new Filter(setting as FilterEffect)).ToList(); new Filter(new LCDPostEffect()),
new Filter(new MattiasCRT()),
};
var json = PlayerPrefs.GetString(nameof(FilterRomSetting)); var json = PlayerPrefs.GetString(nameof(FilterRomSetting));
m_filterRomSetting = JsonUtility.FromJson<FilterRomSetting>(json) ?? new FilterRomSetting(); m_filterRomSetting = JsonUtility.FromJson<FilterRomSetting>(json) ?? new FilterRomSetting();
m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false); m_previewFilterWraper = new AlphaWraper(mainBg, filterPreview, false);
ShutDownFilterPreview(); ShutDownFilterPreview();
ShutDownFilter(); ShutDownFilter();
}
private RenderTexture result = null;
public RenderTexture ExecuteFilterRender(RenderTexture rt)
{
if (result == null)
result = RenderTexture.GetTemporary(Screen.width, Screen.height);
bool anyFilterEnable = false;
foreach (var filter in Filters)
{
if (!filter.m_setting.Enable.GetValue()) continue;
filter.m_setting.Render(rt, result);
anyFilterEnable = true;
}
if (anyFilterEnable)
return result;
else
return rt;
} }
/// <summary> 关闭滤镜预览 </summary> /// <summary> 关闭滤镜预览 </summary>
@ -54,8 +77,8 @@ namespace AxibugEmuOnline.Client
{ {
foreach (var selfFiler in Filters) foreach (var selfFiler in Filters)
{ {
if (selfFiler != filter) selfFiler.m_setting.enabled.Override(false); if (selfFiler != filter) selfFiler.m_setting.Enable.Override(false);
else selfFiler.m_setting.enabled.Override(true); else selfFiler.m_setting.Enable.Override(true);
} }
} }
@ -65,8 +88,8 @@ namespace AxibugEmuOnline.Client
public void ShutDownFilter() public void ShutDownFilter()
{ {
//关闭所有后处理效果 //关闭所有后处理效果
foreach (var setting in m_filterPorfile.settings) foreach (var filter in Filters)
setting.enabled.Override(false); filter.m_setting.Enable.Override(false);
} }
/// <summary> /// <summary>
@ -329,7 +352,7 @@ namespace AxibugEmuOnline.Client
return JsonUtility.ToJson(this); return JsonUtility.ToJson(this);
} }
public ValueTuple<string,string> Get(RomFile rom) public ValueTuple<string, string> Get(RomFile rom)
{ {
prepareCache(); prepareCache();

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f61dfd2411084ec469cdb3faacca298e

View File

@ -0,0 +1,49 @@
using System;
using System.Collections;
using UnityEngine;
namespace Assets.Script.AppMain.Filter
{
public abstract class FilterParameter
{
public abstract Type ValueType { get; }
object m_overrideValue;
protected object m_defaultValue;
public object Value
{
get => m_overrideValue ?? m_defaultValue;
set => m_overrideValue = value;
}
}
public class FilterParameter<T> : FilterParameter
{
public override Type ValueType => typeof(T);
public void Override(T value)
{
Value = value;
}
public T GetValue() => (T)Value;
public FilterParameter(T defaultValue)
{
m_defaultValue = defaultValue;
}
}
public class BoolParameter : FilterParameter<bool>
{
public BoolParameter(bool defaultValue) : base(defaultValue) { }
}
public class Vector2Parameter : FilterParameter<Vector2>
{
public Vector2Parameter(Vector2 defaultValue) : base(defaultValue) { }
}
public class FloatParameter : FilterParameter<float>
{
public FloatParameter(float defaultValue) : base(defaultValue) { }
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 53e95955f1beeb34a87d2046875fa16f

View File

@ -1,50 +1,29 @@
using AxibugEmuOnline.Client; using Assets.Script.AppMain.Filter;
using AxibugEmuOnline.Client;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(FixingPixelArtGrilleRenderer), PostProcessEvent.BeforeStack, "Filter/FixingPixelArtGrille")]
public sealed class FixingPixelArtGrille : FilterEffect public sealed class FixingPixelArtGrille : FilterEffect
{ {
public override string Name => nameof(FixingPixelArtGrille); public override string Name => nameof(FixingPixelArtGrille);
public ParameterOverride<EnumMaskStyle> MaskStyle = new ParameterOverride<EnumMaskStyle> { value = EnumMaskStyle.ApertureGrille }; protected override string ShaderName => "PostEffect/FixingPixcelArtGrille";
public FilterParameter<EnumMaskStyle> MaskStyle = new FilterParameter<EnumMaskStyle>(EnumMaskStyle.ApertureGrille);
[Tooltip("Emulated input resolution\nOptimize for resize")] public Vector2Parameter DrawResolution = new Vector2Parameter(new Vector2(272, 240));
public Vector2Parameter DrawResolution = new Vector2Parameter
{
value = new Vector2(272, 240)
};
[Tooltip("Hardness of scanline")]
[Range(-32, 0)] [Range(-32, 0)]
public FloatParameter HardScan = new FloatParameter { value = -10 }; public FloatParameter HardScan = new FloatParameter(-10);
[Tooltip("Hardness of pixels in scanline")]
[Range(-6, 0)] [Range(-6, 0)]
public FloatParameter HardPix = new FloatParameter { value = -2 }; public FloatParameter HardPix = new FloatParameter(-2);
[Tooltip("Hardness of short vertical bloom")]
[Range(-8, 0)] [Range(-8, 0)]
public FloatParameter HardBloomScan = new FloatParameter { value = -4.0f }; public FloatParameter HardBloomScan = new FloatParameter(-4.0f);
[Tooltip("Hardness of short horizontal bloom")]
[Range(-4, 0)] [Range(-4, 0)]
public FloatParameter HardBloomPix = new FloatParameter { value = -1.5f }; public FloatParameter HardBloomPix = new FloatParameter(-1.5f);
[Tooltip("Amount of small bloom effect")]
[Range(0, 1)] [Range(0, 1)]
public FloatParameter BloomAmount = new FloatParameter { value = 1 / 16f }; public FloatParameter BloomAmount = new FloatParameter(1 / 16f);
public Vector2Parameter Warp = new Vector2Parameter(new Vector2(1f / 64f, 1f / 24f));
[Tooltip("Display warp")]
public Vector2Parameter Warp = new Vector2Parameter { value = new Vector2(1f / 64f, 1f / 24f) };
[Tooltip("Amount of shadow mask Light")]
[Range(1, 3)] [Range(1, 3)]
public FloatParameter MaskLight = new FloatParameter { value = 1.5f }; public FloatParameter MaskLight = new FloatParameter(1.5f);
[Range(0.1f, 1)] [Range(0.1f, 1)]
[Tooltip("Amount of shadow mask Dark")] public FloatParameter MaskDrak = new FloatParameter(0.5f);
public FloatParameter MaskDrak = new FloatParameter { value = 0.5f };
public enum EnumMaskStyle public enum EnumMaskStyle
{ {
@ -53,54 +32,41 @@ public sealed class FixingPixelArtGrille : FilterEffect
StretchedVGA, StretchedVGA,
VGAStyle VGAStyle
} }
}
public sealed class FixingPixelArtGrilleRenderer : PostProcessEffectRenderer<FixingPixelArtGrille>
{
private Shader shader;
private Material material;
public override void Init() protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
{ {
shader = Shader.Find("PostEffect/FixingPixcelArtGrille"); renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0));
material = new Material(shader); renderMat.SetVector("_res", new Vector4(DrawResolution.GetValue().x, DrawResolution.GetValue().y, 0, 0));
} renderMat.SetFloat("_hardScan", HardScan.GetValue());
renderMat.SetFloat("_hardPix", HardPix.GetValue());
renderMat.SetFloat("_hardBloomScan", HardBloomScan.GetValue());
renderMat.SetFloat("_hardBloomPix", HardBloomPix.GetValue());
renderMat.SetFloat("_bloomAmount", BloomAmount.GetValue());
renderMat.SetVector("_warp", Warp.GetValue());
renderMat.SetFloat("_maskDark", MaskDrak.GetValue());
renderMat.SetFloat("_maskLight", MaskLight.GetValue());
public override void Render(PostProcessRenderContext context) renderMat.DisableKeyword("_MASKSTYLE_VGASTYLE");
renderMat.DisableKeyword("_MASKSTYLE_TVSTYLE");
renderMat.DisableKeyword("_MASKSTYLE_APERTUREGRILLE");
renderMat.DisableKeyword("_MASKSTYLE_STRETCHEDVGA");
switch (MaskStyle.GetValue())
{ {
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0)); case EnumMaskStyle.VGAStyle:
var res = settings.DrawResolution; renderMat.EnableKeyword("_MASKSTYLE_VGASTYLE");
material.SetVector("_res", new Vector4(res.value.x, res.value.y, 0, 0));
material.SetFloat("_hardScan", settings.HardScan.value);
material.SetFloat("_hardPix", settings.HardPix.value);
material.SetFloat("_hardBloomScan", settings.HardBloomScan.value);
material.SetFloat("_hardBloomPix", settings.HardBloomPix.value);
material.SetFloat("_bloomAmount", settings.BloomAmount.value);
material.SetVector("_warp", settings.Warp.value);
material.SetFloat("_maskDark", settings.MaskDrak.value);
material.SetFloat("_maskLight", settings.MaskLight.value);
material.DisableKeyword("_MASKSTYLE_VGASTYLE");
material.DisableKeyword("_MASKSTYLE_TVSTYLE");
material.DisableKeyword("_MASKSTYLE_APERTUREGRILLE");
material.DisableKeyword("_MASKSTYLE_STRETCHEDVGA");
switch (settings.MaskStyle.value)
{
case FixingPixelArtGrille.EnumMaskStyle.VGAStyle:
material.EnableKeyword("_MASKSTYLE_VGASTYLE");
break; break;
case FixingPixelArtGrille.EnumMaskStyle.TVStyle: case EnumMaskStyle.TVStyle:
material.EnableKeyword("_MASKSTYLE_TVSTYLE"); renderMat.EnableKeyword("_MASKSTYLE_TVSTYLE");
break; break;
case FixingPixelArtGrille.EnumMaskStyle.ApertureGrille: case EnumMaskStyle.ApertureGrille:
material.EnableKeyword("_MASKSTYLE_APERTUREGRILLE"); renderMat.EnableKeyword("_MASKSTYLE_APERTUREGRILLE");
break; break;
case FixingPixelArtGrille.EnumMaskStyle.StretchedVGA: case EnumMaskStyle.StretchedVGA:
material.EnableKeyword("_MASKSTYLE_STRETCHEDVGA"); renderMat.EnableKeyword("_MASKSTYLE_STRETCHEDVGA");
break; break;
} }
Graphics.Blit(rt, result, renderMat);
context.command.Blit(context.source, context.destination, material);
} }
} }

View File

@ -31,7 +31,7 @@ MonoBehaviour:
active: 1 active: 1
enabled: enabled:
overrideState: 1 overrideState: 1
value: 1 value: 0
MaskStyle: MaskStyle:
overrideState: 0 overrideState: 0
value: 1 value: 1
@ -77,7 +77,7 @@ MonoBehaviour:
active: 1 active: 1
enabled: enabled:
overrideState: 1 overrideState: 1
value: 1 value: 0
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -155,7 +155,7 @@ MonoBehaviour:
active: 1 active: 1
enabled: enabled:
overrideState: 1 overrideState: 1
value: 1 value: 0
--- !u!114 &2118329037781486242 --- !u!114 &2118329037781486242
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 3 m_ObjectHideFlags: 3

View File

@ -1,28 +1,15 @@
using AxibugEmuOnline.Client; using AxibugEmuOnline.Client;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(LCDPostEffectRenderer), PostProcessEvent.BeforeStack, "Filter/LCDPostEffect")]
public sealed class LCDPostEffect : FilterEffect public sealed class LCDPostEffect : FilterEffect
{ {
public override string Name => nameof(LCDPostEffect); public override string Name => nameof(LCDPostEffect);
}
public sealed class LCDPostEffectRenderer : PostProcessEffectRenderer<LCDPostEffect> protected override string ShaderName => "Filter/LCDPostEffect";
{
private Shader shader;
private Material material;
public override void Init() protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
{ {
shader = Shader.Find("Filter/LCDPostEffect"); renderMat.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
material = new Material(shader); Graphics.Blit(rt, result, renderMat);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
context.command.Blit(context.source, context.destination, material);
} }
} }

View File

@ -1,28 +1,15 @@
using AxibugEmuOnline.Client; using AxibugEmuOnline.Client;
using UnityEngine; using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
[System.Serializable]
[PostProcess(typeof(MattiasCRTRenderer), PostProcessEvent.BeforeStack, "Filter/MattiasCRT")]
public sealed class MattiasCRT : FilterEffect public sealed class MattiasCRT : FilterEffect
{ {
public override string Name => nameof(MattiasCRT); public override string Name => nameof(MattiasCRT);
}
public sealed class MattiasCRTRenderer : PostProcessEffectRenderer<MattiasCRT> protected override string ShaderName => "Filter/MattiasCRT";
{
private Shader shader;
private Material material;
public override void Init() protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
{ {
shader = Shader.Find("Filter/MattiasCRT"); renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0));
material = new Material(shader); Graphics.Blit(rt, result, renderMat);
}
public override void Render(PostProcessRenderContext context)
{
material.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
context.command.Blit(context.source, context.destination, material);
} }
} }

View File

@ -6,7 +6,6 @@ namespace AxibugEmuOnline.Client
{ {
public class Initer : MonoBehaviour public class Initer : MonoBehaviour
{ {
public PostProcessVolume m_filterVolume;
public CanvasGroup m_filterPreview; public CanvasGroup m_filterPreview;
public CanvasGroup m_xmbBg; public CanvasGroup m_xmbBg;
public static string dev_UUID; public static string dev_UUID;

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 5354e2e13dbff91438a04b9de2351645
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -38,9 +38,7 @@ namespace AxibugEmuOnline.Client
/// </summary> /// </summary>
private unsafe void Update() private unsafe void Update()
{ {
if (IsPause) return; if (NesCore != null && !IsPause)
if (NesCore != null)
{ {
PushEmulatorFrame(); PushEmulatorFrame();
if (InGameUI.Instance.IsNetPlay) if (InGameUI.Instance.IsNetPlay)
@ -49,6 +47,9 @@ namespace AxibugEmuOnline.Client
var screenBuffer = NesCore.ppu.GetScreenPtr(); var screenBuffer = NesCore.ppu.GetScreenPtr();
VideoProvider.SetDrawData(screenBuffer); VideoProvider.SetDrawData(screenBuffer);
} }
VideoProvider.ApplyFilterEffect();
} }
public EnumPlatform Platform => EnumPlatform.NES; public EnumPlatform Platform => EnumPlatform.NES;

View File

@ -2,19 +2,24 @@
%TAG !u! tag:unity3d.com,2011: %TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000 --- !u!21 &2100000
Material: Material:
serializedVersion: 6 serializedVersion: 8
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: NesEmulator_Screen m_Name: NesEmulator_Screen
m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3} m_Shader: {fileID: 4800000, guid: b351396ff606116478d7f4412abe4e2e, type: 3}
m_ShaderKeywords: m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
stringTagMap: {} stringTagMap: {}
disabledShaderPasses: [] disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
@ -58,6 +63,7 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats: m_Floats:
- _BumpScale: 1 - _BumpScale: 1
- _ColorMask: 15 - _ColorMask: 15
@ -85,3 +91,5 @@ Material:
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@ -102,10 +102,10 @@
{ {
float2 mapUV = IN.texcoord; float2 mapUV = IN.texcoord;
float start= 8.0/272.0; float start= 0.02941535;
float end = (272.0-8.0)/272.0; float end = 0.970582;
mapUV.x = lerp(start,end, mapUV.x); mapUV.x = lerp(start,end, mapUV.x);
//uv映射改为ugui BaseMeshEffect 机制实现uv映射,比shader代码更为平滑
half4 color = tex2D(_MainTex,mapUV); half4 color = tex2D(_MainTex,mapUV);

View File

@ -0,0 +1,35 @@
using UnityEngine;
using UnityEngine.UI;
public class UVRemapper : BaseMeshEffect
{
public Vector2 uvMin = new Vector2(0, 0);
public Vector2 uvMax = new Vector2(1, 1);
public override void ModifyMesh(VertexHelper vh)
{
UIVertex vertex = new UIVertex();
for (int i = 0; i < vh.currentVertCount; i++)
{
vh.PopulateUIVertex(ref vertex, i);
switch (i % 4)
{
case 0:
vertex.uv0 = uvMin;
break;
case 1:
vertex.uv0 = new Vector2(uvMin.x, uvMax.y);
break;
case 2:
vertex.uv0 = uvMax;
break;
case 3:
vertex.uv0 = new Vector2(uvMax.x, uvMin.y);
break;
}
vh.SetUIVertex(vertex, i);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 68e8ce220f7d51548a7bbea061c7c70e

View File

@ -1,3 +1,4 @@
using AxibugEmuOnline.Client.ClientCore;
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using UnityEngine; using UnityEngine;
@ -14,7 +15,6 @@ namespace AxibugEmuOnline.Client
public RawImage Image; public RawImage Image;
#endregion #endregion
#region GPU_TURBO #region GPU_TURBO
//图像数据字节数 //图像数据字节数
private int TexBufferSize_gpu; private int TexBufferSize_gpu;
@ -24,7 +24,9 @@ namespace AxibugEmuOnline.Client
private Texture2D wrapTex_gpu; private Texture2D wrapTex_gpu;
//nes调色板数据,已转换为unity纹理对象 //nes调色板数据,已转换为unity纹理对象
private Texture2D pPal_gpu; private Texture2D pPal_gpu;
[SerializeField]
private Material GPUTurboMat_gpu; private Material GPUTurboMat_gpu;
private RenderTexture rt_gpu;
#endregion #endregion
#region CPU #region CPU
@ -42,13 +44,18 @@ namespace AxibugEmuOnline.Client
private void Awake() private void Awake()
{ {
DrawCanvas.worldCamera = Camera.main; DrawCanvas.worldCamera = Camera.main;
GPUTurboMat_gpu = Image.material;
} }
private void OnDestroy() private void OnDestroy()
{ {
if (wrapTexBufferGH.IsAllocated) if (wrapTexBufferGH.IsAllocated)
wrapTexBufferGH.Free(); wrapTexBufferGH.Free();
if (rt_gpu != null)
{
RenderTexture.ReleaseTemporary(rt_gpu);
rt_gpu = null;
}
} }
public unsafe void SetDrawData(uint* screenData) public unsafe void SetDrawData(uint* screenData)
@ -61,6 +68,7 @@ namespace AxibugEmuOnline.Client
{ {
wrapTex_gpu.LoadRawTextureData(wrapTexBufferPointer_gpu, TexBufferSize_gpu); wrapTex_gpu.LoadRawTextureData(wrapTexBufferPointer_gpu, TexBufferSize_gpu);
wrapTex_gpu.Apply(); wrapTex_gpu.Apply();
Graphics.Blit(wrapTex_gpu, rt_gpu, GPUTurboMat_gpu);
} }
else else
{ {
@ -69,27 +77,32 @@ namespace AxibugEmuOnline.Client
} }
} }
public void ApplyFilterEffect()
{
Image.texture = App.filter.ExecuteFilterRender(rt_gpu);
}
private unsafe void PrepareUI(uint* screenData) private unsafe void PrepareUI(uint* screenData)
{ {
if (GPUTurbo) if (GPUTurbo)
{ {
if (Image.material != GPUTurboMat_gpu) Image.material = GPUTurboMat_gpu;
if (wrapTex_gpu == null) if (wrapTex_gpu == null)
{ {
wrapTex_gpu = new Texture2D(PPU.SCREEN_WIDTH, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); wrapTex_gpu = new Texture2D(PPU.SCREEN_WIDTH, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false);
wrapTex_gpu.filterMode = FilterMode.Point; wrapTex_gpu.filterMode = FilterMode.Point;
wrapTexBufferPointer_gpu = (IntPtr)screenData; wrapTexBufferPointer_gpu = (IntPtr)screenData;
rt_gpu = RenderTexture.GetTemporary(wrapTex_gpu.width, wrapTex_gpu.height, 0);
rt_gpu.filterMode = FilterMode.Point;
rt_gpu.anisoLevel = 0;
rt_gpu.antiAliasing = 1;
TexBufferSize_gpu = wrapTex_gpu.width * wrapTex_gpu.height * 4; TexBufferSize_gpu = wrapTex_gpu.width * wrapTex_gpu.height * 4;
} }
if (Image.texture != wrapTex_gpu) Image.texture = wrapTex_gpu; if (Image.texture != rt_gpu) Image.texture = rt_gpu;
} }
else else
{ {
if (Image.material == GPUTurboMat_gpu) Image.material = null;
if (wrapTex_cpu == null) if (wrapTex_cpu == null)
{ {
wrapTex_cpu = new Texture2D(PPU.SCREEN_WIDTH - 16, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false); wrapTex_cpu = new Texture2D(PPU.SCREEN_WIDTH - 16, PPU.SCREEN_HEIGHT, TextureFormat.RGBA32, false);
@ -103,6 +116,7 @@ namespace AxibugEmuOnline.Client
} }
if (Image.texture != wrapTex_cpu) Image.texture = wrapTex_cpu; if (Image.texture != wrapTex_cpu) Image.texture = wrapTex_cpu;
} }
} }
private unsafe void PrepareForGPU(uint* screenData) private unsafe void PrepareForGPU(uint* screenData)