Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
simulators
basic-simulator
Commits
909b919a
Commit
909b919a
authored
Sep 12, 2019
by
Jean Meurice
Browse files
Documentation + OpenGL tests
parent
3b99e5d6
Pipeline
#182836
failed with stage
in 58 seconds
Changes
22
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
909b919a
...
...
@@ -23,44 +23,10 @@ stages:
-
build
#jobWindows:
# stage: build
# script:
# - mvn clean install -s settings.xml
# tags:
# - Windows10
masterJobLinux
:
build_linux
:
stage
:
build
# image: maven:3-jdk-8
image
:
maven:3-amazoncorretto-8
before_script
:
# - apt-get update
# - apt-get install -y libxext6
# - apt-get install -y libxrender1
# - apt-get install -y libxtst6
# - apt-get install -y libopenjfx-java
script
:
-
mvn clean deploy -s settings.xml
only
:
-
master
# tags:
# - se
branchJobLinux
:
stage
:
build
image
:
maven:3-jdk-8
before_script
:
-
apt-get update
-
apt-get install -y libxext6
-
apt-get install -y libxrender1
-
apt-get install -y libxtst6
-
apt-get install -y libopenjfx-java
script
:
-
mvn clean install -s settings.xml
except
:
-
master
\ No newline at end of file
README.md
View file @
909b919a
This diff is collapsed.
Click to expand it.
docs/images/basic-sim-banner.png
View replaced file @
3b99e5d6
View file @
909b919a
229 KB
|
W:
|
H:
282 KB
|
W:
|
H:
2-up
Swipe
Onion skin
docs/images/maven-structure.svg
0 → 100644
View file @
909b919a
This diff is collapsed.
Click to expand it.
install/scenarios/straight2.json
View file @
909b919a
...
...
@@ -9,7 +9,7 @@
"cars"
:
[
{
"name"
:
"car1"
,
"physics_model"
:
"m
odelica
"
,
"physics_model"
:
"m
asspoint
"
,
"start_coords"
:
[
50.8354390
,
5.88133850
],
"target_coords"
:
[
50.8355156
,
5.8813333
],
"autopilot"
:
{
...
...
@@ -21,7 +21,8 @@
"cache_IL1"
:
"262144,4,4"
,
"cache_L2"
:
"2097152,6,6"
,
"cache_L3"
:
"12582912,40,40"
,
"no_time"
:
true
"no_time"
:
true
,
"no_emulation"
:
true
}
}
]
...
...
pom.xml
View file @
909b919a
...
...
@@ -37,7 +37,7 @@
<montisim.controller.version>
1.0.3
</montisim.controller.version>
<montisim.server.version>
1.0.7
</montisim.server.version>
<montisim.hardware_emulator.version>
1.0.0
</montisim.hardware_emulator.version>
<montisim.simulation.version>
2.0.
1
</montisim.simulation.version>
<montisim.simulation.version>
2.0.
2
</montisim.simulation.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
...
...
@@ -257,6 +257,16 @@
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
org.jogamp.gluegen
</groupId>
<artifactId>
gluegen-rt-main
</artifactId>
<version>
2.3.2
</version>
</dependency>
<dependency>
<groupId>
org.jogamp.jogl
</groupId>
<artifactId>
jogl-all-main
</artifactId>
<version>
2.3.2
</version>
</dependency>
</dependencies>
...
...
@@ -301,6 +311,9 @@
</transformer>
</transformers>
<outputFile>
${project.basedir}/install/${project.name}.jar
</outputFile>
<descriptors>
<descriptor>
src/main/assembly/application.xml
</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
...
...
@@ -316,6 +329,7 @@
<target>
${java.version}
</target>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.22.1
</version>
...
...
@@ -351,7 +365,27 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<version>
1.3.2
</version>
<executions>
<execution>
<goals>
<goal>
exec
</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>
java
</executable>
<arguments>
<argument>
-classpath
</argument>
<classpath
/>
<argument>
de.rwth.monticore.EmbeddedMontiArc.simulators.basic_simulator.App
</argument>
</arguments>
<workingDirectory>
${project.basedir}/install
</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
...
...
src/main/assembly/assembly.xml
0 → 100644
View file @
909b919a
<!--
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
This project is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this project. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
-->
<assembly
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xsi:schemaLocation=
"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"
>
<id>
with-dependencies
</id>
<includeBaseDirectory>
false
</includeBaseDirectory>
<formats>
<format>
jar
</format>
</formats>
<dependencySets>
<!-- Unpack everything that isn't a JOGL or GlueGen library -->
<dependencySet>
<outputDirectory>
/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<unpackOptions>
<excludes>
<exclude>
libgluegen-rt*
</exclude>
<exclude>
libjogl_desktop.*
</exclude>
<exclude>
libnativewindow_awt.*
</exclude>
<exclude>
libnativewindow_macosx.*
</exclude>
<exclude>
libnativewindow_x11.*
</exclude>
<exclude>
libnewt.*
</exclude>
</excludes>
</unpackOptions>
</dependencySet>
<!-- Place the natives for the popular platforms into the correct place -->
<!-- in the resulting jar file. -->
<dependencySet>
<outputDirectory>
/natives/linux-amd64/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<includes>
<include>
org.jogamp.gluegen:gluegen-rt:jar:natives-linux-amd64
</include>
<include>
org.jogamp.jogl:jogl-all:jar:natives-linux-amd64
</include>
</includes>
<unpackOptions>
<includes><include>
*.so
</include></includes>
</unpackOptions>
</dependencySet>
<dependencySet>
<outputDirectory>
/natives/linux-i586/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<includes>
<include>
org.jogamp.gluegen:gluegen-rt:jar:natives-linux-i586
</include>
<include>
org.jogamp.jogl:jogl-all:jar:natives-linux-i586
</include>
</includes>
<unpackOptions>
<includes><include>
*.so
</include></includes>
</unpackOptions>
</dependencySet>
<dependencySet>
<outputDirectory>
/natives/windows-amd64/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<includes>
<include>
org.jogamp.gluegen:gluegen-rt:jar:natives-windows-amd64
</include>
<include>
org.jogamp.jogl:jogl-all:jar:natives-windows-amd64
</include>
</includes>
<unpackOptions>
<includes><include>
*.dll
</include></includes>
</unpackOptions>
</dependencySet>
<dependencySet>
<outputDirectory>
/natives/windows-i586/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<includes>
<include>
org.jogamp.gluegen:gluegen-rt:jar:natives-windows-i586
</include>
<include>
org.jogamp.jogl:jogl-all:jar:natives-windows-i586
</include>
</includes>
<unpackOptions>
<includes><include>
*.dll
</include></includes>
</unpackOptions>
</dependencySet>
<dependencySet>
<outputDirectory>
/natives/macosx-universal/
</outputDirectory>
<useProjectArtifact>
true
</useProjectArtifact>
<scope>
runtime
</scope>
<unpack>
true
</unpack>
<includes>
<include>
org.jogamp.gluegen:gluegen-rt:jar:natives-macosx-universal
</include>
<include>
org.jogamp.jogl:jogl-all:jar:natives-macosx-universal
</include>
</includes>
<unpackOptions>
<includes><include>
*.jnilib
</include></includes>
</unpackOptions>
</dependencySet>
</dependencySets>
</assembly>
\ No newline at end of file
src/main/java/de/rwth/monticore/EmbeddedMontiArc/simulators/basic_simulator/gui/DefaultVis.java
View file @
909b919a
...
...
@@ -22,6 +22,11 @@ package de.rwth.monticore.EmbeddedMontiArc.simulators.basic_simulator.gui;
import
javax.swing.*
;
import
com.jogamp.opengl.GLCapabilities
;
import
com.jogamp.opengl.GLProfile
;
import
opengltest.OpenGLPanel
;
public
class
DefaultVis
extends
SimVis
{
public
DefaultVis
(){
setLayout
(
new
BoxLayout
(
this
,
BoxLayout
.
Y_AXIS
));
...
...
@@ -29,6 +34,11 @@ public class DefaultVis extends SimVis {
add_text
(
"Select one of the scenarios to start a simulation."
);
add_text
(
"Visualize the available maps. (Coming)"
);
add_text
(
"Watch completed simulations in the results. (Coming)"
);
/* System.out.println("Creating OpenGL context.");
GLProfile glprofile = GLProfile.getDefault();
GLCapabilities glcapabilities = new GLCapabilities( glprofile );
add(new OpenGLPanel(glcapabilities)); */
}
private
void
add_text
(
String
text
){
...
...
src/main/java/framework/Semantic.java
0 → 100644
View file @
909b919a
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package
framework
;
abstract
public
class
Semantic
{
public
interface
Attr
{
int
POSITION
=
0
;
int
COLOR
=
1
;
int
NORMAL
=
2
;
int
TEXCOORD
=
3
;
int
DRAW_ID
=
4
;
}
public
interface
Buffer
{
int
STATIC
=
0
;
int
DYNAMIC
=
1
;
}
public
interface
Frag
{
int
COLOR
=
0
;
int
RED
=
0
;
int
GREEN
=
1
;
int
BLUE
=
2
;
int
ALPHA
=
0
;
}
public
interface
Image
{
int
DIFFUSE
=
0
;
int
PICKING
=
1
;
}
public
interface
Object
{
int
VAO
=
0
;
int
VBO
=
1
;
int
IBO
=
2
;
int
TEXTURE
=
3
;
int
SAMPLER
=
4
;
int
SIZE
=
5
;
}
public
interface
Renderbuffer
{
int
DEPTH
=
0
;
int
COLOR0
=
1
;
}
public
interface
Sampler
{
int
DIFFUSE
=
0
;
int
POSITION
=
4
;
int
TEXCOORD
=
5
;
int
COLOR
=
6
;
}
public
interface
Storage
{
int
VERTEX
=
0
;
}
public
interface
Uniform
{
int
MATERIAL
=
0
;
int
TRANSFORM0
=
1
;
int
TRANSFORM1
=
2
;
int
INDIRECTION
=
3
;
int
GLOBAL_MATRICES
=
4
;
int
CONSTANT
=
0
;
int
PER_FRAME
=
1
;
int
PER_PASS
=
2
;
int
LIGHT
=
3
;
}
public
interface
Vert
{
int
POSITION
=
0
;
int
COLOR
=
3
;
int
TEXCOORD
=
4
;
int
INSTANCE
=
7
;
}
public
interface
Stream
{
int
A
=
0
;
int
B
=
1
;
}
}
\ No newline at end of file
src/main/java/opengltest/OpenGLPanel.java
0 → 100644
View file @
909b919a
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package
opengltest
;
import
com.jogamp.opengl.*
;
import
com.jogamp.opengl.awt.GLCanvas
;
import
com.jogamp.opengl.math.FloatUtil
;
import
com.jogamp.opengl.util.Animator
;
import
com.jogamp.opengl.util.GLBuffers
;
import
com.jogamp.opengl.util.glsl.ShaderCode
;
import
com.jogamp.opengl.util.glsl.ShaderProgram
;
import
framework.Semantic
;
import
java.nio.ByteBuffer
;
import
java.nio.FloatBuffer
;
import
java.nio.IntBuffer
;
import
java.nio.ShortBuffer
;
import
static
com
.
jogamp
.
opengl
.
GL
.
GL_TRIANGLES
;
import
static
com
.
jogamp
.
opengl
.
GL
.
GL_UNSIGNED_SHORT
;
import
static
com
.
jogamp
.
opengl
.
GL2ES3
.*;
import
static
com
.
jogamp
.
opengl
.
GL2ES3
.
GL_UNIFORM_BUFFER
;
import
static
com
.
jogamp
.
opengl
.
GL4
.
GL_MAP_COHERENT_BIT
;
import
static
com
.
jogamp
.
opengl
.
GL4
.
GL_MAP_PERSISTENT_BIT
;
public
class
OpenGLPanel
extends
GLCanvas
implements
GLEventListener
{
private
static
Animator
animator
;
private
float
[]
vertexData
=
{
-
1
,
-
1
,
1
,
0
,
0
,
+
0
,
+
2
,
0
,
0
,
1
,
+
1
,
-
1
,
0
,
1
,
0
};
private
short
[]
elementData
=
{
0
,
2
,
1
};
private
interface
Buffer
{
int
VERTEX
=
0
;
int
ELEMENT
=
1
;
int
GLOBAL_MATRICES
=
2
;
int
MODEL_MATRIX
=
3
;
int
MAX
=
4
;
}
private
IntBuffer
bufferName
=
GLBuffers
.
newDirectIntBuffer
(
Buffer
.
MAX
);
private
IntBuffer
vertexArrayName
=
GLBuffers
.
newDirectIntBuffer
(
1
);
private
FloatBuffer
clearColor
=
GLBuffers
.
newDirectFloatBuffer
(
4
);
private
FloatBuffer
clearDepth
=
GLBuffers
.
newDirectFloatBuffer
(
1
);
private
FloatBuffer
matBuffer
=
GLBuffers
.
newDirectFloatBuffer
(
16
);
private
ByteBuffer
globalMatricesPointer
,
modelMatrixPointer
;
private
Program
program
;
private
long
start
;
public
OpenGLPanel
(
GLCapabilities
glcapabilities
){
super
(
glcapabilities
);
addGLEventListener
(
this
);
animator
=
new
Animator
(
this
);
animator
.
start
();
}
@Override
public
void
init
(
GLAutoDrawable
drawable
)
{
GL4
gl
=
drawable
.
getGL
().
getGL4
();
initDebug
(
gl
);
initBuffers
(
gl
);
initVertexArray
(
gl
);
program
=
new
Program
(
gl
,
"shaders/gl4"
,
"hello-triangle"
,
"hello-triangle"
);
gl
.
glEnable
(
GL_DEPTH_TEST
);
start
=
System
.
currentTimeMillis
();
}
private
void
initDebug
(
GL4
gl
)
{
getContext
().
addGLDebugListener
(
new
GLDebugListener
()
{
@Override
public
void
messageSent
(
GLDebugMessage
event
)
{
System
.
out
.
println
(
event
);
}
});
gl
.
glDebugMessageControl
(
GL_DONT_CARE
,
GL_DONT_CARE
,
GL_DONT_CARE
,
0
,
null
,
false
);
gl
.
glDebugMessageControl
(
GL_DONT_CARE
,
GL_DONT_CARE
,
GL_DEBUG_SEVERITY_HIGH
,
0
,
null
,
true
);
gl
.
glDebugMessageControl
(
GL_DONT_CARE
,
GL_DONT_CARE
,
GL_DEBUG_SEVERITY_MEDIUM
,
0
,
null
,
true
);
}
private
void
initBuffers
(
GL4
gl
)
{
FloatBuffer
vertexBuffer
=
GLBuffers
.
newDirectFloatBuffer
(
vertexData
);
ShortBuffer
elementBuffer
=
GLBuffers
.
newDirectShortBuffer
(
elementData
);
gl
.
glCreateBuffers
(
Buffer
.
MAX
,
bufferName
);
gl
.
glBindBuffer
(
GL_ARRAY_BUFFER
,
bufferName
.
get
(
Buffer
.
VERTEX
));
gl
.
glBufferStorage
(
GL_ARRAY_BUFFER
,
vertexBuffer
.
capacity
()
*
Float
.
BYTES
,
vertexBuffer
,
0
);
gl
.
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
gl
.
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
bufferName
.
get
(
Buffer
.
ELEMENT
));
gl
.
glBufferStorage
(
GL_ELEMENT_ARRAY_BUFFER
,
elementBuffer
.
capacity
()
*
Short
.
BYTES
,
elementBuffer
,
0
);
gl
.
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
0
);
IntBuffer
uniformBufferOffset
=
GLBuffers
.
newDirectIntBuffer
(
1
);
gl
.
glGetIntegerv
(
GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT
,
uniformBufferOffset
);
int
globalBlockSize
=
Math
.
max
(
16
*
4
*
2
,
uniformBufferOffset
.
get
(
0
));
int
modelBlockSize
=
Math
.
max
(
16
*
4
,
uniformBufferOffset
.
get
(
0
));
gl
.
glBindBuffer
(
GL_UNIFORM_BUFFER
,
bufferName
.
get
(
Buffer
.
GLOBAL_MATRICES
));
gl
.
glBufferStorage
(
GL_UNIFORM_BUFFER
,
globalBlockSize
,
null
,
GL_MAP_WRITE_BIT
|
GL_MAP_PERSISTENT_BIT
|
GL_MAP_COHERENT_BIT
);
gl
.
glBindBuffer
(
GL_UNIFORM_BUFFER
,
0
);
gl
.
glBindBuffer
(
GL_UNIFORM_BUFFER
,
bufferName
.
get
(
Buffer
.
MODEL_MATRIX
));
gl
.
glBufferStorage
(
GL_UNIFORM_BUFFER
,
modelBlockSize
,
null
,
GL_MAP_WRITE_BIT
|
GL_MAP_PERSISTENT_BIT
|
GL_MAP_COHERENT_BIT
);
gl
.
glBindBuffer
(
GL_UNIFORM_BUFFER
,
0
);
// map the transform buffers and keep them mapped
globalMatricesPointer
=
gl
.
glMapNamedBufferRange
(
bufferName
.
get
(
Buffer
.
GLOBAL_MATRICES
),
0
,
16
*
4
*
2
,
GL_MAP_WRITE_BIT
|
GL_MAP_PERSISTENT_BIT
|
GL_MAP_COHERENT_BIT
|
GL_MAP_INVALIDATE_BUFFER_BIT
);
// flags
modelMatrixPointer
=
gl
.
glMapNamedBufferRange
(
bufferName
.
get
(
Buffer
.
MODEL_MATRIX
),
0
,
16
*
4
,
GL_MAP_WRITE_BIT
|
GL_MAP_PERSISTENT_BIT
|
GL_MAP_COHERENT_BIT
|
GL_MAP_INVALIDATE_BUFFER_BIT
);
}
private
void
initVertexArray
(
GL4
gl
)
{
gl
.
glCreateVertexArrays
(
1
,
vertexArrayName
);
gl
.
glVertexArrayAttribBinding
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
POSITION
,
Semantic
.
Stream
.
A
);
gl
.
glVertexArrayAttribBinding
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
COLOR
,
Semantic
.
Stream
.
A
);
gl
.
glVertexArrayAttribFormat
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
POSITION
,
2
,
GL_FLOAT
,
false
,
0
);
gl
.
glVertexArrayAttribFormat
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
COLOR
,
3
,
GL_FLOAT
,
false
,
2
*
4
);
gl
.
glEnableVertexArrayAttrib
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
POSITION
);
gl
.
glEnableVertexArrayAttrib
(
vertexArrayName
.
get
(
0
),
Semantic
.
Attr
.
COLOR
);