Search in sources :

Example 1 with TextureRegionAsset

use of org.terasology.engine.rendering.assets.texture.TextureRegionAsset in project Terasology by MovingBlocks.

the class IconMeshDataProducer method getAssetData.

@Override
public Optional<MeshData> getAssetData(ResourceUrn urn) throws IOException {
    if (ICON_DISCRIMINATOR.equals(urn.getResourceName())) {
        ResourceUrn textureUrn = new ResourceUrn(urn.getModuleName().toString() + ResourceUrn.RESOURCE_SEPARATOR + urn.getFragmentName().toString());
        Optional<TextureRegionAsset> textureRegionAsset = assetManager.getAsset(textureUrn, TextureRegionAsset.class);
        if (textureRegionAsset.isPresent() && !textureRegionAsset.get().getTexture().isDisposed()) {
            return Optional.of(IconMeshFactory.generateIconMeshData(textureRegionAsset.get()));
        }
    }
    return Optional.empty();
}
Also used : ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) TextureRegionAsset(org.terasology.engine.rendering.assets.texture.TextureRegionAsset)

Aggregations

TextureRegionAsset (org.terasology.engine.rendering.assets.texture.TextureRegionAsset)1 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)1