Skip to content

Commit

Permalink
fix: fix grid mesh for hexmap
Browse files Browse the repository at this point in the history
  • Loading branch information
jmecn committed Apr 13, 2024
1 parent e0ac28d commit 083f8b7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions lib/src/main/java/io/github/jmecn/tiled/TiledMapAppState.java
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,17 @@ public void toggleGrid() {
* @return
*/
private Material createGridMaterial() {
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Gray);
Material mat = new Material(assetManager, TiledConst.TILED_J3MD);
mat.setColor("Color", ColorRGBA.DarkGray);
mat.getAdditionalRenderState().setWireframe(true);
mat.getAdditionalRenderState().setDepthTest(false);
return mat;
}

private Material createCursorMaterial() {
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(0.7f, 0.8f, 0.9f, 0.3f));
Material mat = new Material(assetManager, TiledConst.TILED_J3MD);
mat.setColor("Color", new ColorRGBA(0.4f, 0.8f, 0.4f, 0.7f));
//mat.setBoolean("UseAlpha", true);
return mat;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private boolean doStaggerY(int y) {

@Override
public Spatial createTileGrid(Material material) {
Hexagon mesh = new Hexagon(tileWidth, tileHeight, map.getHexSideLength(), map.getStaggerAxis(), true);
Hexagon mesh = new Hexagon(tileWidth, tileHeight, map.getHexSideLength(), map.getStaggerAxis(), false);
// Rect mesh = new Rect(tileWidth, tileHeight, false);
Geometry geom = new Geometry("HexGrid", mesh);
geom.setMaterial(material);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public IsometricRenderer(TiledMap map) {
@Override
public Spatial createTileGrid(Material material) {
// create a grid
Diamond mesh = new Diamond(tileWidth, tileHeight, true);
Diamond mesh = new Diamond(tileWidth, tileHeight, false);
// Rect mesh = new Rect(tileWidth, tileHeight, false);
Geometry geom = new Geometry("TileGrid", mesh);
geom.setMaterial(material);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public Hexagon(int mapTileWidth, int mapTileHeight, int hexSideLength, StaggerAx
}
polygon.add(new Vector2f(columnWidth, tileHeight));
if (isStaggerX) {
polygon.add(new Vector2f(0, tileHeight));
polygon.add(new Vector2f(sideOffsetX, tileHeight));
}

if (border) {
Expand Down

0 comments on commit 083f8b7

Please sign in to comment.