EOS 2
1.1.0
Einfache Objektbasierte Sprache
EosRobotLib
src
de
lathanda
eos
robot
gui
GLBaseRenderObject.java
gehe zur Dokumentation dieser Datei
1
package
de.lathanda.eos.robot.gui;
2
3
import
java.awt.Color;
4
5
import
com.jogamp.opengl.GL;
6
import
com.jogamp.opengl.GL2;
7
8
import
de.lathanda.eos.robot.geom3d.Face;
9
import
de.lathanda.eos.robot.geom3d.Polyhedron;
10
11
public
class
GLBaseRenderObject
implements
GLRenderObject
{
12
private
final
Polyhedron
data;
13
public
GLBaseRenderObject
(
Polyhedron
data) {
14
this.data = data;
15
}
16
public
void
render
(GL2 gl, Color base) {
17
data.
faces
.stream().forEach(f ->
renderFace
(f, base, gl));
18
}
19
protected
void
renderFace
(
Face
f, Color base, GL2 gl) {
20
GLTextureBuffer
texture =
GLTextureBuffer
.
get
(f.
m
, gl);
21
texture.
openMaterial
(base, gl);
22
gl.glBegin(GL.GL_TRIANGLES);
23
for
(
int
i = 0; i < f.
v
.length; i++) {
24
if
(f.
vn
!=
null
) {
25
gl.glNormal3f(f.
vn
[i].
dx
, f.
vn
[i].
dy
, f.
vn
[i].
dz
);
26
}
27
if
(f.
vt
!=
null
) {
28
gl.glTexCoord2f(f.
vt
[i].
u
, 1 - f.
vt
[i].
v
);
// I have no idea why
29
// jogamp is
30
// inverted
31
}
32
gl.glVertex3f(f.
v
[i].
x
, f.
v
[i].
y
, f.
v
[i].
z
);
33
34
}
35
gl.glEnd();
36
texture.
closeMaterial
(gl);
37
}
38
@Override
39
public
void
destroy
(GL gl) {
40
// free data?
41
}
42
}
de.lathanda.eos.robot.geom3d.Face
Definition:
Face.java:9
de.lathanda.eos.robot.geom3d.Face.vt
final VerticeTexture[] vt
Definition:
Face.java:11
de.lathanda.eos.robot.geom3d.Face.vn
final VerticeNormal[] vn
Definition:
Face.java:12
de.lathanda.eos.robot.geom3d.Face.m
final Material m
Definition:
Face.java:13
de.lathanda.eos.robot.geom3d.Face.v
final Vertice[] v
Definition:
Face.java:10
de.lathanda.eos.robot.geom3d.Polyhedron
Definition:
Polyhedron.java:11
de.lathanda.eos.robot.geom3d.Polyhedron.faces
final LinkedList< Face > faces
Definition:
Polyhedron.java:12
de.lathanda.eos.robot.geom3d.Vertice.y
final float y
Definition:
Vertice.java:10
de.lathanda.eos.robot.geom3d.Vertice.z
final float z
Definition:
Vertice.java:11
de.lathanda.eos.robot.geom3d.Vertice.x
final float x
Definition:
Vertice.java:9
de.lathanda.eos.robot.geom3d.VerticeNormal.dy
final float dy
Definition:
VerticeNormal.java:10
de.lathanda.eos.robot.geom3d.VerticeNormal.dz
final float dz
Definition:
VerticeNormal.java:11
de.lathanda.eos.robot.geom3d.VerticeNormal.dx
final float dx
Definition:
VerticeNormal.java:9
de.lathanda.eos.robot.geom3d.VerticeTexture.v
final float v
Definition:
VerticeTexture.java:12
de.lathanda.eos.robot.geom3d.VerticeTexture.u
final float u
Definition:
VerticeTexture.java:11
de.lathanda.eos.robot.gui.GLBaseRenderObject
Definition:
GLBaseRenderObject.java:11
de.lathanda.eos.robot.gui.GLBaseRenderObject.destroy
void destroy(GL gl)
Definition:
GLBaseRenderObject.java:39
de.lathanda.eos.robot.gui.GLBaseRenderObject.renderFace
void renderFace(Face f, Color base, GL2 gl)
Definition:
GLBaseRenderObject.java:19
de.lathanda.eos.robot.gui.GLBaseRenderObject.render
void render(GL2 gl, Color base)
Definition:
GLBaseRenderObject.java:16
de.lathanda.eos.robot.gui.GLBaseRenderObject.GLBaseRenderObject
GLBaseRenderObject(Polyhedron data)
Definition:
GLBaseRenderObject.java:13
de.lathanda.eos.robot.gui.GLTextureBuffer
Definition:
GLTextureBuffer.java:14
de.lathanda.eos.robot.gui.GLTextureBuffer.closeMaterial
void closeMaterial(GL2 gl)
Definition:
GLTextureBuffer.java:90
de.lathanda.eos.robot.gui.GLTextureBuffer.get
static synchronized GLTextureBuffer get(Material m, GL gl)
Definition:
GLTextureBuffer.java:18
de.lathanda.eos.robot.gui.GLTextureBuffer.openMaterial
void openMaterial(Color base, GL2 gl)
Definition:
GLTextureBuffer.java:46
de.lathanda.eos.robot.gui.GLRenderObject
Definition:
GLRenderObject.java:8
Impressum