forked from sin365/AxibugEmuOnline
Compare commits
3 Commits
35548687d0
...
bac3e514b6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bac3e514b6 | ||
|
|
91ca428269 | ||
|
|
f129651e99 |
@ -353,7 +353,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: -0.97058296
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
@ -389,7 +389,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -0.48529053
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
@ -931,7 +931,8 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 802786939}
|
||||
- component: {fileID: 802786941}
|
||||
- component: {fileID: 802786940}
|
||||
- component: {fileID: 802786942}
|
||||
- component: {fileID: 802786943}
|
||||
m_Layer: 5
|
||||
m_Name: Image2
|
||||
m_TagString: Untagged
|
||||
@ -958,7 +959,15 @@ RectTransform:
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &802786940
|
||||
--- !u!222 &802786941
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 802786938}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &802786942
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
@ -967,7 +976,7 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 802786938}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
@ -978,24 +987,25 @@ MonoBehaviour:
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: e043954733c440645ba43b09301ee4a6, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &802786941
|
||||
CanvasRenderer:
|
||||
m_Texture: {fileID: 2800000, guid: e043954733c440645ba43b09301ee4a6, type: 3}
|
||||
m_UVRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!114 &802786943
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 802786938}
|
||||
m_CullTransparentMesh: 1
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a0987fcca76655248ac8defaffd1cb45, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!224 &939125854 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||
@ -1026,8 +1036,8 @@ RectTransform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1124446956}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10799.999}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1471857115}
|
||||
@ -1035,10 +1045,10 @@ RectTransform:
|
||||
m_Father: {fileID: 1599240741}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 960.00006, y: 540}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!225 &1124446961
|
||||
CanvasGroup:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2235,6 +2245,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 736530578155193984, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 935090267056593628, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
@ -2727,6 +2741,10 @@ PrefabInstance:
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8801936766261209235, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
|
||||
@ -48,13 +48,13 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
public void Render(RenderTexture rt, RenderTexture result)
|
||||
public void Render(Texture src, RenderTexture result)
|
||||
{
|
||||
m_material.SetTexture("_MainTex", rt);
|
||||
OnRenderer(m_material, rt, result);
|
||||
m_material.SetTexture("_MainTex", src);
|
||||
OnRenderer(m_material, src, result);
|
||||
}
|
||||
|
||||
protected abstract void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result);
|
||||
protected abstract void OnRenderer(Material renderMat, Texture src, RenderTexture result);
|
||||
|
||||
public class EditableParamerter
|
||||
{
|
||||
|
||||
@ -38,7 +38,7 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
private RenderTexture result = null;
|
||||
public RenderTexture ExecuteFilterRender(RenderTexture rt)
|
||||
public Texture ExecuteFilterRender(Texture src)
|
||||
{
|
||||
if (result == null)
|
||||
result = RenderTexture.GetTemporary(Screen.width, Screen.height);
|
||||
@ -47,14 +47,14 @@ namespace AxibugEmuOnline.Client
|
||||
foreach (var filter in Filters)
|
||||
{
|
||||
if (!filter.m_setting.Enable.GetValue()) continue;
|
||||
filter.m_setting.Render(rt, result);
|
||||
filter.m_setting.Render(src, result);
|
||||
anyFilterEnable = true;
|
||||
}
|
||||
|
||||
if (anyFilterEnable)
|
||||
return result;
|
||||
else
|
||||
return rt;
|
||||
return src;
|
||||
}
|
||||
|
||||
/// <summary> 关闭滤镜预览 </summary>
|
||||
|
||||
@ -34,7 +34,7 @@ public sealed class FixingPixelArtGrille : FilterEffect
|
||||
}
|
||||
|
||||
|
||||
protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
|
||||
protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result)
|
||||
{
|
||||
renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0));
|
||||
renderMat.SetVector("_res", new Vector4(DrawResolution.GetValue().x, DrawResolution.GetValue().y, 0, 0));
|
||||
@ -67,6 +67,6 @@ public sealed class FixingPixelArtGrille : FilterEffect
|
||||
renderMat.EnableKeyword("_MASKSTYLE_STRETCHEDVGA");
|
||||
break;
|
||||
}
|
||||
Graphics.Blit(rt, result, renderMat);
|
||||
Graphics.Blit(src, result, renderMat);
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,9 @@ public sealed class LCDPostEffect : FilterEffect
|
||||
|
||||
protected override string ShaderName => "Filter/LCDPostEffect";
|
||||
|
||||
protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
|
||||
protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result)
|
||||
{
|
||||
renderMat.SetVector("_iResolution", new Vector4(Screen.width, Screen.height, 0, 0));
|
||||
Graphics.Blit(rt, result, renderMat);
|
||||
Graphics.Blit(src, result, renderMat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client;
|
||||
using UnityEngine;
|
||||
|
||||
public sealed class MattiasCRT : FilterEffect
|
||||
@ -7,9 +7,9 @@ public sealed class MattiasCRT : FilterEffect
|
||||
|
||||
protected override string ShaderName => "Filter/MattiasCRT";
|
||||
|
||||
protected override void OnRenderer(Material renderMat, RenderTexture rt, RenderTexture result)
|
||||
protected override void OnRenderer(Material renderMat, Texture src, RenderTexture result)
|
||||
{
|
||||
renderMat.SetVector("_iResolution", new Vector4(result.width, result.height, 0, 0));
|
||||
Graphics.Blit(rt, result, renderMat);
|
||||
Graphics.Blit(src, result, renderMat);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(RawImage))]
|
||||
public class UIFilterPreviewer : MonoBehaviour
|
||||
{
|
||||
private RawImage m_rawImg;
|
||||
private Texture m_src;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_rawImg = GetComponent<RawImage>();
|
||||
m_src = m_rawImg.texture;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_rawImg.texture = App.filter.ExecuteFilterRender(m_src);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0987fcca76655248ac8defaffd1cb45
|
||||
@ -1,35 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68e8ce220f7d51548a7bbea061c7c70e
|
||||
@ -1,4 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
@ -16,13 +16,13 @@ namespace AxibugEmuOnline.Client
|
||||
#endregion
|
||||
|
||||
#region GPU_TURBO
|
||||
//图像数据字节数
|
||||
//图像数据字节数
|
||||
private int TexBufferSize_gpu;
|
||||
//图像数据指针
|
||||
//图像数据指针
|
||||
private IntPtr wrapTexBufferPointer_gpu;
|
||||
//Unity 2D纹理对象,用于UI上绘制最终输出画面
|
||||
//Unity 2D纹理对象,用于UI上绘制最终输出画面
|
||||
private Texture2D wrapTex_gpu;
|
||||
//nes调色板数据,已转换为unity纹理对象
|
||||
//nes调色板数据,已转换为unity纹理对象
|
||||
private Texture2D pPal_gpu;
|
||||
[SerializeField]
|
||||
private Material GPUTurboMat_gpu;
|
||||
@ -30,12 +30,12 @@ namespace AxibugEmuOnline.Client
|
||||
#endregion
|
||||
|
||||
#region CPU
|
||||
//图像数据字节数
|
||||
//图像数据字节数
|
||||
private int TexBufferSize_cpu;
|
||||
//图像数据指针
|
||||
//图像数据指针
|
||||
private GCHandle wrapTexBufferGH;
|
||||
private IntPtr wrapTexBufferPointer_cpu;
|
||||
//Unity 2D纹理对象,用于UI上绘制最终输出画面
|
||||
//Unity 2D纹理对象,用于UI上绘制最终输出画面
|
||||
private Texture2D wrapTex_cpu;
|
||||
#endregion
|
||||
|
||||
@ -61,8 +61,8 @@ namespace AxibugEmuOnline.Client
|
||||
public unsafe void SetDrawData(uint* screenData)
|
||||
{
|
||||
PrepareUI(screenData);
|
||||
if (GPUTurbo) PrepareForGPU(screenData);//判断使用GPU还是CPU
|
||||
else PrepareForCPU(screenData);//使用CPU
|
||||
if (GPUTurbo) PrepareForGPU(screenData);//判断使用GPU还是CPU
|
||||
else PrepareForCPU(screenData);//使用CPU
|
||||
|
||||
if (GPUTurbo)
|
||||
{
|
||||
@ -155,7 +155,7 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
for (int line = 0; line < PPU.SCREEN_HEIGHT; line++)
|
||||
{
|
||||
//PS:如果是CPU计算,宽度减少16的不必要部分,才能对齐
|
||||
//PS:如果是CPU计算,宽度减少16的不必要部分,才能对齐
|
||||
width = PPU.SCREEN_WIDTH - 16;
|
||||
|
||||
while (width > 0)
|
||||
@ -163,17 +163,17 @@ namespace AxibugEmuOnline.Client
|
||||
var edx = screenData[pScn + 8];
|
||||
|
||||
uint index = edx & 0xFF;
|
||||
//按下标颜色查找表中真实颜色
|
||||
//按下标颜色查找表中真实颜色
|
||||
var colorData = palRaw[index];
|
||||
//dst中颜色排列为abgr,而colorData排列为argb
|
||||
uint r = (colorData & 0x00FF0000) >> 16; // 提取Red通道
|
||||
uint g = (colorData & 0x0000FF00) >> 8; // 提取Green通道
|
||||
uint b = (colorData & 0x000000FF); // 提取Blue通道
|
||||
//dst中颜色排列为abgr,而colorData排列为argb
|
||||
uint r = (colorData & 0x00FF0000) >> 16; // 提取Red通道
|
||||
uint g = (colorData & 0x0000FF00) >> 8; // 提取Green通道
|
||||
uint b = (colorData & 0x000000FF); // 提取Blue通道
|
||||
|
||||
//用rgb构建颜色对象(如果非unity 可以用这个rgb 构建System.Drawing.Color 单个颜色对象)
|
||||
//用rgb构建颜色对象(如果非unity 可以用这个rgb 构建System.Drawing.Color 单个颜色对象)
|
||||
uint abgr = 0xFF000000 | (b << 16) | (g << 8) | (r << 0);
|
||||
|
||||
//放进颜色矩阵
|
||||
//放进颜色矩阵
|
||||
Dst[pDst] = abgr;
|
||||
|
||||
pScn += 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user