我想从已经编译到 xnb 的文件中加载效果。
我可以在 XNA 3.0 中使用它
Effect (GraphicsDevice, Stream, CompilerOptions, EffectPool)
但我不知道如何在 XNA 4.0 中做到这一点,因为没有这样的构造函数。
任何帮助都感激不尽。
最后我通过 XNA 4.0 中的新构造函数解决了这个问题:
public Effect(GraphicsDevice graphicsDevice, byte[] effectCode);
那是
Stream bumpStream = ... //get the file stream
byte[] buffer = new byte[bumpStream.Length];
bumpStream.Read(buffer, 0, buffer.Length);
myFx = new Effect(graphicsDevice, buffer)
完毕!