Package org.terasology.rendering.assets.texture

Examples of org.terasology.rendering.assets.texture.Texture


            return null;
        }
        AssetManager assetManager = CoreRegistry.get(AssetManager.class);
        AssetUri uri = assetManager.resolve(AssetType.TEXTURE, simpleUri);
        if (uri != null) {
            Texture result = assetManager.tryLoadAsset(uri, Texture.class);
            if (result != null) {
                return result;
            }
        }
        uri = assetManager.resolve(AssetType.SUBTEXTURE, simpleUri);
View Full Code Here


    private void parsePage(FontDataBuilder builder, Name moduleName, String pageInfo) throws IOException {
        Matcher pageMatcher = pagePattern.matcher(pageInfo);
        if (pageMatcher.matches()) {
            int pageId = Integer.parseInt(pageMatcher.group(1));
            String textureName = pageMatcher.group(2).substring(0, pageMatcher.group(2).lastIndexOf('.'));
            Texture texture = Assets.getTexture(moduleName, textureName);
            if (texture == null) {
                throw new IOException("Failed to load font - unable to resolve font page '" + textureName + "'");
            }

            MaterialData materialData = new MaterialData(Assets.getShader("engine:font"));
View Full Code Here

            program.setFloat("blurStart", blurStart, true);
            program.setFloat("blurLength", blurLength, true);
        }

        Texture colorGradingLut = Assets.getTexture("engine:colorGradingLut1");

        if (colorGradingLut != null) {
            GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId);
            glBindTexture(GL12.GL_TEXTURE_3D, colorGradingLut.getId());
            program.setInt("texColorGradingLut", texId++, true);
        }

        DefaultRenderingProcess.FBO sceneCombined = DefaultRenderingProcess.getInstance().getFBO("sceneOpaque");

        if (sceneCombined != null) {
            GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId);
            sceneCombined.bindDepthTexture();
            program.setInt("texDepth", texId++, true);

            Texture filmGrainNoiseTexture = Assets.getTexture("engine:noise");

            if (CoreRegistry.get(Config.class).getRendering().isFilmGrain()) {
                GL13.glActiveTexture(GL13.GL_TEXTURE0 + texId);
                glBindTexture(GL11.GL_TEXTURE_2D, filmGrainNoiseTexture.getId());
                program.setInt("texNoise", texId++, true);
                program.setFloat("grainIntensity", filmGrainIntensity, true);
                program.setFloat("noiseOffset", rand.nextFloat(), true);

                program.setFloat2("noiseSize", filmGrainNoiseTexture.getWidth(), filmGrainNoiseTexture.getHeight(), true);
                program.setFloat2("renderTargetSize", sceneCombined.width, sceneCombined.height, true);
            }
        }

        Camera activeCamera = CoreRegistry.get(WorldRenderer.class).getActiveCamera();
View Full Code Here

    @Override
    public void applyParameters(Material program) {
        super.applyParameters(program);

        Texture terrainTex = Assets.getTexture("engine:terrain");

        if (terrainTex == null) {
            return;
        }

        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        glBindTexture(GL11.GL_TEXTURE_2D, terrainTex.getId());

        program.setFloat3("colorOffset", 1.0f, 1.0f, 1.0f, true);
        program.setBoolean("textured", true, true);
        program.setFloat("alpha", 1.0f, true);
    }
View Full Code Here

        Color color = new Color(red, green, blue);

        config.getPlayer().setColor(color);

        AssetUri uri = TextureUtil.getTextureUriForColor(color);
        Texture tex = (Texture) Assets.get(uri);

        img.setImage(tex);
    }
View Full Code Here

        IntBuffer fboId = BufferUtils.createIntBuffer(1);
        GL30.glGenFramebuffers(fboId);
        frame = fboId.get(0);

        Texture texture = generateTexture(uri);

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frame);
        GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, texture.getId(), 0);

        int result = GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER);
        if (result != GL30.GL_FRAMEBUFFER_COMPLETE) {
            throw new IllegalStateException("Something went wrong with framebuffer! " + result);
        }
View Full Code Here

        ByteBuffer[] data = createAtlasMipmaps(numMipMaps, TRANSPARENT_COLOR, tiles, "tiles.png");
        ByteBuffer[] dataNormal = createAtlasMipmaps(numMipMaps, UNIT_Z_COLOR, tilesNormal, "tilesNormal.png");
        ByteBuffer[] dataHeight = createAtlasMipmaps(numMipMaps, BLACK_COLOR, tilesHeight, "tilesHeight.png");

        TextureData terrainTexData = new TextureData(atlasSize, atlasSize, data, Texture.WrapMode.CLAMP, Texture.FilterMode.NEAREST);
        Texture terrainTex = Assets.generateAsset(new AssetUri(AssetType.TEXTURE, "engine:terrain"), terrainTexData, Texture.class);

        TextureData terrainNormalData = new TextureData(atlasSize, atlasSize, dataNormal, Texture.WrapMode.CLAMP, Texture.FilterMode.NEAREST);
        Assets.generateAsset(new AssetUri(AssetType.TEXTURE, "engine:terrainNormal"), terrainNormalData, Texture.class);

        TextureData terrainHeightData = new TextureData(atlasSize, atlasSize, dataHeight, Texture.WrapMode.CLAMP, Texture.FilterMode.NEAREST);
View Full Code Here

    }

    @Override
    public AtlasData load(Module module, InputStream stream, List<URL> urls, List<URL> deltas) throws IOException {
        AtlasDefinition def = gson.fromJson(new InputStreamReader(stream, Charsets.UTF_8), AtlasDefinition.class);
        Texture texture = Assets.getTexture(def.getTexture());
        if (texture != null) {
            Vector2i size = def.getTextureSize();
            if (size == null) {
                size = new Vector2i(texture.getWidth(), texture.getHeight());
            }
            Map<Name, SubtextureData> result = Maps.newHashMap();
            if (def.getGrid() != null) {
                process(def.getGrid(), texture, size, result);
            }
View Full Code Here

TOP

Related Classes of org.terasology.rendering.assets.texture.Texture

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.