improve textures
This commit is contained in:
BIN
assets/textures/dirt.png
Normal file
BIN
assets/textures/dirt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 KiB |
BIN
assets/textures/grass.png
Normal file
BIN
assets/textures/grass.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 165 KiB |
BIN
assets/textures/moss.png
Normal file
BIN
assets/textures/moss.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 190 KiB |
BIN
assets/textures/paving_2.png
Normal file
BIN
assets/textures/paving_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 163 KiB |
BIN
assets/textures/rocky_grass.png
Normal file
BIN
assets/textures/rocky_grass.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
BIN
assets/textures/rocky_grass_2.png
Normal file
BIN
assets/textures/rocky_grass_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 177 KiB |
@@ -82,11 +82,6 @@ public class GameScreen implements Screen {
|
|||||||
60f, 60f, // viewport size
|
60f, 60f, // viewport size
|
||||||
1f, 100f // near/far for the light camera
|
1f, 100f // near/far for the light camera
|
||||||
);
|
);
|
||||||
// initial values; DayNightCycle will start animating these
|
|
||||||
shadowLight.set(
|
|
||||||
1.0f, 0.85f, 0.9f, // light color
|
|
||||||
-0.7f, -1.0f, -0.3f // direction
|
|
||||||
);
|
|
||||||
|
|
||||||
environment.add(shadowLight);
|
environment.add(shadowLight);
|
||||||
environment.shadowMap = shadowLight;
|
environment.shadowMap = shadowLight;
|
||||||
@@ -96,9 +91,9 @@ public class GameScreen implements Screen {
|
|||||||
// create the cycle controller
|
// create the cycle controller
|
||||||
dayNightCycle = new DayNightCycle(shadowLight, ambientLight);
|
dayNightCycle = new DayNightCycle(shadowLight, ambientLight);
|
||||||
// optional: start at morning/noon/etc
|
// optional: start at morning/noon/etc
|
||||||
dayNightCycle.setTimeOfDay(0.4f); // good sun
|
dayNightCycle.setTimeOfDay(0.2f); // good sun
|
||||||
dayNightCycle.setAxialTilt(30f);
|
dayNightCycle.setAxialTilt(30f);
|
||||||
dayNightCycle.setDayLength(60f * 5f); // 20 minutes
|
dayNightCycle.setDayLength(10f); // 5 minutes
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initWorld() {
|
private void initWorld() {
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ public class DayNightCycle {
|
|||||||
private final ColorAttribute ambientLight;
|
private final ColorAttribute ambientLight;
|
||||||
|
|
||||||
// base colors
|
// base colors
|
||||||
private final Color dayAmbient = new Color(0.5f, 0.5f, 0.5f, 1f);
|
private final Color dayAmbient = new Color(0.6f, 0.7f, 0.7f, 1f);
|
||||||
private final Color nightAmbient = new Color(0.05f, 0.05f, 0.1f, 1f);
|
private final Color nightAmbient = new Color(0.2f, 0.15f, 0.2f, 1f);
|
||||||
|
|
||||||
private final Color daySunColor = new Color(1.0f, 0.85f, 0.9f, 1f);
|
private final Color daySunColor = new Color(1.0f, 0.9f, 1f, 1f);
|
||||||
private final Color nightSunColor = new Color(0.4f, 0.4f, 0.6f, 1f);
|
private final Color nightSunColor = new Color(0.4f, 0.4f, 0.6f, 1f);
|
||||||
|
|
||||||
private final Color daySkyColor = new Color(0.5f, 0.6f, 1.0f, 1f);
|
private final Color daySkyColor = new Color(0.8f, 0.9f, 1.0f, 1f);
|
||||||
private final Color nightSkyColor = new Color(0.02f, 0.02f, 0.06f, 1f);
|
private final Color nightSkyColor = new Color(0.1f, 0.01f, 0.2f, 1f);
|
||||||
|
|
||||||
private final Color currentSkyColor = new Color();
|
private final Color currentSkyColor = new Color();
|
||||||
private final Color tmpSunColor = new Color();
|
private final Color tmpSunColor = new Color();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class FpsCameraController {
|
|||||||
private int centerX;
|
private int centerX;
|
||||||
private int centerY;
|
private int centerY;
|
||||||
private int captureWarmupFrames = 0;
|
private int captureWarmupFrames = 0;
|
||||||
private static final int WARMUP_FRAMES = 6; // frames to ignore after capture
|
private static final int WARMUP_FRAMES = 10; // frames to ignore after capture
|
||||||
|
|
||||||
private Cursor invisibleCursor;
|
private Cursor invisibleCursor;
|
||||||
|
|
||||||
|
|||||||
@@ -15,16 +15,19 @@ public class ModelLibrary {
|
|||||||
private final ModelBuilder builder = new ModelBuilder();
|
private final ModelBuilder builder = new ModelBuilder();
|
||||||
|
|
||||||
public final Texture groundTexture;
|
public final Texture groundTexture;
|
||||||
|
public final Texture pathTexture;
|
||||||
|
public final Texture houseTexture; // <-- new
|
||||||
|
|
||||||
public final Model groundModel;
|
public final Model groundModel;
|
||||||
public final Model unitCubeModel;
|
public final Model unitCubeModel;
|
||||||
|
|
||||||
// new: town-related primitives
|
// town-related primitives
|
||||||
public final Model houseBlockModel;
|
public final Model houseBlockModel;
|
||||||
public final Model pathTileModel;
|
public final Model pathTileModel;
|
||||||
|
|
||||||
public ModelLibrary() {
|
public ModelLibrary() {
|
||||||
// --- ground texture + model (unchanged) ---
|
// --- ground texture + model ---
|
||||||
groundTexture = new Texture(Gdx.files.internal("textures/paving.png"));
|
groundTexture = new Texture(Gdx.files.internal("textures/rocky_grass_2.png"));
|
||||||
groundTexture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
groundTexture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||||
groundTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
groundTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
||||||
|
|
||||||
@@ -55,33 +58,54 @@ public class ModelLibrary {
|
|||||||
);
|
);
|
||||||
groundModel = builder.end();
|
groundModel = builder.end();
|
||||||
|
|
||||||
// generic 2x2x2 cube
|
// generic cube (still untextured)
|
||||||
unitCubeModel = builder.createBox(
|
unitCubeModel = builder.createBox(
|
||||||
1f, 1f, 1f,
|
1f, 1f, 1f,
|
||||||
new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f)),
|
new Material(ColorAttribute.createDiffuse(1f, 1f, 1f, 1f)),
|
||||||
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
|
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
|
||||||
);
|
);
|
||||||
|
|
||||||
// simple “blocky house” primitive: 4x3x4
|
// --- house texture + model ---
|
||||||
|
// assumes textures/texture_09.png exists
|
||||||
|
houseTexture = new Texture(Gdx.files.internal("textures/texture_03.png"));
|
||||||
|
houseTexture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||||
|
houseTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
||||||
|
|
||||||
houseBlockModel = builder.createBox(
|
houseBlockModel = builder.createBox(
|
||||||
4f, 3f, 4f,
|
4f, 3f, 4f,
|
||||||
new Material(ColorAttribute.createDiffuse(0.9f, 0.8f, 0.7f, 1f)),
|
new Material(
|
||||||
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal
|
TextureAttribute.createDiffuse(houseTexture)
|
||||||
|
// optionally tint:
|
||||||
|
// ColorAttribute.createDiffuse(0.9f, 0.8f, 0.7f, 1f)
|
||||||
|
),
|
||||||
|
VertexAttributes.Usage.Position
|
||||||
|
| VertexAttributes.Usage.Normal
|
||||||
|
| VertexAttributes.Usage.TextureCoordinates // <-- important
|
||||||
);
|
);
|
||||||
|
|
||||||
// flat path tile (2D quad slightly above ground)
|
// --- path tile texture + model ---
|
||||||
|
pathTexture = new Texture(Gdx.files.internal("textures/paving_2.png"));
|
||||||
|
pathTexture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||||
|
pathTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
|
||||||
|
|
||||||
builder.begin();
|
builder.begin();
|
||||||
Material pathMat = new Material(
|
Material pathMat = new Material(
|
||||||
ColorAttribute.createDiffuse(0.6f, 0.6f, 0.6f, 1f)
|
TextureAttribute.createDiffuse(pathTexture)
|
||||||
);
|
);
|
||||||
|
|
||||||
MeshPartBuilder pathMpb = builder.part(
|
MeshPartBuilder pathMpb = builder.part(
|
||||||
"pathTile",
|
"pathTile",
|
||||||
GL20.GL_TRIANGLES,
|
GL20.GL_TRIANGLES,
|
||||||
VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal,
|
VertexAttributes.Usage.Position
|
||||||
|
| VertexAttributes.Usage.Normal
|
||||||
|
| VertexAttributes.Usage.TextureCoordinates,
|
||||||
pathMat
|
pathMat
|
||||||
);
|
);
|
||||||
float tHalf = 1f; // tile size 4x4
|
|
||||||
float y = 0.01f; // just above ground to avoid z-fighting
|
float tHalf = 1f; // 2x2 tile
|
||||||
|
float y = 0.01f;
|
||||||
|
|
||||||
|
pathMpb.setUVRange(0f, 0f, 0.5f, 0.5f);
|
||||||
pathMpb.rect(
|
pathMpb.rect(
|
||||||
-tHalf, y, tHalf,
|
-tHalf, y, tHalf,
|
||||||
tHalf, y, tHalf,
|
tHalf, y, tHalf,
|
||||||
@@ -97,6 +121,9 @@ public class ModelLibrary {
|
|||||||
unitCubeModel.dispose();
|
unitCubeModel.dispose();
|
||||||
houseBlockModel.dispose();
|
houseBlockModel.dispose();
|
||||||
pathTileModel.dispose();
|
pathTileModel.dispose();
|
||||||
|
|
||||||
groundTexture.dispose();
|
groundTexture.dispose();
|
||||||
|
pathTexture.dispose();
|
||||||
|
houseTexture.dispose(); // <-- new
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user