/*
* Copyright (C) 2014 vincent
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package aspect.render;
import static aspect.core.AspectRenderer.*;
import aspect.util.Angles;
import aspect.util.Color;
import aspect.util.Vector3;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import static org.lwjgl.opengl.GL11.*;
/**
*
* @author vincent
*/
public class LineModel extends ViewModel {
private final Mesh triangles;
private final Mesh lines;
public LineModel(Mesh triangles, Mesh lines) {
this.triangles = triangles;
this.lines = lines;
}
@Override
protected void renderModel() {
glEnable(GL_POLYGON_OFFSET_FILL);
//glColorMask(false, false, false, false);
FloatBuffer color = BufferUtils.createFloatBuffer(16);
glGetFloat(GL_COLOR_CLEAR_VALUE, color);
//color.flip();
color(new Color(color));
glPolygonOffset(1f, 1f);
triangles.render();
glLineWidth(1.0f);
glDisable(GL_POLYGON_OFFSET_FILL);
glEnable(GL_POLYGON_OFFSET_LINE);
glEnable(GL_LINE_SMOOTH);
glPolygonOffset(-1f, -1f);
//glColorMask(true, true, true, true);
color(Color.BLACK);
lines.render();
glDisable(GL_POLYGON_OFFSET_LINE);
}
}