1
Support / Re: How to bind the Texture to a serialized Object3D loaded from JPCT into JPCT-AE
« on: June 05, 2020, 07:09:22 pm »
Thanks got it working!
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.
Object3D[] objects = Loader.loadOBJ(objFileName, mtlFileName, 1.0f);
Object3D resultObj = Object3D.mergeAll(objects)
resultObj.build();
DeSerializer serializer = new DeSerializer();
serializer.serialize(resultObj, outStream, true);
Object3D modelObj = Loader.loadSerializedObject(objInputStream);
String texFile = "root/map.jpg";
Texture texture = new Texture(BitmapHelper.rescale(
BitmapFactory.decodeFile(texFile),
256,
256
));
texture.setMipmap(true);
TextureManager.getInstance().addTexture("map.jpg", texture);
modelObj.setTexture("map.jpg");