mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-06 06:53:59 +00:00
Tons more utils!
This commit is contained in:
parent
2f77cb9604
commit
c08c972bce
17 changed files with 2198 additions and 5 deletions
|
|
@ -36,6 +36,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.util.Color;
|
||||
import org.lwjgl.util.model.*;
|
||||
import org.lwjgl.util.model.BoneFrame;
|
||||
import org.lwjgl.util.model.BonedModel;
|
||||
|
|
@ -92,6 +93,7 @@ public class Loader {
|
|||
material,
|
||||
loadTriangles(),
|
||||
loadSkin(),
|
||||
loadColor(),
|
||||
loadBoneAnimations(),
|
||||
loadBonedVertices()
|
||||
);
|
||||
|
|
@ -101,6 +103,7 @@ public class Loader {
|
|||
material,
|
||||
loadTriangles(),
|
||||
loadSkin(),
|
||||
loadColor(),
|
||||
loadMeshAnimations()
|
||||
);
|
||||
} else {
|
||||
|
|
@ -149,6 +152,28 @@ public class Loader {
|
|||
return skins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the colour
|
||||
* @return Color[]
|
||||
* @throws Exception
|
||||
*/
|
||||
private Color[] loadColor() throws Exception {
|
||||
List colorElements = XMLUtil.getChildren(src.getDocumentElement(), "color");
|
||||
if (colorElements.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
if (colorElements.size() != numVertices) {
|
||||
throw new Exception("Color count incorrect, got "+colorElements.size()+", expected "+numVertices);
|
||||
}
|
||||
Color[] colors = new Color[colorElements.size()];
|
||||
int colorCount = 0;
|
||||
for (Iterator i = colorElements.iterator(); i.hasNext(); ) {
|
||||
Element colorElement = (Element) i.next();
|
||||
colors[colorCount++] = loadColor(colorElement);
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all the Triangles
|
||||
* @return Triangle[]
|
||||
|
|
@ -317,6 +342,21 @@ public class Loader {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a colour from XML
|
||||
* @param element
|
||||
* @return a Color
|
||||
* @throws Exception
|
||||
*/
|
||||
private Color loadColor(Element element) throws Exception {
|
||||
return new Color(
|
||||
XMLUtil.getInt(element, "r"),
|
||||
XMLUtil.getInt(element, "g"),
|
||||
XMLUtil.getInt(element, "b"),
|
||||
XMLUtil.getInt(element, "a", 255)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a boned Animation from XML
|
||||
* @param element
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue