diff --git a/.classpath b/.classpath index 5ba8a76..3083ca1 100644 --- a/.classpath +++ b/.classpath @@ -1,32 +1,27 @@ - - - + + + + + + + + + - + - + - - + - + - - - - - - - - - - - + diff --git a/.project b/.project index b2503f2..dbff839 100644 --- a/.project +++ b/.project @@ -10,19 +10,14 @@ + + org.eclipse.m2e.core.maven2Builder + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature - - - 1646149232199 - - 30 - - org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ - - - diff --git a/lutin_org-atriasoft-loader3d.py b/lutin_org-atriasoft-loader3d.py index f34c4f1..898c671 100644 --- a/lutin_org-atriasoft-loader3d.py +++ b/lutin_org-atriasoft-loader3d.py @@ -39,7 +39,7 @@ def configure(target, my_module): 'src/org/atriasoft/loader3d/model/PhysicShape.java', 'src/org/atriasoft/loader3d/model/ModelData.java', 'src/org/atriasoft/loader3d/model/MaterialGlId.java', - 'src/org/atriasoft/loader3d/internal/Log.java', + 'src/org/atriasoft/loader3d/internal/LOGGER.java', 'src/org/atriasoft/loader3d/Loader3d.java', 'src/org/atriasoft/loader3d/resources/ResourceStaticColoredMesh.java', 'src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java', diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9304dc6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,128 @@ + + 4.0.0 + org.atriasoft + loader3d + 0.1.0 + + 3.13.0 + 21 + 21 + 3.1.1 + + + + + gitea + https://gitea.atria-soft.org/api/packages/org.atriasoft/maven + + + + + gitea + https://gitea.atria-soft.org/api/packages/org.atriasoft/maven + + + gitea + https://gitea.atria-soft.org/api/packages/org.atriasoft/maven + + + + + + org.atriasoft + gale + 0.1.0 + + + org.atriasoft + ejson + 0.1.0 + + + org.junit.jupiter + junit-jupiter-api + 5.9.3 + test + + + org.slf4j + slf4j-simple + 2.0.7 + test + + + + + src + test/src + ${project.basedir}/out/maven/ + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven.compiler.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + maven-assembly-plugin + + + + fully.qualified.MainClass + + + + jar-with-dependencies + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + private + true + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + public + + + + + + diff --git a/src/org/atriasoft/loader3d/OBJFileLoader.java b/src/org/atriasoft/loader3d/OBJFileLoader.java index 7df6572..9539b0a 100644 --- a/src/org/atriasoft/loader3d/OBJFileLoader.java +++ b/src/org/atriasoft/loader3d/OBJFileLoader.java @@ -69,7 +69,7 @@ public class OBJFileLoader { public static ModelData loadOBJ(final Uri objFileName) { final InputStream stream = Uri.getStream(objFileName); if (stream == null) { - Log.error("Can not read file: " + objFileName + " ==> load OBJ"); + LOGGER.error("Can not read file: " + objFileName + " ==> load OBJ"); return null; } /* @@ -86,7 +86,7 @@ public class OBJFileLoader { try { reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); } catch (final UnsupportedEncodingException e1) { - Log.error("Error in loading file: " + objFileName + " ==> load OBJ"); + LOGGER.error("Error in loading file: " + objFileName + " ==> load OBJ"); e1.printStackTrace(); return null; } diff --git a/src/org/atriasoft/loader3d/internal/Log.java b/src/org/atriasoft/loader3d/internal/Log.java index f38d6e5..d017ace 100644 --- a/src/org/atriasoft/loader3d/internal/Log.java +++ b/src/org/atriasoft/loader3d/internal/Log.java @@ -6,15 +6,15 @@ import org.atriasoft.reggol.Logger; public class Log { private static final boolean FORCE_ALL = false; private static final String LIB_NAME = "loader3d"; - private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME); - private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL); - private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG); - private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR); - private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO); - private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT); - private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO); - private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE); - private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING); + private static final String LIB_NAME_DRAW = Logger.getDrawableName(LOGGER.LIB_NAME); + private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.CRITICAL); + private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.DEBUG); + private static final boolean PRINT_ERROR = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.ERROR); + private static final boolean PRINT_INFO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.INFO); + private static final boolean PRINT_PRINT = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.PRINT); + private static final boolean PRINT_TODO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.TODO); + private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.VERBOSE); + private static final boolean PRINT_WARNING = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.WARNING); public static void critical(final Exception e, final String data) { e.printStackTrace(); diff --git a/src/org/atriasoft/loader3d/model/Material.java b/src/org/atriasoft/loader3d/model/Material.java index 991bb8e..e3a3055 100644 --- a/src/org/atriasoft/loader3d/model/Material.java +++ b/src/org/atriasoft/loader3d/model/Material.java @@ -23,27 +23,27 @@ public class Material extends MaterialBase{ super(); } public void draw(ResourceProgram _prog, MaterialGlId _glID){ - Log.verbose("draw Material : (start)"); + LOGGER.trace("draw Material : (start)"); _prog.uniformVector(_glID.oglAmbientFactor(), this.ambientFactor); _prog.uniformVector(_glID.oglDiffuseFactor(), this.diffuseFactor); _prog.uniformVector(_glID.oglSpecularFactor(), this.specularFactor); _prog.uniformFloat(_glID.oglShininess(), this.shininess); if (this.texture0 != null) { - Log.verbose(" set texture: " + _glID.oglTexture0() + " " + this.texture0.getId()); + LOGGER.trace(" set texture: " + _glID.oglTexture0() + " " + this.texture0.getId()); _prog.setTexture0(_glID.oglTexture0(), this.texture0.getRendererId()); if (false) { if (_prog.checkIdValidity(_glID.oglTexture0()) == false) { - Log.error("try to set texture on a unexistant shader interface (wrong ID)"); + LOGGER.error("try to set texture on a unexistant shader interface (wrong ID)"); } } } else { if (false) { if (_prog.checkIdValidity(_glID.oglTexture0()) == true) { - Log.error("Missing texture to send on the shader ..."); + LOGGER.error("Missing texture to send on the shader ..."); } } } - Log.verbose("draw Material: ( end )"); + LOGGER.trace("draw Material: ( end )"); } public void setRenderMode(RenderMode _val) { switch (_val) { @@ -52,33 +52,33 @@ public class Material extends MaterialBase{ case LINE: break; case LINE_STRIP: - Log.info("Does not support " + _val + " auto convert it in 'LINE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'LINE'"); _val = RenderMode.LINE; break; case LINE_LOOP: - Log.info("Does not support " + _val + " auto convert it in 'LINE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'LINE'"); _val = RenderMode.LINE; break; case TRIANGLE: break; case TRIANGLE_STRIP: - Log.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); _val = RenderMode.TRIANGLE; break; case TRIANGLE_FAN: - Log.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); _val = RenderMode.TRIANGLE; break; case QUAD: - Log.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); _val = RenderMode.TRIANGLE; break; case QUAD_STRIP: - Log.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); + LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'"); _val = RenderMode.TRIANGLE; break; case POLYGON: - Log.error("Does not support " + _val + " try convert it in 'TRIANGLE'"); + LOGGER.error("Does not support " + _val + " try convert it in 'TRIANGLE'"); _val = RenderMode.TRIANGLE; break; } @@ -97,7 +97,7 @@ public class Material extends MaterialBase{ ResourceTexture2 tmpCopy = this.texture0; this.texture0 = ResourceTextureFile.create(_uri, tmpSize); if (this.texture0 == null) { - Log.error("Can not load specific texture : " + _uri); + LOGGER.error("Can not load specific texture : " + _uri); // retreave previous texture: this.texture0 = tmpCopy; if (this.texture0 != null) { diff --git a/src/org/atriasoft/loader3d/model/MaterialBase.java b/src/org/atriasoft/loader3d/model/MaterialBase.java index 66dd78e..e5ff15f 100644 --- a/src/org/atriasoft/loader3d/model/MaterialBase.java +++ b/src/org/atriasoft/loader3d/model/MaterialBase.java @@ -24,7 +24,7 @@ public class MaterialBase { this.ambientFactor = _val; } public void setDiffuseFactor( Vector4f _val){ - //Log.error("**************** set difuse factor:" + _val); + //LOGGER.error("**************** set difuse factor:" + _val); this.diffuseFactor = _val; } public void setSpecularFactor( Vector4f _val){ diff --git a/src/org/atriasoft/loader3d/resources/ResourceMesh.java b/src/org/atriasoft/loader3d/resources/ResourceMesh.java index 87ec098..95847dc 100644 --- a/src/org/atriasoft/loader3d/resources/ResourceMesh.java +++ b/src/org/atriasoft/loader3d/resources/ResourceMesh.java @@ -23,26 +23,26 @@ import org.atriasoft.loader3d.model.Material; public class ResourceMesh extends ResourceStaticMesh { public static ResourceMesh create(final Uri uri) { - Log.verbose("KEEP: Resource Mesh: " + uri); + LOGGER.trace("KEEP: Resource Mesh: " + uri); ResourceMesh object = null; final Resource object2 = Resource.getManager().localKeep(uri); if (object2 != null) { if (object2 instanceof ResourceMesh tmpp) { return tmpp; } - Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)"); + LOGGER.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)"); return null; } - Log.debug("CREATE: new Mesh: " + uri); + LOGGER.debug("CREATE: new Mesh: " + uri); if (uri.getExtention().equals("emf")) { try { return new ResourceMeshEmf(uri); } catch (Exception e) { - Log.warning("Can not load file: " + e.toString()); + LOGGER.warn("Can not load file: " + e.toString()); return null; } } - Log.error("Not managed extention type: '" + uri.getExtention() + "'"); + LOGGER.error("Not managed extention type: '" + uri.getExtention() + "'"); return null; } @@ -72,7 +72,7 @@ public class ResourceMesh extends ResourceStaticMesh { public ResourceMesh(final Uri _fileName) { super(_fileName); - Log.verbose("Load a new mesh : '" + _fileName + "'"); + LOGGER.trace("Load a new mesh : '" + _fileName + "'"); // ------------------------------------------------------------------------------------------------ // this is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer this.vao = ResourceVirtualArrayObject.createDynamic(); @@ -125,12 +125,12 @@ public class ResourceMesh extends ResourceStaticMesh { public void addLine(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Color _color1, final Color _color2) { if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) { - Log.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); + LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); return; } RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); if (tmpRenderMode != RenderMode.LINE && tmpRenderMode != RenderMode.LINE_STRIP && tmpRenderMode != RenderMode.LINE_LOOP) { - Log.error("try to add Line in a mesh material section that not support Line"); + LOGGER.error("try to add Line in a mesh material section that not support Line"); return; } // try to find position: @@ -153,7 +153,7 @@ public class ResourceMesh extends ResourceStaticMesh { public void addLines(final String _layerName, final List _list, final List _color) { if (_color.size() != _list.size()) { - Log.error("Can not add line with changing color without same number of color"); + LOGGER.error("Can not add line with changing color without same number of color"); return; } for (int iii = 1; iii < _list.size(); ++iii) { @@ -163,26 +163,26 @@ public class ResourceMesh extends ResourceStaticMesh { public void addMaterial(final String _name, final Material _data) { if (_data == null) { - Log.error(" can not add material with null pointer"); + LOGGER.error(" can not add material with null pointer"); return; } if (_name == "") { - Log.error(" can not add material with no name"); + LOGGER.error(" can not add material with no name"); return; } // really add the material: - Log.warning("Add material: " + _name); + LOGGER.warn("Add material: " + _name); this.materials.put(_name, _data); } public void addPoint(final String _layerName, final Vector3f _pos, final Color _color) { if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) { - Log.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); + LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); return; } RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); if (tmpRenderMode != RenderMode.POINT) { - Log.error("try to add Point in a mesh material section that not support Point"); + LOGGER.error("try to add Point in a mesh material section that not support Point"); return; } // try to find position: @@ -215,12 +215,12 @@ public class ResourceMesh extends ResourceStaticMesh { // public void draw(Matrix4f _positionMatrix, boolean _enableDepthTest, boolean _enableDepthUpdate) { // // TODO : Remove this, it is just for test the 23-04-2016 // //this.checkNormal = false; - // Log.verbose("draw Mesh : " + this.name + " (start)"); + // LOGGER.trace("draw Mesh : " + this.name + " (start)"); // if (this.GLprogram == null) { - // Log.error("No shader ..."); + // LOGGER.error("No shader ..."); // return; // } - // //Log.debug(this.name + " " + this.light); + // //LOGGER.debug(this.name + " " + this.light); // if (_enableDepthTest == true) { // gale::openGL::enable(gale::openGL::flag_depthTest); // if (_enableDepthUpdate == false) { @@ -229,7 +229,7 @@ public class ResourceMesh extends ResourceStaticMesh { // } else { // gale::openGL::disable(gale::openGL::flag_depthTest); // } - // //Log.debug(" display " + this.coord.size() + " elements" ); + // //LOGGER.debug(" display " + this.coord.size() + " elements" ); // this.GLprogram.use(); // // set Matrix : translation/positionMatrix // Matrix4f projMatrix = gale::openGL::getMatrix(); @@ -250,7 +250,7 @@ public class ResourceMesh extends ResourceStaticMesh { // // colors : // this.GLprogram.sendAttributePointer(this.GLColor, this.verticesVBO, MESH_VBO_COLOR); // // draw lights : - // //Log.info("light : " + this.light); + // //LOGGER.info("light : " + this.light); // this.light.draw(this.GLprogram); //// #ifdef DISPLAY_NB_VERTEX_DISPLAYED //// int nbElementDrawTheoric = 0; @@ -258,7 +258,7 @@ public class ResourceMesh extends ResourceStaticMesh { //// #endif // for (int kkk=0; kkk getPhysicalProperties() { // for (auto it: this.physics) { // if (it == null) { - // Log.warning("Get null ... "); + // LOGGER.warn("Get null ... "); // continue; // } // if (it.getType() == ege::physics::Shape::type::concave) { // // need to generate the internal list of point and triangle needed: // ege::physics::shape::Concave* tmpElement = it.toConcave(); // if (tmpElement == null) { - // Log.error(" Concave ==> can not cast in Concave"); + // LOGGER.error(" Concave ==> can not cast in Concave"); // return this.physics; // } // tmpElement.clear(); - // //Log.info(" add vertices : " + this.listVertex); + // //LOGGER.info(" add vertices : " + this.listVertex); // tmpElement.setListOfVertex(this.listVertex); // for (int kkk=0; kkk index; @@ -486,12 +486,12 @@ public class ResourceMesh extends ResourceStaticMesh { // index.pushBack(it.vertex[1]); // index.pushBack(it.vertex[2]); // } - // //Log.info(" add triangle : " + elem.getValue().index); + // //LOGGER.info(" add triangle : " + elem.getValue().index); // // //tmpElement.addTriangle(elem.getValue().index); // tmpElement.addTriangle(index); // } - // //Log.critical("kjlkj"); + // //LOGGER.critical("kjlkj"); // // Can have only one concave element in a mesh ... // //return this.physics; // } @@ -533,14 +533,14 @@ public class ResourceMesh extends ResourceStaticMesh { public void addTriangle(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector2f _uv1, final Vector2f _uv2, final Vector2f _uv3, final Color _color1, final Color _color2, final Color _color3) { - Log.info("add Triangle: " + _layerName + " ..."); + LOGGER.info("add Triangle: " + _layerName + " ..."); if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) { - Log.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); + LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ..."); return; } RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); if (tmpRenderMode != RenderMode.TRIANGLE && tmpRenderMode != RenderMode.TRIANGLE_STRIP && tmpRenderMode != RenderMode.TRIANGLE_FAN) { - Log.error("try to add Line in a mesh material section that not support Line"); + LOGGER.error("try to add Line in a mesh material section that not support Line"); return; } // try to find position: @@ -558,17 +558,17 @@ public class ResourceMesh extends ResourceStaticMesh { Face tmpFace = new Face(pos1, uv1, pos2, uv2, pos3, uv3); tmpFace.setColor(color1, color2, color3); this.listFaces.get(_layerName).face().add(tmpFace); - Log.info(" nbFace: " + this.listFaces.get(_layerName).face().size()); + LOGGER.info(" nbFace: " + this.listFaces.get(_layerName).face().size()); } private void calculateNormaleEdge(final String _materialName) { this.listVertexNormal.clear(); if (this.normalMode == NormalMode.VERTEX) { List outNormal = new ArrayList<>(); - Log.info("calculateNormaleEdge(" + _materialName + ")"); + LOGGER.info("calculateNormaleEdge(" + _materialName + ")"); RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode(); if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) { - Log.error("calculateNormaleEdge(" + _materialName + ") : can not calculate normal on lines ..."); + LOGGER.error("calculateNormaleEdge(" + _materialName + ") : can not calculate normal on lines ..."); this.normalMode = NormalMode.NONE; return; } @@ -599,10 +599,10 @@ public class ResourceMesh extends ResourceStaticMesh { protected void calculateNormaleFaceLocal(final String _materialName) { if (this.normalMode == NormalMode.FACE) { - Log.verbose("calculateNormaleFace(" + _materialName + ")"); + LOGGER.trace("calculateNormaleFace(" + _materialName + ")"); RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode(); if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) { - Log.error("calculateNormaleFace(" + _materialName + ") : can not calculate normal on lines ..."); + LOGGER.error("calculateNormaleFace(" + _materialName + ") : can not calculate normal on lines ..."); this.normalMode = NormalMode.NONE; return; } @@ -615,9 +615,9 @@ public class ResourceMesh extends ResourceStaticMesh { for (Face it : faceList.face()) { // for all case, We use only the 3 vertex for quad element, in theory 3D modeler export element in triangle if it is not a real plane. Vector3f normal = (this.listVertex.get(it.vertex[0]).less(this.listVertex.get(it.vertex[1]))).cross(this.listVertex.get(it.vertex[1]).less(this.listVertex.get(it.vertex[2]))); - //Log.info("normal: " + normal.normalized()); + //LOGGER.info("normal: " + normal.normalized()); if (normal.isZero()) { - Log.error("Null vertor for a face ... " + this.listVertex.get(it.vertex[0]) + " " + this.listVertex.get(it.vertex[1]) + " " + this.listVertex.get(it.vertex[2])); + LOGGER.error("Null vertor for a face ... " + this.listVertex.get(it.vertex[0]) + " " + this.listVertex.get(it.vertex[1]) + " " + this.listVertex.get(it.vertex[2])); this.listFacesNormal.add(new Vector3f(1, 0, 0)); } else { this.listFacesNormal.add(normal.normalize()); @@ -633,7 +633,7 @@ public class ResourceMesh extends ResourceStaticMesh { protected void calculateNormaleFaces(final List materialsNames) { this.listFacesNormal.clear(); for (String name : materialsNames) { - Log.warning("generate normal for: '" + name + "'"); + LOGGER.warn("generate normal for: '" + name + "'"); calculateNormaleFaceLocal(name); } } @@ -786,7 +786,7 @@ public class ResourceMesh extends ResourceStaticMesh { // center /= float(nbIndicInFace); // int index = face.normal[0]; // if (index >= this.listFacesNormal.size()) { - // Log.error("not enougth normal in the buffer ... " + index + " >= " + this.listFacesNormal.size()); + // LOGGER.error("not enougth normal in the buffer ... " + index + " >= " + this.listFacesNormal.size()); // return; // } // Vector3f normal = this.listFacesNormal[index]; @@ -809,11 +809,11 @@ public class ResourceMesh extends ResourceStaticMesh { // calculate the normal of all faces if needed if (this.normalMode != NormalMode.NONE && this.listFacesNormal.size() == 0) { // when no normal detected == > auto generate Face normal .... - Log.error("No normal detected ??? ==> abort generation of the VBO"); + LOGGER.error("No normal detected ??? ==> abort generation of the VBO"); // calculateNormaleFace(this.listFaces.getKeys()[0]); } - Log.warning("Generate VBO for nb faces layers: " + this.listFaces.size() + " list layer=" + this.listFaces.keySet()); + LOGGER.warn("Generate VBO for nb faces layers: " + this.listFaces.size() + " list layer=" + this.listFaces.keySet()); // generate element in 2 pass: // - create new index depending on a vertex is a unique component of position, texture, normal @@ -825,7 +825,7 @@ public class ResourceMesh extends ResourceStaticMesh { int outPositionIndewStart = this.outPosition.size(); int nbIndicInFace = 3; if (this.materials.containsKey(elem.getKey()) == false) { - Log.warning("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet()); + LOGGER.warn("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet()); continue; } nbIndicInFace = switch (this.materials.get(elem.getKey()).getRenderMode()) { @@ -875,7 +875,7 @@ public class ResourceMesh extends ResourceStaticMesh { // && this.verticesVBO.getOnBufferVector2f(MESH_VBO_TEXTURE,jjj) == texturepos) { // vertexVBOId[indice] = jjj; // elementFind = true; - // //Log.debug("search indice : " + jjj); + // //LOGGER.debug("search indice : " + jjj); // tmpppppp += jjj; // // stop searching ... // break; @@ -899,7 +899,7 @@ public class ResourceMesh extends ResourceStaticMesh { } // #ifdef TRY_MINIMAL_VBO - // Log.debug("nb cycle ? : " + tmpppppp); + // LOGGER.debug("nb cycle ? : " + tmpppppp); // #endif } @@ -913,7 +913,7 @@ public class ResourceMesh extends ResourceStaticMesh { for (Entry elem : this.listPaletteFaces.entrySet()) { int nbIndicInFace = 3; if (this.materials.containsKey(elem.getKey()) == false) { - Log.warning("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet()); + LOGGER.warn("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet()); continue; } switch (this.materials.get(elem.getKey()).getRenderMode()) { @@ -929,22 +929,22 @@ public class ResourceMesh extends ResourceStaticMesh { case QUAD: case QUAD_STRIP: case POLYGON: - Log.critical("Unsupported palet mode: " + this.materials.get(elem.getKey()).getRenderMode()); + LOGGER.critical("Unsupported palet mode: " + this.materials.get(elem.getKey()).getRenderMode()); break; } float maxValues = ResourcePaletteFile.getColorMax(); float height = ResourcePaletteFile.getHeight(); int indexColor = ResourcePaletteFile.getColorId(elem.getKey().substring(8)); Vector2f texturepos = new Vector2f((indexColor + 0.5f) / maxValues, 0.5f / height); - Log.error("find color : " + elem.getKey().substring(8) + " ==> " + indexColor + " pos = " + texturepos); + LOGGER.error("find color : " + elem.getKey().substring(8) + " ==> " + indexColor + " pos = " + texturepos); int faceId = -1; FaceIndexing tmpFaceList = elem.getValue(); for (Face face : tmpFaceList.face()) { faceId++; - //Log.warning("Parse faceID = " + faceId); + //LOGGER.warn("Parse faceID = " + faceId); int[] vertexVBOId = new int[3]; for (int indice = 0; indice < nbIndicInFace; indice++) { - //Log.warning("find position indice = " + indice + " / " + face.vertex.length); + //LOGGER.warn("find position indice = " + indice + " / " + face.vertex.length); // get position Vector3f position = this.listVertex.get(face.vertex[indice]); // get Color @@ -1011,9 +1011,9 @@ public class ResourceMesh extends ResourceStaticMesh { public void render(final String layerName) { /* - Log.info("--------------------------------------"); + LOGGER.info("--------------------------------------"); for (String elem : this.listFacesDrawIndex.keySet()) { - Log.info(" - " + elem); + LOGGER.info(" - " + elem); } */ Vector2i elements = this.listFacesDrawIndex.get(layerName); diff --git a/src/org/atriasoft/loader3d/resources/ResourceMeshEmf.java b/src/org/atriasoft/loader3d/resources/ResourceMeshEmf.java index c71325e..e4ee08c 100644 --- a/src/org/atriasoft/loader3d/resources/ResourceMeshEmf.java +++ b/src/org/atriasoft/loader3d/resources/ResourceMeshEmf.java @@ -71,7 +71,7 @@ public class ResourceMeshEmf extends ResourceMesh { this.normalMode = NormalMode.NONE; InputStream fileIOStream = Uri.getStream(fileName); if (fileIOStream == null) { - Log.error("CAn not get the file named='" + fileName + "'"); + LOGGER.error("CAn not get the file named='" + fileName + "'"); return; // TODO false; } BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream)); @@ -86,14 +86,14 @@ public class ResourceMeshEmf extends ResourceMesh { if (inputDataLine.startsWith("EMF(STRING)") == true) { // parse in string mode ... } else if (inputDataLine.startsWith("EMF(BINARY)") == true) { - Log.error(" file binary mode is not supported now : 'EMF(BINARY)'"); + LOGGER.error(" file binary mode is not supported now : 'EMF(BINARY)'"); return; // TODO false; } else { - Log.error(" file mode is not supported now : 'EMF(? ? ?)' = '" + inputDataLine + "'"); + LOGGER.error(" file mode is not supported now : 'EMF(? ? ?)' = '" + inputDataLine + "'"); return; // TODO false; } emfModuleMode currentMode = emfModuleMode.EMFModuleNone; - Log.verbose("Start parsing Mesh file : " + fileName); + LOGGER.trace("Start parsing Mesh file : " + fileName); // mesh global param : String currentMeshName = ""; FaceIndexing currentFaceIndexing = null; @@ -111,7 +111,7 @@ public class ResourceMeshEmf extends ResourceMesh { int level = levelIO.value; if (level == -1) { // detect comment; - Log.warning("Detect comment"); + LOGGER.warn("Detect comment"); continue; } if (level == 0) { @@ -123,18 +123,18 @@ public class ResourceMeshEmf extends ResourceMesh { Matcher m = filterPattern.matcher(currentMeshName); if (!m.matches()) { currentMode = emfModuleMode.EMFModuleSkip; - Log.verbose("Parse Mesh(SKIP): " + currentMeshName); + LOGGER.trace("Parse Mesh(SKIP): " + currentMeshName); } else { - Log.verbose("Parse Mesh: " + currentMeshName); + LOGGER.trace("Parse Mesh: " + currentMeshName); } } else { - Log.verbose("Parse Mesh: " + currentMeshName); + LOGGER.trace("Parse Mesh: " + currentMeshName); } offsetVertexId = this.listVertex.size(); offsetUV = this.listUV.size(); offsetFaceNormal = this.listFacesNormal.size(); offsetVertexNormal = this.listVertexNormal.size(); - //Log.error("new offset: " + offsetVertexId + " " + offsetUV + " " + offsetFaceNormal + " " + offsetVertexNormal); + //LOGGER.error("new offset: " + offsetVertexId + " " + offsetUV + " " + offsetFaceNormal + " " + offsetVertexNormal); } else if (inputDataLine.startsWith("Materials:")) { // add previous material: if (materialName != "" && material != null) { @@ -151,7 +151,7 @@ public class ResourceMeshEmf extends ResourceMesh { currentMode = emfModuleMode.EMFModuleMaterial; material = new Material(); materialName = inputDataLine.substring(10); - Log.verbose("Parse Material: " + materialName); + LOGGER.trace("Parse Material: " + materialName); } else if (inputDataLine.startsWith("Palettes:")) { // add previous material: if (materialName != "" && material != null) { @@ -168,10 +168,10 @@ public class ResourceMeshEmf extends ResourceMesh { currentMode = emfModuleMode.EMFModulePalette; material = new Material(); materialName = inputDataLine.substring(9); - Log.verbose("Parse Palette: " + materialName); + LOGGER.trace("Parse Palette: " + materialName); } else if (inputDataLine.startsWith("Physics:") == true) { currentMode = emfModuleMode.EMFModulePhysics; - Log.verbose("Parse global Physics: "); + LOGGER.trace("Parse global Physics: "); } else { currentMode = emfModuleMode.EMFModuleNone; } @@ -185,25 +185,25 @@ public class ResourceMeshEmf extends ResourceMesh { if (level == 1) { if (inputDataLine.startsWith("Vertex:") == true) { currentMode = emfModuleMode.EMFModuleMeshVertex; - Log.verbose(" Vertex ..."); + LOGGER.trace(" Vertex ..."); } else if (inputDataLine.startsWith("UV-mapping:") == true) { currentMode = emfModuleMode.EMFModuleMeshUVMapping; haveUVMapping = true; - Log.verbose(" UV-mapping ..."); + LOGGER.trace(" UV-mapping ..."); } else if (inputDataLine.startsWith("Normal(vertex):") == true) { currentMode = emfModuleMode.EMFModuleMeshNormalVertex; - Log.verbose(" Normal(vertex) ..."); + LOGGER.trace(" Normal(vertex) ..."); } else if (inputDataLine.startsWith("Normal(face):") == true) { currentMode = emfModuleMode.EMFModuleMeshNormalFace; - Log.verbose(" Normal(face) ..."); + LOGGER.trace(" Normal(face) ..."); } else if (inputDataLine.startsWith("Face:") == true) { currentMode = emfModuleMode.EMFModuleMeshFace; - Log.verbose(" Face ..."); + LOGGER.trace(" Face ..."); } else if (inputDataLine.startsWith("Physics:") == true) { currentMode = emfModuleMode.EMFModuleMeshPhysics; - Log.verbose(" Physics ..."); + LOGGER.trace(" Physics ..."); } else { - Log.error(" Unknow mesh property '" + inputDataLine + "'"); + LOGGER.error(" Unknow mesh property '" + inputDataLine + "'"); currentMode = emfModuleMode.EMFModuleMesh; } continue; @@ -211,14 +211,14 @@ public class ResourceMeshEmf extends ResourceMesh { // level > 1 switch (currentMode) { default: - Log.error("Unknow ... " + level); + LOGGER.error("Unknow ... " + level); break; case EMFModuleMeshVertex: { for (String elem : inputDataLine.split("\\|")) { Vector3f vertex = Vector3f.valueOf(elem); this.listVertex.add(vertex); } - Log.verbose(" " + this.listVertex.size() + " vertex"); + LOGGER.trace(" " + this.listVertex.size() + " vertex"); break; } case EMFModuleMeshUVMapping: { @@ -226,7 +226,7 @@ public class ResourceMeshEmf extends ResourceMesh { Vector2f uvMap = Vector2f.valueOf(elem); this.listUV.add(uvMap); } - Log.verbose(" " + this.listUV.size() + " coord"); + LOGGER.trace(" " + this.listUV.size() + " coord"); break; } case EMFModuleMeshNormalVertex: { @@ -235,17 +235,17 @@ public class ResourceMeshEmf extends ResourceMesh { Vector3f normal = Vector3f.valueOf(elem); this.listVertexNormal.add(normal); } - Log.verbose(" " + this.listVertexNormal.size() + " Normals"); + LOGGER.trace(" " + this.listVertexNormal.size() + " Normals"); break; } case EMFModuleMeshNormalFace: { - Log.error("Change mode in face mode ..."); + LOGGER.error("Change mode in face mode ..."); this.normalMode = NormalMode.FACE; for (String elem : inputDataLine.split("\\|")) { Vector3f normal = Vector3f.valueOf(elem); this.listFacesNormal.add(normal); } - Log.verbose(" " + this.listFacesNormal.size() + " Normals"); + LOGGER.trace(" " + this.listFacesNormal.size() + " Normals"); break; } case EMFModuleMeshFace: @@ -269,10 +269,10 @@ public class ResourceMeshEmf extends ResourceMesh { currentFaceIndexing = this.listFaces.get(meshFaceMaterialID); } } - Log.verbose(" " + inputDataLine); + LOGGER.trace(" " + inputDataLine); } else if (currentMode == emfModuleMode.EMFModuleMeshFaceMaterial) { if (currentFaceIndexing == null) { - Log.error("Get elements without material defined ..."); + LOGGER.error("Get elements without material defined ..."); continue; } for (String elem : inputDataLine.split("\\|")) { @@ -284,10 +284,10 @@ public class ResourceMeshEmf extends ResourceMesh { } currentFaceIndexing.face().add(tmp); } - Log.verbose(" " + currentFaceIndexing.face().size() + " faces"); + LOGGER.trace(" " + currentFaceIndexing.face().size() + " faces"); } else { // insert element without material ... - Log.error(" try to add face without material selection ..."); + LOGGER.error(" try to add face without material selection ..."); } break; case EMFModuleMeshPhysics: @@ -296,19 +296,19 @@ public class ResourceMeshEmf extends ResourceMesh { if (level == 2) { physics = ege::physics::Shape::create(inputDataLine); if (physics == null) { - Log.error("Allocation error when creating physical shape ..."); + LOGGER.error("Allocation error when creating physical shape ..."); continue; } addPhysicElement(physics); - Log.verbose(" " + this.physics.size() + " " + inputDataLine); + LOGGER.trace(" " + this.physics.size() + " " + inputDataLine); currentMode = emfModuleMode.EMFModuleMeshPhysicsNamed; } else if (currentMode == EMFModuleMeshPhysicsNamed) { if (physics == null) { - Log.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); + LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); continue; } if (physics.parse(&inputDataLine[0]) == false) { - Log.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ..."); + LOGGER.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ..."); } } */ @@ -319,79 +319,79 @@ public class ResourceMeshEmf extends ResourceMesh { if ((currentMode.getValue() >= emfModuleMode.EMFModuleMaterial.getValue() && currentMode.getValue() <= emfModuleMode.EMFModuleMaterial_END.getValue()) || (currentMode.getValue() >= emfModuleMode.EMFModulePalette.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePalette_END.getValue())) { if (material == null) { - Log.error("material allocation error"); + LOGGER.error("material allocation error"); continue; } if (inputDataLine.startsWith("Ns ") == true) { float tmpVal = Float.valueOf(inputDataLine.substring(3)); material.setShininess(tmpVal); - Log.verbose(" Shininess " + tmpVal); + LOGGER.trace(" Shininess " + tmpVal); } else if (inputDataLine.startsWith("Ka ") == true) { Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); tmp = tmp.withW(1); material.setAmbientFactor(tmp); - Log.verbose(" AmbientFactor " + tmp); + LOGGER.trace(" AmbientFactor " + tmp); } else if (inputDataLine.startsWith("Kd ") == true) { Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); tmp = tmp.withW(1); material.setDiffuseFactor(tmp); - Log.error(" DiffuseFactor " + tmp); + LOGGER.error(" DiffuseFactor " + tmp); } else if (inputDataLine.startsWith("Ks ") == true) { Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); tmp = tmp.withW(1); material.setSpecularFactor(tmp); - Log.verbose(" SpecularFactor " + tmp); + LOGGER.trace(" SpecularFactor " + tmp); } else if (inputDataLine.startsWith("Ni ") == true) { float tmpVal = Float.valueOf(inputDataLine.substring(3)); // TODO : ... - Log.verbose(" Ni " + tmpVal); + LOGGER.trace(" Ni " + tmpVal); } else if (inputDataLine.startsWith("d ") == true) { float tmpVal = Float.valueOf(inputDataLine.substring(2)); // TODO : ... - Log.verbose(" d " + tmpVal); + LOGGER.trace(" d " + tmpVal); } else if (inputDataLine.startsWith("illum ") == true) { float tmpVal = Float.valueOf(inputDataLine.substring(6)); // TODO : ... - Log.verbose(" illum " + tmpVal); + LOGGER.trace(" illum " + tmpVal); } else if (inputDataLine.startsWith("map_Kd ") == true) { Uri tmpTexture = fileName.getParent(); tmpTexture = tmpTexture.pathAdd(inputDataLine.substring(7)); material.setTexture0(tmpTexture); - Log.verbose(" Texture " + tmpTexture); + LOGGER.trace(" Texture " + tmpTexture); } else if (inputDataLine.startsWith("renderMode ") == true) { //RenderMode mode; //frothis.string(mode, &inputDataLine[11]); //material.setRenderMode(mode); - Log.verbose(" Texture " + this.mode); + LOGGER.trace(" Texture " + this.mode); } else { - Log.error("unknow material property ... : '" + inputDataLine + "'"); + LOGGER.error("unknow material property ... : '" + inputDataLine + "'"); } continue; } if (currentMode.getValue() >= emfModuleMode.EMFModulePhysics.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePhysics_END.getValue()) { if (level == 1) { - Log.error("Load shape : " + inputDataLine); + LOGGER.error("Load shape : " + inputDataLine); // physics = ege::physics::Shape::create(inputDataLine); // if (physics == null) { - // Log.error("Allocation error when creating physical shape ..."); + // LOGGER.error("Allocation error when creating physical shape ..."); // continue; // } // addPhysicElement(physics); - // Log.verbose(" " + this.physics.size() + " " + inputDataLine); + // LOGGER.trace(" " + this.physics.size() + " " + inputDataLine); // currentMode = emfModuleMode.EMFModulePhysicsNamed; } else if (currentMode == emfModuleMode.EMFModulePhysicsNamed) { // if (physics == null) { - // Log.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); + // LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); // continue; // } // if (physics.parse(&inputDataLine[0]) == false) { - // Log.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ..."); + // LOGGER.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ..."); // } } continue; } // unknown ... - Log.warning("Unknown type of line == > jump end of line ... " + inputDataLine); + LOGGER.warn("Unknown type of line == > jump end of line ... " + inputDataLine); } // add last material ... if (materialName != "" && material != null) { @@ -405,7 +405,7 @@ public class ResourceMeshEmf extends ResourceMesh { materialName = ""; material = null; } - Log.verbose("Stop parsing Mesh file"); + LOGGER.trace("Stop parsing Mesh file"); try { fileIO.close(); @@ -415,17 +415,17 @@ public class ResourceMeshEmf extends ResourceMesh { e.printStackTrace(); } - Log.verbose("New mesh : "); - Log.verbose(" nb vertex: " + this.listVertex.size()); - Log.verbose(" nb UV: " + this.listUV.size()); - Log.verbose(" nb Colors: " + this.listColor.size()); - Log.verbose(" nb Normal face: " + this.listFacesNormal.size()); - Log.verbose(" nb Normal vertex: " + this.listVertexNormal.size()); - Log.verbose(" nb Faces: " + this.listFaces.size()); - Log.verbose(" nb Faces (palette): " + this.listPaletteFaces.size()); - Log.verbose(" nb material: " + this.materials.size()); - Log.verbose(" nb palettes: " + this.palettes.size()); - //Log.verbose(" nb physic: " + this.physics.size()); + LOGGER.trace("New mesh : "); + LOGGER.trace(" nb vertex: " + this.listVertex.size()); + LOGGER.trace(" nb UV: " + this.listUV.size()); + LOGGER.trace(" nb Colors: " + this.listColor.size()); + LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size()); + LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size()); + LOGGER.trace(" nb Faces: " + this.listFaces.size()); + LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.size()); + LOGGER.trace(" nb material: " + this.materials.size()); + LOGGER.trace(" nb palettes: " + this.palettes.size()); + //LOGGER.trace(" nb physic: " + this.physics.size()); if (this.listVertex.size() == 0) { throw new Exception("unable to load the mesh file: " + fileName + " ==> no vertex available."); } @@ -469,7 +469,7 @@ public class ResourceMeshEmf extends ResourceMesh { // || ( current == ':' // && _stopColomn == true) ) // { - // //Log.debug(" plop : '" + _elementLine + "'" ); + // //LOGGER.debug(" plop : '" + _elementLine + "'" ); // return buf.toString(); // } else if( buf.length() == 0 // && current != '\t') { @@ -564,7 +564,7 @@ public class ResourceMeshEmf extends ResourceMesh { e.printStackTrace(); } } - Log.error("Read line: offset=" + level.value + "\n" + buf.toString()); + LOGGER.error("Read line: offset=" + level.value + "\n" + buf.toString()); if (buf.length() == 0) { return null; } diff --git a/src/org/atriasoft/loader3d/resources/ResourceMeshHeightMap.java b/src/org/atriasoft/loader3d/resources/ResourceMeshHeightMap.java index 5473c31..fa5afa5 100644 --- a/src/org/atriasoft/loader3d/resources/ResourceMeshHeightMap.java +++ b/src/org/atriasoft/loader3d/resources/ResourceMeshHeightMap.java @@ -147,21 +147,21 @@ public class ResourceMeshHeightMap extends ResourceMesh { } } } - //Log.warning("this.listVertex: " + this.listVertex.size()); - //Log.warning("this.listFacesNormal: " + this.listFacesNormal.size()); + //LOGGER.warn("this.listVertex: " + this.listVertex.size()); + //LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size()); calculateNormaleFaces(materialsNames); - //Log.warning("this.listVertex: " + this.listVertex.size()); - //Log.warning("this.listFacesNormal: " + this.listFacesNormal.size()); - // Log.verbose("New heightmap mesh : "); - // Log.verbose(" nb vertex: " + this.listVertex.size()); - // Log.verbose(" nb UV: " + this.listUV.size()); - // Log.verbose(" nb Colors: " + this.listColor.size()); - // Log.verbose(" nb Normal face: " + this.listFacesNormal.size()); - // Log.verbose(" nb Normal vertex: " + this.listVertexNormal.size()); - // Log.verbose(" nb Faces: " + this.listFaces.size()); - // Log.verbose(" nb Faces (palette): " + this.listPaletteFaces.get(0).face().size()); - // Log.verbose(" nb material: " + this.materials.size()); - // Log.verbose(" nb palettes: " + this.palettes.size()); + //LOGGER.warn("this.listVertex: " + this.listVertex.size()); + //LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size()); + // LOGGER.trace("New heightmap mesh : "); + // LOGGER.trace(" nb vertex: " + this.listVertex.size()); + // LOGGER.trace(" nb UV: " + this.listUV.size()); + // LOGGER.trace(" nb Colors: " + this.listColor.size()); + // LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size()); + // LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size()); + // LOGGER.trace(" nb Faces: " + this.listFaces.size()); + // LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.get(0).face().size()); + // LOGGER.trace(" nb material: " + this.materials.size()); + // LOGGER.trace(" nb palettes: " + this.palettes.size()); generateVBO(); } diff --git a/src/org/atriasoft/loader3d/resources/ResourcePaletteFile.java b/src/org/atriasoft/loader3d/resources/ResourcePaletteFile.java index cf20004..6629abc 100644 --- a/src/org/atriasoft/loader3d/resources/ResourcePaletteFile.java +++ b/src/org/atriasoft/loader3d/resources/ResourcePaletteFile.java @@ -61,17 +61,17 @@ public class ResourcePaletteFile extends Resource { private Runnable updatePostAction = null; public static ResourcePaletteFile create(final Uri uri) { - Log.verbose("KEEP: ColorFile: " + uri); + LOGGER.trace("KEEP: ColorFile: " + uri); ResourcePaletteFile object = null; final Resource object2 = Resource.getManager().localKeep(uri); if (object2 != null) { if (object2 instanceof ResourcePaletteFile) { return (ResourcePaletteFile) object2; } - Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)"); + LOGGER.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)"); return null; } - Log.debug("CREATE: FontFreeType: " + uri); + LOGGER.debug("CREATE: FontFreeType: " + uri); // need to crate a new one ... return new ResourcePaletteFile(uri); } @@ -89,9 +89,9 @@ public class ResourcePaletteFile extends Resource { */ public ResourcePaletteFile(final Uri uri) { super(uri); - Log.debug("CF : load '" + uri + "'"); + LOGGER.debug("CF : load '" + uri + "'"); reload(); - // Log.debug("List of all color : " + this.list.keySet()); + // LOGGER.debug("List of all color : " + this.list.keySet()); } @Override @@ -118,33 +118,33 @@ public class ResourcePaletteFile extends Resource { if (node != null) { if (node.exist(ResourcePaletteFile.DEFINE_SHINESS)) { final double data = node.get(ResourcePaletteFile.DEFINE_SHINESS).toJsonNumber().getValue(); - Log.verbose(" Shininess " + data); + LOGGER.trace(" Shininess " + data); element.setShininess((float)data); } if (node.exist(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR)) { final String data = node.get(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR).toJsonString().getValue(); Vector4f tmp = Vector4f.valueOf(data); tmp = tmp.withW(1); - Log.verbose(" AmbientFactor " + tmp); + LOGGER.trace(" AmbientFactor " + tmp); element.setAmbientFactor(tmp); } if (node.exist(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR)) { final String data = node.get(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR).toJsonString().getValue(); Vector4f tmp = Vector4f.valueOf(data); tmp = tmp.withW(1); - Log.verbose(" DiffuseFactor " + tmp); + LOGGER.trace(" DiffuseFactor " + tmp); element.setDiffuseFactor(tmp); } if (node.exist(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR)) { final String data = node.get(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR).toJsonString().getValue(); Vector4f tmp = Vector4f.valueOf(data); tmp = tmp.withW(1); - Log.verbose(" SpecularFactor " + tmp); + LOGGER.trace(" SpecularFactor " + tmp); element.setSpecularFactor(tmp); } } } catch (final Exception e) { - Log.error("chach exception in parsing config file... " + e.getMessage()); + LOGGER.error("chach exception in parsing config file... " + e.getMessage()); e.printStackTrace(); } return element; @@ -162,7 +162,7 @@ public class ResourcePaletteFile extends Resource { final JsonObject baseObject = out.get(ResourcePaletteFile.DEFINE_PALETTE).toJsonObject(); if (baseObject == null) { - Log.error("Can not get basic object : 'palette' in file:" + this.name); + LOGGER.error("Can not get basic object : 'palette' in file:" + this.name); Ejson.display(out); return; } @@ -184,13 +184,13 @@ public class ResourcePaletteFile extends Resource { } } } catch (final Exception e) { - Log.error("chach exception in parsing config file... " + e.getMessage()); + LOGGER.error("chach exception in parsing config file... " + e.getMessage()); e.printStackTrace(); } if (this.updatePostAction != null) { - Log.warning("Detect auto_update on onthe element ..."); + LOGGER.warn("Detect auto_update on onthe element ..."); this.updatePostAction.run(); - Log.warning("Detect auto_update on onthe element ... (DONE)"); + LOGGER.warn("Detect auto_update on onthe element ... (DONE)"); } } @@ -218,7 +218,7 @@ public class ResourcePaletteFile extends Resource { MaterialBase mat = it.getValue(); MaterialBase matOver = this.listOver.get(it.getKey()); MaterialBase matSelect = this.listSelect.get(it.getKey()); - Log.error("add Material in texture: '" + it.getKey() + "' ==> " + id + " mat=" + mat); + LOGGER.error("add Material in texture: '" + it.getKey() + "' ==> " + id + " mat=" + mat); // 2 element this will permit to change color in the future on depend on some parameters... putColor(id, 0, out, mat); putColor(id, 1, out, matOver); diff --git a/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java b/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java index 9ea207d..4484f4e 100644 --- a/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java +++ b/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java @@ -13,7 +13,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh { Resource resource2; final String name = uriObj.getValue(); if (name.isEmpty() || name.equals("---")) { - Log.error("Can not create a shader without a filaname"); + LOGGER.error("Can not create a shader without a filaname"); return null; } resource2 = Resource.getManager().localKeep(name); @@ -22,7 +22,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh { resource2.keep(); return (ResourceStaticMeshObj) resource2; } - Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)"); + LOGGER.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)"); return null; } resource = new ResourceStaticMeshObj(uriObj); diff --git a/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObjDynamic.java b/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObjDynamic.java index 72fc8a9..bb50a0c 100644 --- a/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObjDynamic.java +++ b/src/org/atriasoft/loader3d/resources/ResourceStaticMeshObjDynamic.java @@ -12,7 +12,7 @@ public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj { Resource resource2; final String name = uriObj.getValue(); if (name.isEmpty() || name.equals("---")) { - Log.error("Can not create a shader without a filaname"); + LOGGER.error("Can not create a shader without a filaname"); return null; } resource2 = Resource.getManager().localKeep(name); @@ -21,7 +21,7 @@ public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj { resource2.keep(); return tmpp; } - Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)"); + LOGGER.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)"); return null; } resource = new ResourceStaticMeshObjDynamic(uriObj); diff --git a/test/src/test/atriasoft/loader3d/TestBasicLog.java b/test/src/test/atriasoft/loader3d/TestBasicLog.java index 9936a8c..b9e5c51 100644 --- a/test/src/test/atriasoft/loader3d/TestBasicLog.java +++ b/test/src/test/atriasoft/loader3d/TestBasicLog.java @@ -26,7 +26,7 @@ public class TestBasicLog { Gale.init(); GaleContextTest tmpContext = new GaleContextTest(); Uri.setGroup("EMF", "emf"); - Uri.setApplication(TestBasicLog.class, ""); + Uri.setApplication(TestBasicLOGGER.class, ""); Uri.addLibrary("test", ResourceMeshHeightMap.class, "/resources"); //ResourceMeshEmf tmp = new ResourceMeshEmf(new Uri("EMF", "tree1.emf", "test"));