如何解决SharpDX/Direct2D Atlas 效果 InputRectangle 设置错误的 Vector 值
我的所有纹理都在一个大图集纹理中,我想使用 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 举报,一经查实,本站将立刻删除。