[FEAT] use Maven a build system root tool

This commit is contained in:
Edouard DUPIN 2024-06-07 09:28:33 +02:00
parent 4ce31bf6c9
commit 49367d8969
15 changed files with 328 additions and 210 deletions

View File

@ -1,32 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="resources"/> <classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="out/eclipse/classes-test" path="test/src">
<attributes> <attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="out/maven/test-classes" path="test/src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-ejson">
<attributes> <attributes>
<attribute name="module" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-etk"> <classpathentry kind="output" path="out/maven/classes"/>
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-gale">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/eclipse/classes"/>
</classpath> </classpath>

View File

@ -10,19 +10,14 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures> </natures>
<filteredResources>
<filter>
<id>1646149232199</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription> </projectDescription>

View File

@ -39,7 +39,7 @@ def configure(target, my_module):
'src/org/atriasoft/loader3d/model/PhysicShape.java', 'src/org/atriasoft/loader3d/model/PhysicShape.java',
'src/org/atriasoft/loader3d/model/ModelData.java', 'src/org/atriasoft/loader3d/model/ModelData.java',
'src/org/atriasoft/loader3d/model/MaterialGlId.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/Loader3d.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticColoredMesh.java', 'src/org/atriasoft/loader3d/resources/ResourceStaticColoredMesh.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java', 'src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java',

128
pom.xml Normal file
View File

@ -0,0 +1,128 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.atriasoft</groupId>
<artifactId>loader3d</artifactId>
<version>0.1.0</version>
<properties>
<maven.compiler.version>3.13.0</maven.compiler.version>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.dependency.version>3.1.1</maven.dependency.version>
</properties>
<repositories>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</repository>
<snapshotRepository>
<id>gitea</id>
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>gale</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.atriasoft</groupId>
<artifactId>ejson</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test/src</testSourceDirectory>
<directory>${project.basedir}/out/maven/</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<!--<encoding>${project.build.sourceEncoding}</encoding>-->
</configuration>
</plugin>
<!-- Create the source bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- junit results -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>fully.qualified.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<!-- Java-doc generation for stand-alone site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
</configuration>
</plugin>
</plugins>
</build>
<!-- Generate Java-docs As Part Of Project Reports -->
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -69,7 +69,7 @@ public class OBJFileLoader {
public static ModelData loadOBJ(final Uri objFileName) { public static ModelData loadOBJ(final Uri objFileName) {
final InputStream stream = Uri.getStream(objFileName); final InputStream stream = Uri.getStream(objFileName);
if (stream == null) { if (stream == null) {
Log.error("Can not read file: " + objFileName + " ==> load OBJ"); LOGGER.error("Can not read file: " + objFileName + " ==> load OBJ");
return null; return null;
} }
/* /*
@ -86,7 +86,7 @@ public class OBJFileLoader {
try { try {
reader = new BufferedReader(new InputStreamReader(stream, "UTF-8")); reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
} catch (final UnsupportedEncodingException e1) { } catch (final UnsupportedEncodingException e1) {
Log.error("Error in loading file: " + objFileName + " ==> load OBJ"); LOGGER.error("Error in loading file: " + objFileName + " ==> load OBJ");
e1.printStackTrace(); e1.printStackTrace();
return null; return null;
} }

View File

@ -6,15 +6,15 @@ import org.atriasoft.reggol.Logger;
public class Log { public class Log {
private static final boolean FORCE_ALL = false; private static final boolean FORCE_ALL = false;
private static final String LIB_NAME = "loader3d"; private static final String LIB_NAME = "loader3d";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME); private static final String LIB_NAME_DRAW = Logger.getDrawableName(LOGGER.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL); private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG); private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR); private static final boolean PRINT_ERROR = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO); private static final boolean PRINT_INFO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT); private static final boolean PRINT_PRINT = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO); private static final boolean PRINT_TODO = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE); private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING); private static final boolean PRINT_WARNING = Logger.getNeedPrint(LOGGER.LIB_NAME, LogLevel.WARNING);
public static void critical(final Exception e, final String data) { public static void critical(final Exception e, final String data) {
e.printStackTrace(); e.printStackTrace();

View File

@ -23,27 +23,27 @@ public class Material extends MaterialBase{
super(); super();
} }
public void draw(ResourceProgram _prog, MaterialGlId _glID){ 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.oglAmbientFactor(), this.ambientFactor);
_prog.uniformVector(_glID.oglDiffuseFactor(), this.diffuseFactor); _prog.uniformVector(_glID.oglDiffuseFactor(), this.diffuseFactor);
_prog.uniformVector(_glID.oglSpecularFactor(), this.specularFactor); _prog.uniformVector(_glID.oglSpecularFactor(), this.specularFactor);
_prog.uniformFloat(_glID.oglShininess(), this.shininess); _prog.uniformFloat(_glID.oglShininess(), this.shininess);
if (this.texture0 != null) { 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()); _prog.setTexture0(_glID.oglTexture0(), this.texture0.getRendererId());
if (false) { if (false) {
if (_prog.checkIdValidity(_glID.oglTexture0()) == 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 { } else {
if (false) { if (false) {
if (_prog.checkIdValidity(_glID.oglTexture0()) == true) { 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) { public void setRenderMode(RenderMode _val) {
switch (_val) { switch (_val) {
@ -52,33 +52,33 @@ public class Material extends MaterialBase{
case LINE: case LINE:
break; break;
case LINE_STRIP: 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; _val = RenderMode.LINE;
break; break;
case LINE_LOOP: 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; _val = RenderMode.LINE;
break; break;
case TRIANGLE: case TRIANGLE:
break; break;
case TRIANGLE_STRIP: 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; _val = RenderMode.TRIANGLE;
break; break;
case TRIANGLE_FAN: 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; _val = RenderMode.TRIANGLE;
break; break;
case QUAD: 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; _val = RenderMode.TRIANGLE;
break; break;
case QUAD_STRIP: 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; _val = RenderMode.TRIANGLE;
break; break;
case POLYGON: 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; _val = RenderMode.TRIANGLE;
break; break;
} }
@ -97,7 +97,7 @@ public class Material extends MaterialBase{
ResourceTexture2 tmpCopy = this.texture0; ResourceTexture2 tmpCopy = this.texture0;
this.texture0 = ResourceTextureFile.create(_uri, tmpSize); this.texture0 = ResourceTextureFile.create(_uri, tmpSize);
if (this.texture0 == null) { if (this.texture0 == null) {
Log.error("Can not load specific texture : " + _uri); LOGGER.error("Can not load specific texture : " + _uri);
// retreave previous texture: // retreave previous texture:
this.texture0 = tmpCopy; this.texture0 = tmpCopy;
if (this.texture0 != null) { if (this.texture0 != null) {

View File

@ -24,7 +24,7 @@ public class MaterialBase {
this.ambientFactor = _val; this.ambientFactor = _val;
} }
public void setDiffuseFactor( Vector4f _val){ public void setDiffuseFactor( Vector4f _val){
//Log.error("**************** set difuse factor:" + _val); //LOGGER.error("**************** set difuse factor:" + _val);
this.diffuseFactor = _val; this.diffuseFactor = _val;
} }
public void setSpecularFactor( Vector4f _val){ public void setSpecularFactor( Vector4f _val){

View File

@ -23,26 +23,26 @@ import org.atriasoft.loader3d.model.Material;
public class ResourceMesh extends ResourceStaticMesh { public class ResourceMesh extends ResourceStaticMesh {
public static ResourceMesh create(final Uri uri) { public static ResourceMesh create(final Uri uri) {
Log.verbose("KEEP: Resource Mesh: " + uri); LOGGER.trace("KEEP: Resource Mesh: " + uri);
ResourceMesh object = null; ResourceMesh object = null;
final Resource object2 = Resource.getManager().localKeep(uri); final Resource object2 = Resource.getManager().localKeep(uri);
if (object2 != null) { if (object2 != null) {
if (object2 instanceof ResourceMesh tmpp) { if (object2 instanceof ResourceMesh tmpp) {
return 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; return null;
} }
Log.debug("CREATE: new Mesh: " + uri); LOGGER.debug("CREATE: new Mesh: " + uri);
if (uri.getExtention().equals("emf")) { if (uri.getExtention().equals("emf")) {
try { try {
return new ResourceMeshEmf(uri); return new ResourceMeshEmf(uri);
} catch (Exception e) { } catch (Exception e) {
Log.warning("Can not load file: " + e.toString()); LOGGER.warn("Can not load file: " + e.toString());
return null; return null;
} }
} }
Log.error("Not managed extention type: '" + uri.getExtention() + "'"); LOGGER.error("Not managed extention type: '" + uri.getExtention() + "'");
return null; return null;
} }
@ -72,7 +72,7 @@ public class ResourceMesh extends ResourceStaticMesh {
public ResourceMesh(final Uri _fileName) { public ResourceMesh(final Uri _fileName) {
super(_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 is the properties of the buffer requested : "r"/"w" + "-" + buffer type "f"=flaot "i"=integer
this.vao = ResourceVirtualArrayObject.createDynamic(); 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) { 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) { 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; return;
} }
RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
if (tmpRenderMode != RenderMode.LINE && tmpRenderMode != RenderMode.LINE_STRIP && tmpRenderMode != RenderMode.LINE_LOOP) { 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; return;
} }
// try to find position: // try to find position:
@ -153,7 +153,7 @@ public class ResourceMesh extends ResourceStaticMesh {
public void addLines(final String _layerName, final List<Vector3f> _list, final List<Color> _color) { public void addLines(final String _layerName, final List<Vector3f> _list, final List<Color> _color) {
if (_color.size() != _list.size()) { 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; return;
} }
for (int iii = 1; iii < _list.size(); ++iii) { 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) { public void addMaterial(final String _name, final Material _data) {
if (_data == null) { if (_data == null) {
Log.error(" can not add material with null pointer"); LOGGER.error(" can not add material with null pointer");
return; return;
} }
if (_name == "") { if (_name == "") {
Log.error(" can not add material with no name"); LOGGER.error(" can not add material with no name");
return; return;
} }
// really add the material: // really add the material:
Log.warning("Add material: " + _name); LOGGER.warn("Add material: " + _name);
this.materials.put(_name, _data); this.materials.put(_name, _data);
} }
public void addPoint(final String _layerName, final Vector3f _pos, final Color _color) { public void addPoint(final String _layerName, final Vector3f _pos, final Color _color) {
if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) { 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; return;
} }
RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
if (tmpRenderMode != RenderMode.POINT) { 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; return;
} }
// try to find position: // try to find position:
@ -215,12 +215,12 @@ public class ResourceMesh extends ResourceStaticMesh {
// public void draw(Matrix4f _positionMatrix, boolean _enableDepthTest, boolean _enableDepthUpdate) { // public void draw(Matrix4f _positionMatrix, boolean _enableDepthTest, boolean _enableDepthUpdate) {
// // TODO : Remove this, it is just for test the 23-04-2016 // // TODO : Remove this, it is just for test the 23-04-2016
// //this.checkNormal = false; // //this.checkNormal = false;
// Log.verbose("draw Mesh : " + this.name + " (start)"); // LOGGER.trace("draw Mesh : " + this.name + " (start)");
// if (this.GLprogram == null) { // if (this.GLprogram == null) {
// Log.error("No shader ..."); // LOGGER.error("No shader ...");
// return; // return;
// } // }
// //Log.debug(this.name + " " + this.light); // //LOGGER.debug(this.name + " " + this.light);
// if (_enableDepthTest == true) { // if (_enableDepthTest == true) {
// gale::openGL::enable(gale::openGL::flag_depthTest); // gale::openGL::enable(gale::openGL::flag_depthTest);
// if (_enableDepthUpdate == false) { // if (_enableDepthUpdate == false) {
@ -229,7 +229,7 @@ public class ResourceMesh extends ResourceStaticMesh {
// } else { // } else {
// gale::openGL::disable(gale::openGL::flag_depthTest); // gale::openGL::disable(gale::openGL::flag_depthTest);
// } // }
// //Log.debug(" display " + this.coord.size() + " elements" ); // //LOGGER.debug(" display " + this.coord.size() + " elements" );
// this.GLprogram.use(); // this.GLprogram.use();
// // set Matrix : translation/positionMatrix // // set Matrix : translation/positionMatrix
// Matrix4f projMatrix = gale::openGL::getMatrix(); // Matrix4f projMatrix = gale::openGL::getMatrix();
@ -250,7 +250,7 @@ public class ResourceMesh extends ResourceStaticMesh {
// // colors : // // colors :
// this.GLprogram.sendAttributePointer(this.GLColor, this.verticesVBO, MESH_VBO_COLOR); // this.GLprogram.sendAttributePointer(this.GLColor, this.verticesVBO, MESH_VBO_COLOR);
// // draw lights : // // draw lights :
// //Log.info("light : " + this.light); // //LOGGER.info("light : " + this.light);
// this.light.draw(this.GLprogram); // this.light.draw(this.GLprogram);
//// #ifdef DISPLAY_NB_VERTEX_DISPLAYED //// #ifdef DISPLAY_NB_VERTEX_DISPLAYED
//// int nbElementDrawTheoric = 0; //// int nbElementDrawTheoric = 0;
@ -258,7 +258,7 @@ public class ResourceMesh extends ResourceStaticMesh {
//// #endif //// #endif
// for (int kkk=0; kkk<this.listFaces.size(); kkk++) { // for (int kkk=0; kkk<this.listFaces.size(); kkk++) {
// if (this.materials.exist(elem.getKey()) == false) { // if (this.materials.exist(elem.getKey()) == false) {
// Log.warning("missing materials : '" + elem.getKey() + "'"); // LOGGER.warn("missing materials : '" + elem.getKey() + "'");
// continue; // continue;
// } // }
// this.materials[elem.getKey()].draw(this.GLprogram, this.GLMaterial); // this.materials[elem.getKey()].draw(this.GLprogram, this.GLMaterial);
@ -318,12 +318,12 @@ public class ResourceMesh extends ResourceStaticMesh {
// } // }
//// #ifdef DISPLAY_NB_VERTEX_DISPLAYED //// #ifdef DISPLAY_NB_VERTEX_DISPLAYED
//// if (this.listFaces.size() == 0) { //// if (this.listFaces.size() == 0) {
//// Log.error(" !!!! No Face to display elements [" + this.name + "]"); //// LOGGER.error(" !!!! No Face to display elements [" + this.name + "]");
//// } else { //// } else {
//// if (nbElementDrawTheoric != 0) { //// if (nbElementDrawTheoric != 0) {
//// Log.warning(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) + "% Request draw : " + this.listFaces.size() + ":" + nbElementDraw + "/" + nbElementDrawTheoric + " elements [" + this.name + "]"); //// LOGGER.warn(((float)nbElementDraw/(float)nbElementDrawTheoric*100.0f) + "% Request draw : " + this.listFaces.size() + ":" + nbElementDraw + "/" + nbElementDrawTheoric + " elements [" + this.name + "]");
//// } else { //// } else {
//// Log.warning("0% Request draw : " + this.listFaces.size() + ":" + nbElementDraw + "/" + nbElementDrawTheoric + " elements [" + this.name + "]"); //// LOGGER.warn("0% Request draw : " + this.listFaces.size() + ":" + nbElementDraw + "/" + nbElementDrawTheoric + " elements [" + this.name + "]");
//// } //// }
//// } //// }
//// #endif //// #endif
@ -337,7 +337,7 @@ public class ResourceMesh extends ResourceStaticMesh {
// } // }
// // TODO : UNDERSTAND why ... it is needed // // TODO : UNDERSTAND why ... it is needed
// gale::openGL::unbindBuffer(); // gale::openGL::unbindBuffer();
// Log.verbose("draw Mesh : " + this.name + " ( end )"); // LOGGER.trace("draw Mesh : " + this.name + " ( end )");
// } // }
/** /**
@ -435,12 +435,12 @@ public class ResourceMesh extends ResourceStaticMesh {
*/ */
public void addTriangle(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Color _color1, final Color _color2, final Color _color3) { public void addTriangle(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Color _color1, final Color _color2, final Color _color3) {
if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) { 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; return;
} }
RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
if (tmpRenderMode == RenderMode.QUAD || tmpRenderMode == RenderMode.QUAD_STRIP) { if (tmpRenderMode == RenderMode.QUAD || tmpRenderMode == RenderMode.QUAD_STRIP) {
Log.todo("Create quad interface ..."); LOGGER.info("[TODO] Create quad interface ...");
} else if (tmpRenderMode == RenderMode.TRIANGLE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.TRIANGLE_FAN) { } else if (tmpRenderMode == RenderMode.TRIANGLE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.TRIANGLE_FAN) {
// try to find position: // try to find position:
@ -455,7 +455,7 @@ public class ResourceMesh extends ResourceStaticMesh {
tmpFace.setColor(color1, color2, color3); tmpFace.setColor(color1, color2, color3);
this.listFaces.get(_layerName).face().add(tmpFace); this.listFaces.get(_layerName).face().add(tmpFace);
} else { } else {
Log.error("try to add Quad in a mesh material section that not support Quad"); LOGGER.error("try to add Quad in a mesh material section that not support Quad");
} }
} }
@ -466,18 +466,18 @@ public class ResourceMesh extends ResourceStaticMesh {
// public List<ege::physics::Shape> getPhysicalProperties() { // public List<ege::physics::Shape> getPhysicalProperties() {
// for (auto it: this.physics) { // for (auto it: this.physics) {
// if (it == null) { // if (it == null) {
// Log.warning("Get null ... "); // LOGGER.warn("Get null ... ");
// continue; // continue;
// } // }
// if (it.getType() == ege::physics::Shape::type::concave) { // if (it.getType() == ege::physics::Shape::type::concave) {
// // need to generate the internal list of point and triangle needed: // // need to generate the internal list of point and triangle needed:
// ege::physics::shape::Concave* tmpElement = it.toConcave(); // ege::physics::shape::Concave* tmpElement = it.toConcave();
// if (tmpElement == null) { // if (tmpElement == null) {
// Log.error(" Concave ==> can not cast in Concave"); // LOGGER.error(" Concave ==> can not cast in Concave");
// return this.physics; // return this.physics;
// } // }
// tmpElement.clear(); // tmpElement.clear();
// //Log.info(" add vertices : " + this.listVertex); // //LOGGER.info(" add vertices : " + this.listVertex);
// tmpElement.setListOfVertex(this.listVertex); // tmpElement.setListOfVertex(this.listVertex);
// for (int kkk=0; kkk<this.listFaces.size(); ++kkk) { // for (int kkk=0; kkk<this.listFaces.size(); ++kkk) {
// List<uint> index; // List<uint> index;
@ -486,12 +486,12 @@ public class ResourceMesh extends ResourceStaticMesh {
// index.pushBack(it.vertex[1]); // index.pushBack(it.vertex[1]);
// index.pushBack(it.vertex[2]); // 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(elem.getValue().index);
// tmpElement.addTriangle(index); // tmpElement.addTriangle(index);
// } // }
// //Log.critical("kjlkj"); // //LOGGER.critical("kjlkj");
// // Can have only one concave element in a mesh ... // // Can have only one concave element in a mesh ...
// //return this.physics; // //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, 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) { 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) { 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; return;
} }
RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
if (tmpRenderMode != RenderMode.TRIANGLE && tmpRenderMode != RenderMode.TRIANGLE_STRIP && tmpRenderMode != RenderMode.TRIANGLE_FAN) { 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; return;
} }
// try to find position: // try to find position:
@ -558,17 +558,17 @@ public class ResourceMesh extends ResourceStaticMesh {
Face tmpFace = new Face(pos1, uv1, pos2, uv2, pos3, uv3); Face tmpFace = new Face(pos1, uv1, pos2, uv2, pos3, uv3);
tmpFace.setColor(color1, color2, color3); tmpFace.setColor(color1, color2, color3);
this.listFaces.get(_layerName).face().add(tmpFace); 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) { private void calculateNormaleEdge(final String _materialName) {
this.listVertexNormal.clear(); this.listVertexNormal.clear();
if (this.normalMode == NormalMode.VERTEX) { if (this.normalMode == NormalMode.VERTEX) {
List<Vector3f> outNormal = new ArrayList<>(); List<Vector3f> outNormal = new ArrayList<>();
Log.info("calculateNormaleEdge(" + _materialName + ")"); LOGGER.info("calculateNormaleEdge(" + _materialName + ")");
RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode();
if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) { 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; this.normalMode = NormalMode.NONE;
return; return;
} }
@ -599,10 +599,10 @@ public class ResourceMesh extends ResourceStaticMesh {
protected void calculateNormaleFaceLocal(final String _materialName) { protected void calculateNormaleFaceLocal(final String _materialName) {
if (this.normalMode == NormalMode.FACE) { if (this.normalMode == NormalMode.FACE) {
Log.verbose("calculateNormaleFace(" + _materialName + ")"); LOGGER.trace("calculateNormaleFace(" + _materialName + ")");
RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode(); RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode();
if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE || tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) { 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; this.normalMode = NormalMode.NONE;
return; return;
} }
@ -615,9 +615,9 @@ public class ResourceMesh extends ResourceStaticMesh {
for (Face it : faceList.face()) { 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. // 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]))); 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()) { 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)); this.listFacesNormal.add(new Vector3f(1, 0, 0));
} else { } else {
this.listFacesNormal.add(normal.normalize()); this.listFacesNormal.add(normal.normalize());
@ -633,7 +633,7 @@ public class ResourceMesh extends ResourceStaticMesh {
protected void calculateNormaleFaces(final List<String> materialsNames) { protected void calculateNormaleFaces(final List<String> materialsNames) {
this.listFacesNormal.clear(); this.listFacesNormal.clear();
for (String name : materialsNames) { for (String name : materialsNames) {
Log.warning("generate normal for: '" + name + "'"); LOGGER.warn("generate normal for: '" + name + "'");
calculateNormaleFaceLocal(name); calculateNormaleFaceLocal(name);
} }
} }
@ -786,7 +786,7 @@ public class ResourceMesh extends ResourceStaticMesh {
// center /= float(nbIndicInFace); // center /= float(nbIndicInFace);
// int index = face.normal[0]; // int index = face.normal[0];
// if (index >= this.listFacesNormal.size()) { // 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; // return;
// } // }
// Vector3f normal = this.listFacesNormal[index]; // Vector3f normal = this.listFacesNormal[index];
@ -809,11 +809,11 @@ public class ResourceMesh extends ResourceStaticMesh {
// calculate the normal of all faces if needed // calculate the normal of all faces if needed
if (this.normalMode != NormalMode.NONE && this.listFacesNormal.size() == 0) { if (this.normalMode != NormalMode.NONE && this.listFacesNormal.size() == 0) {
// when no normal detected == > auto generate Face normal .... // 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]); // 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: // generate element in 2 pass:
// - create new index depending on a vertex is a unique component of position, texture, normal // - 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 outPositionIndewStart = this.outPosition.size();
int nbIndicInFace = 3; int nbIndicInFace = 3;
if (this.materials.containsKey(elem.getKey()) == false) { 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; continue;
} }
nbIndicInFace = switch (this.materials.get(elem.getKey()).getRenderMode()) { 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) { // && this.verticesVBO.getOnBufferVector2f(MESH_VBO_TEXTURE,jjj) == texturepos) {
// vertexVBOId[indice] = jjj; // vertexVBOId[indice] = jjj;
// elementFind = true; // elementFind = true;
// //Log.debug("search indice : " + jjj); // //LOGGER.debug("search indice : " + jjj);
// tmpppppp += jjj; // tmpppppp += jjj;
// // stop searching ... // // stop searching ...
// break; // break;
@ -899,7 +899,7 @@ public class ResourceMesh extends ResourceStaticMesh {
} }
// #ifdef TRY_MINIMAL_VBO // #ifdef TRY_MINIMAL_VBO
// Log.debug("nb cycle ? : " + tmpppppp); // LOGGER.debug("nb cycle ? : " + tmpppppp);
// #endif // #endif
} }
@ -913,7 +913,7 @@ public class ResourceMesh extends ResourceStaticMesh {
for (Entry<String, FaceIndexing> elem : this.listPaletteFaces.entrySet()) { for (Entry<String, FaceIndexing> elem : this.listPaletteFaces.entrySet()) {
int nbIndicInFace = 3; int nbIndicInFace = 3;
if (this.materials.containsKey(elem.getKey()) == false) { 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; continue;
} }
switch (this.materials.get(elem.getKey()).getRenderMode()) { switch (this.materials.get(elem.getKey()).getRenderMode()) {
@ -929,22 +929,22 @@ public class ResourceMesh extends ResourceStaticMesh {
case QUAD: case QUAD:
case QUAD_STRIP: case QUAD_STRIP:
case POLYGON: 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; break;
} }
float maxValues = ResourcePaletteFile.getColorMax(); float maxValues = ResourcePaletteFile.getColorMax();
float height = ResourcePaletteFile.getHeight(); float height = ResourcePaletteFile.getHeight();
int indexColor = ResourcePaletteFile.getColorId(elem.getKey().substring(8)); int indexColor = ResourcePaletteFile.getColorId(elem.getKey().substring(8));
Vector2f texturepos = new Vector2f((indexColor + 0.5f) / maxValues, 0.5f / height); 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; int faceId = -1;
FaceIndexing tmpFaceList = elem.getValue(); FaceIndexing tmpFaceList = elem.getValue();
for (Face face : tmpFaceList.face()) { for (Face face : tmpFaceList.face()) {
faceId++; faceId++;
//Log.warning("Parse faceID = " + faceId); //LOGGER.warn("Parse faceID = " + faceId);
int[] vertexVBOId = new int[3]; int[] vertexVBOId = new int[3];
for (int indice = 0; indice < nbIndicInFace; indice++) { 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 // get position
Vector3f position = this.listVertex.get(face.vertex[indice]); Vector3f position = this.listVertex.get(face.vertex[indice]);
// get Color // get Color
@ -1011,9 +1011,9 @@ public class ResourceMesh extends ResourceStaticMesh {
public void render(final String layerName) { public void render(final String layerName) {
/* /*
Log.info("--------------------------------------"); LOGGER.info("--------------------------------------");
for (String elem : this.listFacesDrawIndex.keySet()) { for (String elem : this.listFacesDrawIndex.keySet()) {
Log.info(" - " + elem); LOGGER.info(" - " + elem);
} }
*/ */
Vector2i elements = this.listFacesDrawIndex.get(layerName); Vector2i elements = this.listFacesDrawIndex.get(layerName);

View File

@ -71,7 +71,7 @@ public class ResourceMeshEmf extends ResourceMesh {
this.normalMode = NormalMode.NONE; this.normalMode = NormalMode.NONE;
InputStream fileIOStream = Uri.getStream(fileName); InputStream fileIOStream = Uri.getStream(fileName);
if (fileIOStream == null) { if (fileIOStream == null) {
Log.error("CAn not get the file named='" + fileName + "'"); LOGGER.error("CAn not get the file named='" + fileName + "'");
return; // TODO false; return; // TODO false;
} }
BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream)); BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream));
@ -86,14 +86,14 @@ public class ResourceMeshEmf extends ResourceMesh {
if (inputDataLine.startsWith("EMF(STRING)") == true) { if (inputDataLine.startsWith("EMF(STRING)") == true) {
// parse in string mode ... // parse in string mode ...
} else if (inputDataLine.startsWith("EMF(BINARY)") == true) { } 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; return; // TODO false;
} else { } else {
Log.error(" file mode is not supported now : 'EMF(? ? ?)' = '" + inputDataLine + "'"); LOGGER.error(" file mode is not supported now : 'EMF(? ? ?)' = '" + inputDataLine + "'");
return; // TODO false; return; // TODO false;
} }
emfModuleMode currentMode = emfModuleMode.EMFModuleNone; emfModuleMode currentMode = emfModuleMode.EMFModuleNone;
Log.verbose("Start parsing Mesh file : " + fileName); LOGGER.trace("Start parsing Mesh file : " + fileName);
// mesh global param : // mesh global param :
String currentMeshName = ""; String currentMeshName = "";
FaceIndexing currentFaceIndexing = null; FaceIndexing currentFaceIndexing = null;
@ -111,7 +111,7 @@ public class ResourceMeshEmf extends ResourceMesh {
int level = levelIO.value; int level = levelIO.value;
if (level == -1) { if (level == -1) {
// detect comment; // detect comment;
Log.warning("Detect comment"); LOGGER.warn("Detect comment");
continue; continue;
} }
if (level == 0) { if (level == 0) {
@ -123,18 +123,18 @@ public class ResourceMeshEmf extends ResourceMesh {
Matcher m = filterPattern.matcher(currentMeshName); Matcher m = filterPattern.matcher(currentMeshName);
if (!m.matches()) { if (!m.matches()) {
currentMode = emfModuleMode.EMFModuleSkip; currentMode = emfModuleMode.EMFModuleSkip;
Log.verbose("Parse Mesh(SKIP): " + currentMeshName); LOGGER.trace("Parse Mesh(SKIP): " + currentMeshName);
} else { } else {
Log.verbose("Parse Mesh: " + currentMeshName); LOGGER.trace("Parse Mesh: " + currentMeshName);
} }
} else { } else {
Log.verbose("Parse Mesh: " + currentMeshName); LOGGER.trace("Parse Mesh: " + currentMeshName);
} }
offsetVertexId = this.listVertex.size(); offsetVertexId = this.listVertex.size();
offsetUV = this.listUV.size(); offsetUV = this.listUV.size();
offsetFaceNormal = this.listFacesNormal.size(); offsetFaceNormal = this.listFacesNormal.size();
offsetVertexNormal = this.listVertexNormal.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:")) { } else if (inputDataLine.startsWith("Materials:")) {
// add previous material: // add previous material:
if (materialName != "" && material != null) { if (materialName != "" && material != null) {
@ -151,7 +151,7 @@ public class ResourceMeshEmf extends ResourceMesh {
currentMode = emfModuleMode.EMFModuleMaterial; currentMode = emfModuleMode.EMFModuleMaterial;
material = new Material(); material = new Material();
materialName = inputDataLine.substring(10); materialName = inputDataLine.substring(10);
Log.verbose("Parse Material: " + materialName); LOGGER.trace("Parse Material: " + materialName);
} else if (inputDataLine.startsWith("Palettes:")) { } else if (inputDataLine.startsWith("Palettes:")) {
// add previous material: // add previous material:
if (materialName != "" && material != null) { if (materialName != "" && material != null) {
@ -168,10 +168,10 @@ public class ResourceMeshEmf extends ResourceMesh {
currentMode = emfModuleMode.EMFModulePalette; currentMode = emfModuleMode.EMFModulePalette;
material = new Material(); material = new Material();
materialName = inputDataLine.substring(9); materialName = inputDataLine.substring(9);
Log.verbose("Parse Palette: " + materialName); LOGGER.trace("Parse Palette: " + materialName);
} else if (inputDataLine.startsWith("Physics:") == true) { } else if (inputDataLine.startsWith("Physics:") == true) {
currentMode = emfModuleMode.EMFModulePhysics; currentMode = emfModuleMode.EMFModulePhysics;
Log.verbose("Parse global Physics: "); LOGGER.trace("Parse global Physics: ");
} else { } else {
currentMode = emfModuleMode.EMFModuleNone; currentMode = emfModuleMode.EMFModuleNone;
} }
@ -185,25 +185,25 @@ public class ResourceMeshEmf extends ResourceMesh {
if (level == 1) { if (level == 1) {
if (inputDataLine.startsWith("Vertex:") == true) { if (inputDataLine.startsWith("Vertex:") == true) {
currentMode = emfModuleMode.EMFModuleMeshVertex; currentMode = emfModuleMode.EMFModuleMeshVertex;
Log.verbose(" Vertex ..."); LOGGER.trace(" Vertex ...");
} else if (inputDataLine.startsWith("UV-mapping:") == true) { } else if (inputDataLine.startsWith("UV-mapping:") == true) {
currentMode = emfModuleMode.EMFModuleMeshUVMapping; currentMode = emfModuleMode.EMFModuleMeshUVMapping;
haveUVMapping = true; haveUVMapping = true;
Log.verbose(" UV-mapping ..."); LOGGER.trace(" UV-mapping ...");
} else if (inputDataLine.startsWith("Normal(vertex):") == true) { } else if (inputDataLine.startsWith("Normal(vertex):") == true) {
currentMode = emfModuleMode.EMFModuleMeshNormalVertex; currentMode = emfModuleMode.EMFModuleMeshNormalVertex;
Log.verbose(" Normal(vertex) ..."); LOGGER.trace(" Normal(vertex) ...");
} else if (inputDataLine.startsWith("Normal(face):") == true) { } else if (inputDataLine.startsWith("Normal(face):") == true) {
currentMode = emfModuleMode.EMFModuleMeshNormalFace; currentMode = emfModuleMode.EMFModuleMeshNormalFace;
Log.verbose(" Normal(face) ..."); LOGGER.trace(" Normal(face) ...");
} else if (inputDataLine.startsWith("Face:") == true) { } else if (inputDataLine.startsWith("Face:") == true) {
currentMode = emfModuleMode.EMFModuleMeshFace; currentMode = emfModuleMode.EMFModuleMeshFace;
Log.verbose(" Face ..."); LOGGER.trace(" Face ...");
} else if (inputDataLine.startsWith("Physics:") == true) { } else if (inputDataLine.startsWith("Physics:") == true) {
currentMode = emfModuleMode.EMFModuleMeshPhysics; currentMode = emfModuleMode.EMFModuleMeshPhysics;
Log.verbose(" Physics ..."); LOGGER.trace(" Physics ...");
} else { } else {
Log.error(" Unknow mesh property '" + inputDataLine + "'"); LOGGER.error(" Unknow mesh property '" + inputDataLine + "'");
currentMode = emfModuleMode.EMFModuleMesh; currentMode = emfModuleMode.EMFModuleMesh;
} }
continue; continue;
@ -211,14 +211,14 @@ public class ResourceMeshEmf extends ResourceMesh {
// level > 1 // level > 1
switch (currentMode) { switch (currentMode) {
default: default:
Log.error("Unknow ... " + level); LOGGER.error("Unknow ... " + level);
break; break;
case EMFModuleMeshVertex: { case EMFModuleMeshVertex: {
for (String elem : inputDataLine.split("\\|")) { for (String elem : inputDataLine.split("\\|")) {
Vector3f vertex = Vector3f.valueOf(elem); Vector3f vertex = Vector3f.valueOf(elem);
this.listVertex.add(vertex); this.listVertex.add(vertex);
} }
Log.verbose(" " + this.listVertex.size() + " vertex"); LOGGER.trace(" " + this.listVertex.size() + " vertex");
break; break;
} }
case EMFModuleMeshUVMapping: { case EMFModuleMeshUVMapping: {
@ -226,7 +226,7 @@ public class ResourceMeshEmf extends ResourceMesh {
Vector2f uvMap = Vector2f.valueOf(elem); Vector2f uvMap = Vector2f.valueOf(elem);
this.listUV.add(uvMap); this.listUV.add(uvMap);
} }
Log.verbose(" " + this.listUV.size() + " coord"); LOGGER.trace(" " + this.listUV.size() + " coord");
break; break;
} }
case EMFModuleMeshNormalVertex: { case EMFModuleMeshNormalVertex: {
@ -235,17 +235,17 @@ public class ResourceMeshEmf extends ResourceMesh {
Vector3f normal = Vector3f.valueOf(elem); Vector3f normal = Vector3f.valueOf(elem);
this.listVertexNormal.add(normal); this.listVertexNormal.add(normal);
} }
Log.verbose(" " + this.listVertexNormal.size() + " Normals"); LOGGER.trace(" " + this.listVertexNormal.size() + " Normals");
break; break;
} }
case EMFModuleMeshNormalFace: { case EMFModuleMeshNormalFace: {
Log.error("Change mode in face mode ..."); LOGGER.error("Change mode in face mode ...");
this.normalMode = NormalMode.FACE; this.normalMode = NormalMode.FACE;
for (String elem : inputDataLine.split("\\|")) { for (String elem : inputDataLine.split("\\|")) {
Vector3f normal = Vector3f.valueOf(elem); Vector3f normal = Vector3f.valueOf(elem);
this.listFacesNormal.add(normal); this.listFacesNormal.add(normal);
} }
Log.verbose(" " + this.listFacesNormal.size() + " Normals"); LOGGER.trace(" " + this.listFacesNormal.size() + " Normals");
break; break;
} }
case EMFModuleMeshFace: case EMFModuleMeshFace:
@ -269,10 +269,10 @@ public class ResourceMeshEmf extends ResourceMesh {
currentFaceIndexing = this.listFaces.get(meshFaceMaterialID); currentFaceIndexing = this.listFaces.get(meshFaceMaterialID);
} }
} }
Log.verbose(" " + inputDataLine); LOGGER.trace(" " + inputDataLine);
} else if (currentMode == emfModuleMode.EMFModuleMeshFaceMaterial) { } else if (currentMode == emfModuleMode.EMFModuleMeshFaceMaterial) {
if (currentFaceIndexing == null) { if (currentFaceIndexing == null) {
Log.error("Get elements without material defined ..."); LOGGER.error("Get elements without material defined ...");
continue; continue;
} }
for (String elem : inputDataLine.split("\\|")) { for (String elem : inputDataLine.split("\\|")) {
@ -284,10 +284,10 @@ public class ResourceMeshEmf extends ResourceMesh {
} }
currentFaceIndexing.face().add(tmp); currentFaceIndexing.face().add(tmp);
} }
Log.verbose(" " + currentFaceIndexing.face().size() + " faces"); LOGGER.trace(" " + currentFaceIndexing.face().size() + " faces");
} else { } else {
// insert element without material ... // insert element without material ...
Log.error(" try to add face without material selection ..."); LOGGER.error(" try to add face without material selection ...");
} }
break; break;
case EMFModuleMeshPhysics: case EMFModuleMeshPhysics:
@ -296,19 +296,19 @@ public class ResourceMeshEmf extends ResourceMesh {
if (level == 2) { if (level == 2) {
physics = ege::physics::Shape::create(inputDataLine); physics = ege::physics::Shape::create(inputDataLine);
if (physics == null) { if (physics == null) {
Log.error("Allocation error when creating physical shape ..."); LOGGER.error("Allocation error when creating physical shape ...");
continue; continue;
} }
addPhysicElement(physics); addPhysicElement(physics);
Log.verbose(" " + this.physics.size() + " " + inputDataLine); LOGGER.trace(" " + this.physics.size() + " " + inputDataLine);
currentMode = emfModuleMode.EMFModuleMeshPhysicsNamed; currentMode = emfModuleMode.EMFModuleMeshPhysicsNamed;
} else if (currentMode == EMFModuleMeshPhysicsNamed) { } else if (currentMode == EMFModuleMeshPhysicsNamed) {
if (physics == null) { if (physics == null) {
Log.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ...");
continue; continue;
} }
if (physics.parse(&inputDataLine[0]) == false) { 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()) if ((currentMode.getValue() >= emfModuleMode.EMFModuleMaterial.getValue() && currentMode.getValue() <= emfModuleMode.EMFModuleMaterial_END.getValue())
|| (currentMode.getValue() >= emfModuleMode.EMFModulePalette.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePalette_END.getValue())) { || (currentMode.getValue() >= emfModuleMode.EMFModulePalette.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePalette_END.getValue())) {
if (material == null) { if (material == null) {
Log.error("material allocation error"); LOGGER.error("material allocation error");
continue; continue;
} }
if (inputDataLine.startsWith("Ns ") == true) { if (inputDataLine.startsWith("Ns ") == true) {
float tmpVal = Float.valueOf(inputDataLine.substring(3)); float tmpVal = Float.valueOf(inputDataLine.substring(3));
material.setShininess(tmpVal); material.setShininess(tmpVal);
Log.verbose(" Shininess " + tmpVal); LOGGER.trace(" Shininess " + tmpVal);
} else if (inputDataLine.startsWith("Ka ") == true) { } else if (inputDataLine.startsWith("Ka ") == true) {
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
tmp = tmp.withW(1); tmp = tmp.withW(1);
material.setAmbientFactor(tmp); material.setAmbientFactor(tmp);
Log.verbose(" AmbientFactor " + tmp); LOGGER.trace(" AmbientFactor " + tmp);
} else if (inputDataLine.startsWith("Kd ") == true) { } else if (inputDataLine.startsWith("Kd ") == true) {
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
tmp = tmp.withW(1); tmp = tmp.withW(1);
material.setDiffuseFactor(tmp); material.setDiffuseFactor(tmp);
Log.error(" DiffuseFactor " + tmp); LOGGER.error(" DiffuseFactor " + tmp);
} else if (inputDataLine.startsWith("Ks ") == true) { } else if (inputDataLine.startsWith("Ks ") == true) {
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3)); Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
tmp = tmp.withW(1); tmp = tmp.withW(1);
material.setSpecularFactor(tmp); material.setSpecularFactor(tmp);
Log.verbose(" SpecularFactor " + tmp); LOGGER.trace(" SpecularFactor " + tmp);
} else if (inputDataLine.startsWith("Ni ") == true) { } else if (inputDataLine.startsWith("Ni ") == true) {
float tmpVal = Float.valueOf(inputDataLine.substring(3)); float tmpVal = Float.valueOf(inputDataLine.substring(3));
// TODO : ... // TODO : ...
Log.verbose(" Ni " + tmpVal); LOGGER.trace(" Ni " + tmpVal);
} else if (inputDataLine.startsWith("d ") == true) { } else if (inputDataLine.startsWith("d ") == true) {
float tmpVal = Float.valueOf(inputDataLine.substring(2)); float tmpVal = Float.valueOf(inputDataLine.substring(2));
// TODO : ... // TODO : ...
Log.verbose(" d " + tmpVal); LOGGER.trace(" d " + tmpVal);
} else if (inputDataLine.startsWith("illum ") == true) { } else if (inputDataLine.startsWith("illum ") == true) {
float tmpVal = Float.valueOf(inputDataLine.substring(6)); float tmpVal = Float.valueOf(inputDataLine.substring(6));
// TODO : ... // TODO : ...
Log.verbose(" illum " + tmpVal); LOGGER.trace(" illum " + tmpVal);
} else if (inputDataLine.startsWith("map_Kd ") == true) { } else if (inputDataLine.startsWith("map_Kd ") == true) {
Uri tmpTexture = fileName.getParent(); Uri tmpTexture = fileName.getParent();
tmpTexture = tmpTexture.pathAdd(inputDataLine.substring(7)); tmpTexture = tmpTexture.pathAdd(inputDataLine.substring(7));
material.setTexture0(tmpTexture); material.setTexture0(tmpTexture);
Log.verbose(" Texture " + tmpTexture); LOGGER.trace(" Texture " + tmpTexture);
} else if (inputDataLine.startsWith("renderMode ") == true) { } else if (inputDataLine.startsWith("renderMode ") == true) {
//RenderMode mode; //RenderMode mode;
//frothis.string(mode, &inputDataLine[11]); //frothis.string(mode, &inputDataLine[11]);
//material.setRenderMode(mode); //material.setRenderMode(mode);
Log.verbose(" Texture " + this.mode); LOGGER.trace(" Texture " + this.mode);
} else { } else {
Log.error("unknow material property ... : '" + inputDataLine + "'"); LOGGER.error("unknow material property ... : '" + inputDataLine + "'");
} }
continue; continue;
} }
if (currentMode.getValue() >= emfModuleMode.EMFModulePhysics.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePhysics_END.getValue()) { if (currentMode.getValue() >= emfModuleMode.EMFModulePhysics.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePhysics_END.getValue()) {
if (level == 1) { if (level == 1) {
Log.error("Load shape : " + inputDataLine); LOGGER.error("Load shape : " + inputDataLine);
// physics = ege::physics::Shape::create(inputDataLine); // physics = ege::physics::Shape::create(inputDataLine);
// if (physics == null) { // if (physics == null) {
// Log.error("Allocation error when creating physical shape ..."); // LOGGER.error("Allocation error when creating physical shape ...");
// continue; // continue;
// } // }
// addPhysicElement(physics); // addPhysicElement(physics);
// Log.verbose(" " + this.physics.size() + " " + inputDataLine); // LOGGER.trace(" " + this.physics.size() + " " + inputDataLine);
// currentMode = emfModuleMode.EMFModulePhysicsNamed; // currentMode = emfModuleMode.EMFModulePhysicsNamed;
} else if (currentMode == emfModuleMode.EMFModulePhysicsNamed) { } else if (currentMode == emfModuleMode.EMFModulePhysicsNamed) {
// if (physics == null) { // if (physics == null) {
// Log.error("Can not parse :'" + inputDataLine + "' in physical shape ..."); // LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ...");
// continue; // continue;
// } // }
// if (physics.parse(&inputDataLine[0]) == false) { // 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; continue;
} }
// unknown ... // 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 ... // add last material ...
if (materialName != "" && material != null) { if (materialName != "" && material != null) {
@ -405,7 +405,7 @@ public class ResourceMeshEmf extends ResourceMesh {
materialName = ""; materialName = "";
material = null; material = null;
} }
Log.verbose("Stop parsing Mesh file"); LOGGER.trace("Stop parsing Mesh file");
try { try {
fileIO.close(); fileIO.close();
@ -415,17 +415,17 @@ public class ResourceMeshEmf extends ResourceMesh {
e.printStackTrace(); e.printStackTrace();
} }
Log.verbose("New mesh : "); LOGGER.trace("New mesh : ");
Log.verbose(" nb vertex: " + this.listVertex.size()); LOGGER.trace(" nb vertex: " + this.listVertex.size());
Log.verbose(" nb UV: " + this.listUV.size()); LOGGER.trace(" nb UV: " + this.listUV.size());
Log.verbose(" nb Colors: " + this.listColor.size()); LOGGER.trace(" nb Colors: " + this.listColor.size());
Log.verbose(" nb Normal face: " + this.listFacesNormal.size()); LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size());
Log.verbose(" nb Normal vertex: " + this.listVertexNormal.size()); LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size());
Log.verbose(" nb Faces: " + this.listFaces.size()); LOGGER.trace(" nb Faces: " + this.listFaces.size());
Log.verbose(" nb Faces (palette): " + this.listPaletteFaces.size()); LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.size());
Log.verbose(" nb material: " + this.materials.size()); LOGGER.trace(" nb material: " + this.materials.size());
Log.verbose(" nb palettes: " + this.palettes.size()); LOGGER.trace(" nb palettes: " + this.palettes.size());
//Log.verbose(" nb physic: " + this.physics.size()); //LOGGER.trace(" nb physic: " + this.physics.size());
if (this.listVertex.size() == 0) { if (this.listVertex.size() == 0) {
throw new Exception("unable to load the mesh file: " + fileName + " ==> no vertex available."); throw new Exception("unable to load the mesh file: " + fileName + " ==> no vertex available.");
} }
@ -469,7 +469,7 @@ public class ResourceMeshEmf extends ResourceMesh {
// || ( current == ':' // || ( current == ':'
// && _stopColomn == true) ) // && _stopColomn == true) )
// { // {
// //Log.debug(" plop : '" + _elementLine + "'" ); // //LOGGER.debug(" plop : '" + _elementLine + "'" );
// return buf.toString(); // return buf.toString();
// } else if( buf.length() == 0 // } else if( buf.length() == 0
// && current != '\t') { // && current != '\t') {
@ -564,7 +564,7 @@ public class ResourceMeshEmf extends ResourceMesh {
e.printStackTrace(); 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) { if (buf.length() == 0) {
return null; return null;
} }

View File

@ -147,21 +147,21 @@ public class ResourceMeshHeightMap extends ResourceMesh {
} }
} }
} }
//Log.warning("this.listVertex: " + this.listVertex.size()); //LOGGER.warn("this.listVertex: " + this.listVertex.size());
//Log.warning("this.listFacesNormal: " + this.listFacesNormal.size()); //LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size());
calculateNormaleFaces(materialsNames); calculateNormaleFaces(materialsNames);
//Log.warning("this.listVertex: " + this.listVertex.size()); //LOGGER.warn("this.listVertex: " + this.listVertex.size());
//Log.warning("this.listFacesNormal: " + this.listFacesNormal.size()); //LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size());
// Log.verbose("New heightmap mesh : "); // LOGGER.trace("New heightmap mesh : ");
// Log.verbose(" nb vertex: " + this.listVertex.size()); // LOGGER.trace(" nb vertex: " + this.listVertex.size());
// Log.verbose(" nb UV: " + this.listUV.size()); // LOGGER.trace(" nb UV: " + this.listUV.size());
// Log.verbose(" nb Colors: " + this.listColor.size()); // LOGGER.trace(" nb Colors: " + this.listColor.size());
// Log.verbose(" nb Normal face: " + this.listFacesNormal.size()); // LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size());
// Log.verbose(" nb Normal vertex: " + this.listVertexNormal.size()); // LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size());
// Log.verbose(" nb Faces: " + this.listFaces.size()); // LOGGER.trace(" nb Faces: " + this.listFaces.size());
// Log.verbose(" nb Faces (palette): " + this.listPaletteFaces.get(0).face().size()); // LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.get(0).face().size());
// Log.verbose(" nb material: " + this.materials.size()); // LOGGER.trace(" nb material: " + this.materials.size());
// Log.verbose(" nb palettes: " + this.palettes.size()); // LOGGER.trace(" nb palettes: " + this.palettes.size());
generateVBO(); generateVBO();
} }

View File

@ -61,17 +61,17 @@ public class ResourcePaletteFile extends Resource {
private Runnable updatePostAction = null; private Runnable updatePostAction = null;
public static ResourcePaletteFile create(final Uri uri) { public static ResourcePaletteFile create(final Uri uri) {
Log.verbose("KEEP: ColorFile: " + uri); LOGGER.trace("KEEP: ColorFile: " + uri);
ResourcePaletteFile object = null; ResourcePaletteFile object = null;
final Resource object2 = Resource.getManager().localKeep(uri); final Resource object2 = Resource.getManager().localKeep(uri);
if (object2 != null) { if (object2 != null) {
if (object2 instanceof ResourcePaletteFile) { if (object2 instanceof ResourcePaletteFile) {
return (ResourcePaletteFile) object2; 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; return null;
} }
Log.debug("CREATE: FontFreeType: " + uri); LOGGER.debug("CREATE: FontFreeType: " + uri);
// need to crate a new one ... // need to crate a new one ...
return new ResourcePaletteFile(uri); return new ResourcePaletteFile(uri);
} }
@ -89,9 +89,9 @@ public class ResourcePaletteFile extends Resource {
*/ */
public ResourcePaletteFile(final Uri uri) { public ResourcePaletteFile(final Uri uri) {
super(uri); super(uri);
Log.debug("CF : load '" + uri + "'"); LOGGER.debug("CF : load '" + uri + "'");
reload(); reload();
// Log.debug("List of all color : " + this.list.keySet()); // LOGGER.debug("List of all color : " + this.list.keySet());
} }
@Override @Override
@ -118,33 +118,33 @@ public class ResourcePaletteFile extends Resource {
if (node != null) { if (node != null) {
if (node.exist(ResourcePaletteFile.DEFINE_SHINESS)) { if (node.exist(ResourcePaletteFile.DEFINE_SHINESS)) {
final double data = node.get(ResourcePaletteFile.DEFINE_SHINESS).toJsonNumber().getValue(); final double data = node.get(ResourcePaletteFile.DEFINE_SHINESS).toJsonNumber().getValue();
Log.verbose(" Shininess " + data); LOGGER.trace(" Shininess " + data);
element.setShininess((float)data); element.setShininess((float)data);
} }
if (node.exist(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR)) { if (node.exist(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR).toJsonString().getValue(); final String data = node.get(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data); Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1); tmp = tmp.withW(1);
Log.verbose(" AmbientFactor " + tmp); LOGGER.trace(" AmbientFactor " + tmp);
element.setAmbientFactor(tmp); element.setAmbientFactor(tmp);
} }
if (node.exist(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR)) { if (node.exist(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR).toJsonString().getValue(); final String data = node.get(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data); Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1); tmp = tmp.withW(1);
Log.verbose(" DiffuseFactor " + tmp); LOGGER.trace(" DiffuseFactor " + tmp);
element.setDiffuseFactor(tmp); element.setDiffuseFactor(tmp);
} }
if (node.exist(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR)) { if (node.exist(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR).toJsonString().getValue(); final String data = node.get(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data); Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1); tmp = tmp.withW(1);
Log.verbose(" SpecularFactor " + tmp); LOGGER.trace(" SpecularFactor " + tmp);
element.setSpecularFactor(tmp); element.setSpecularFactor(tmp);
} }
} }
} catch (final Exception e) { } 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(); e.printStackTrace();
} }
return element; return element;
@ -162,7 +162,7 @@ public class ResourcePaletteFile extends Resource {
final JsonObject baseObject = out.get(ResourcePaletteFile.DEFINE_PALETTE).toJsonObject(); final JsonObject baseObject = out.get(ResourcePaletteFile.DEFINE_PALETTE).toJsonObject();
if (baseObject == null) { 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); Ejson.display(out);
return; return;
} }
@ -184,13 +184,13 @@ public class ResourcePaletteFile extends Resource {
} }
} }
} catch (final Exception e) { } 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(); e.printStackTrace();
} }
if (this.updatePostAction != null) { if (this.updatePostAction != null) {
Log.warning("Detect auto_update on onthe element ..."); LOGGER.warn("Detect auto_update on onthe element ...");
this.updatePostAction.run(); 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 mat = it.getValue();
MaterialBase matOver = this.listOver.get(it.getKey()); MaterialBase matOver = this.listOver.get(it.getKey());
MaterialBase matSelect = this.listSelect.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... // 2 element this will permit to change color in the future on depend on some parameters...
putColor(id, 0, out, mat); putColor(id, 0, out, mat);
putColor(id, 1, out, matOver); putColor(id, 1, out, matOver);

View File

@ -13,7 +13,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
Resource resource2; Resource resource2;
final String name = uriObj.getValue(); final String name = uriObj.getValue();
if (name.isEmpty() || name.equals("---")) { 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; return null;
} }
resource2 = Resource.getManager().localKeep(name); resource2 = Resource.getManager().localKeep(name);
@ -22,7 +22,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
resource2.keep(); resource2.keep();
return (ResourceStaticMeshObj) resource2; 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; return null;
} }
resource = new ResourceStaticMeshObj(uriObj); resource = new ResourceStaticMeshObj(uriObj);

View File

@ -12,7 +12,7 @@ public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj {
Resource resource2; Resource resource2;
final String name = uriObj.getValue(); final String name = uriObj.getValue();
if (name.isEmpty() || name.equals("---")) { 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; return null;
} }
resource2 = Resource.getManager().localKeep(name); resource2 = Resource.getManager().localKeep(name);
@ -21,7 +21,7 @@ public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj {
resource2.keep(); resource2.keep();
return tmpp; 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; return null;
} }
resource = new ResourceStaticMeshObjDynamic(uriObj); resource = new ResourceStaticMeshObjDynamic(uriObj);

View File

@ -26,7 +26,7 @@ public class TestBasicLog {
Gale.init(); Gale.init();
GaleContextTest tmpContext = new GaleContextTest(); GaleContextTest tmpContext = new GaleContextTest();
Uri.setGroup("EMF", "emf"); Uri.setGroup("EMF", "emf");
Uri.setApplication(TestBasicLog.class, ""); Uri.setApplication(TestBasicLOGGER.class, "");
Uri.addLibrary("test", ResourceMeshHeightMap.class, "/resources"); Uri.addLibrary("test", ResourceMeshHeightMap.class, "/resources");
//ResourceMeshEmf tmp = new ResourceMeshEmf(new Uri("EMF", "tree1.emf", "test")); //ResourceMeshEmf tmp = new ResourceMeshEmf(new Uri("EMF", "tree1.emf", "test"));