g3dj / g3db模型没有渲染,obj工作正常

时间:2015-11-11 20:33:45

标签: java libgdx

我对libgdx有点新意,请耐心等待我!我使用Blender将我的模型导出到FBX,然后使用fbx-conv生成g3db和g3dj文件,这两个文件都没有在我的桌面项目中呈现。这是我渲染模型的代码:

public AssetManager assetManager;
public Array<ModelInstance> instances;
public ModelBatch modelBatch;
public boolean loading;

@Override
public void create () {
    ...

    instances = new Array<ModelInstance>();
    modelBatch = new ModelBatch();
    assetManager = new AssetManager();
    assetManager.load("models/test.g3dj", Model.class);
    loading = true;
}

private void doneLoading() {
    Model test = assetManager.get("models/test.g3dj", Model.class);
    ModelInstance testInstance = new ModelInstance(test);
    instances.add(testInstance);

    //vv this shows that it is loading vv
    System.out.println("Loaded" + test.toString());

    loading = false;
}

public void render () {
    if (loading && assetManager.update()) {
        doneLoading();
    }

    modelBatch.begin(camera);
    modelBatch.render(instances, environment);
    modelBatch.end();
}

以下是g3db json文件中的非顶点位:

"materials": [
    {
        "id": "Material", 
        "ambient": [ 0.200000,  0.200000,  0.200000], 
        "diffuse": [ 1.000000,  1.000000,  1.000000],
        "emissive": [ 0.500000,  0.500000,  0.500000],
        "opacity":  1.000000,
        "specular": [ 0.200000,  0.200000,  0.200000], 
        "shininess":  20.000000
    }
], 
"nodes": [
    {
        "id": "Circle.002", 
        "rotation": [ 0.000000,  0.000000, -0.000000,  1.000000], 
        "scale": [ 500.000000,  500.000000,  500.000000], 
        "translation": [-1241.342407,  9.894826,  1.567357], 
        "parts": [
            {
                "meshpartid": "Mesh_part1", 
                "materialid": "Material", 
                "uvMapping": [[]]
            }
        ]
    }
], 
"animations": []

我没有在Blender中对它应用任何图像纹理,只是一种漫反射的白色。我知道这不是我的环境照明或相机导致obj加载正常。

关于发生了什么的任何想法?

0 个答案:

没有答案