Пример #1
0
def test_animated_gltf(animated_gltf):
    gltf = GLTF(animated_gltf)
    gltf.read()
    assert len(gltf.content.animations) > 0

    exporter = gltf.exporter
    json.dumps(exporter._gltf_dict)
    assert len(exporter._gltf_dict['animations']) > 0
    assert 'images' not in exporter._gltf_dict
Пример #2
0
def test_simple_gltf(simple_gltf):
    gltf = GLTF(simple_gltf)
    gltf.read()
    assert len(gltf.content.scenes[0].children) == 2

    exporter = gltf.exporter
    json.dumps(exporter._gltf_dict)
    assert len(exporter._gltf_dict['nodes']) == 2
    assert len(exporter._gltf_dict['meshes']) == 1
    assert len(
        exporter._buffer) == exporter._gltf_dict['buffers'][0]['byteLength']
Пример #3
0
def test_embedded_gltf(embedded_gltf):
    gltf = GLTF(embedded_gltf)
    gltf.read()
    assert len(gltf.content.scenes[0].children) > 1

    exporter = gltf.exporter
    exporter.embed_data = True
    exporter.load()
    json.dumps(exporter._gltf_dict)
    assert exporter._gltf_dict['buffers'][0]['uri'].startswith('data')
    assert 'animations' not in exporter._gltf_dict
    assert 'materials' not in exporter._gltf_dict
Пример #4
0
def test_textured_gltf(textured_gltf):
    gltf = GLTF(textured_gltf)
    gltf.read()
    assert len(gltf.content.materials) > 0

    exporter = gltf.exporter
    json.dumps(exporter._gltf_dict)
    assert len(exporter._gltf_dict['materials']) > 0
    assert len(exporter._gltf_dict['samplers']) > 0
    assert len(exporter._gltf_dict['images']) > 0
    assert len(exporter._gltf_dict['textures']) > 0
    assert 'animations' not in exporter._gltf_dict
Пример #5
0
def test_morph_gltf(morph_gltf):
    gltf = GLTF(morph_gltf)
    gltf.read()
    assert (0.5, 1.5, 0.0) in gltf.content.meshes[0].vertices
Пример #6
0
def test_indexless_gltf(indexless_gltf):
    gltf = GLTF(indexless_gltf)
    gltf.read()
    assert len(gltf.content.meshes[0].vertices) > 0
Пример #7
0
def test_interleaved_glb(interleaved_glb):
    gltf = GLTF(interleaved_glb)
    gltf.read()
    assert len(gltf.content.nodes) == 2
    assert len(gltf.content.meshes[0].vertices) == 24
Пример #8
0
def test_sparse_gltf(sparse_gltf):
    gltf = GLTF(sparse_gltf)
    gltf.read()
    assert (5.0, 4.0, 0.0) in gltf.content.meshes[0].vertices
    assert len(gltf.content.meshes[0].faces) > 0
    assert (5.0, 4.0, 0.0) in gltf.content.nodes[0].vertices