Solution for exercise 13:
edited another state in the server and client, added the rocket, added the 'Shell.java' and 'ShellControl.java' edited the logic for the states and 3 messages for the server client comunication, edited the 'SeaSynchronizer' and ShipMapSynchronizer', so that the animations will be displayed, added the sound for the rocket
This commit is contained in:
@@ -210,6 +210,60 @@ private Geometry makeCircle(ColorRGBA color) {
|
||||
return circle;
|
||||
}
|
||||
|
||||
/**
|
||||
* this method returns a dot in the color given
|
||||
* @param color the color
|
||||
* @return Geometry
|
||||
*/
|
||||
public Geometry makeFilledCircle(ColorRGBA color) {
|
||||
if (circleMesh == null) {
|
||||
circleMesh = new Mesh();
|
||||
|
||||
// Setze den Modus auf Triangles, um den Kreis aus Dreiecken zu füllen
|
||||
circleMesh.setMode(Mesh.Mode.Triangles);
|
||||
|
||||
final float[] pointBuffer = new float[3 * (NUM + 1)]; // NUM + 1, da wir den Mittelpunkt hinzufügen
|
||||
final short[] indexBuffer = new short[NUM * 3]; // NUM * 3, da wir Dreiecke erstellen
|
||||
|
||||
int j = 0;
|
||||
// Mittelpunkt des Kreises (0, 0, 0)
|
||||
pointBuffer[j++] = 0f; // x
|
||||
pointBuffer[j++] = 0f; // y
|
||||
pointBuffer[j++] = 0f; // z
|
||||
|
||||
// Außenpunkte des Kreises
|
||||
for (short i = 1; i <= NUM; i++) {
|
||||
final float a = TWO_PI / NUM * (i - 1);
|
||||
pointBuffer[j++] = 0.5f * cos(a);
|
||||
pointBuffer[j++] = 0.5f * sin(a);
|
||||
pointBuffer[j++] = 0f;
|
||||
}
|
||||
|
||||
// Dreiecke setzen (Mittelpunkt zu jedem Paar benachbarter Punkte)
|
||||
j = 0;
|
||||
for (short i = 1; i <= NUM; i++) {
|
||||
indexBuffer[j++] = 0; // Mittelpunkt
|
||||
indexBuffer[j++] = i; // aktueller Punkt
|
||||
indexBuffer[j++] = (i == NUM) ? 1 : (short) (i + 1); // nächster Punkt oder zurück zum ersten Punkt
|
||||
}
|
||||
|
||||
circleMesh.setBuffer(VertexBuffer.Type.Position, 3, pointBuffer);
|
||||
circleMesh.setBuffer(VertexBuffer.Type.Index, 3, indexBuffer);
|
||||
circleMesh.updateBound(); // Mesh-Buffer aktualisieren
|
||||
}
|
||||
|
||||
// Erstelle das Geometry-Objekt mit dem Kreis-Mesh
|
||||
final Geometry circle = new Geometry("circleMesh", circleMesh.clone());
|
||||
|
||||
// Setze das Material
|
||||
Material matWireframe = new Material(am, UNSHADED); //NON-NLS
|
||||
matWireframe.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
|
||||
matWireframe.setColor(COLOR, color); //NON-NLS
|
||||
circle.setMaterial(matWireframe);
|
||||
|
||||
return circle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an ellipse with the specified color.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user