我正在尝试在 Ubuntu 上使用MasterQ32 的 OpenWorld.Engine 。我遵循了“文档”中的示例场景。一切都运行良好,除了资产导入。有趣的是,同样的错误也发生在 Windows 7 上:Assimp.NET's library loader can't find kernel32.dll
. 下面是堆栈跟踪:
Unhandled Exception:
System.DllNotFoundException: kernel32
at (wrapper managed-to-native) Assimp.Unmanaged.NativeMethods:LoadLibrary (string)
at Assimp.Unmanaged.AssimpLibraryImplementation.LoadLibrary (System.String path) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary (System.String libPath) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary (System.String lib32Path, System.String lib64Path) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary () [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadIfNotLoaded () [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.EnableVerboseLogging (Boolean enable) [0x00000] in <filename unknown>:0
at Assimp.AssimpImporter.PrepareImport () [0x00000] in <filename unknown>:0
at Assimp.AssimpImporter.ImportFileFromStream (System.IO.Stream stream, PostProcessSteps postProcessFlags, System.String formatHint) [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Model.Load (OpenWorld.Engine.AssetLoadContext context, System.IO.Stream stream, System.String extensionHint) [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Asset+<Load>c__AnonStorey0`1[OpenWorld.Engine.Model].<>m__0 () [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Game.DeferRoutines () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: kernel32
at (wrapper managed-to-native) Assimp.Unmanaged.NativeMethods:LoadLibrary (string)
at Assimp.Unmanaged.AssimpLibraryImplementation.LoadLibrary (System.String path) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary (System.String libPath) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary (System.String lib32Path, System.String lib64Path) [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadLibrary () [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.LoadIfNotLoaded () [0x00000] in <filename unknown>:0
at Assimp.Unmanaged.AssimpLibrary.EnableVerboseLogging (Boolean enable) [0x00000] in <filename unknown>:0
at Assimp.AssimpImporter.PrepareImport () [0x00000] in <filename unknown>:0
at Assimp.AssimpImporter.ImportFileFromStream (System.IO.Stream stream, PostProcessSteps postProcessFlags, System.String formatHint) [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Model.Load (OpenWorld.Engine.AssetLoadContext context, System.IO.Stream stream, System.String extensionHint) [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Asset+<Load>c__AnonStorey0`1[OpenWorld.Engine.Model].<>m__0 () [0x00000] in <filename unknown>:0
at OpenWorld.Engine.Game.DeferRoutines () [0x00000] in <filename unknown>:0
at System.Threading.Thread.StartInternal () [0x00000] in <filename unknown>:0
这是我正在使用的代码,与文档中的代码基本相同:使用相机和单个对象设置场景。我正在使用存储库中提供的资产,并且我验证了资产路径是正确的。
using System;
using System.IO;
using OpenWorld.Engine;
using System.Drawing;
using OpenTK.Graphics;
using OpenWorld.Engine.SceneManagement;
using OpenTK;
namespace OpenWorldLearn {
public class TestGame : Game {
Scene scene;
PerspectiveLookAtCamera camera;
protected override PresentationParameters GetPresentationParameters() {
var def = base.GetPresentationParameters();
def.GraphicsMode = new GraphicsMode(24, 24, 0, 0);
def.Resolution = new Size(800, 600);
def.IsFullscreen = false;
def.Title = "Potato!";
return def;
}
protected override void OnLoad() {
FrameBuffer.ClearColor = OpenWorld.Engine.Color.CornflowerBlue;
Assets.Sources.Add(new FileSystemAssetSource("../../../Assets"));
camera = new PerspectiveLookAtCamera();
camera.FieldOfView = 90;
camera.LookAt(new Vector3(-0.1f, 1.9f, -4f), Vector3.Zero);
scene = new Scene();
SceneNode child = new SceneNode();
var renderer = child.Components.Add<Renderer>();
renderer.Model = Assets.Load<Model>("crate");
scene.Root.Children.Add(child);
}
protected override void OnUpdate(GameTime time) {
scene.Update(time);
}
protected override void OnDrawPostState(GameTime time) {
FrameBuffer.Clear();
scene.Draw(this.camera, time);
}
}
}