Hi there!
I’ve been making android applications recently and one of my biggest time consumers is properly texturing models on android to have unshaded materials but the proper textures
My current method involves making a material for each different material used in the model, then creating a texture key for it, then applying it to the correct area on the model via this method
[java] private void initHouse(){
building = new Node(“House”);
building = (Node) assetManager.loadModel(“Models/cg_house_A.j3o”);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key1 = new TextureKey("Textures/mortar_brick/D.png", false);
Texture tex1 = assetManager.loadTexture(key1);
mat1.setTexture("ColorMap", tex1);
Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key2 = new TextureKey("Textures/floor/D.png", false);
Texture tex2 = assetManager.loadTexture(key2);
mat2.setTexture("ColorMap", tex2);
Material mat3 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key3 = new TextureKey("Textures/roof_shale/D.png", false);
Texture tex3 = assetManager.loadTexture(key3);
mat3.setTexture("ColorMap", tex3);
Material mat4 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
TextureKey key4 = new TextureKey("Textures/roof_straw/D.png", false);
Texture tex4 = assetManager.loadTexture(key4);
mat4.setTexture("ColorMap", tex4);
building.getChild("house").setMaterial(mat1);
building.getChild("floor").setMaterial(mat2);
building.getChild("shale_roof").setMaterial(mat3);
building.getChild("straw_roof").setMaterial(mat4);
building.scale(1f);
RigidBodyControl buildPhys = new RigidBodyControl(0f);
building.addControl(buildPhys);
physics.getPhysicsSpace().add(buildPhys);
rootNode.attachChild(building);
buildPhys.setPhysicsLocation(new Vector3f(0, 0, 0));
}[/java]
Something tells me that there may be an easier way than what Im doing. Perhaps just being to set the material to unshaded rather than recreating each material and texturing properly!
Thanks for reading and I hope I’ve communicated my issue properly