<commit_before>package org.helioviewer.gl3d;

import java.awt.Component;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;

import javax.media.opengl.GL2;

import org.helioviewer.base.Pair;
import org.helioviewer.base.math.GL3DMat4d;
import org.helioviewer.base.math.GL3DQuatd;
import org.helioviewer.base.math.GL3DVec2d;
import org.helioviewer.base.math.GL3DVec3d;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.gl3d.camera.GL3DCamera;
import org.helioviewer.jhv.display.Displayer;
import org.helioviewer.jhv.gui.filters.FilterPanelContainer;
import org.helioviewer.jhv.plugin.renderable.Renderable;
import org.helioviewer.jhv.plugin.renderable.RenderableType;
import org.helioviewer.jhv.renderable.RenderableImageType;
import org.helioviewer.viewmodel.imagedata.ImageData;
import org.helioviewer.viewmodel.metadata.HelioviewerMetaData;
import org.helioviewer.viewmodel.metadata.MetaData;
import org.helioviewer.viewmodel.region.Region;
import org.helioviewer.viewmodel.region.StaticRegion;
import org.helioviewer.viewmodel.view.AbstractView;
import org.helioviewer.viewmodel.view.opengl.GLInfo;
import org.helioviewer.viewmodel.view.opengl.GLSLShader;
import org.helioviewer.viewmodel.viewport.StaticViewport;
import org.helioviewer.viewmodel.viewport.Viewport;
import org.helioviewer.viewmodel.viewport.ViewportAdapter;

import com.jogamp.common.nio.Buffers;

/**
 * This is the scene graph equivalent of an image layer sub view chain attached
 * to the GL3DLayeredView. It represents exactly one image layer in the view
 * chain
 *
 * @author <NAME> (<EMAIL>)
 *
 */
public class GL3DImageLayer implements Renderable {

    private static boolean showCorona = true;
    private static int nextLayerId = 0;
    private final int layerId;

    public int getLayerId() {
        return layerId;
    }

    public double minZ = -Constants.SunRadius;
    public double maxZ = Constants.SunRadius;

    private final int resolution = 3;
    private final GL3DVec2d[] pointlist = new GL3DVec2d[(resolution + 1) * 2 * 2];
    private int positionBufferID;
    private int indexBufferID;
    private int indexBufferSize;

    private int positionBufferSize;
    private final AbstractView mainLayerView;
    private final RenderableType type;
    private boolean isVisible = true;

    public GL3DImageLayer(String name, AbstractView view) {
        this.type = new RenderableImageType(view.getName());
        layerId = nextLayerId++;
        this.mainLayerView = view;

        int count = 0;
        for (int i = 0; i <= this.resolution; i++) {
            for (int j = 0; j <= 1; j++) {
                this.pointlist[count] = new GL3DVec2d(2. * (1. * i / this.resolution - 0.5), -2. * (j - 0.5));
                count++;
            }
        }
        for (int i = 0; i <= 1; i++) {
            for (int j = 0; j <= this.resolution; j++) {
                this.pointlist[count] = new GL3DVec2d(2. * (i / 1. - 0.5), -2. * (1. * j / this.resolution - 0.5));
                count++;
            }
        }

        Displayer.getRenderablecontainer().addBeforeRenderable(this);
        mainLayerView.setOpacity((float) (1. / (1. + Displayer.getLayersModel().getNumLayers())));
    }

    @Override
    public void init(GL3DState state) {
        Pair<FloatBuffer, IntBuffer> bufferPair = makeIcosphere(2);
        FloatBuffer positionBuffer = bufferPair.a;
        IntBuffer indexBuffer = bufferPair.b;

        this.positionBufferSize = positionBuffer.capacity();
        positionBufferID = generate(state);

        state.gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, positionBufferID);
        state.gl.glBufferData(GL2.GL_ARRAY_BUFFER, this.positionBufferSize * Buffers.SIZEOF_FLOAT, positionBuffer, GL2.GL_STATIC_DRAW);
        state.gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);

        indexBufferID = generate(state);
        indexBufferSize = indexBuffer.capacity();
        state.gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferID);<commit_msg>check for COR and LASCO<commit_after>package org.helioviewer.gl3d;

import java.awt.Component;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;

import javax.media.opengl.GL2;

