3
我遇到了libgdx的问题,当我以任何格式加载模型时,纹理显示不正确。我不确定是什么导致了这个问题。使用libgdx模型纹理错误
例子:在3ds Max或搅拌机它看起来像这样
但是当我把它变成一个libgdx项目它看起来像这样
我的代码是基于http://blog.xoppa.com/loading-models-using-libgdx/
我已经尝试过,没有没有运气的灯
代码:
个//Loading the model
assetManager = new AssetManager();
assetManager.load("data/models/M4A1 SOPMOD/M4A1 SOPMOD.g3db", Model.class);
//..................................................
//Calling to an object and drawing it
public void create()
modelBatch = new ModelBatch();
box = Assets.assetManager.get("data/models/M4A1 SOPMOD/M4A1 SOPMOD.g3db", Model.class);
//box = Assets.getModelByName("M4");
//box = modelBuilder.createBox(1f, 1f, 1f, new Material(ColorAttribute.createDiffuse(Color.WHITE), ColorAttribute.createSpecular(Color.WHITE), FloatAttribute.createShininess(64f)), Usage.Position | Usage.Normal);
boxInstance = new ModelInstance(box);
lights = new Lights();
lights.ambientLight.set(1f, 1f, 1f, 1f);
lights.add(new DirectionalLight().set(1f, 1f, 1f, -1f, -0.8f, -0.2f));
}
public void Update(float deltaTime)
{
dotd.camera.rotateAround(Vector3.Zero, new Vector3(0, 1, 0), deltaTime* 50.0f);
dotd.camera.update();
}
public void Render()
{
modelBatch.begin(dotd.camera);
modelBatch.render(boxInstance, lights);
modelBatch.end();
}
非常感谢你 –