Java 类net.minecraft.client.util.JsonException 实例源码

项目:DecompiledMinecraft    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:BaseClient    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:BaseClient    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:Backmemed    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:CustomWorldGen    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:ShadyMod    文件:ShadyMod.java   
public void activateBatch()
{
    if(batch != null)
    {
        if(OpenGlHelper.shadersSupported)
        {
            try
            {
                ShaderGroup theShaderGroup = batch.toShaderGroup(resManager);
                theShaderGroup.createBindFramebuffers(Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, theShaderGroup, 51);
                ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, true, 55);
            }
            catch(JsonException e)
            {
                e.printStackTrace();
            }
        }
    }
}
项目:Resilience-Client-Source    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.jsonElementTypeIsString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject var2 = JsonUtils.getJsonElementAsJsonObject(p_148027_1_, "target");
        String var3 = JsonUtils.getJsonObjectStringFieldValue(var2, "name");
        int var4 = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(var2, "width", this.mainFramebufferWidth);
        int var5 = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(var2, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(var3))
        {
            throw new JsonException(var3 + " is already defined");
        }

        this.addFramebuffer(var3, var4, var5);
    }
}
项目:ExpandedRailsMod    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.isString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getString(jsonobject, "name");
        int i = JsonUtils.getInt(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getInt(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:Cauldron    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.jsonElementTypeIsString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonElementAsJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getJsonObjectStringFieldValue(jsonobject, "name");
        int i = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:Cauldron    文件:ShaderGroup.java   
private void initTarget(JsonElement p_148027_1_) throws JsonException
{
    if (JsonUtils.jsonElementTypeIsString(p_148027_1_))
    {
        this.addFramebuffer(p_148027_1_.getAsString(), this.mainFramebufferWidth, this.mainFramebufferHeight);
    }
    else
    {
        JsonObject jsonobject = JsonUtils.getJsonElementAsJsonObject(p_148027_1_, "target");
        String s = JsonUtils.getJsonObjectStringFieldValue(jsonobject, "name");
        int i = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "width", this.mainFramebufferWidth);
        int j = JsonUtils.getJsonObjectIntegerFieldValueOrDefault(jsonobject, "height", this.mainFramebufferHeight);

        if (this.mapFramebuffers.containsKey(s))
        {
            throw new JsonException(s + " is already defined");
        }

        this.addFramebuffer(s, i, j);
    }
}
项目:DecompiledMinecraft    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:DecompiledMinecraft    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream());
        byte[] abyte = toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.glCreateShader(type.getShaderMode());
        OpenGlHelper.glShaderSource(i, bytebuffer);
        OpenGlHelper.glCompileShader(i);

        if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(type, i, filename);
        type.getLoadedShaders().put(filename, shaderloader);
    }

    return shaderloader;
}
项目:DecompiledMinecraft    文件:ShaderManager.java   
private void parseSampler(JsonElement p_147996_1_) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:DecompiledMinecraft    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager p_i1050_2_, Framebuffer p_i1050_3_, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = p_i1050_2_;
    this.mainFramebuffer = p_i1050_3_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i1050_3_.framebufferWidth;
    this.mainFramebufferHeight = p_i1050_3_.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:BaseClient    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:BaseClient    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream());
        byte[] abyte = toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.glCreateShader(type.getShaderMode());
        OpenGlHelper.glShaderSource(i, bytebuffer);
        OpenGlHelper.glCompileShader(i);

        if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(type, i, filename);
        type.getLoadedShaders().put(filename, shaderloader);
    }

    return shaderloader;
}
项目:BaseClient    文件:ShaderManager.java   
private void parseSampler(JsonElement p_147996_1_) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:BaseClient    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager p_i1050_2_, Framebuffer p_i1050_3_, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = p_i1050_2_;
    this.mainFramebuffer = p_i1050_3_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i1050_3_.framebufferWidth;
    this.mainFramebufferHeight = p_i1050_3_.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:BaseClient    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:BaseClient    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(resourceManager.getResource(resourcelocation).getInputStream());
        byte[] abyte = toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.glCreateShader(type.getShaderMode());
        OpenGlHelper.glShaderSource(i, bytebuffer);
        OpenGlHelper.glCompileShader(i);

        if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(type, i, filename);
        type.getLoadedShaders().put(filename, shaderloader);
    }

    return shaderloader;
}
项目:BaseClient    文件:ShaderManager.java   
private void parseSampler(JsonElement p_147996_1_) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(p_147996_1_, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:BaseClient    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager p_i1050_2_, Framebuffer p_i1050_3_, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = p_i1050_2_;
    this.mainFramebuffer = p_i1050_3_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i1050_3_.framebufferWidth;
    this.mainFramebufferHeight = p_i1050_3_.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:Backmemed    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:Backmemed    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        IResource iresource = resourceManager.getResource(resourcelocation);

        try
        {
            byte[] abyte = IOUtils.toByteArray((InputStream)(new BufferedInputStream(iresource.getInputStream())));
            ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
            bytebuffer.put(abyte);
            bytebuffer.position(0);
            int i = OpenGlHelper.glCreateShader(type.getShaderMode());
            OpenGlHelper.glShaderSource(i, bytebuffer);
            OpenGlHelper.glCompileShader(i);

            if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
            {
                String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
                JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
                jsonexception.setFilenameAndFlush(resourcelocation.getResourcePath());
                throw jsonexception;
            }

            shaderloader = new ShaderLoader(type, i, filename);
            type.getLoadedShaders().put(filename, shaderloader);
        }
        finally
        {
            IOUtils.closeQuietly((Closeable)iresource);
        }
    }

    return shaderloader;
}
项目:Backmemed    文件:ShaderManager.java   
private void parseSampler(JsonElement element) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(element, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:Backmemed    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager resourceManagerIn, Framebuffer mainFramebufferIn, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = resourceManagerIn;
    this.mainFramebuffer = mainFramebufferIn;
    this.time = 0.0F;
    this.lastStamp = 0.0F;
    this.mainFramebufferWidth = mainFramebufferIn.framebufferWidth;
    this.mainFramebufferHeight = mainFramebufferIn.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:CustomWorldGen    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:CustomWorldGen    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        IResource iresource = resourceManager.getResource(resourcelocation);

        try
        {
            byte[] abyte = IOUtils.toByteArray((InputStream)(new BufferedInputStream(iresource.getInputStream())));
            ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
            bytebuffer.put(abyte);
            bytebuffer.position(0);
            int i = OpenGlHelper.glCreateShader(type.getShaderMode());
            OpenGlHelper.glShaderSource(i, bytebuffer);
            OpenGlHelper.glCompileShader(i);

            if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
            {
                String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
                JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
                jsonexception.setFilenameAndFlush(resourcelocation.getResourcePath());
                throw jsonexception;
            }

            shaderloader = new ShaderLoader(type, i, filename);
            type.getLoadedShaders().put(filename, shaderloader);
        }
        finally
        {
            IOUtils.closeQuietly((Closeable)iresource);
        }
    }

    return shaderloader;
}
项目:CustomWorldGen    文件:ShaderManager.java   
private void parseSampler(JsonElement element) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(element, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:CustomWorldGen    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager resourceManagerIn, Framebuffer mainFramebufferIn, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = resourceManagerIn;
    this.mainFramebuffer = mainFramebufferIn;
    this.time = 0.0F;
    this.lastStamp = 0.0F;
    this.mainFramebufferWidth = mainFramebufferIn.framebufferWidth;
    this.mainFramebufferHeight = mainFramebufferIn.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:malmo    文件:TextureHelper.java   
public static int loadShader(String filename, int shaderType) throws IOException
{
    int shaderID = -1;
    InputStream stream = MalmoMod.class.getClassLoader().getResourceAsStream(filename);
    if (stream == null)
    {
        System.out.println("Cannot find shader.");
        return -1;
    }
    try
    {
        byte[] abyte = IOUtils.toByteArray((InputStream) (new BufferedInputStream(stream)));
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        shaderID = OpenGlHelper.glCreateShader(shaderType);
        OpenGlHelper.glShaderSource(shaderID, bytebuffer);
        OpenGlHelper.glCompileShader(shaderID);

        if (OpenGlHelper.glGetShaderi(shaderID, OpenGlHelper.GL_COMPILE_STATUS) == 0)
        {
            String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(shaderID, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile shader program: " + s);
            throw jsonexception;
        }
    }
    finally
    {
        IOUtils.closeQuietly(stream);
    }
    return shaderID;
}
项目:Resilience-Client-Source    文件:ShaderLinkHelper.java   
public int func_148078_c() throws JsonException
{
    int var1 = GL20.glCreateProgram();

    if (var1 <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + var1 + ")");
    }
    else
    {
        return var1;
    }
}
项目:Resilience-Client-Source    文件:ShaderLoader.java   
public static ShaderLoader func_148057_a(IResourceManager p_148057_0_, ShaderLoader.ShaderType p_148057_1_, String p_148057_2_) throws IOException
{
    ShaderLoader var3 = (ShaderLoader)p_148057_1_.func_148064_d().get(p_148057_2_);

    if (var3 == null)
    {
        ResourceLocation var4 = new ResourceLocation("shaders/program/" + p_148057_2_ + p_148057_1_.func_148063_b());
        BufferedInputStream var5 = new BufferedInputStream(p_148057_0_.getResource(var4).getInputStream());
        byte[] var6 = IOUtils.toByteArray(var5);
        ByteBuffer var7 = BufferUtils.createByteBuffer(var6.length);
        var7.put(var6);
        var7.position(0);
        int var8 = GL20.glCreateShader(p_148057_1_.func_148065_c());
        GL20.glShaderSource(var8, var7);
        GL20.glCompileShader(var8);

        if (GL20.glGetShaderi(var8, 35713) == 0)
        {
            String var9 = StringUtils.trim(GL20.glGetShaderInfoLog(var8, 32768));
            JsonException var10 = new JsonException("Couldn\'t compile " + p_148057_1_.func_148062_a() + " program: " + var9);
            var10.func_151381_b(var4.getResourcePath());
            throw var10;
        }

        var3 = new ShaderLoader(p_148057_1_, var8, p_148057_2_);
        p_148057_1_.func_148064_d().put(p_148057_2_, var3);
    }

    return var3;
}
项目:Resilience-Client-Source    文件:ShaderGroup.java   
public ShaderGroup(IResourceManager p_i45088_1_, Framebuffer p_i45088_2_, ResourceLocation p_i45088_3_) throws JsonException
{
    this.resourceManager = p_i45088_1_;
    this.mainFramebuffer = p_i45088_2_;
    this.field_148036_j = 0.0F;
    this.field_148037_k = 0.0F;
    this.mainFramebufferWidth = p_i45088_2_.framebufferWidth;
    this.mainFramebufferHeight = p_i45088_2_.framebufferHeight;
    this.shaderGroupName = p_i45088_3_.toString();
    this.resetProjectionMatrix();
    this.initFromLocation(p_i45088_3_);
}
项目:ExpandedRailsMod    文件:ShaderLinkHelper.java   
public int createProgram() throws JsonException
{
    int i = OpenGlHelper.glCreateProgram();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:ExpandedRailsMod    文件:ShaderLoader.java   
public static ShaderLoader loadShader(IResourceManager resourceManager, ShaderLoader.ShaderType type, String filename) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)type.getLoadedShaders().get(filename);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + filename + type.getShaderExtension());
        IResource iresource = resourceManager.getResource(resourcelocation);

        try
        {
            byte[] abyte = IOUtils.toByteArray((InputStream)(new BufferedInputStream(iresource.getInputStream())));
            ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
            bytebuffer.put(abyte);
            bytebuffer.position(0);
            int i = OpenGlHelper.glCreateShader(type.getShaderMode());
            OpenGlHelper.glShaderSource(i, bytebuffer);
            OpenGlHelper.glCompileShader(i);

            if (OpenGlHelper.glGetShaderi(i, OpenGlHelper.GL_COMPILE_STATUS) == 0)
            {
                String s = StringUtils.trim(OpenGlHelper.glGetShaderInfoLog(i, 32768));
                JsonException jsonexception = new JsonException("Couldn\'t compile " + type.getShaderName() + " program: " + s);
                jsonexception.setFilenameAndFlush(resourcelocation.getResourcePath());
                throw jsonexception;
            }

            shaderloader = new ShaderLoader(type, i, filename);
            type.getLoadedShaders().put(filename, shaderloader);
        }
        finally
        {
            IOUtils.closeQuietly((Closeable)iresource);
        }
    }

    return shaderloader;
}
项目:ExpandedRailsMod    文件:ShaderManager.java   
private void parseSampler(JsonElement element) throws JsonException
{
    JsonObject jsonobject = JsonUtils.getJsonObject(element, "sampler");
    String s = JsonUtils.getString(jsonobject, "name");

    if (!JsonUtils.isString(jsonobject, "file"))
    {
        this.shaderSamplers.put(s, (Object)null);
        this.samplerNames.add(s);
    }
    else
    {
        this.samplerNames.add(s);
    }
}
项目:ExpandedRailsMod    文件:ShaderGroup.java   
public ShaderGroup(TextureManager p_i1050_1_, IResourceManager resourceManagerIn, Framebuffer mainFramebufferIn, ResourceLocation p_i1050_4_) throws JsonException, IOException, JsonSyntaxException
{
    this.resourceManager = resourceManagerIn;
    this.mainFramebuffer = mainFramebufferIn;
    this.time = 0.0F;
    this.lastStamp = 0.0F;
    this.mainFramebufferWidth = mainFramebufferIn.framebufferWidth;
    this.mainFramebufferHeight = mainFramebufferIn.framebufferHeight;
    this.shaderGroupName = p_i1050_4_.toString();
    this.resetProjectionMatrix();
    this.parseGroup(p_i1050_1_, p_i1050_4_);
}
项目:Cauldron    文件:ShaderLinkHelper.java   
public int func_148078_c() throws JsonException
{
    int i = OpenGlHelper.func_153183_d();

    if (i <= 0)
    {
        throw new JsonException("Could not create shader program (returned program ID " + i + ")");
    }
    else
    {
        return i;
    }
}
项目:Cauldron    文件:ShaderLoader.java   
public static ShaderLoader func_148057_a(IResourceManager p_148057_0_, ShaderLoader.ShaderType p_148057_1_, String p_148057_2_) throws IOException
{
    ShaderLoader shaderloader = (ShaderLoader)p_148057_1_.func_148064_d().get(p_148057_2_);

    if (shaderloader == null)
    {
        ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_148057_2_ + p_148057_1_.func_148063_b());
        BufferedInputStream bufferedinputstream = new BufferedInputStream(p_148057_0_.getResource(resourcelocation).getInputStream());
        byte[] abyte = IOUtils.toByteArray(bufferedinputstream);
        ByteBuffer bytebuffer = BufferUtils.createByteBuffer(abyte.length);
        bytebuffer.put(abyte);
        bytebuffer.position(0);
        int i = OpenGlHelper.func_153195_b(p_148057_1_.func_148065_c());
        OpenGlHelper.func_153169_a(i, bytebuffer);
        OpenGlHelper.func_153170_c(i);

        if (OpenGlHelper.func_153157_c(i, OpenGlHelper.field_153208_p) == 0)
        {
            String s1 = StringUtils.trim(OpenGlHelper.func_153158_d(i, 32768));
            JsonException jsonexception = new JsonException("Couldn\'t compile " + p_148057_1_.func_148062_a() + " program: " + s1);
            jsonexception.func_151381_b(resourcelocation.getResourcePath());
            throw jsonexception;
        }

        shaderloader = new ShaderLoader(p_148057_1_, i, p_148057_2_);
        p_148057_1_.func_148064_d().put(p_148057_2_, shaderloader);
    }

    return shaderloader;
}