import org.helioviewer.base.Pair;
import org.helioviewer.base.math.GL3DMat4d;
import org.helioviewer.base.math.GL3DQuatd;
import org.helioviewer.base.math.GL3DVec2d;
import org.helioviewer.base.math.GL3DVec3d;
import org.helioviewer.base.physics.Constants;
import org.helioviewer.gl3d.camera.GL3DCamera;
import org.helioviewer.jhv.display.Displayer;
import org.helioviewer.jhv.gui.filters.FilterPanelContainer;
import org.helioviewer.jhv.plugin.renderable.Renderable;
import org.helioviewer.jhv.plugin.renderable.RenderableType;
import org.helioviewer.jhv.renderable.RenderableImageType;
import org.helioviewer.viewmodel.imagedata.ImageData;
import org.helioviewer.viewmodel.metadata.HelioviewerMetaData;
import org.helioviewer.viewmodel.metadata.MetaData;
import org.helioviewer.viewmodel.region.Region;
import org.helioviewer.viewmodel.region.StaticRegion;
import org.helioviewer.viewmodel.view.AbstractView;
import org.helioviewer.viewmodel.view.jp2view.JHVJP2View;
import org.helioviewer.viewmodel.view.opengl.GLInfo;
import org.helioviewer.viewmodel.view.opengl.GLSLShader;
import org.helioviewer.viewmodel.viewport.StaticViewport;
import org.helioviewer.viewmodel.viewport.Viewport;
import org.helioviewer.viewmodel.viewport.ViewportAdapter;

import com.jogamp.common.nio.Buffers;

/**
 * This is the scene graph equivalent of an image layer sub view chain attached
 * to the GL3DLayeredView. It represents exactly one image layer in the view
 * chain
 *
 * @author <NAME> (<EMAIL>)
 *
 */
public class GL3DImageLayer implements Renderable {

    private static boolean showCorona = true;
    private static int nextLayerId = 0;
    private final int layerId;

    public int getLayerId() {
        return layerId;
    }

    public double minZ = -Constants.SunRadius;
    public double maxZ = Constants.SunRadius;

    private final int resolution = 3;
    private final GL3DVec2d[] pointlist = new GL3DVec2d[(resolution + 1) * 2 * 2];
    private int positionBufferID;
    private int indexBufferID;
    private int indexBufferSize;

    private int positionBufferSize;
    private final AbstractView mainLayerView;
    private final RenderableType type;
    private boolean isVisible = true;

    public GL3DImageLayer(String name, AbstractView view) {
        this.type = new RenderableImageType(view.getName());
        layerId = nextLayerId++;
        this.mainLayerView = view;

        int count = 0;
        for (int i = 0; i <= this.resolution; i++) {
            for (int j = 0; j <= 1; j++) {
                this.pointlist[count] = new GL3DVec2d(2. * (1. * i / this.resolution - 0.5), -2. * (j - 0.5));
                count++;
            }
        }
        for (int i = 0; i <= 1; i++) {
            for (int j = 0; j <= this.resolution; j++) {
                this.pointlist[count] = new GL3DVec2d(2. * (i / 1. - 0.5), -2. * (1. * j / this.resolution - 0.5));
                count++;
            }
        }

        Displayer.getRenderablecontainer().addBeforeRenderable(this);
        float opacity = (float) (1. / (1. + Displayer.getLayersModel().getNumLayers()));
        if (mainLayerView instanceof JHVJP2View) {
            JHVJP2View jp2v = ((JHVJP2View) mainLayerView);
            if (jp2v.getName().contains("LASCO") || jp2v.getName().contains("COR")) {
                opacity = 1.f;
            }
        }
        mainLayerView.setOpacity(opacity);

    }

    @Override
    public void init(GL3DState state) {
        Pair<FloatBuffer, IntBuffer> bufferPair = makeIcosphere(2);
        FloatBuffer positionBuffer = bufferPair.a;
        IntBuffer indexBuffer = bufferPair.b;

        this.positionBufferSize = positionBuffer.capacity();
        positionBufferID = generate(state);

        state.gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, positionBufferID);
        state.gl.glBufferData(GL2.GL_ARRAY_BUFFER, this.positionBufferSize * Buffers.SIZEOF_FLOAT, positionBuffer, GL2.GL_STATIC_DRAW);
        state.gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);

        indexBufferID = generate(state);
        indexBufferSize = indexBuffer.capacity();
        state.gl.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferID);
{'fraction_non_alphanumeric': 0.10721969878077935, 'fraction_numerical': 0.015180492469519484, 'mean_word_length': 3.3578125, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '671840', 'n_tokens_mistral': 2841, 'n_tokens_neox': 2738, 'n_words': 551}