Merge branch 'development' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development
This commit is contained in:
@@ -107,7 +107,7 @@ public void simpleInitApp() {
|
||||
gameView = new GameView(this);
|
||||
ceremonyView = new CeremonyView(this);
|
||||
|
||||
enter(MdgaState.GAME);
|
||||
enter(MdgaState.MAIN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,9 +28,6 @@ public class ModelSynchronizer {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
private Color testColor;
|
||||
private int test = 0;
|
||||
|
||||
public void animationEnd() {
|
||||
app.getGameLogic().selectAnimationEnd();
|
||||
}
|
||||
@@ -135,35 +132,6 @@ public void leave() {
|
||||
|
||||
public void enter(MdgaState state) {
|
||||
LOGGER.log(Level.INFO, "enter: {0}", state);
|
||||
app.enter(state);
|
||||
|
||||
if (state == MdgaState.CEREMONY) {
|
||||
CeremonyView ceremonyView = (CeremonyView) app.getView();
|
||||
ceremonyView.addCeremonyParticipant(Color.AIRFORCE, 1, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.ARMY, 2, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.NAVY, 3, "ugidffdg");
|
||||
ceremonyView.addCeremonyParticipant(Color.CYBER, 4, "ugidffdg");
|
||||
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("player sdgsd", 1, 2, 3, 4, 5, 6);
|
||||
ceremonyView.addStatisticsRow("Gesamt", 1, 2, 3, 4, 5, 6);
|
||||
}
|
||||
|
||||
if (state == MdgaState.GAME) {
|
||||
GameView gameView = (GameView) app.getView();
|
||||
|
||||
//app.getNotificationSynchronizer().addTestNotification(new DrawCardNotification(Color.AIRFORCE, BonusCard.SHIELD));
|
||||
selectPiece(UUID.randomUUID());
|
||||
}
|
||||
|
||||
if (state == MdgaState.LOBBY) {
|
||||
LobbyView lobbyView = (LobbyView) app.getView();
|
||||
|
||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.CYBER, "blablabupp", false));
|
||||
app.getNotificationSynchronizer().addTestNotification(new TskSelectNotification(Color.ARMY, "Spieler 2", false));
|
||||
lobbyView.setReady(Color.ARMY, true);
|
||||
}
|
||||
//app.enter(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,6 @@ public void update(float scroll, float rotation) {
|
||||
rotationValue = getAngleByColor(ownColor);
|
||||
radius = 50f;
|
||||
}
|
||||
System.out.println(rotationValue);
|
||||
float verticalAngleRadians = FastMath.DEG_TO_RAD * verticalAngle;
|
||||
|
||||
float z = radius * FastMath.sin(verticalAngleRadians);
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package pp.mdga.client.board.outline;
|
||||
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.MaterialDef;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.post.Filter;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
|
||||
|
||||
public class OutlineFilter extends Filter {
|
||||
|
||||
private OutlinePreFilter outlinePreFilter;
|
||||
private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
|
||||
private float outlineWidth = 1;
|
||||
|
||||
public OutlineFilter(OutlinePreFilter outlinePreFilter) {
|
||||
super("OutlineFilter");
|
||||
this.outlinePreFilter = outlinePreFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
||||
MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/Outline.j3md");
|
||||
material = new Material(matDef);
|
||||
material.setVector2("Resolution", new Vector2f(w, h));
|
||||
material.setColor("OutlineColor", outlineColor);
|
||||
material.setFloat("OutlineWidth", outlineWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preFrame(float tpf) {
|
||||
super.preFrame(tpf);
|
||||
material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
|
||||
// System.out.println("OutlineFilter.preFrame()");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
||||
// material.setTexture("OutlineDepthTexture", outlinePreFilter.getDefaultPassDepthTexture());
|
||||
// System.out.println("OutlineFilter.postFrame()");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public ColorRGBA getOutlineColor() {
|
||||
return outlineColor;
|
||||
}
|
||||
|
||||
public void setOutlineColor(ColorRGBA outlineColor) {
|
||||
this.outlineColor = outlineColor;
|
||||
if (material != null) {
|
||||
material.setColor("OutlineColor", outlineColor);
|
||||
}
|
||||
}
|
||||
|
||||
public float getOutlineWidth() {
|
||||
return outlineWidth;
|
||||
}
|
||||
|
||||
public void setOutlineWidth(float outlineWidth) {
|
||||
this.outlineWidth = outlineWidth;
|
||||
if (material != null) {
|
||||
material.setFloat("OutlineWidth", outlineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
public OutlinePreFilter getOutlinePreFilter() {
|
||||
return outlinePreFilter;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package pp.mdga.client.board.outline;
|
||||
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.post.Filter;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.Renderer;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.renderer.queue.RenderQueue;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
import com.jme3.texture.Image.Format;
|
||||
import com.jme3.texture.Texture;
|
||||
|
||||
|
||||
public class OutlinePreFilter extends Filter {
|
||||
|
||||
private Pass normalPass;
|
||||
private RenderManager renderManager;
|
||||
|
||||
/**
|
||||
* Creates a OutlinePreFilter
|
||||
*/
|
||||
public OutlinePreFilter() {
|
||||
super("OutlinePreFilter");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRequiresDepthTexture() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postQueue(RenderQueue queue) {
|
||||
Renderer r = renderManager.getRenderer();
|
||||
r.setFrameBuffer(normalPass.getRenderFrameBuffer());
|
||||
renderManager.getRenderer().clearBuffers(true, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public Texture getOutlineTexture() {
|
||||
return normalPass.getRenderedTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
||||
this.renderManager = renderManager;
|
||||
normalPass = new Pass();
|
||||
normalPass.init(renderManager.getRenderer(), w, h, Format.RGBA8, Format.Depth);
|
||||
material = new Material(manager, "MatDefs/SelectObjectOutliner/OutlinePre.j3md");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanUpFilter(Renderer r) {
|
||||
normalPass.cleanup(r);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package pp.mdga.client.board.outline;
|
||||
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.material.Material;
|
||||
import com.jme3.material.MaterialDef;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import com.jme3.post.Filter;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.texture.FrameBuffer;
|
||||
|
||||
public class OutlineProFilter extends Filter {
|
||||
|
||||
private OutlinePreFilter outlinePreFilter;
|
||||
private ColorRGBA outlineColor = new ColorRGBA(0, 1, 0, 1);
|
||||
private float outlineWidth = 1;
|
||||
|
||||
public OutlineProFilter(OutlinePreFilter outlinePreFilter) {
|
||||
super("OutlineFilter");
|
||||
this.outlinePreFilter = outlinePreFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initFilter(AssetManager assetManager, RenderManager renderManager, ViewPort vp, int w, int h) {
|
||||
MaterialDef matDef = (MaterialDef) assetManager.loadAsset("MatDefs/SelectObjectOutliner/OutlinePro.j3md");
|
||||
material = new Material(matDef);
|
||||
material.setVector2("Resolution", new Vector2f(w, h));
|
||||
material.setColor("OutlineColor", outlineColor);
|
||||
material.setFloat("OutlineWidth", outlineWidth);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preFrame(float tpf) {
|
||||
super.preFrame(tpf);
|
||||
material.setTexture("OutlineDepthTexture", outlinePreFilter.getOutlineTexture());
|
||||
// System.out.println("OutlineFilter.preFrame()");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
|
||||
super.postFrame(renderManager, viewPort, prevFilterBuffer, sceneBuffer);
|
||||
// material.setTexture("OutlineDepthTexture", outlinePreFilter.getDefaultPassDepthTexture());
|
||||
// System.out.println("OutlineFilter.postFrame()");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material getMaterial() {
|
||||
return material;
|
||||
}
|
||||
|
||||
public ColorRGBA getOutlineColor() {
|
||||
return outlineColor;
|
||||
}
|
||||
|
||||
public void setOutlineColor(ColorRGBA outlineColor) {
|
||||
this.outlineColor = outlineColor;
|
||||
if (material != null) {
|
||||
material.setColor("OutlineColor", outlineColor);
|
||||
}
|
||||
}
|
||||
|
||||
public float getOutlineWidth() {
|
||||
return outlineWidth;
|
||||
}
|
||||
|
||||
public void setOutlineWidth(float outlineWidth) {
|
||||
this.outlineWidth = outlineWidth;
|
||||
if (material != null) {
|
||||
material.setFloat("OutlineWidth", outlineWidth);
|
||||
}
|
||||
}
|
||||
|
||||
public OutlinePreFilter getOutlinePreFilter() {
|
||||
return outlinePreFilter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package pp.mdga.client.board.outline;
|
||||
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.post.FilterPostProcessor;
|
||||
import com.jme3.renderer.Camera;
|
||||
import com.jme3.renderer.RenderManager;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.Spatial;
|
||||
import pp.mdga.client.MdgaApp;
|
||||
|
||||
public class SelectObjectOutliner {
|
||||
|
||||
private final FilterPostProcessor fpp;
|
||||
private final RenderManager renderManager;
|
||||
private final AssetManager assetManager;
|
||||
private final Camera cam;
|
||||
private final int width;
|
||||
private boolean selected;
|
||||
private ViewPort outlineViewport = null;
|
||||
// private OutlineFilter outlineFilter = null;
|
||||
private OutlineProFilter outlineFilter = null;
|
||||
private final MdgaApp app;
|
||||
|
||||
public SelectObjectOutliner(int width, FilterPostProcessor fpp, RenderManager renderManager, AssetManager assetManager, Camera cam, MdgaApp app) {
|
||||
this.selected = false;
|
||||
this.fpp = fpp;
|
||||
this.renderManager = renderManager;
|
||||
this.assetManager = assetManager;
|
||||
this.cam = cam;
|
||||
this.width = width;
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public void deselect(Spatial model) {
|
||||
if(selected){
|
||||
selected = false;
|
||||
hideOutlineFilterEffect(model);
|
||||
}
|
||||
}
|
||||
|
||||
public void select(Spatial model, ColorRGBA color) {
|
||||
if(!selected){
|
||||
selected = true;
|
||||
showOutlineFilterEffect(model, width, color);
|
||||
}
|
||||
}
|
||||
|
||||
public void select(Spatial model, ColorRGBA color, int width) {
|
||||
if(!selected){
|
||||
selected = true;
|
||||
showOutlineFilterEffect(model, width, color);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideOutlineFilterEffect(Spatial model) {
|
||||
// app.enqueue(() -> {
|
||||
outlineFilter.setEnabled(false);
|
||||
outlineFilter.getOutlinePreFilter().setEnabled(false);
|
||||
fpp.removeFilter(outlineFilter);
|
||||
outlineViewport.detachScene(model);
|
||||
outlineViewport.clearProcessors();
|
||||
renderManager.removePreView(outlineViewport);
|
||||
outlineViewport = null;
|
||||
// return null;
|
||||
// });
|
||||
}
|
||||
|
||||
private void showOutlineFilterEffect(Spatial model, int width, ColorRGBA color) {
|
||||
// app.enqueue(() -> {
|
||||
outlineViewport = renderManager.createPreView("outlineViewport", cam);
|
||||
FilterPostProcessor outlineFpp = new FilterPostProcessor(assetManager);
|
||||
|
||||
OutlinePreFilter outlinePreFilter = new OutlinePreFilter();
|
||||
outlineFpp.addFilter(outlinePreFilter);
|
||||
|
||||
outlineViewport.attachScene(model);
|
||||
outlineViewport.addProcessor(outlineFpp);
|
||||
|
||||
outlineFilter = new OutlineProFilter(outlinePreFilter);
|
||||
outlineFilter.setOutlineColor(color);
|
||||
outlineFilter.setOutlineWidth(width);
|
||||
|
||||
fpp.addFilter(outlineFilter);
|
||||
// return null;
|
||||
// });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user