Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building a 3D Game with LibGDX

You're reading from  Building a 3D Game with LibGDX

Product type Book
Published in Aug 2016
Publisher Packt
ISBN-13 9781785288418
Pages 234 pages
Edition 1st Edition
Languages

Performance improvements on the enemy model


We now want to work a bit on performance. Though there's quite a lot of performance work we can do for our game, there's one big improvement we can do with the enemy model, and another small improvement that can be useful for bigger games, frustum culling.

Fire up EntityFactory: 
public class EntityFactory { 
   private static Model playerModel, enemyModel; 
   private static Texture playerTexture; 
   private static ModelBuilder modelBuilder; 
   private static ModelData enemyModelData; 
   private static ModelComponent enemyModelComponent; 
   ... 
   public static Entity createEnemy(BulletSystem bulletSystem,
       float x, float y, float z) { 
       Entity entity = new Entity(); 
       ModelLoader<?> modelLoader = new G3dModelLoader(new 
       JsonReader()); 
       if (enemyModel == null) { 
           enemyModelData =
           modelLoader.loadModelData(Gdx...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}