I dont know how acces on many textures use by my models because i don’t have a methode like mySpacial.getMaterial() i dont use any material just a .j3o file
well recursivly go down to the geometry objects
there you can do getMaterial
there you can get the Materialparams
then loop over all with type texture
then get the texture
then where texture not null set the filtering.
@hedi said:
" go down to the geometry objects " .... i am idiot maybe :) but i am stuck on this point..
I work on netbeans not in JME sdk
do instanceof to determine the type of a spatial
recursive(Spatial spat)
if spat instanceof Node
-> cast to node and call for all children this method
if spat instanceof Geometry
-> cast to gemotery and do work
Well you might have nested layout,
node -> node -> node -> geom
But the top spatial might also be already a Geometry
this depends greatly on the model and the way it is imported.
The following is a optimisation for my physic models, but the base logic is similar,
you should be able to just but your material handeling in it instead of the mesh stripping.
[java]
private void stripMaterialsAndData(final Spatial model) {
System.out.println("scanning " + model.getName());
if (model instanceof Geometry) {
final Mesh mesh = ((Geometry) model).getMesh();
// kill all except position and index for reducing physicdata
mesh.clearBuffer(Type.BindPoseNormal);
mesh.clearBuffer(Type.BindPosePosition);
mesh.clearBuffer(Type.BindPoseTangent);
mesh.clearBuffer(Type.Binormal);
mesh.clearBuffer(Type.BoneIndex);
mesh.clearBuffer(Type.BoneWeight);
mesh.clearBuffer(Type.Color);
mesh.clearBuffer(Type.HWBoneIndex);
mesh.clearBuffer(Type.HWBoneWeight);
mesh.clearBuffer(Type.Normal);
mesh.clearBuffer(Type.Size);
mesh.clearBuffer(Type.Tangent);
mesh.clearBuffer(Type.TexCoord);
mesh.clearBuffer(Type.TexCoord2);
mesh.clearBuffer(Type.TexCoord3);
mesh.clearBuffer(Type.TexCoord4);
mesh.clearBuffer(Type.TexCoord5);
mesh.clearBuffer(Type.TexCoord6);
mesh.clearBuffer(Type.TexCoord7);
mesh.clearBuffer(Type.TexCoord8);
}
if (model instanceof Node) {
final Node casted = (Node) model;
for (final Spatial child : casted.getChildren()) {
this.stripMaterialsAndData(child);
}
}
}
[/java]
^^ That was not even the one I meant, but if it works,^^
I meant tex.setAnisotropicFilter(16);
Then you can probably reactivate the mipmap based ones as well, since without you get some pixelated effects, depending on what you do.
@Empire Phoenix said:
^^ That was not even the one I meant, but if it works,^^
I meant tex.setAnisotropicFilter(16);
Then you can probably reactivate the mipmap based ones as well, since without you get some pixelated effects, depending on what you do.
your are all right with setAnisotropicFilter it is better.