How to add a new model - Fish-In-A-Suit/Conquest GitHub Wiki
This way of adding models is very likely to be changed in the future, as it's currently quite tedious and repetitive, not counting the fact that the models currently have to be hard-coded.
Creating a model based on vertices, indices and colours
- Create a new class representing the specific model (eg. cube) inside the models package and define it's vertex positions, indices and colours
- Define the model from step one to be a private member of class Game. Then initialize it at the start of the constructor of Game.
- Create a new GameEntity instance out of the data defined in step one inside the constructor of Game. Add this entity to the entities array of type GameEntity in the same constructor.
- Implement keyboard input logic for that model (access it by an index in the entities array) inside Game.updateLogic(Window window)
Creating a textured model
- Create a new class representing the model (eg. cube) inside the models package and define its vertex positions (coordinates), indices and texture coordinates
- Define the model to be a private member of class Game. Then initialize it at the start of the constructor (
Game.Game
). This model will be used to provide data for the constructor of GameEntity to create a new entity representing that model. - Create a new GameEntity instance inside a try clause of Game.Game and specify vertex positions (first param), indices (second param), texture coordinates (third param) and the String representing the path to where the PNG texture image is stored (fourth param)
- Add this newly created GameEntity instance to the array GameEntity entities
- If the model is going to be affected by input events, set according responses using if statements in the
Game.updateLogic
method