Show Posts

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.


Messages - Sheshmoshen

Pages: [1]
1
Thanks got it working!

2
I updated my question for clarity.

The actual image is one file.

But in that file there is a bunch of different textures that will be applied to different polygons in the Object3D.

Thanks again!

3
Thank you for the reply.

I'm going to elaborate on my question.

I have a java server side script that converts the obj file into a java serialized object.

Instead of serializing the whole Object3D[] array that is returned from loading.

I do something like this:
Code: [Select]
Object3D[] objects = Loader.loadOBJ(objFileName, mtlFileName, 1.0f);

Object3D resultObj = Object3D.mergeAll(objects)
resultObj.build();

DeSerializer serializer = new DeSerializer();
serializer.serialize(resultObj, outStream, true);

The texture in the MTL file is named map.jpg, and JPCT outputs this name as well.

Now on the android side of things:

I need to map the texture to different faces of the Object3D model.

How can I achieve this once I merged everything into one Object3D and serialized it?

Here is what I have and it's not quite working.

Code: [Select]

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");

It does show something but not quite what I see in MeshLab or Blender.

I think my issue is that I'm mapping the textures improperly.

Hope I clarified my issue, thanks for helping!

Pages: [1]