Java 类com.badlogic.gdx.graphics.g3d.model.data.ModelMesh 实例源码

项目:Mundus    文件:MG3dModelLoader.java   
private void parseMeshes(ModelData model, JsonValue json) {
    JsonValue meshes = json.get("meshes");
    if (meshes != null) {

        model.meshes.ensureCapacity(meshes.size);
        for (JsonValue mesh = meshes.child; mesh != null; mesh = mesh.next) {
            ModelMesh jsonMesh = new ModelMesh();

            String id = mesh.getString("id", "");
            jsonMesh.id = id;

            JsonValue attributes = mesh.require("attributes");
            jsonMesh.attributes = parseAttributes(attributes);
            jsonMesh.vertices = mesh.require("vertices").asFloatArray();

            JsonValue meshParts = mesh.require("parts");
            Array<ModelMeshPart> parts = new Array<ModelMeshPart>();
            for (JsonValue meshPart = meshParts.child; meshPart != null; meshPart = meshPart.next) {
                ModelMeshPart jsonPart = new ModelMeshPart();
                String partId = meshPart.getString("id", null);
                if (partId == null) {
                    throw new GdxRuntimeException("Not id given for mesh part");
                }
                for (ModelMeshPart other : parts) {
                    if (other.id.equals(partId)) {
                        throw new GdxRuntimeException("Mesh part with id '" + partId + "' already in defined");
                    }
                }
                jsonPart.id = partId;

                String type = meshPart.getString("type", null);
                if (type == null) {
                    throw new GdxRuntimeException("No primitive type given for mesh part '" + partId + "'");
                }
                jsonPart.primitiveType = parseType(type);

                jsonPart.indices = meshPart.require("indices").asShortArray();
                parts.add(jsonPart);
            }
            jsonMesh.parts = parts.toArray(ModelMeshPart.class);
            model.meshes.add(jsonMesh);
        }
    }
}
项目:libgdxcn    文件:G3dModelLoader.java   
private void parseMeshes (ModelData model, JsonValue json) {
    JsonValue meshes = json.get("meshes");
    if (meshes != null) {

        model.meshes.ensureCapacity(meshes.size);
        for (JsonValue mesh = meshes.child; mesh != null; mesh = mesh.next) {
            ModelMesh jsonMesh = new ModelMesh();

            String id = mesh.getString("id", "");
            jsonMesh.id = id;

            JsonValue attributes = mesh.require("attributes");
            jsonMesh.attributes = parseAttributes(attributes);
            jsonMesh.vertices = mesh.require("vertices").asFloatArray();

            JsonValue meshParts = mesh.require("parts");
            Array<ModelMeshPart> parts = new Array<ModelMeshPart>();
            for (JsonValue meshPart = meshParts.child; meshPart != null; meshPart = meshPart.next) {
                ModelMeshPart jsonPart = new ModelMeshPart();
                String partId = meshPart.getString("id", null);
                if (id == null) {
                    throw new GdxRuntimeException("Not id given for mesh part");
                }
                for (ModelMeshPart other : parts) {
                    if (other.id.equals(partId)) {
                        throw new GdxRuntimeException("Mesh part with id '" + partId + "' already in defined");
                    }
                }
                jsonPart.id = partId;

                String type = meshPart.getString("type", null);
                if (type == null) {
                    throw new GdxRuntimeException("No primitive type given for mesh part '" + partId + "'");
                }
                jsonPart.primitiveType = parseType(type);

                jsonPart.indices = meshPart.require("indices").asShortArray();
                parts.add(jsonPart);
            }
            jsonMesh.parts = parts.toArray(ModelMeshPart.class);
            model.meshes.add(jsonMesh);
        }
    }
}
项目:libgdxcn    文件:Model.java   
private void loadMeshes (Iterable<ModelMesh> meshes) {
    for (ModelMesh mesh : meshes) {
        convertMesh(mesh);
    }
}
项目:gdx-proto    文件:HeadlessG3dModelLoader.java   
private void parseMeshes (ModelData model, JsonValue json) {
    JsonValue meshes = json.require("meshes");

    model.meshes.ensureCapacity(meshes.size);
    for (JsonValue mesh = meshes.child; mesh != null; mesh = mesh.next) {
        ModelMesh jsonMesh = new ModelMesh();

        String id = mesh.getString("id", "");
        jsonMesh.id = id;

        JsonValue attributes = mesh.require("attributes");
        jsonMesh.attributes = parseAttributes(attributes);
        jsonMesh.vertices = mesh.require("vertices").asFloatArray();

        JsonValue meshParts = mesh.require("parts");
        Array<ModelMeshPart> parts = new Array<ModelMeshPart>();
        for (JsonValue meshPart = meshParts.child; meshPart != null; meshPart = meshPart.next) {
            ModelMeshPart jsonPart = new ModelMeshPart();
            String partId = meshPart.getString("id", null);
            if (id == null) {
                throw new GdxRuntimeException("Not id given for mesh part");
            }
            for (ModelMeshPart other : parts) {
                if (other.id.equals(partId)) {
                    throw new GdxRuntimeException("Mesh part with id '" + partId + "' already in defined");
                }
            }
            jsonPart.id = partId;

            String type = meshPart.getString("type", null);
            if (type == null) {
                throw new GdxRuntimeException("No primitive type given for mesh part '" + partId + "'");
            }
            jsonPart.primitiveType = parseType(type);

            jsonPart.indices = meshPart.require("indices").asShortArray();
            parts.add(jsonPart);
        }
        jsonMesh.parts = parts.toArray(ModelMeshPart.class);
        model.meshes.add(jsonMesh);
    }
}
项目:gdx-proto    文件:HeadlessModel.java   
private void loadMeshes (Iterable<ModelMesh> meshes) {
    for (ModelMesh mesh : meshes) {
        convertMesh(mesh);
    }
}