Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package engine.models;
- import com.opencsv.CSVReader;
- import com.opencsv.bean.CsvToBean;
- import com.opencsv.bean.CsvToBeanBuilder;
- import engine.models.textures.ModelTexture;
- import engine.objconverter.Vertex;
- imports... etc..
- import org.lwjgl.util.vector.Vector3f;
- /**
- *
- * Reads the models.csv file
- * @author
- *
- */
- public class ModelReader {
- static int modelTotalNumber;
- /*
- *
- * Start of ArrayList for X,Y,Z coordinates
- */
- //List<Float> x = new ArrayList<Float>();
- //List<Float> y = new ArrayList<Float>();
- //List<Float> z = new ArrayList<Float>();
- /*
- *
- * End of ArrayList for X,Y,Z coordinates
- */
- /*
- *
- * Start of HashMap test!
- */
- static HashMap<String,String> modFTNamesh = new HashMap<String,String>();
- static HashMap<Float, Float> xy = new HashMap<Float,Float>();
- float x;
- float y;
- float zc;
- public static HashMap<Float, Float> getXy() {
- return xy;
- }
- public static HashMap<Float, Float> getZ() {
- return z;
- }
- static HashMap<Float, Float> z = new HashMap<Float,Float>();
- public static HashMap<String, String> getModFTNamesh() {
- return modFTNamesh;
- }
- /*
- *
- * End of Hashmap test!
- */
- public ModelReader() {
- try {
- CSVReader reader = new CSVReader(new FileReader("res/read/models.csv"));
- String[] nextLine;
- int modelNum = 0;
- while((nextLine = reader.readNext()) != null) {
- modelNum++;
- if(nextLine != null) {
- String modelNumber = nextLine[0];
- String modelName = nextLine[1];
- String modelFileName = nextLine[2];
- String modelTexture = nextLine[3];
- String modelCoordX = nextLine[4];
- String modelCoordY = nextLine[5];
- String modelCoordZ = nextLine[6];
- float modelCoordXFloat = Float.parseFloat(modelCoordX);
- float modelCoordYFloat = Float.parseFloat(modelCoordY);
- float modelCoordZFloat = Float.parseFloat(modelCoordZ);
- zc = modelCoordZFloat;
- x = modelCoordXFloat;
- y = modelCoordYFloat;
- /*
- *
- * Start of HashMap
- */
- modFTNamesh.put(modelFileName, modelTexture);
- xy.put(modelCoordXFloat, modelCoordYFloat);
- z.put(modelCoordZFloat, 0f);
- /*
- *
- * End of Hashmap
- */
- }
- }
- } catch(Exception e) {
- System.out.println(e);
- }
- }
- //get the value then get the row then get the x y z
- public float getX() {
- return x;
- }
- public float getY() {
- return y;
- }
- public float getZc() {
- return zc;
- }
- public static int getModelTotalNumber() {
- return modelTotalNumber;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement