16
Support / Java 10 Serialization
« on: April 25, 2018, 08:42:07 pm »
I think that you have to update the serialization stuff for Java 10. Would you?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public Object3D(float[] coordinates,
float[] normals,
float[] uvs,
int[] indices,
int textureId)
uvs - the texture coordinates [u1,v1,u2,v2,...]
private void combineAmbientAndDiffuse() {
Texture tex = TextureManager.getInstance().getTexture("EnvironmentMap");
tex.add(TextureManager.getInstance().getTexture("Starfighter.png"), .5f);
}
public void mouseClicked(MouseEvent e) {
Point p = e.getPoint();
SimpleVector p3d = Interact2D.reproject2D3DWS(camera, buffer, p.x, p.y);
System.out.println("p3d: "+p3d);
p3d.y = -2000f;
objects[numberOfObjects++] = Primitives.getCube(100f);
objects[numberOfObjects-1].build();
objects[numberOfObjects-1].translate(p3d);
theWorld.addObject(objects[numberOfObjects-1]);
}
if (ship instanceof Blah) {
ship.body.rotateY((float)Math.PI*.5f);
ship.body.rotateMesh();
ship.body.clearRotation();
}
int amount = 15;
float attenuation = 3.6f, dist = 1f;
theWorld.setAmbientLight(25, 25, 25);//-20
if (b.usesRenderer(IRenderer.RENDERER_OPENGL)) {
theWorld.setAmbientLight(125, 125, 125);//-20
amount = 55;
attenuation = 3600f;
dist = 10f;
}
else Config.lightMul = 1;
System.out.println("\n\n\nWarcraft.loadObject: "+fileName +" Is the mtl null? "+(mtlFile==null));
System.out.println("Is loadOBJ(fileName, mtlFile) null? "+(Loader.loadOBJ(fileName, mtlFile, .5f)==null));
Warcraft.loadObject: buildings\castle_construction0.obj Is the mtl null? false
Exception in thread "main" java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at com.threed.jpct.Loader.loadOBJ(Loader.java:819)
at com.threed.jpct.Loader.loadOBJ(Loader.java:508)
at Warcraft.loadObject(Warcraft.java:250)
at Worker.moveTowardsDest(Character.java:393)
at Warcraft.loop(Warcraft.java:320)
at Warcraft.<init>(Warcraft.java:163)
at Warcraft.main(Warcraft.java:1058)
if (!TextureManager.getInstance().containsTexture("fog-top")) {
TextureManager.getInstance().addTexture("fog-top", new Texture("Assets"+File.separator+"fog-top.png", true));
TextureManager.getInstance().addTexture("fog-left", new Texture("Assets"+File.separator+"fog-left.png", true));
TextureManager.getInstance().addTexture("fog-right", new Texture("Assets"+File.separator+"fog-right.png", true));
TextureManager.getInstance().addTexture("fog-bottom", new Texture("Assets"+File.separator+"fog-bottom.png", true));
}
SimpleVector pos = bridge.getTransformedCenter();
pos.y -= 160f;
SimpleVector forward = bridge.getZAxis();
laserLength *= (1f+(deltaTime*6f));
laser.update(new SimpleVector[]{pos, pos.calcAdd(new SimpleVector(forward.x*laserLength, forward.y*laserLength, forward.z*laserLength))});
https://javadoc.lwjgl.org/org/lwjgl/system/jawt/JAWT.html
It's kind of funny the notion of someone going, "do you know what Java needs? Malloc. I miss malloc." LOLclass Bone {
protected String name;
protected SimpleVector position;
protected Matrix transform;
protected int index, parentIndex;
public Bone(String name, SimpleVector position, Matrix transform, int index, int parentIndex) {
this.name = name;
this.position = position;
this.transform = transform;
this.index = index;
this.parentIndex = parentIndex;
}
public boolean hasParent () {
return this.parentIndex >= 0;
}
public String toString () {
return this.name + ": " + this.position;
}
}
System.out.println(newBone.toString() +": "+newBone.index);
public static AnimatedGroup loadGroup(JsonLoader jsonLoader) {
MaxBonesClip[] clips = Importer.getMaxBonesClips(jsonLoader);
MaxBonesImporter jImporter = new MaxBonesImporter(jsonLoader, clips);
ArrayList<ArrayList> objects = jImporter.getList();
ArrayList<Bone> bones = jImporter.getBones();
ArrayList<ArrayList> objectsBonesReferences = jImporter.getBonesReferences(); // for all objects, respects the same order of objects
Animated3D anObject = null;
SimpleVector center = null;
scaleBones(bones);
invertBonesCoords(bones);
Skeleton skeleton = Importer.makeSkeleton(bones);
SkeletonPose pose = new SkeletonPose(skeleton);
pose.updateTransforms();
Animated3D[] list = new Animated3D[objects.size()];
for (int i = 0; i < objects.size(); i++) {
ArrayList<ArrayList> theObject = objects.get(i);
if (bones == null || bones.size() <= 0) {
Logger.log("Problem: no bones. Try loadObject(String) instead.");
java.awt.Toolkit.getDefaultToolkit().beep();
return null;
}
anObject = makeAnimated3D(pose, objectsBonesReferences.get(i), theObject, new File(jsonLoader.getMainFileName()).getParent());
anObject.build();
list[i] = anObject;
}
System.out.println("To test: "+bones.get(JSONFrame.BONE_INDEX_TO_TEST));
AnimatedGroup asGroup = new AnimatedGroup(list);
asGroup.setSkinClipSequence(getSkinClipSequence(jImporter, anObject.getSkeleton()));
return asGroup;
}
private static Animated3D makeAnimated3D(SkeletonPose pose, ArrayList<BoneReference> boneRefs, ArrayList<ArrayList> theImportedObject, String absolutePath) {
ArrayList<ArrayList> vertices = theImportedObject.get(0);
ArrayList<String> diffuseAndNormal = theImportedObject.get(3);
int verticesCount = vertices.size();
//skeletonDebugger = new SkeletonDebugger(pose, 0f, 1f);
float[][] weights = new float[verticesCount][Importer.MAX_JOINTS_PER_VERTEX];
short[][] jointIndices = new short[verticesCount][Importer.MAX_JOINTS_PER_VERTEX];
int[] verticesCounters = new int[verticesCount];
for (int i = 0; i < verticesCount; i++) verticesCounters[i] = 0;
for (BoneReference aBoneRef: boneRefs) {
int vertexRef = aBoneRef.vertexIndexReference;
int verticesCounter = verticesCounters[vertexRef];
if (verticesCounter < Importer.MAX_JOINTS_PER_VERTEX) {
weights[vertexRef][verticesCounter] = aBoneRef.vertexWeight;
jointIndices[vertexRef][verticesCounter] = aBoneRef.boneIndexReference;
verticesCounters[vertexRef]++;
}
}
SkinData skin = new SkinData(weights, jointIndices);
if (!TextureManager.getInstance().containsTexture(diffuseAndNormal.get(0)))
TextureManager.getInstance().addTexture(diffuseAndNormal.get(0), new Texture(absolutePath +File.separator+diffuseAndNormal.get(0)));
MeshData meshData = makeMeshData(theImportedObject);
Animated3D anAnimated = new Animated3D(meshData, skin, pose);
anAnimated.setTexture(diffuseAndNormal.get(0));
return anAnimated;
}
for (int h = 0; h < asGroup.getSize(); h++) {
Animated3D temp = asGroup.get(h);
Skeleton s = asGroup.get(h).getSkeletonPose().getSkeleton();
for (int i = 0; i < s.getNumberOfJoints(); i++) {
System.out.println(temp.getSkinClipSequence().getClip(0).getSkeleton().getJoint(i).getBindPose().toString());
//temp.applySkeletonPose();
//temp.animateSkin(frame, sequence);
//temp.applyAnimation();
}
}