Exemple #1
0
 public void applyMatricesToVertices(MDL mdlr) {
   int sz = numVerteces();
   for (int i = 0; i < sz; i++) {
     GeosetVertex gv = vertex.get(i);
     gv.clearBoneAttachments();
     Matrix mx = getMatrix(gv.getVertexGroup());
     mx.updateIds(mdlr);
     int szmx = mx.size();
     for (int m = 0; m < szmx; m++) {
       gv.addBoneAttachment((Bone) mdlr.getIdObject(mx.getBoneId(m)));
     }
   }
 }
Exemple #2
0
 public void updateToObjects(MDL mdlr) {
   // upload the temporary UVLayer and Matrix objects into the vertices themselves
   int sz = numVerteces();
   for (Matrix m : matrix) {
     m.updateBones(mdlr);
   }
   for (int i = 0; i < sz; i++) {
     GeosetVertex gv = vertex.get(i);
     gv.clearTVerts();
     int szuv = uvlayers.size();
     for (int l = 0; l < szuv; l++) {
       try {
         gv.addTVertex(uvlayers.get(l).getTVertex(i));
       } catch (Exception e) {
         JOptionPane.showMessageDialog(
             MDLReader.getDefaultContainer(),
             "Error: Length of TVertices and Vertices chunk differ (Or some other unknown error has occurred)!");
       }
     }
     Matrix mx = getMatrix(gv.getVertexGroup());
     int szmx = mx.size();
     gv.clearBoneAttachments();
     for (int m = 0; m < szmx; m++) {
       gv.addBoneAttachment((Bone) mdlr.getIdObject(mx.getBoneId(m)));
     }
     gv.setNormal(normals.get(i));
     for (Triangle t : triangle) {
       if (t.containsRef(gv)) {
         gv.triangles.add(t);
       }
     }
     gv.geoset = this;
     //             gv.addBoneAttachment(null);//Why was this here?
   }
   try {
     material = mdlr.getMaterial(materialID);
   } catch (ArrayIndexOutOfBoundsException e) {
     JOptionPane.showMessageDialog(null, "Error: Material index out of bounds for geoset!");
   }
   parentModel = mdlr;
 }