Compare commits
25 Commits
b_schmidt_
...
b_puderbac
Author | SHA1 | Date | |
---|---|---|---|
|
fe41a67341 | ||
|
842eabd32e | ||
|
e4a24c3070 | ||
|
04d16a2882 | ||
|
a798edf07f | ||
|
5dff2c271f | ||
|
b6642a4815 | ||
|
33dba7f3b6 | ||
|
96992c5b03 | ||
|
c525a8994c | ||
|
86a3d90bf8 | ||
|
a6fec62fa0 | ||
|
b8cd71120f | ||
|
fc22ae1819 | ||
|
f27ec36d2b | ||
|
68e252e174 | ||
|
b33ddcb2c2 | ||
|
3386d395fe | ||
|
91b24db6ca | ||
|
0ff5fceae7 | ||
|
f6699c2a0a | ||
|
9ca08c3d0c | ||
|
f47cda7dc4 | ||
|
c7269f032f | ||
|
4581e611ca |
2
.gitignore
vendored
@@ -24,3 +24,5 @@ out
|
||||
.DS_Store
|
||||
!Projekte/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
45.j3o
|
||||
KingGeorge.j3o
|
||||
|
@@ -73,8 +73,7 @@ Betriebssystem:
|
||||
die Zeile:
|
||||
|
||||
`export JAVA_HOME="<Pfad zum entpackten Archiv>"`
|
||||
|
||||
Ersetzen Sie dabei `<Pfad zum entpackten Archiv>` mit dem entsprechenden Pfad.
|
||||
cd Ersetzen Sie dabei `<Pfad zum entpackten Archiv>` mit dem entsprechenden Pfad.
|
||||
Zum Beispiel:
|
||||
|
||||
`export JAVA_HOME="/home/user/jdk-20.0.2"`
|
||||
|
@@ -11,14 +11,16 @@ dependencies {
|
||||
implementation 'org.jmonkeyengine:jme3-effects:3.6.0-stable'
|
||||
|
||||
|
||||
|
||||
implementation libs.jme3.desktop
|
||||
implementation project(path: ':battleship:server')
|
||||
implementation project(path: ':battleship:server')
|
||||
|
||||
|
||||
runtimeOnly libs.jme3.awt.dialogs
|
||||
runtimeOnly libs.jme3.plugins
|
||||
runtimeOnly libs.jme3.jogg
|
||||
runtimeOnly libs.jme3.testdata
|
||||
|
||||
|
||||
}
|
||||
|
||||
application {
|
||||
|
@@ -23,7 +23,7 @@
|
||||
{
|
||||
"length": 2,
|
||||
"x": 4,
|
||||
"y": 8,
|
||||
"y": 12,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
|
66
Projekte/battleship/client/maps/map3.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"width": 10,
|
||||
"height": 10,
|
||||
"ships": [
|
||||
{
|
||||
"length": 4,
|
||||
"x": 0,
|
||||
"y": 5,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 3,
|
||||
"x": 0,
|
||||
"y": 9,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 3,
|
||||
"x": 2,
|
||||
"y": 6,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 4,
|
||||
"y": 8,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 2,
|
||||
"y": 4,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 2,
|
||||
"y": 1,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 6,
|
||||
"y": 2,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 8,
|
||||
"y": 2,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 6,
|
||||
"y": 0,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 8,
|
||||
"y": 0,
|
||||
"rot": "RIGHT"
|
||||
}
|
||||
]
|
||||
}
|
66
Projekte/battleship/client/maps/map4.json
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"width": 10,
|
||||
"height": 10,
|
||||
"ships": [
|
||||
{
|
||||
"length": 4,
|
||||
"x": 0,
|
||||
"y": 5,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 3,
|
||||
"x": 0,
|
||||
"y": 4,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 3,
|
||||
"x": 2,
|
||||
"y": 6,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 4,
|
||||
"y": 8,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 2,
|
||||
"y": 4,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 2,
|
||||
"x": 2,
|
||||
"y": 1,
|
||||
"rot": "DOWN"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 6,
|
||||
"y": 2,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 8,
|
||||
"y": 2,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 6,
|
||||
"y": 0,
|
||||
"rot": "RIGHT"
|
||||
},
|
||||
{
|
||||
"length": 1,
|
||||
"x": 8,
|
||||
"y": 0,
|
||||
"rot": "RIGHT"
|
||||
}
|
||||
]
|
||||
}
|
@@ -7,6 +7,15 @@
|
||||
|
||||
package pp.battleship.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import com.jme3.app.DebugKeysAppState;
|
||||
import com.jme3.app.SimpleApplication;
|
||||
import com.jme3.app.StatsAppState;
|
||||
@@ -20,10 +29,12 @@ import com.jme3.input.controls.MouseButtonTrigger;
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.simsilica.lemur.GuiGlobals;
|
||||
import com.simsilica.lemur.style.BaseStyles;
|
||||
|
||||
import static pp.battleship.Resources.lookup;
|
||||
import pp.battleship.client.gui.BattleAppState;
|
||||
import pp.battleship.client.gui.BgMusic;
|
||||
import pp.battleship.client.gui.EditorAppState;
|
||||
import pp.battleship.client.gui.SeaAppState;
|
||||
import pp.battleship.client.GameMusic;
|
||||
import pp.battleship.game.client.BattleshipClient;
|
||||
import pp.battleship.game.client.ClientGameLogic;
|
||||
import pp.battleship.game.client.ServerConnection;
|
||||
@@ -36,17 +47,6 @@ import pp.dialog.DialogBuilder;
|
||||
import pp.dialog.DialogManager;
|
||||
import pp.graphics.Draw;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import static pp.battleship.Resources.lookup;
|
||||
|
||||
/**
|
||||
* The main class for the Battleship client application.
|
||||
* It manages the initialization, input setup, GUI setup, and game states for the client.
|
||||
@@ -268,9 +268,8 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
|
||||
stateManager.detach(stateManager.getState(DebugKeysAppState.class));
|
||||
|
||||
attachGameSound();
|
||||
attachGameMusic();
|
||||
|
||||
stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState());
|
||||
attachBgMusic();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,16 +281,13 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient
|
||||
gameSound.setEnabled(GameSound.enabledInPreferences());
|
||||
stateManager.attach(gameSound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches the music state and sets its initial enabled state.
|
||||
*/
|
||||
private void attachGameMusic() {
|
||||
final GameMusic gameMusic = new GameMusic();
|
||||
gameMusic.setEnabled(GameMusic.enabledInPreferences());
|
||||
stateManager.attach(gameMusic);
|
||||
private void attachBgMusic() {
|
||||
final BgMusic gameSound = new BgMusic();
|
||||
gameSound.setEnabled(BgMusic.enabledInPreferences());
|
||||
stateManager.attach(gameSound);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates the application state every frame.
|
||||
* This method is called once per frame during the game loop.
|
||||
|
@@ -7,6 +7,10 @@
|
||||
|
||||
package pp.battleship.client;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
@@ -14,13 +18,9 @@ import com.jme3.asset.AssetLoadException;
|
||||
import com.jme3.asset.AssetNotFoundException;
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
|
||||
import pp.battleship.notification.GameEventListener;
|
||||
import pp.battleship.notification.SoundEvent;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import static pp.util.PreferencesUtils.getPreferences;
|
||||
|
||||
/**
|
||||
|
@@ -7,22 +7,25 @@
|
||||
|
||||
package pp.battleship.client;
|
||||
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Checkbox;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
import pp.battleship.client.gui.VolumeControl;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.dialog.StateCheckboxModel;
|
||||
import pp.dialog.TextInputDialog;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Checkbox;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.style.ElementId;
|
||||
|
||||
import static pp.battleship.Resources.lookup;
|
||||
import pp.battleship.client.gui.BgMusic;
|
||||
import pp.battleship.client.gui.VolumeSlider;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.dialog.StateCheckboxModel;
|
||||
import pp.dialog.TextInputDialog;
|
||||
import static pp.util.PreferencesUtils.getPreferences;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Menu class represents the main menu in the Battleship game application.
|
||||
* It extends the Dialog class and provides functionalities for loading, saving,
|
||||
@@ -34,7 +37,7 @@ class Menu extends Dialog {
|
||||
private final BattleshipApp app;
|
||||
private final Button loadButton = new Button(lookup("menu.map.load"));
|
||||
private final Button saveButton = new Button(lookup("menu.map.save"));
|
||||
private final VolumeControl volumeSlider;
|
||||
private final VolumeSlider slider;
|
||||
|
||||
/**
|
||||
* Constructs the Menu dialog for the Battleship application.
|
||||
@@ -44,16 +47,15 @@ class Menu extends Dialog {
|
||||
public Menu(BattleshipApp app) {
|
||||
super(app.getDialogManager());
|
||||
this.app = app;
|
||||
|
||||
addChild(new Label(lookup("battleship.name"), new ElementId("header")));//NON-NLS
|
||||
|
||||
slider = new VolumeSlider(app.getStateManager().getState(BgMusic.class));
|
||||
addChild(new Label(lookup("battleship.name"), new ElementId("header"))); //NON-NLS
|
||||
// addChild(new Checkbox(lookup("menu.sound-enabled"),
|
||||
// new StateCheckboxModel(app, GameSound.class)));
|
||||
addChild(new Checkbox(lookup("menu.sound-enabled"), new StateCheckboxModel(app, GameSound.class)));
|
||||
|
||||
addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, GameMusic.class)));
|
||||
|
||||
volumeSlider = new VolumeControl(app.getStateManager().getState(GameMusic.class));
|
||||
|
||||
addChild(volumeSlider);
|
||||
addChild(new Checkbox(lookup("menu.background-sound-enabled"), new StateCheckboxModel(app, BgMusic.class)));
|
||||
|
||||
addChild(slider);
|
||||
|
||||
addChild(loadButton)
|
||||
.addClickCommands(s -> ifTopDialog(this::loadDialog));
|
||||
@@ -74,16 +76,11 @@ class Menu extends Dialog {
|
||||
loadButton.setEnabled(app.getGameLogic().mayLoadMap());
|
||||
saveButton.setEnabled(app.getGameLogic().maySaveMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the position of the volume control slider.
|
||||
*/
|
||||
@Override
|
||||
public void update(float delta) {
|
||||
volumeSlider.update();
|
||||
slider.update();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* As an escape action, this method closes the menu if it is the top dialog.
|
||||
*/
|
||||
|
@@ -7,22 +7,22 @@
|
||||
|
||||
package pp.battleship.client;
|
||||
|
||||
import com.simsilica.lemur.Checkbox;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.TextField;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
import pp.battleship.client.server.BattleshipSelfhostServer;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.dialog.DialogBuilder;
|
||||
import pp.dialog.SimpleDialog;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.simsilica.lemur.Checkbox;
|
||||
import com.simsilica.lemur.Container;
|
||||
import com.simsilica.lemur.Label;
|
||||
import com.simsilica.lemur.TextField;
|
||||
import com.simsilica.lemur.component.SpringGridLayout;
|
||||
|
||||
import static pp.battleship.Resources.lookup;
|
||||
import pp.battleship.client.server.BattleshipSelfhostServer;
|
||||
import pp.dialog.Dialog;
|
||||
import pp.dialog.DialogBuilder;
|
||||
import pp.dialog.SimpleDialog;
|
||||
|
||||
/**
|
||||
* Represents a dialog for setting up a network connection in the Battleship game.
|
||||
@@ -172,4 +172,3 @@ class NetworkDialog extends SimpleDialog {
|
||||
serverThread.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,15 @@
|
||||
package pp.battleship.client;
|
||||
////////////////////////////////////////
|
||||
// Programming project code
|
||||
// UniBw M, 2022, 2023, 2024
|
||||
// www.unibw.de/inf2
|
||||
// (c) Mark Minas (mark.minas@unibw.de)
|
||||
////////////////////////////////////////
|
||||
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
@@ -9,25 +19,18 @@ import com.jme3.asset.AssetNotFoundException;
|
||||
import com.jme3.audio.AudioData;
|
||||
import com.jme3.audio.AudioNode;
|
||||
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import static pp.util.PreferencesUtils.getPreferences;
|
||||
|
||||
/**
|
||||
* An application state that plays music.
|
||||
* An application state that plays sounds.
|
||||
*/
|
||||
public class GameMusic extends AbstractAppState {
|
||||
private static final Logger LOGGER = System.getLogger(GameMusic.class.getName());
|
||||
private static final Preferences PREFERENCES = getPreferences(GameMusic.class);
|
||||
public class BgMusic extends AbstractAppState{
|
||||
private static final Logger LOGGER = System.getLogger(BgMusic.class.getName());
|
||||
private static final Preferences PREFERENCES = getPreferences(BgMusic.class);
|
||||
private static final String ENABLED_PREF = "enabled"; //NON-NLS
|
||||
private static final String VOLUME_PREF = "volume"; //NON-NLS
|
||||
|
||||
private AudioNode battleMusic;
|
||||
private AudioNode menuMusicModern;
|
||||
private AudioNode menuMusicTraditional;
|
||||
private AudioNode music;
|
||||
|
||||
/**
|
||||
* Checks if sound is enabled in the preferences.
|
||||
@@ -37,47 +40,18 @@ public class GameMusic extends AbstractAppState {
|
||||
public static boolean enabledInPreferences() {
|
||||
return PREFERENCES.getBoolean(ENABLED_PREF, true);
|
||||
}
|
||||
/**
|
||||
* Checks enabled volume in preferences.
|
||||
*
|
||||
* @return {@code float} if a volumePreference is set, the volume is set to the Value in PREFERENCES,
|
||||
* {@code 0.25f} if no volumePreference is set in PREFERENCES, the Volume is set to a default of 0.25f
|
||||
*
|
||||
*/
|
||||
|
||||
public static float volumePreference() {
|
||||
return PREFERENCES.getFloat(VOLUME_PREF, 0.25f);
|
||||
/**
|
||||
* Checks if sound is enabled in the preferences.
|
||||
*
|
||||
* @return //TODO
|
||||
*/
|
||||
public static float volumeInPreferences() {
|
||||
return PREFERENCES.getFloat(VOLUME_PREF, 0.5f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the game sound on or off.
|
||||
*/
|
||||
public void toggleSound() {
|
||||
setEnabled(!isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the enabled state of this AppState.
|
||||
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
|
||||
*
|
||||
* @param enabled {@code true} to enable the AppState, {@code false} to disable it.
|
||||
*/
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (isEnabled() == enabled) return;
|
||||
else if (!isEnabled() && enabled) {
|
||||
if (menuMusicModern != null) menuMusicModern.play();
|
||||
} else if (isEnabled() && !enabled) {
|
||||
if (menuMusicModern != null) menuMusicModern.stop();
|
||||
}
|
||||
|
||||
super.setEnabled(enabled);
|
||||
LOGGER.log(Level.INFO, "Music enabled: {0}", enabled); //NON-NLS
|
||||
PREFERENCES.putBoolean(ENABLED_PREF, enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the music.
|
||||
* Initializes the sound effects for the game.
|
||||
* Overrides {@link AbstractAppState#initialize(AppStateManager, Application)}
|
||||
*
|
||||
* @param stateManager The state manager
|
||||
@@ -86,17 +60,16 @@ public class GameMusic extends AbstractAppState {
|
||||
@Override
|
||||
public void initialize(AppStateManager stateManager, Application app) {
|
||||
super.initialize(stateManager, app);
|
||||
menuMusicModern =loadSound(app, "Sound/BackgroundMusic/menu-music-modern.ogg");
|
||||
setVolume(volumePreference());
|
||||
menuMusicModern.setLooping(true);
|
||||
if (isEnabled() && menuMusicModern != null) {
|
||||
menuMusicModern.play();
|
||||
music = loadSound(app, "Sound/Music/bgMusic.ogg");
|
||||
setVolume(volumeInPreferences());
|
||||
music.setLooping(true);
|
||||
if (isEnabled() && music != null) {
|
||||
music.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the music from the specified file.
|
||||
* Loads a sound from the specified file.
|
||||
*
|
||||
* @param app The application
|
||||
* @param name The name of the sound file.
|
||||
@@ -115,15 +88,34 @@ public class GameMusic extends AbstractAppState {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vol param to the level set in PREFERENCES
|
||||
*
|
||||
* @param vol Volume level of the music as indicated by the Volume control Slider
|
||||
/** TODO
|
||||
* Sets the enabled state of this AppState.
|
||||
* Overrides {@link com.jme3.app.state.AbstractAppState#setEnabled(boolean)}
|
||||
*
|
||||
* @param enabled {@code true} to enable the AppState, {@code false} to disable it.
|
||||
*/
|
||||
public void setVolume(float vol){
|
||||
menuMusicModern.setVolume(vol);
|
||||
PREFERENCES.putFloat(VOLUME_PREF, vol);
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
if (isEnabled() == enabled) return;
|
||||
else if(!isEnabled() && enabled) {
|
||||
if (music != null) music.play();
|
||||
} else if (isEnabled() && !enabled) {
|
||||
if (music != null) music.stop();
|
||||
}
|
||||
super.setEnabled(enabled);
|
||||
LOGGER.log(Level.INFO, "Sound enabled: {0}", enabled); //NON-NLS
|
||||
PREFERENCES.putBoolean(ENABLED_PREF, enabled);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Toggles the game sound on or off.
|
||||
*/
|
||||
public void toggleSound() {
|
||||
setEnabled(!isEnabled());
|
||||
}
|
||||
|
||||
public void setVolume(float vol){
|
||||
music.setVolume(vol);
|
||||
PREFERENCES.putFloat(VOLUME_PREF, vol);
|
||||
}
|
||||
}
|
@@ -7,19 +7,19 @@
|
||||
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.system.AppSettings;
|
||||
import com.simsilica.lemur.Button;
|
||||
import com.simsilica.lemur.Container;
|
||||
import pp.battleship.client.BattleshipAppState;
|
||||
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
|
||||
import static pp.battleship.Resources.lookup;
|
||||
import static pp.battleship.client.BattleshipApp.CLICK;
|
||||
import pp.battleship.client.BattleshipAppState;
|
||||
|
||||
/**
|
||||
* EditorState manages the editor mode in the Battleship game,
|
||||
|
@@ -16,6 +16,7 @@ import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial.CullHint;
|
||||
import com.jme3.scene.shape.Quad;
|
||||
|
||||
import pp.battleship.client.BattleshipApp;
|
||||
import pp.battleship.model.IntPoint;
|
||||
import pp.battleship.model.ShipMap;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.jme3.material.Material;
|
||||
import static com.jme3.material.Materials.UNSHADED;
|
||||
import com.jme3.material.RenderState;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
@@ -15,13 +16,12 @@ import com.jme3.scene.Geometry;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.shape.Sphere;
|
||||
|
||||
import pp.battleship.model.Battleship;
|
||||
import pp.battleship.model.Shell;
|
||||
import pp.battleship.model.Shot;
|
||||
import pp.util.Position;
|
||||
|
||||
import static com.jme3.material.Materials.UNSHADED;
|
||||
|
||||
/**
|
||||
* Synchronizes the visual representation of the ship map with the game model.
|
||||
* It handles the rendering of ships and shots on the map view, updating the view
|
||||
@@ -116,6 +116,8 @@ class MapViewSynchronizer extends ShipMapSynchronizer {
|
||||
return shipNode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a line geometry representing part of the ship's border.
|
||||
*
|
||||
@@ -129,8 +131,7 @@ class MapViewSynchronizer extends ShipMapSynchronizer {
|
||||
private Geometry shipLine(float x1, float y1, float x2, float y2, ColorRGBA color) {
|
||||
return view.getApp().getDraw().makeFatLine(x1, y1, x2, y2, SHIP_DEPTH, color, SHIP_LINE_WIDTH);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Creates and returns a Spatial representation of the given {@code Shell} object
|
||||
* for 2D visualization in the game. The shell is represented as a circle.
|
||||
*
|
||||
|
@@ -0,0 +1,283 @@
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.jme3.effect.ParticleEmitter;
|
||||
import com.jme3.effect.ParticleMesh.Type;
|
||||
import com.jme3.effect.shapes.EmitterSphereShape;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Vector3f;
|
||||
|
||||
import pp.battleship.client.BattleshipApp;
|
||||
|
||||
/**
|
||||
* Factory class responsible for creating particle effects used in the game.
|
||||
* This centralizes the creation of various types of particle emitters.
|
||||
*/
|
||||
public class ParticleEffectFactory {
|
||||
private static final int COUNT_FACTOR = 1;
|
||||
private static final float COUNT_FACTOR_F = 1f;
|
||||
private static final boolean POINT_SPRITE = true;
|
||||
private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle;
|
||||
|
||||
private final BattleshipApp app;
|
||||
|
||||
ParticleEffectFactory(BattleshipApp app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a flame particle emitter.
|
||||
*
|
||||
* @return a configured flame particle emitter
|
||||
*/
|
||||
ParticleEmitter createFlame() {
|
||||
ParticleEmitter flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR);
|
||||
flame.setSelectRandomImage(true);
|
||||
flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F)));
|
||||
flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
|
||||
flame.setStartSize(0.1f);
|
||||
flame.setEndSize(0.5f);
|
||||
flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
|
||||
flame.setParticlesPerSec(0);
|
||||
flame.setGravity(0, -5, 0);
|
||||
flame.setLowLife(.4f);
|
||||
flame.setHighLife(.5f);
|
||||
flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
flame.getParticleInfluencer().setVelocityVariation(1f);
|
||||
flame.setImagesX(2);
|
||||
flame.setImagesY(2);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/flame.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
flame.setMaterial(mat);
|
||||
|
||||
return flame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a flash particle emitter.
|
||||
*
|
||||
* @return a configured flash particle emitter
|
||||
*/
|
||||
ParticleEmitter createFlash() {
|
||||
ParticleEmitter flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR);
|
||||
flash.setSelectRandomImage(true);
|
||||
flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1f / COUNT_FACTOR_F));
|
||||
flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
flash.setStartSize(.1f);
|
||||
flash.setEndSize(0.5f);
|
||||
flash.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
|
||||
flash.setParticlesPerSec(0);
|
||||
flash.setGravity(0, 0, 0);
|
||||
flash.setLowLife(.2f);
|
||||
flash.setHighLife(.2f);
|
||||
flash.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 5f, 0));
|
||||
flash.getParticleInfluencer().setVelocityVariation(1);
|
||||
flash.setImagesX(2);
|
||||
flash.setImagesY(2);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/flash.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
flash.setMaterial(mat);
|
||||
|
||||
return flash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a round spark particle emitter.
|
||||
*
|
||||
* @return a configured round spark particle emitter
|
||||
*/
|
||||
ParticleEmitter createRoundSpark() {
|
||||
ParticleEmitter roundSpark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR);
|
||||
roundSpark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F)));
|
||||
roundSpark.setEndColor(new ColorRGBA(0, 0, 0, 0.5f / COUNT_FACTOR_F));
|
||||
roundSpark.setStartSize(0.2f);
|
||||
roundSpark.setEndSize(0.8f);
|
||||
roundSpark.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
|
||||
roundSpark.setParticlesPerSec(0);
|
||||
roundSpark.setGravity(0, -.5f, 0);
|
||||
roundSpark.setLowLife(1.8f);
|
||||
roundSpark.setHighLife(2f);
|
||||
roundSpark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 3, 0));
|
||||
roundSpark.getParticleInfluencer().setVelocityVariation(.5f);
|
||||
roundSpark.setImagesX(1);
|
||||
roundSpark.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/roundspark.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
roundSpark.setMaterial(mat);
|
||||
|
||||
return roundSpark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a spark particle emitter.
|
||||
*
|
||||
* @return a configured spark particle emitter
|
||||
*/
|
||||
ParticleEmitter createSpark() {
|
||||
ParticleEmitter spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
|
||||
spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F));
|
||||
spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
spark.setStartSize(.5f);
|
||||
spark.setEndSize(.5f);
|
||||
spark.setFacingVelocity(true);
|
||||
spark.setParticlesPerSec(0);
|
||||
spark.setGravity(0, 5, 0);
|
||||
spark.setLowLife(1.1f);
|
||||
spark.setHighLife(1.5f);
|
||||
spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0));
|
||||
spark.getParticleInfluencer().setVelocityVariation(1);
|
||||
spark.setImagesX(1);
|
||||
spark.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/spark.png"));
|
||||
spark.setMaterial(mat);
|
||||
|
||||
return spark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a smoke trail particle emitter.
|
||||
*
|
||||
* @return a configured smoke trail particle emitter
|
||||
*/
|
||||
ParticleEmitter createSmokeTrail() {
|
||||
ParticleEmitter smokeTrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
|
||||
smokeTrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F));
|
||||
smokeTrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
smokeTrail.setStartSize(.2f);
|
||||
smokeTrail.setEndSize(1f);
|
||||
smokeTrail.setFacingVelocity(true);
|
||||
smokeTrail.setParticlesPerSec(0);
|
||||
smokeTrail.setGravity(0, 1, 0);
|
||||
smokeTrail.setLowLife(.4f);
|
||||
smokeTrail.setHighLife(.5f);
|
||||
smokeTrail.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 12, 0));
|
||||
smokeTrail.getParticleInfluencer().setVelocityVariation(1);
|
||||
smokeTrail.setImagesX(1);
|
||||
smokeTrail.setImagesY(3);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/smoketrail.png"));
|
||||
smokeTrail.setMaterial(mat);
|
||||
|
||||
return smokeTrail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a debris particle emitter.
|
||||
*
|
||||
* @return a configured debris particle emitter
|
||||
*/
|
||||
ParticleEmitter createDebris() {
|
||||
ParticleEmitter debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
|
||||
debris.setSelectRandomImage(true);
|
||||
debris.setRandomAngle(true);
|
||||
debris.setRotateSpeed(FastMath.TWO_PI * 4);
|
||||
debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, 1.0f / COUNT_FACTOR_F));
|
||||
debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
|
||||
debris.setStartSize(.10f);
|
||||
debris.setEndSize(.15f);
|
||||
debris.setParticlesPerSec(0);
|
||||
debris.setGravity(0, 12f, 0);
|
||||
debris.setLowLife(1.4f);
|
||||
debris.setHighLife(1.5f);
|
||||
debris.setLocalTranslation(0, 2f, 0);
|
||||
debris.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 15, 0));
|
||||
debris.getParticleInfluencer().setVelocityVariation(.60f);
|
||||
debris.setImagesX(3);
|
||||
debris.setImagesY(3);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/Debris.png"));
|
||||
debris.setMaterial(mat);
|
||||
|
||||
return debris;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a shockwave particle emitter.
|
||||
*
|
||||
* @return a configured shockwave particle emitter
|
||||
*/
|
||||
ParticleEmitter createShockwave() {
|
||||
ParticleEmitter shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR);
|
||||
shockwave.setFaceNormal(Vector3f.UNIT_Y);
|
||||
shockwave.setStartColor(new ColorRGBA(.48f, 0.17f, 0.01f, .8f / COUNT_FACTOR_F));
|
||||
shockwave.setEndColor(new ColorRGBA(.48f, 0.17f, 0.01f, 0f));
|
||||
shockwave.setStartSize(0f);
|
||||
shockwave.setEndSize(3f);
|
||||
shockwave.setParticlesPerSec(0);
|
||||
shockwave.setGravity(0, 0, 0);
|
||||
shockwave.setLowLife(0.5f);
|
||||
shockwave.setHighLife(0.5f);
|
||||
shockwave.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
shockwave.getParticleInfluencer().setVelocityVariation(0f);
|
||||
shockwave.setImagesX(1);
|
||||
shockwave.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/shockwave.png"));
|
||||
shockwave.setMaterial(mat);
|
||||
|
||||
return shockwave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a moving smoke emitter.
|
||||
*
|
||||
* @return a configured smoke emitter
|
||||
*/
|
||||
ParticleEmitter createMovingSmokeEmitter() {
|
||||
ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300);
|
||||
smokeEmitter.setGravity(0, 0, 0);
|
||||
smokeEmitter.getParticleInfluencer().setVelocityVariation(1);
|
||||
smokeEmitter.setLocalTranslation(0, 2f, 0); //___________________
|
||||
smokeEmitter.setLowLife(1);
|
||||
smokeEmitter.setHighLife(1);
|
||||
smokeEmitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
smokeEmitter.setImagesX(15);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Smoke/Smoke.png"));
|
||||
smokeEmitter.setMaterial(mat);
|
||||
|
||||
return smokeEmitter;
|
||||
}
|
||||
public ParticleEmitter createWaterSplash() { //wird durch explosions animation ersetzt
|
||||
// Create a new particle emitter for the splash effect
|
||||
ParticleEmitter waterSplash = new ParticleEmitter("WaterSplash", Type.Triangle, 30);
|
||||
|
||||
// Set the shape of the emitter, making particles emit from a point or small area
|
||||
waterSplash.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f));
|
||||
|
||||
// Start and end colors for water (blue, fading out)
|
||||
waterSplash.setStartColor(new ColorRGBA(0.4f, 0.4f, 1f, 1f)); // Light blue at start
|
||||
waterSplash.setEndColor(new ColorRGBA(0.4f, 0.4f, 1f, 0f)); // Transparent at the end
|
||||
|
||||
// Particle size: small at start, larger before fading out
|
||||
waterSplash.setStartSize(0.1f);
|
||||
waterSplash.setEndSize(0.3f);
|
||||
|
||||
// Particle lifespan (how long particles live)
|
||||
waterSplash.setLowLife(0.5f);
|
||||
waterSplash.setHighLife(1f);
|
||||
|
||||
// Gravity: Pull the water particles downwards
|
||||
waterSplash.setGravity(0, -9.81f, 0); // Earth's gravity simulation
|
||||
|
||||
// Velocity: Give particles an initial burst upward (simulates splash)
|
||||
waterSplash.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 3, 0));
|
||||
waterSplash.getParticleInfluencer().setVelocityVariation(0.6f); // Add randomness to splash
|
||||
|
||||
// Set how many particles are emitted per second (0 to emit all particles at once)
|
||||
waterSplash.setParticlesPerSec(0);
|
||||
|
||||
// Load a texture for the water splash (assuming a texture exists at this path)
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Splash/splash.png"));
|
||||
waterSplash.setMaterial(mat);
|
||||
|
||||
return waterSplash;
|
||||
}
|
||||
|
||||
}
|
@@ -7,9 +7,10 @@
|
||||
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import com.jme3.effect.ParticleEmitter;
|
||||
import com.jme3.effect.ParticleMesh.Type;
|
||||
import com.jme3.effect.shapes.EmitterSphereShape;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.RenderState.BlendMode;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
@@ -21,306 +22,42 @@ import com.jme3.scene.Node;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.shape.Box;
|
||||
import com.jme3.scene.shape.Cylinder;
|
||||
|
||||
import pp.battleship.client.BattleshipApp;
|
||||
import pp.battleship.model.Battleship;
|
||||
import pp.battleship.model.Rotation;
|
||||
import pp.battleship.model.Shell;
|
||||
import pp.battleship.model.ShipMap;
|
||||
import pp.battleship.model.Shot;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static pp.util.FloatMath.HALF_PI;
|
||||
import static pp.util.FloatMath.PI;
|
||||
|
||||
/**
|
||||
* The {@code SeaSynchronizer} class is responsible for synchronizing the graphical
|
||||
* representation of the ships and shots on the sea map with the underlying model.
|
||||
* representation of the ships and shots on the sea map with the underlying data model.
|
||||
* It extends the {@link ShipMapSynchronizer} to provide specific synchronization
|
||||
* logic for the sea map.
|
||||
*/
|
||||
class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private static final String UNSHADED = "Common/MatDefs/Misc/Unshaded.j3md"; //NON-NLS
|
||||
private static final String KING_GEORGE_V_MODEL = "Models/KingGeorgeV/KingGeorgeV.j3o";//NON-NLS
|
||||
private static final String SMALL_BOAT_MODEL = "Models/BoatSmall/12219_boat_v2_L2.j3o";
|
||||
private static final String BATTLE_MODEL = "Models/Battle/Battle.j3o"; //NON-NLS
|
||||
private static final String CV_MODEL = "Models/CV/CV.j3o"; //NON-NLS
|
||||
private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md";
|
||||
private static final String KING_GEORGE_V_MODEL = "Models/Transporter/cr90.j3o"; //NON-NLS
|
||||
private static final String TIE_FIGHTER = "Models/TieFighter/TieFighter.j3o"; //NON-NLS
|
||||
private static final String TRANSPORTER = "Models/KingGeorgeV/KingGeorge.j3o"; //NON-NLS
|
||||
//private static final String VENATOR = "Models/Venator/Venator.j3o"; //NON-NLS
|
||||
private static final String WING = "Models/Wing/Wing.j3o"; //NON-NLS
|
||||
|
||||
private static final String COLOR = "Color"; //NON-NLS
|
||||
private static final String SHIP = "ship"; //NON-NLS
|
||||
private static final String SHOT = "shot"; //NON-NLS
|
||||
private static final ColorRGBA BOX_COLOR = ColorRGBA.Gray;
|
||||
private static final ColorRGBA SPLASH_COLOR = new ColorRGBA(0f, 0f, 1f, 0.4f);
|
||||
private static final ColorRGBA HIT_COLOR = new ColorRGBA(1f, 0f, 0f, 0.4f);
|
||||
private static final String LIGHTING = "Common/MatDefs/Light/Lighting.j3md";
|
||||
|
||||
private final ShipMap map;
|
||||
private final BattleshipApp app;
|
||||
private Shell shell;
|
||||
private Spatial shellModel;
|
||||
|
||||
private ParticleEmitter flame, flash, spark, roundspark, smoketrail, debris,
|
||||
shockwave;
|
||||
|
||||
|
||||
private static final int COUNT_FACTOR = 1;
|
||||
private static final float COUNT_FACTOR_F = 1f;
|
||||
|
||||
private static final boolean POINT_SPRITE = true;
|
||||
private static final Type EMITTER_TYPE = POINT_SPRITE ? Type.Point : Type.Triangle;
|
||||
|
||||
/**
|
||||
* Creates a Flame texture with indefinite Lifetime
|
||||
* @return flame texture
|
||||
*/
|
||||
private ParticleEmitter createFlame(){
|
||||
flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR);
|
||||
flame.setSelectRandomImage(true);
|
||||
flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (1f / COUNT_FACTOR_F)));
|
||||
flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
|
||||
flame.setStartSize(0.1f);
|
||||
flame.setEndSize(0.5f);
|
||||
flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
|
||||
flame.setParticlesPerSec(0);
|
||||
flame.setGravity(0, -5, 0);
|
||||
flame.setLowLife(.4f);
|
||||
flame.setHighLife(.5f);
|
||||
flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0));
|
||||
flame.getParticleInfluencer().setVelocityVariation(1f);
|
||||
flame.setImagesX(2);
|
||||
flame.setImagesY(2);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/flame.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
flame.setMaterial(mat);
|
||||
|
||||
return flame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Flash texture
|
||||
* @return flash texture
|
||||
*/
|
||||
private ParticleEmitter createFlash(){
|
||||
flash = new ParticleEmitter("Flash", EMITTER_TYPE, 24 * COUNT_FACTOR);
|
||||
flash.setSelectRandomImage(true);
|
||||
flash.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1f / COUNT_FACTOR_F));
|
||||
flash.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
flash.setStartSize(.1f);
|
||||
flash.setEndSize(0.5f);
|
||||
flash.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
|
||||
flash.setParticlesPerSec(0);
|
||||
flash.setGravity(0, 0, 0);
|
||||
flash.setLowLife(.2f);
|
||||
flash.setHighLife(.2f);
|
||||
flash.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 5f, 0));
|
||||
flash.getParticleInfluencer().setVelocityVariation(1);
|
||||
flash.setImagesX(2);
|
||||
flash.setImagesY(2);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/flash.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
flash.setMaterial(mat);
|
||||
|
||||
return flash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates small spark particles, that dissipate into the air
|
||||
* @return spark texture
|
||||
*/
|
||||
private ParticleEmitter createRoundSpark(){
|
||||
roundspark = new ParticleEmitter("RoundSpark", EMITTER_TYPE, 20 * COUNT_FACTOR);
|
||||
roundspark.setStartColor(new ColorRGBA(1f, 0.29f, 0.34f, (float) (1.0 / COUNT_FACTOR_F)));
|
||||
roundspark.setEndColor(new ColorRGBA(0, 0, 0, 0.5f / COUNT_FACTOR_F));
|
||||
roundspark.setStartSize(0.2f);
|
||||
roundspark.setEndSize(0.8f);
|
||||
roundspark.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
|
||||
roundspark.setParticlesPerSec(0);
|
||||
roundspark.setGravity(0, -.5f, 0);
|
||||
roundspark.setLowLife(1.8f);
|
||||
roundspark.setHighLife(2f);
|
||||
roundspark.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 3, 0));
|
||||
roundspark.getParticleInfluencer().setVelocityVariation(.5f);
|
||||
roundspark.setImagesX(1);
|
||||
roundspark.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/roundspark.png"));
|
||||
mat.setBoolean("PointSprite", POINT_SPRITE);
|
||||
roundspark.setMaterial(mat);
|
||||
|
||||
return roundspark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates small, thin smoke trails that enhance the flying debris
|
||||
* @return crates a thin smoke trail texture
|
||||
*/
|
||||
private ParticleEmitter createSpark(){
|
||||
spark = new ParticleEmitter("Spark", Type.Triangle, 30 * COUNT_FACTOR);
|
||||
spark.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F));
|
||||
spark.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
spark.setStartSize(.5f);
|
||||
spark.setEndSize(.5f);
|
||||
spark.setFacingVelocity(true);
|
||||
spark.setParticlesPerSec(0);
|
||||
spark.setGravity(0, 5, 0);
|
||||
spark.setLowLife(1.1f);
|
||||
spark.setHighLife(1.5f);
|
||||
spark.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 20, 0));
|
||||
spark.getParticleInfluencer().setVelocityVariation(1);
|
||||
spark.setImagesX(1);
|
||||
spark.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/spark.png"));
|
||||
spark.setMaterial(mat);
|
||||
|
||||
return spark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a dynamic smoke trail
|
||||
* @return smoke texture
|
||||
*/
|
||||
private ParticleEmitter createSmokeTrail(){
|
||||
smoketrail = new ParticleEmitter("SmokeTrail", Type.Triangle, 22 * COUNT_FACTOR);
|
||||
smoketrail.setStartColor(new ColorRGBA(1f, 0.8f, 0.36f, 1.0f / COUNT_FACTOR_F));
|
||||
smoketrail.setEndColor(new ColorRGBA(1f, 0.8f, 0.36f, 0f));
|
||||
smoketrail.setStartSize(.2f);
|
||||
smoketrail.setEndSize(1f);
|
||||
|
||||
// smoketrail.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
|
||||
smoketrail.setFacingVelocity(true);
|
||||
smoketrail.setParticlesPerSec(0);
|
||||
smoketrail.setGravity(0, 1, 0);
|
||||
smoketrail.setLowLife(.4f);
|
||||
smoketrail.setHighLife(.5f);
|
||||
smoketrail.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 12, 0));
|
||||
smoketrail.getParticleInfluencer().setVelocityVariation(1);
|
||||
smoketrail.setImagesX(1);
|
||||
smoketrail.setImagesY(3);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/smoketrail.png"));
|
||||
smoketrail.setMaterial(mat);
|
||||
|
||||
return smoketrail;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates flying debris particles
|
||||
* @return debris texture
|
||||
*/
|
||||
private ParticleEmitter createDebris(){
|
||||
debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
|
||||
debris.setSelectRandomImage(true);
|
||||
debris.setRandomAngle(true);
|
||||
debris.setRotateSpeed(FastMath.TWO_PI * 4);
|
||||
debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, 1.0f / COUNT_FACTOR_F));
|
||||
debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
|
||||
debris.setStartSize(.10f);
|
||||
debris.setEndSize(.15f);
|
||||
|
||||
// debris.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
|
||||
debris.setParticlesPerSec(0);
|
||||
debris.setGravity(0, 12f, 0);
|
||||
debris.setLowLife(1.4f);
|
||||
debris.setHighLife(1.5f);
|
||||
debris.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 15, 0));
|
||||
debris.getParticleInfluencer().setVelocityVariation(.60f);
|
||||
debris.setImagesX(3);
|
||||
debris.setImagesY(3);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/Debris.png"));
|
||||
debris.setMaterial(mat);
|
||||
|
||||
return debris;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an expanding circular shockwave
|
||||
* @return shockwave texture
|
||||
*/
|
||||
private ParticleEmitter createShockwave(){
|
||||
shockwave = new ParticleEmitter("Shockwave", Type.Triangle, 1 * COUNT_FACTOR);
|
||||
// shockwave.setRandomAngle(true);
|
||||
shockwave.setFaceNormal(Vector3f.UNIT_Y);
|
||||
shockwave.setStartColor(new ColorRGBA(.48f, 0.17f, 0.01f, .8f / COUNT_FACTOR_F));
|
||||
shockwave.setEndColor(new ColorRGBA(.48f, 0.17f, 0.01f, 0f));
|
||||
|
||||
shockwave.setStartSize(0f);
|
||||
shockwave.setEndSize(3f);
|
||||
|
||||
shockwave.setParticlesPerSec(0);
|
||||
shockwave.setGravity(0, 0, 0);
|
||||
shockwave.setLowLife(0.5f);
|
||||
shockwave.setHighLife(0.5f);
|
||||
shockwave.getParticleInfluencer()
|
||||
.setInitialVelocity(new Vector3f(0, 0, 0));
|
||||
shockwave.getParticleInfluencer().setVelocityVariation(0f);
|
||||
shockwave.setImagesX(1);
|
||||
shockwave.setImagesY(1);
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Explosion/shockwave.png"));
|
||||
shockwave.setMaterial(mat);
|
||||
|
||||
return shockwave;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an animated smoke column.
|
||||
* @return moving smoke texture
|
||||
*/
|
||||
private ParticleEmitter createMovingSmokeEmitter() {
|
||||
ParticleEmitter smokeEmitter = new ParticleEmitter("SmokeEmitter", Type.Triangle, 300);
|
||||
smokeEmitter.setGravity(0, 0, 0);
|
||||
smokeEmitter.getParticleInfluencer().setVelocityVariation(1);
|
||||
smokeEmitter.setLowLife(1);
|
||||
smokeEmitter.setHighLife(1);
|
||||
smokeEmitter.getParticleInfluencer().setInitialVelocity(new Vector3f(0, .5f, 0));
|
||||
smokeEmitter.setImagesX(15); // Assuming the smoke texture is a sprite sheet with 15 frames
|
||||
|
||||
// Set the material for the emitter
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Smoke/Smoke.png"));
|
||||
smokeEmitter.setMaterial(mat);
|
||||
|
||||
return smokeEmitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a small burst of bubbles.
|
||||
*
|
||||
* @return bubbling water texture.
|
||||
*/
|
||||
public ParticleEmitter createWaterSplash() {
|
||||
ParticleEmitter waterSplash = new ParticleEmitter("WaterSplash", Type.Triangle, 30);
|
||||
|
||||
waterSplash.setShape(new EmitterSphereShape(Vector3f.ZERO, 0.2f));
|
||||
|
||||
waterSplash.setStartColor(new ColorRGBA(0.4f, 0.4f, 1f, 1f)); // Light blue at start
|
||||
waterSplash.setEndColor(new ColorRGBA(0.4f, 0.4f, 1f, 0f)); // Transparent at the end
|
||||
|
||||
waterSplash.setStartSize(0.05f);
|
||||
waterSplash.setEndSize(0.1f);
|
||||
|
||||
waterSplash.setLowLife(0.5f);
|
||||
waterSplash.setHighLife(1f);
|
||||
|
||||
|
||||
waterSplash.setGravity(0, 0, 0); // No gravity to simulate a horizontal water splash
|
||||
|
||||
waterSplash.getParticleInfluencer().setInitialVelocity(new Vector3f(1f, 0f, 1f)); // Horizontal spread
|
||||
waterSplash.getParticleInfluencer().setVelocityVariation(1f); // Add randomness to splash
|
||||
waterSplash.setParticlesPerSec(0);
|
||||
|
||||
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Particle.j3md");
|
||||
mat.setTexture("Texture", app.getAssetManager().loadTexture("Effects/Splash/splash.png"));
|
||||
waterSplash.setMaterial(mat);
|
||||
|
||||
return waterSplash;
|
||||
}
|
||||
private final ParticleEffectFactory particleFactory;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a {@code SeaSynchronizer} object with the specified application, root node, and ship map.
|
||||
@@ -333,6 +70,7 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
super(app.getGameLogic().getOwnMap(), root);
|
||||
this.app = app;
|
||||
this.map = map;
|
||||
this.particleFactory = new ParticleEffectFactory(app);
|
||||
addExisting();
|
||||
}
|
||||
|
||||
@@ -348,6 +86,33 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
public Spatial visit(Shot shot) {
|
||||
return shot.isHit() ? handleHit(shot) : handleMiss(shot);
|
||||
}
|
||||
private Spatial handleMiss(Shot shot) {
|
||||
Node shotNode = new Node("ShotNode");
|
||||
Geometry shotCylinder = createCylinder(shot);
|
||||
shotNode.attachChild(shotCylinder);
|
||||
ParticleEmitter waterSplash = particleFactory.createWaterSplash();
|
||||
waterSplash.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f);
|
||||
shotNode.attachChild(waterSplash);
|
||||
waterSplash.emitAllParticles();
|
||||
|
||||
return shotNode;
|
||||
}
|
||||
private void sinkAndRemoveShip(Battleship ship) {
|
||||
Battleship wilkeningklaunichtmeinencode = ship;
|
||||
final Node shipNode = (Node) getSpatial(wilkeningklaunichtmeinencode);
|
||||
if (shipNode == null) return;
|
||||
|
||||
// Add sinking control to animate the sinking
|
||||
shipNode.addControl(new SinkingControl(shipNode));
|
||||
|
||||
// Add particle effects
|
||||
ParticleEmitter bubbles = particleFactory.createWaterSplash();
|
||||
bubbles.setLocalTranslation(shipNode.getLocalTranslation());
|
||||
shipNode.attachChild(bubbles);
|
||||
bubbles.emitAllParticles();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Handles a hit by attaching its representation to the node that
|
||||
@@ -361,20 +126,17 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
final Battleship ship = requireNonNull(map.findShipAt(shot), "Missing ship");
|
||||
final Node shipNode = requireNonNull((Node) getSpatial(ship), "Missing ship node");
|
||||
|
||||
|
||||
|
||||
// Create a new node specifically for the hit effects
|
||||
Node hitEffectNode = new Node("HitEffectNode");
|
||||
|
||||
// Create particle effects
|
||||
ParticleEmitter flame = createFlame();
|
||||
ParticleEmitter flash = createFlash();
|
||||
ParticleEmitter spark = createSpark();
|
||||
ParticleEmitter roundSpark = createRoundSpark();
|
||||
ParticleEmitter smokeTrail = createSmokeTrail();
|
||||
ParticleEmitter debris = createDebris();
|
||||
ParticleEmitter shockwave = createShockwave();
|
||||
ParticleEmitter movingSmoke = createMovingSmokeEmitter(); // New moving smoke emitter
|
||||
ParticleEmitter flame = particleFactory.createFlame();
|
||||
ParticleEmitter flash = particleFactory.createFlash();
|
||||
ParticleEmitter spark = particleFactory.createSpark();
|
||||
ParticleEmitter roundSpark = particleFactory.createRoundSpark();
|
||||
ParticleEmitter smokeTrail = particleFactory.createSmokeTrail();
|
||||
ParticleEmitter debris = particleFactory.createDebris();
|
||||
ParticleEmitter shockwave = particleFactory.createShockwave();
|
||||
ParticleEmitter movingSmoke = particleFactory.createMovingSmokeEmitter();
|
||||
|
||||
// Attach all effects to the hitEffectNode
|
||||
hitEffectNode.attachChild(flame);
|
||||
@@ -404,35 +166,14 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
roundSpark.emitAllParticles();
|
||||
|
||||
if (ship.isDestroyed()) {
|
||||
// Add ShipSinkingControl to the shipNode
|
||||
ShipSinkingControl sinkingControl = new ShipSinkingControl(2f, 5f, -5f, 60f);
|
||||
shipNode.addControl(sinkingControl);
|
||||
sinkingControl.startSinking(); // Start the sinking process
|
||||
|
||||
sinkAndRemoveShip(ship);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a miss by representing it with a blue cylinder
|
||||
* and attaching a water splash effect to it.
|
||||
* @param shot the shot to be processed
|
||||
* @return a Spatial simulating a miss with water splash effect
|
||||
*/
|
||||
private Spatial handleMiss(Shot shot) {
|
||||
Node shotNode = new Node("ShotNode");
|
||||
Geometry shotCylinder = createCylinder(shot);
|
||||
shotNode.attachChild(shotCylinder);
|
||||
ParticleEmitter waterSplash = createWaterSplash();
|
||||
waterSplash.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f);
|
||||
shotNode.attachChild(waterSplash);
|
||||
waterSplash.emitAllParticles();
|
||||
|
||||
return shotNode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a cylinder geometry representing the specified shot.
|
||||
* The appearance of the cylinder depends on whether the shot is a hit or a miss.
|
||||
@@ -443,15 +184,16 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
private Geometry createCylinder(Shot shot) {
|
||||
final ColorRGBA color = shot.isHit() ? HIT_COLOR : SPLASH_COLOR;
|
||||
final float height = shot.isHit() ? 1.2f : 0.1f;
|
||||
|
||||
|
||||
final Cylinder cylinder = new Cylinder(2, 20, 0.45f, height, true);
|
||||
final Geometry geometry = new Geometry(SHOT, cylinder);
|
||||
|
||||
|
||||
geometry.setMaterial(createColoredMaterial(color));
|
||||
geometry.rotate(HALF_PI, 0f, 0f);
|
||||
// compute the center of the shot in world coordinates
|
||||
geometry.setLocalTranslation(shot.getY() + 0.5f, 0f, shot.getX() + 0.5f);
|
||||
|
||||
|
||||
// compute the center of the shot in world coordinates, with an additional 2f height
|
||||
geometry.setLocalTranslation(shot.getY() + 0.5f, 2f + height / 2, shot.getX() + 0.5f);
|
||||
|
||||
return geometry;
|
||||
}
|
||||
|
||||
@@ -483,20 +225,20 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
* @return the spatial representing the battleship
|
||||
*/
|
||||
private Spatial createShip(Battleship ship) {
|
||||
switch (ship.getLength()) {
|
||||
case 4:
|
||||
return createBattleship(ship);
|
||||
case 3:
|
||||
return createCV(ship);
|
||||
case 2:
|
||||
return createBattle(ship);
|
||||
case 1:
|
||||
return createSmallShip(ship);
|
||||
|
||||
default:
|
||||
return createBox(ship);
|
||||
if (ship.getLength() == 1) {
|
||||
return createTie_Fighter(ship);
|
||||
} else if (ship.getLength() == 2) {
|
||||
return createWing(ship);
|
||||
} else if (ship.getLength() == 3) {
|
||||
return createTransporter(ship);
|
||||
} else if (ship.getLength() == 4) {
|
||||
return createBattleship(ship);
|
||||
} else {
|
||||
return createBox(ship);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a simple box to represent a battleship that is not of the "King George V" type.
|
||||
@@ -535,70 +277,100 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a detailed 3D model to represent a "King George V" battleship.
|
||||
* Creates a detailed 3D model to represent all battleships.
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the spatial representing the "King George V" battleship.
|
||||
* @return the spatial representing the "King George V" battleship
|
||||
*/
|
||||
private Spatial createBattleship(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(KING_GEORGE_V_MODEL);
|
||||
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(1.48f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a detailed 3D model to represent a small tugboat.
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the spatial representing the small tugboat.
|
||||
*/
|
||||
private Spatial createSmallShip(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(SMALL_BOAT_MODEL);
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(0.0005f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a detailed 3D model to represent a U-Boat .
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the spatial representing the U-Boat.
|
||||
*/
|
||||
private Spatial createBattle(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(BATTLE_MODEL);
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot()), 0f);
|
||||
// model.move(0f, -0.05f, 0f);
|
||||
model.scale(0.27f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a detailed 3D model to represent an aircraft carrier
|
||||
*
|
||||
* @param ship the battleship to be represented
|
||||
* @return the spatial representing the aircraft carrier.
|
||||
*/
|
||||
private Spatial createCV(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(CV_MODEL);
|
||||
|
||||
model.rotate(0f, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.move(0f, 0.25f, 0f);
|
||||
model.scale(0.85f);
|
||||
// Berechne den Rotationswinkel
|
||||
float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
|
||||
model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
|
||||
model.rotate(0f, rotationAngle, -HALF_PI);
|
||||
model.scale(1.2f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
// Bestimme die Verschiebung basierend auf der Rotation
|
||||
Vector3f translation = model.getLocalTranslation();
|
||||
|
||||
// Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
|
||||
if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
|
||||
// Verschiebe auf der Z-Achse und um 2f nach oben
|
||||
translation = translation.subtract(0,0,1); // Nach hinten auf der Z-Achse, und um 2f nach oben
|
||||
} else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
|
||||
// Verschiebe auf der X-Achse und um 2f nach oben
|
||||
translation = translation.subtract(1,0,0); // Nach hinten auf der X-Achse, und um 2f nach oben
|
||||
}
|
||||
|
||||
model.setLocalTranslation(translation);
|
||||
|
||||
return model;
|
||||
}
|
||||
private Spatial createTransporter(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(TRANSPORTER);
|
||||
float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
|
||||
|
||||
|
||||
model.rotate(-HALF_PI, calculateRotationAngle(ship.getRot())+ PI, 0f);
|
||||
model.scale(0.008f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
|
||||
Vector3f translation = model.getLocalTranslation();
|
||||
// Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
|
||||
if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
|
||||
// Verschiebe auf der Z-Achse und um 2f nach oben
|
||||
translation = translation.subtract(0,0,1);
|
||||
} else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
|
||||
// Verschiebe auf der X-Achse und um 2f nach oben
|
||||
translation = translation.add(1,0,0);
|
||||
}
|
||||
|
||||
model.setLocalTranslation(translation);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
private Spatial createWing(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(WING);
|
||||
model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
|
||||
|
||||
// Berechne den Rotationswinkel
|
||||
float rotationAngle = calculateRotationAngle(ship.getRot())+HALF_PI;
|
||||
model.rotate(0f, rotationAngle, 0f);
|
||||
model.scale(0.0008f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
|
||||
// Bestimme die Verschiebung basierend auf der Rotation
|
||||
Vector3f translation = model.getLocalTranslation();
|
||||
|
||||
// Bei 0 oder 180 Grad wird auf der Z-Achse verschoben, bei 90 oder 270 Grad auf der X-Achse
|
||||
if (rotationAngle == 0 || rotationAngle == FastMath.PI) {
|
||||
// Verschiebe auf der Z-Achse und um 2f nach oben
|
||||
translation = translation.add(0,0,0); // Nach hinten auf der Z-Achse, und um 2f nach oben
|
||||
} else if (rotationAngle == FastMath.HALF_PI || rotationAngle == 3 * FastMath.HALF_PI) {
|
||||
// Verschiebe auf der X-Achse und um 2f nach oben
|
||||
translation = translation.add(0,0,0); // Nach hinten auf der X-Achse, und um 2f nach oben
|
||||
}
|
||||
|
||||
model.setLocalTranslation(translation);
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
private Spatial createTie_Fighter(Battleship ship) {
|
||||
final Spatial model = app.getAssetManager().loadModel(TIE_FIGHTER);
|
||||
|
||||
model.rotate(-0f, calculateRotationAngle(ship.getRot()), 0f);
|
||||
model.scale(0.07f);
|
||||
model.setShadowMode(ShadowMode.CastAndReceive);
|
||||
model.setLocalTranslation(new Vector3f(model.getLocalTranslation().x, 2f, model.getLocalTranslation().z));
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculates the rotation angle for the specified rotation.
|
||||
@@ -614,7 +386,6 @@ class SeaSynchronizer extends ShipMapSynchronizer {
|
||||
case UP -> PI;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and returns a 3D model representation of the given {@code Shell} object
|
||||
* for visualization in the game.
|
||||
|
@@ -47,4 +47,3 @@ public class Shell2DControl extends AbstractControl {
|
||||
// No rendering-specific behavior required for this control
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,8 +4,8 @@ import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.control.AbstractControl;
|
||||
import pp.battleship.model.Shell;
|
||||
|
||||
import pp.battleship.model.Shell;
|
||||
import static pp.util.FloatMath.PI;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public class ShellControl extends AbstractControl {
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
Vector3f pos = shell.getPosition();
|
||||
Vector3f fixed = new Vector3f(pos.z + 0.5f, pos.y, pos.x + 0.5f);
|
||||
Vector3f fixed = new Vector3f(pos.z + 0.5f, pos.y + 2f, pos.x + 0.5f);
|
||||
fixed.setY(pos.y);
|
||||
spatial.setLocalTranslation(fixed);
|
||||
spatial.setLocalRotation(shell.getRotation());
|
||||
@@ -48,4 +48,3 @@ public class ShellControl extends AbstractControl {
|
||||
// No rendering-specific behavior required for this control
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,60 @@
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.jme3.math.FastMath;
|
||||
import com.jme3.math.Quaternion;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.Node;
|
||||
import com.jme3.scene.control.AbstractControl;
|
||||
|
||||
/**
|
||||
* Control that handles the sinking effect for destroyed ships.
|
||||
* It will gradually move the ship downwards and then remove it from the scene.
|
||||
*/
|
||||
class SinkingControl extends AbstractControl {
|
||||
private static final float SINK_DURATION = 2f; // Duration of the sinking animation
|
||||
private static final float SINK_SPEED = 0.6f; // Speed at which the ship sinks
|
||||
private float elapsedTime = 0;
|
||||
|
||||
private final Node shipNode;
|
||||
|
||||
/**
|
||||
* Constructs a {@code SinkingControl} object with the shipNode to be to be sunk
|
||||
* @param shipNode the node to handeld
|
||||
*/
|
||||
public SinkingControl(Node shipNode) {
|
||||
this.shipNode = shipNode;
|
||||
}
|
||||
float tiltAngle= 0;
|
||||
/**
|
||||
* Updated the Map to sink the ship
|
||||
*
|
||||
* @param tpf time per frame
|
||||
*/
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
// Update the sinking effect
|
||||
elapsedTime += tpf;
|
||||
|
||||
// Move the ship down over time
|
||||
Vector3f currentPos = shipNode.getLocalTranslation();
|
||||
shipNode.setLocalTranslation(currentPos.x+SINK_SPEED*tpf, currentPos.y - SINK_SPEED * tpf*2, currentPos.z+SINK_SPEED*tpf*2);
|
||||
|
||||
// Check if sinking duration has passed
|
||||
if (elapsedTime >= SINK_DURATION) {
|
||||
// Remove the ship from the scene
|
||||
shipNode.removeFromParent();
|
||||
}
|
||||
// Apply the tilt angle and rotation during sinking
|
||||
float sinkingTiltAngle = FastMath.DEG_TO_RAD * tiltAngle * tpf;
|
||||
float sinkingRotationAngle = FastMath.DEG_TO_RAD * 45f * tpf; // Additional rotation during sinking
|
||||
Quaternion tiltRotation = new Quaternion().fromAngles(-sinkingTiltAngle, sinkingRotationAngle, 0);
|
||||
spatial.setLocalRotation(tiltRotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void controlRender(RenderManager rm, ViewPort vp) {
|
||||
// No rendering-related code needed
|
||||
}
|
||||
}
|
@@ -13,9 +13,9 @@ import com.jme3.scene.control.AbstractControl;
|
||||
* Controls the burning, tilting, and sinking behavior of a battleship.
|
||||
* The ship will burn and tilt for a specified duration, then sink below the water surface.
|
||||
*/
|
||||
public class ShipSinkingControl extends AbstractControl {
|
||||
public class SinkingShip extends AbstractControl {
|
||||
|
||||
private float elapsedTime = 0f;
|
||||
private float elapsedTime = 0.2f;
|
||||
private final float burnTiltDuration;
|
||||
private final float sinkDuration;
|
||||
private final float sinkDepth;
|
||||
@@ -31,7 +31,7 @@ public class ShipSinkingControl extends AbstractControl {
|
||||
* @param sinkDepth Depth below the water to sink the ship
|
||||
* @param tiltAngle Final tilt angle in degrees
|
||||
*/
|
||||
public ShipSinkingControl(float burnTiltDuration, float sinkDuration, float sinkDepth, float tiltAngle) {
|
||||
public SinkingShip(float burnTiltDuration, float sinkDuration, float sinkDepth, float tiltAngle) {
|
||||
this.burnTiltDuration = burnTiltDuration;
|
||||
this.sinkDuration = sinkDuration;
|
||||
this.sinkDepth = sinkDepth;
|
||||
@@ -78,7 +78,9 @@ public class ShipSinkingControl extends AbstractControl {
|
||||
float progress = Math.min((elapsedTime - burnTiltDuration) / sinkDuration, 1f);
|
||||
|
||||
// Apply the tilt angle (remains constant during sinking)
|
||||
Quaternion tiltRotation = new Quaternion().fromAngles(-FastMath.DEG_TO_RAD * tiltAngle, 0, 0);
|
||||
float sinkingTiltAngle = FastMath.DEG_TO_RAD * tiltAngle * progress;
|
||||
float sinkingRotationAngle = FastMath.DEG_TO_RAD * 45f * progress; // Additional rotation during sinking (test)
|
||||
Quaternion tiltRotation = new Quaternion().fromAngles(-sinkingTiltAngle, sinkingRotationAngle, sinkingRotationAngle);
|
||||
spatial.setLocalRotation(tiltRotation);
|
||||
|
||||
// Sink the ship by interpolating the Y position
|
||||
@@ -92,6 +94,28 @@ public class ShipSinkingControl extends AbstractControl {
|
||||
}
|
||||
spatial.removeControl(this);
|
||||
}
|
||||
// public void checkAndTriggerExplosion() {
|
||||
// // Prüfen, ob das sinkende Schiff den Boden erreicht hat
|
||||
// if (spatial != null && spatial.getLocalTranslation().y <= sinkDepth) {
|
||||
// // Explosion ausführen, wenn der Boden erreicht ist
|
||||
// triggerExplosionAnimation();
|
||||
//
|
||||
// // Entfernen des Schiffs aus dem Elternknoten
|
||||
// Node parentNode = (Node) spatial.getParent();
|
||||
// if (parentNode != null) {
|
||||
// parentNode.detachChild(spatial);
|
||||
// }
|
||||
//
|
||||
// // Entfernen der Kontrolle vom Spatial
|
||||
// spatial.removeControl(this);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void triggerExplosionAnimation() {
|
||||
// // Code für die Explosion-Animation (alibi Methode)
|
||||
// System.out.println("Explosion wird ausgeführt: Das Schiff hat den Boden erreicht!");
|
||||
// // Hier könnte eine echte Animation eingefügt werden, z.B. Partikeleffekte
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,6 +135,6 @@ public class ShipSinkingControl extends AbstractControl {
|
||||
* Starts the sinking process for the ship.
|
||||
*/
|
||||
public void startSinking() {
|
||||
// Nothing to do here as the control update handles the timing and sequence
|
||||
// --> sinkingControl
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.simsilica.lemur.Slider;
|
||||
import pp.battleship.client.GameMusic;
|
||||
|
||||
|
||||
public class VolumeControl extends Slider {
|
||||
|
||||
private final GameMusic menuMusicModern;
|
||||
|
||||
private double vol;
|
||||
|
||||
public VolumeControl(GameMusic music) {
|
||||
super();
|
||||
this.menuMusicModern = music;
|
||||
vol = GameMusic.volumePreference();
|
||||
getModel().setPercent(vol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the volume of the music to the appropriate level set by the User through the Volume control Slider
|
||||
*
|
||||
*/
|
||||
public void update() {
|
||||
if (vol != getModel().getPercent()) {
|
||||
vol = getModel().getPercent();
|
||||
menuMusicModern.setVolume( (float) vol);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@@ -0,0 +1,25 @@
|
||||
package pp.battleship.client.gui;
|
||||
|
||||
import com.simsilica.lemur.Slider;
|
||||
|
||||
public class VolumeSlider extends Slider {
|
||||
|
||||
private final BgMusic music;
|
||||
|
||||
private double vol;
|
||||
|
||||
public VolumeSlider(BgMusic music) {
|
||||
super();
|
||||
this.music = music;
|
||||
vol = BgMusic.volumeInPreferences();
|
||||
getModel().setPercent(vol);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (vol != getModel().getPercent()) {
|
||||
vol = getModel().getPercent();
|
||||
music.setVolume( (float) vol);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -7,6 +7,15 @@
|
||||
|
||||
package pp.battleship.client.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
import com.jme3.network.ConnectionListener;
|
||||
import com.jme3.network.HostedConnection;
|
||||
import com.jme3.network.Message;
|
||||
@@ -14,6 +23,7 @@ import com.jme3.network.MessageListener;
|
||||
import com.jme3.network.Network;
|
||||
import com.jme3.network.Server;
|
||||
import com.jme3.network.serializing.Serializer;
|
||||
|
||||
import pp.battleship.BattleshipConfig;
|
||||
import pp.battleship.game.server.Player;
|
||||
import pp.battleship.game.server.ServerGameLogic;
|
||||
@@ -30,15 +40,6 @@ import pp.battleship.model.Battleship;
|
||||
import pp.battleship.model.IntPoint;
|
||||
import pp.battleship.model.Shot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.System.Logger;
|
||||
import java.lang.System.Logger.Level;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.logging.LogManager;
|
||||
|
||||
/**
|
||||
* Server implementing the visitor pattern as MessageReceiver for ClientMessages
|
||||
*/
|
||||
@@ -64,7 +65,7 @@ public class BattleshipSelfhostServer implements MessageListener<HostedConnectio
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the server.
|
||||
* Starts the Battleships server.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new BattleshipSelfhostServer().run();
|
||||
@@ -116,17 +117,17 @@ public class BattleshipSelfhostServer implements MessageListener<HostedConnectio
|
||||
Serializer.registerClass(MapMessage.class);
|
||||
Serializer.registerClass(ShootMessage.class);
|
||||
Serializer.registerClass(EffectMessage.class);
|
||||
Serializer.registerClass(AnimationFinishedMessage.class);
|
||||
Serializer.registerClass(Battleship.class);
|
||||
Serializer.registerClass(IntPoint.class);
|
||||
Serializer.registerClass(Shot.class);
|
||||
Serializer.registerClass(AnimationFinishedMessage.class);
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
myServer.addMessageListener(this, MapMessage.class);
|
||||
myServer.addMessageListener(this, ShootMessage.class);
|
||||
myServer.addMessageListener(this, AnimationFinishedMessage.class);
|
||||
myServer.addConnectionListener(this);
|
||||
myServer.addMessageListener(this, AnimationFinishedMessage.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,16 +0,0 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 29.03.2012 14:25:39
|
||||
|
||||
newmtl default
|
||||
Ns 35.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.5400 0.5400 0.5400
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
|
||||
map_Kd 14084_WWII_ship_German_Type_II_U-boat_diff.jpg
|
Before Width: | Height: | Size: 168 KiB |
@@ -1,104 +0,0 @@
|
||||
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
|
||||
# File Created: 16.12.2011 14:18:52
|
||||
|
||||
newmtl white
|
||||
Ns 53.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.6667 0.6667 0.6667
|
||||
Kd 0.6667 0.6667 0.6667
|
||||
Ks 0.1800 0.1800 0.1800
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl boat_elements_black
|
||||
Ns 55.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.0000 0.0000 0.0000
|
||||
Kd 0.0000 0.0000 0.0000
|
||||
Ks 0.3600 0.3600 0.3600
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl boat_glass
|
||||
Ns 60.0000
|
||||
Ni 7.0000
|
||||
d 0.4000
|
||||
Tr 0.6000
|
||||
Tf 0.4000 0.4000 0.4000
|
||||
illum 2
|
||||
Ka 0.1059 0.1569 0.1451
|
||||
Kd 0.1059 0.1569 0.1451
|
||||
Ks 0.6750 0.6750 0.6750
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl boat_screw_hooks_bronze
|
||||
Ns 80.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.2941 0.2157 0.0510
|
||||
Kd 0.2941 0.2157 0.0510
|
||||
Ks 0.7200 0.7200 0.7200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl boat_silver
|
||||
Ns 80.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 0.3333 0.3333 0.3333
|
||||
Kd 0.3333 0.3333 0.3333
|
||||
Ks 0.7200 0.7200 0.7200
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
|
||||
newmtl boat_buffer
|
||||
Ns 10.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.2700 0.2700 0.2700
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka boat_buffer_diffuse.jpg
|
||||
map_Kd boat_buffer_diffuse.jpg
|
||||
|
||||
newmtl boat_roof_accessory
|
||||
Ns 15.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.3600 0.3600 0.3600
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka boat_roof_accessory_diffuse.jpg
|
||||
map_Kd boat_roof_accessory_diffuse.jpg
|
||||
|
||||
newmtl boat_body
|
||||
Ns 55.0000
|
||||
Ni 1.5000
|
||||
d 1.0000
|
||||
Tr 0.0000
|
||||
Tf 1.0000 1.0000 1.0000
|
||||
illum 2
|
||||
Ka 1.0000 1.0000 1.0000
|
||||
Kd 1.0000 1.0000 1.0000
|
||||
Ks 0.3600 0.3600 0.3600
|
||||
Ke 0.0000 0.0000 0.0000
|
||||
map_Ka boat_body_diffuse.jpg
|
||||
map_Kd boat_body_diffuse.jpg
|
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 166 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 264 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 98 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 79 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 78 B |
Before Width: | Height: | Size: 79 B |
@@ -1,180 +0,0 @@
|
||||
newmtl Model001_Material001
|
||||
map_Kd Yorktown_paint6.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material002
|
||||
map_Kd diff_null_7.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material003
|
||||
map_Kd diff_null_14.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material004
|
||||
map_Kd diff_null_Color005.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material005
|
||||
map_Kd diff_null_8.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material006
|
||||
map_Kd diff_null_Color007.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material007
|
||||
map_Kd diff_null_17.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material008
|
||||
map_Kd diff_null_FrontColor.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material009
|
||||
map_Kd diff_null_BackColor.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material010
|
||||
map_Kd diff_null_4.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material011
|
||||
map_Kd Color_004.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material012
|
||||
map_Kd diff_null_Gray1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material013
|
||||
map_Kd diff_null_3.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material014
|
||||
map_Kd Metal_Rough.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material015
|
||||
map_Kd diff_null_12.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material016
|
||||
map_Kd diff_null_19.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material017
|
||||
map_Kd diff_null_Color003.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material018
|
||||
map_Kd diff_null_mat1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material019
|
||||
map_Kd diff_null_1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material020
|
||||
map_Kd diff_null_2.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material021
|
||||
map_Kd diff_null_Black1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material022
|
||||
map_Kd diff_null_Model001Materia.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material023
|
||||
map_Kd diff_null_Model001Mate1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material024
|
||||
map_Kd diff_null_13.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material025
|
||||
map_Kd _6.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material026
|
||||
map_Kd Metal_Aluminum_Anodized.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material027
|
||||
map_Kd diff_null_Color006.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material028
|
||||
map_Kd Blinds_Vertical_Stripe_Gray.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material029
|
||||
map_Kd diff_null_15.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material030
|
||||
map_Kd diff_null_Color002.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material031
|
||||
map_Kd Cladding_Siding_Tan.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material032
|
||||
map_Kd diff_null_Color008.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material033
|
||||
map_Kd diff_null_16.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material034
|
||||
map_Kd _2.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material035
|
||||
map_Kd Blinds_Roman_Hobbled_Blue.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material036
|
||||
map_Kd Blinds_Wood_White.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material037
|
||||
map_Kd Metal_Seamed.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material038
|
||||
map_Kd image_16.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material039
|
||||
map_Kd diff_null_9.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material040
|
||||
map_Kd image_15.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material041
|
||||
map_Kd _Blinds_Roman_Hobbled_Blue_1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material042
|
||||
map_Kd diff_null_10.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material043
|
||||
map_Kd diff_null_Material5.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material044
|
||||
map_Kd diff_null_Material1.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
||||
newmtl Model001_Material045
|
||||
map_Kd diff_null_11.png
|
||||
map_bump bumpmap_flat.png
|
||||
|
Before Width: | Height: | Size: 96 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 670 KiB |
Before Width: | Height: | Size: 235 KiB |
Before Width: | Height: | Size: 94 KiB |
@@ -1,3 +0,0 @@
|
||||
based on:
|
||||
https://free3d.com/3d-model/wwii-ship-uk-king-george-v-class-battleship-v1--185381.html
|
||||
License: Free Personal Use Only
|
After Width: | Height: | Size: 354 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 220 KiB |