使用 XNA 的 SamplerState.LinearWrap
有没有人有幸让 LinearWrap 与 XNA 4.0 在到达配置文件上一起工作?
示例...
device.SamplerStates[0] = SamplerState.LinearWrap;
leftVert.TexCoord = new NormalizedShort(0.0f, 0.0f);
rightVert.TexCoord = new NormalizedShort(5.0f, 1.0f);
这不会将纹理沿 u 轴包裹 5 次。事实上,它渲染得就像 5.0f 是 1.0f 一样。
另一个例子...
leftVert.TexCoord = new NormalizedShort(-5.0f, 0.0f);
rightVert.TexCoord = new NormalizedShort(5.0f, 1.0f);
这将纹理包裹一次,但不是预期的 10 次。
那么...有人知道如何使用这个系统的“规则”吗?
也就是说......
相邻坐标之间是否存在最大支持偏差? 所有坐标都需要在 (-1,1) 范围内吗? 第一个数字必须是负数吗? (为什么微软没有在任何地方记录这一点)
Has anyone had any luck getting LinearWrap to work with XNA 4.0 on reach profile?
Example...
device.SamplerStates[0] = SamplerState.LinearWrap;
leftVert.TexCoord = new NormalizedShort(0.0f, 0.0f);
rightVert.TexCoord = new NormalizedShort(5.0f, 1.0f);
This does not wrap the texture 5 times across the u axis. In fact it renders just as if that 5.0f was a 1.0f.
Another example...
leftVert.TexCoord = new NormalizedShort(-5.0f, 0.0f);
rightVert.TexCoord = new NormalizedShort(5.0f, 1.0f);
This wraps the texture once, but not 10 times as expected.
So... does anyone know the "rules" for how to use this system?
That is...
Is there a max supported deviation between adjacent coords?
Do all coords need to be within (-1,1)?
Does the first number have to be negative?
(And why isn't this documented anywhere Microsoft)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你的问题是 NormalizedShort 对象。 “标准化”通常表示从 -1 到 1 的值。对于 XNA,它似乎是 相同。
尝试使用 Vector2(浮动)作为纹理坐标。
I think your issue is the NormalizedShort object. "Normalized" usually means a value from -1 to 1. In case of XNA, it seems to be the same.
Try using Vector2 (floats) as your texture coords instead.