# comments.. bla bla bla
# points
-1 2 3
6 -3 6
9 3 -5
1 5 8
-4 2 6
# polygons
1 2 3
3 4 1
1 3 2
1 3 4
1 2 4
1 2 3
1 2 3
First of all I loaded the file using the Java method I had created for loading text files. Then I excluded all lines starting with "#" except "# points" and "# polygons". I used those two comments as references as to what I was loading right now. I simply loaded all the points into a List using each of the three numbers as a coordinate (x,y,z). When I got to loading the polygons, triangles in this case, I picked the points out of the list with the corresponding index (ex. List Item number 1, 2, and 3) and created a Triangle with them which I then added to my Model.
I created a Model.merge method so I could load another model and merge it into the first model. This allowed for loading each part of a model separately, as was needed for my Character class.
Next I created a folder layout to save all my Character parts in. It would bring some more order into all the files I would need to create so that players could customise their character as they wanted. The folder layout looked something like this:
+CParts (character parts)
--Body
--Hat
--Gloves
--Shoes
--etc.
Each folder would have files in it with names ranging from the number 1 to something hopefully below 100. So to generate my players model I could simply load the corresponding file to the corresponding number in his Look Array from the correct folder. The number 0 in a players Look Array means that he isn't wearing that right now (ex. hat=0; not wearing a hat).
Once I finished that I started thinking about the Item class I would hopefully create on the next day. I didn't come up with anything but since my current speed is pretty good I hope I'll think of something tomorrow. If I don't, I'll start working on the Map class.
No comments:
Post a Comment