Skip to content

Commit

Permalink
fixed up stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Jul 11, 2013
1 parent 544e708 commit 0cb1fa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public DirectionalLight set(final Color color, final Vector3 direction) {
if (color != null)
this.color.set(color);
if (direction != null)
this.direction.set(direction);
this.direction.set(direction).nor();
return this;
}

public DirectionalLight set(final float r, final float g, final float b, final Vector3 direction) {
this.color.set(r,g,b,1f);
if (direction != null)
this.direction.set(direction);
this.direction.set(direction).nor();
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static Pixmap generatePixmap(int width, int height, int min, int max, int
}

public static void generateVoxels(VoxelWorld voxelWorld, int min, int max, int octaveCount) {
byte[] heightMap = PerlinNoiseGenerator.generateHeightMap(voxelWorld.voxelsX, voxelWorld.voxelsZ, min, max, 8);
byte[] heightMap = PerlinNoiseGenerator.generateHeightMap(voxelWorld.voxelsX, voxelWorld.voxelsZ, min, max, octaveCount);
int idx = 0;
for(int z = 0; z < voxelWorld.voxelsZ; z++) {
for(int x = 0; x < voxelWorld.voxelsX; x++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.badlogic.gdx.graphics.g3d.materials.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.materials.Material;
import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
import com.badlogic.gdx.graphics.g3d.shaders.GLES10Shader;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.FirstPersonCameraController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
Expand All @@ -43,6 +44,7 @@ public void create () {
font = new BitmapFont();
modelBatch = new ModelBatch();
DefaultShader.defaultCullFace = GL20.GL_FRONT;
GLES10Shader.defaultCullFace = GL20.GL_FRONT;
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.near = 1;
camera.far = 1000;
Expand All @@ -51,14 +53,14 @@ public void create () {

lights = new Lights();
lights.ambientLight.set(0.4f, 0.4f, 0.4f, 1f);
lights.add(new DirectionalLight().set(1, 1, 1, -0.7f, -0.8f, -0.2f));
lights.add(new DirectionalLight().set(1, 1, 1, 0, -1, 0));

Texture texture = new Texture(Gdx.files.internal("data/g3d/tiles.png"));
TextureRegion[][] tiles = TextureRegion.split(texture, 32, 32);

MathUtils.random.setSeed(0);
voxelWorld = new VoxelWorld(tiles[0], 20, 4, 20);
PerlinNoiseGenerator.generateVoxels(voxelWorld, 0, 63, 3);
voxelWorld = new VoxelWorld(tiles[0], 10, 4, 10);
PerlinNoiseGenerator.generateVoxels(voxelWorld, 0, 63, 10);
// voxelWorld.setCube(0, 0, 0, 16, 16, 16, (byte)1);
float camX = voxelWorld.voxelsX / 2f;
float camZ = voxelWorld.voxelsZ / 2f;
Expand Down Expand Up @@ -90,6 +92,6 @@ public void resize (int width, int height) {

@Override
public boolean needsGL20 () {
return true;
return false;
}
}

0 comments on commit 0cb1fa4

Please sign in to comment.