Package org.terasology.asset

Examples of org.terasology.asset.AssetUri


                if (Files.isDirectory(child)) {
                    scanOverrides(child, basePath);
                } else if (Files.isRegularFile(child)) {
                    Path relativePath = basePath.relativize(child);
                    Path modulePath = relativePath.subpath(0, 1);
                    AssetUri uri = getUri(new Name(modulePath.toString()), modulePath.relativize(relativePath));
                    if (uri != null) {
                        try {
                            addOverride(uri, child.toUri().toURL());
                        } catch (MalformedURLException e) {
                            logger.warn("Failed to load override {}", child, e.getMessage());
View Full Code Here


                if (Files.isDirectory(child)) {
                    scanDeltas(child, basePath);
                } else if (Files.isRegularFile(child)) {
                    Path relativePath = basePath.relativize(child);
                    Path modulePath = relativePath.subpath(0, 1);
                    AssetUri uri = getUri(new Name(modulePath.toString()), modulePath.relativize(relativePath));
                    if (uri != null) {
                        try {
                            setDelta(uri, child.toUri().toURL());
                        } catch (MalformedURLException e) {
                            logger.warn("Failed to load delta {}", child, e.getMessage());
View Full Code Here

            for (Path child : stream) {
                if (Files.isDirectory(child)) {
                    scanAssets(child, basePath);
                } else if (Files.isRegularFile(child)) {
                    Path relativePath = basePath.relativize(child);
                    AssetUri uri = getUri(relativePath);
                    if (uri != null) {
                        try {
                            addItem(uri, child.toUri().toURL());
                        } catch (MalformedURLException e) {
                            logger.warn("Failed to load asset {}", relativePath, e.getMessage());
View Full Code Here

                        continue;
                    }
                    Name moduleName = new Name(key.substring(0, moduleIndex));
                    key = key.substring(moduleIndex + 1);

                    AssetUri uri = getUri(moduleName, key);
                    if (uri == null || !uri.isValid()) {
                        continue;
                    }

                    logger.debug("Discovered override {} at {}", uri, entryPath);
View Full Code Here

                        continue;
                    }
                    Name moduleName = new Name(key.substring(0, moduleIndex));
                    key = key.substring(moduleIndex + 1);

                    AssetUri uri = getUri(moduleName, key);
                    if (uri == null || !uri.isValid()) {
                        continue;
                    }

                    logger.debug("Discovered delta {} at {}", uri, entryPath);
View Full Code Here

                String entryPath = entry.getName();
                logger.debug("Found {}", entryPath);

                if (entryPath.startsWith(assetsPath)) {
                    String key = entryPath.substring(assetsPath.length() + 1);
                    AssetUri uri = getUri(key);
                    if (uri == null || !uri.isValid()) {
                        continue;
                    }

                    logger.debug("Discovered resource {}", uri);
View Full Code Here

    private GLSLMaterial prepareAndStoreShaderProgramInstance(String title, ShaderParameters params) {
        String uri = "engine:" + title;
        Shader shader = Assets.getShader(uri);
        checkNotNull(shader, "Failed to resolve %s", uri);
        shader.recompile();
        GLSLMaterial material = Assets.generateAsset(new AssetUri(AssetType.MATERIAL, "engine:prog." + title), new MaterialData(shader), GLSLMaterial.class);
        material.setShaderParameters(params);

        return material;
    }
View Full Code Here

    private IconMeshFactory() {
    }

    public static Mesh getIconMesh(TextureRegion region) {
        if (region instanceof Asset) {
            AssetUri iconUri = ((Asset) region).getURI();
            return Assets.get(new AssetUri(AssetType.MESH, iconUri.getModuleName(), IconMeshResolver.ICON_DISCRIMINATOR + "." + iconUri.getAssetName()), Mesh.class);
        } else {
            return generateIconMesh(region);
        }
    }
View Full Code Here

                throw new IOException("Failed to load font - unable to resolve font page '" + textureName + "'");
            }

            MaterialData materialData = new MaterialData(Assets.getShader("engine:font"));
            materialData.setParam("texture", texture);
            AssetUri matName = new AssetUri(AssetType.MATERIAL, moduleName, textureName + "_font");
            Material pageMat = Assets.generateAsset(matName, materialData, Material.class);

            builder.addPage(pageId, texture, pageMat);
        } else {
            throw new IOException("Failed to load font - invalid page line '" + pageInfo + "'");
View Full Code Here

    @Override
    public AssetUri resolve(Name partialUri) {
        String[] parts = partialUri.toLowerCase().split("\\.", 2);
        if (parts.length == 2 && parts[0].equals(ICON_DISCRIMINATOR)) {
            AssetUri uri = Assets.resolveAssetUri(AssetType.TEXTURE, parts[1]);
            if (uri == null) {
                uri = Assets.resolveAssetUri(AssetType.SUBTEXTURE, parts[1]);
            }
            if (uri != null) {
                return new AssetUri(AssetType.MESH, uri.getModuleName(), partialUri);
            }
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.terasology.asset.AssetUri

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.