问题描述
我的所有纹理都在一个大图集纹理中,我想使用 Direc2D/SharpDX 和 Atlas Effect 访问它们。问题是,效果接收到错误的 InputRectangle 值。 vector4 轴位置似乎是半随机交换的。
给 InputRectangle 一个 new Vector4(1200,20,50,120)
会产生一个值为 X: 50,Y: 20,Z: 1200,W: 120
的 InputRectangle 但是当 Vector 是类似 new Vector4(12,120)
时它可以工作
我不知所措
示例项目:
using SharpDX;
using SharpDX.Mathematics;
using SharpDX.Direct2D1;
using SharpDX.WIC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bitmap = SharpDX.Direct2D1.Bitmap;
using System.IO;
using SharpDX.Direct2D1.Effects;
namespace Test
{
class Program
{
static void Main(string[] args) {
Factory _factory = new Factory(FactoryType.MultiThreaded,DebugLevel.information);//Direct2DFactory.CreateFactory(FactoryType.SingleThreaded,DebugLevel.information,FactoryVersion.Auto);
SharpDX.Configuration.EnableReleaSEOnFinalizer = true;
rendertargetProperties props = new rendertargetProperties(rendertargetType.Hardware,new SharpDX.Direct2D1.PixelFormat(SharpDX.dxgi.Format.B8G8R8A8_Unorm,AlphaMode.Premultiplied),rendertargetUsage.None,FeatureLevel.Level_DEFAULT);
Bitmaprendertarget _target = new Bitmaprendertarget(new DeviceContextrendertarget(_factory,props),CompatiblerendertargetOptions.GdiCompatible,new Size2F(4096,4096));
DeviceContext deviceContext2d = _target.QueryInterface<DeviceContext>();
Atlas a = new Atlas(deviceContext2d);
a.InputRectangle = new Vector4(1200,120);
int debugStep = 0;
debugStep++;
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)