LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();\r
config.title = "Gdx Invaders";\r
config.vSyncEnabled = true;\r
- config.useGL20 = true;\r
+ config.useGL20 = false;\r
new LwjglApplication(new GdxInvaders(), config);\r
}\r
}\r
import com.badlogic.gdx.graphics.VertexAttributes.Usage;\r
import com.badlogic.gdx.graphics.g2d.BitmapFont;\r
import com.badlogic.gdx.graphics.g2d.SpriteBatch;\r
+import com.badlogic.gdx.graphics.g3d.Light;\r
import com.badlogic.gdx.graphics.g3d.ModelBatch;\r
import com.badlogic.gdx.graphics.g3d.RenderableProvider;\r
import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;\r
/** perspective camera **/\r
private PerspectiveCamera camera;\r
\r
+ /** the directional light **/\r
+ Light[] lights = { new Light(Color.WHITE, new Vector3(-1, -0.5f, 0).nor()) };\r
+\r
+\r
ModelBatch modelBatch;\r
\r
final Vector3 tmpV = new Vector3();\r
modelBatch.begin(camera);\r
modelBatch.render(simulation.explosions);\r
if (!simulation.ship.isExploding)\r
- modelBatch.render(simulation.ship);\r
- modelBatch.render(simulation.invaders);\r
+ modelBatch.render(simulation.ship, lights);\r
+ modelBatch.render(simulation.invaders, lights);\r
modelBatch.render(simulation.blocks);\r
modelBatch.render(simulation.shots);\r
modelBatch.end();\r
import com.badlogic.gdx.math.Vector3;\r
\r
public class Invader extends ModelInstance {\r
+ public static float INVADER_ROTATION = 45f;\r
public static float INVADER_RADIUS = 0.75f;\r
public static float INVADER_VELOCITY = 1;\r
public static int INVADER_POINTS = 40;\r
movedDistance = 0;\r
}\r
}\r
+ transform.rotate(0, 1, 0, INVADER_ROTATION * delta);\r
}\r
}\r
import java.util.ArrayList;\r
\r
import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.graphics.Color;\r
import com.badlogic.gdx.graphics.GL10;\r
import com.badlogic.gdx.graphics.Mesh;\r
import com.badlogic.gdx.graphics.Texture;\r
import com.badlogic.gdx.graphics.Pixmap.Format;\r
import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
import com.badlogic.gdx.graphics.VertexAttributes.Usage;\r
+import com.badlogic.gdx.graphics.g3d.Light;\r
import com.badlogic.gdx.graphics.g3d.Model;\r
import com.badlogic.gdx.graphics.g3d.loader.ObjLoader;\r
import com.badlogic.gdx.graphics.g3d.materials.BlendingAttribute;\r