[FEAT] continue maven integration
This commit is contained in:
parent
49367d8969
commit
dfec0bc838
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||
<fileset name="all" enabled="true" check-config-name="Ewol" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
27
.classpath
27
.classpath
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="out/maven/classes" path="src">
|
||||
<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"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="out/maven/classes"/>
|
||||
</classpath>
|
23
.project
23
.project
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>loader3d</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
3
out/.gitignore
vendored
3
out/.gitignore
vendored
@ -1,3 +0,0 @@
|
||||
|
||||
/__pycache__/
|
||||
/eclipse/
|
21
pom.xml
21
pom.xml
@ -38,24 +38,38 @@
|
||||
<artifactId>ejson</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.atriasoft</groupId>
|
||||
<artifactId>egami</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.9.3</version>
|
||||
<version>5.11.0-M2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>2.0.7</version>
|
||||
<version>2.1.0-alpha1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
|
||||
</resource>
|
||||
</resources>
|
||||
<testSourceDirectory>test/src</testSourceDirectory>
|
||||
<directory>${project.basedir}/out/maven/</directory>
|
||||
<testResources>
|
||||
<testResource>
|
||||
|
||||
</testResource>
|
||||
</testResources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -71,6 +85,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
|
@ -1,12 +1,12 @@
|
||||
|
||||
module org.atriasoft.loader3d {
|
||||
open module org.atriasoft.loader3d {
|
||||
|
||||
exports org.atriasoft.loader3d;
|
||||
exports org.atriasoft.loader3d.model;
|
||||
exports org.atriasoft.loader3d.resources;
|
||||
|
||||
requires transitive org.atriasoft.etk;
|
||||
requires transitive org.atriasoft.gale;
|
||||
requires org.atriasoft.egami;
|
||||
requires transitive org.atriasoft.gale;
|
||||
requires org.atriasoft.ejson;
|
||||
}
|
@ -11,12 +11,20 @@ import java.util.List;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.atriasoft.loader3d.model.ModelData;
|
||||
import org.atriasoft.loader3d.model.Vertex;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class OBJFileLoader {
|
||||
private static float convertDataToArrays(final List<Vertex> vertices, final List<Vector2f> textures, final List<Vector3f> normals, final float[] verticesArray, final float[] texturesArray,
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OBJFileLoader.class);
|
||||
|
||||
private static float convertDataToArrays(
|
||||
final List<Vertex> vertices,
|
||||
final List<Vector2f> textures,
|
||||
final List<Vector3f> normals,
|
||||
final float[] verticesArray,
|
||||
final float[] texturesArray,
|
||||
final float[] normalsArray) {
|
||||
float furthestPoint = 0;
|
||||
for (int i = 0; i < vertices.size(); i++) {
|
||||
@ -47,13 +55,19 @@ public class OBJFileLoader {
|
||||
return indicesArray;
|
||||
}
|
||||
|
||||
private static void dealWithAlreadyProcessedVertex(final Vertex previousVertex, final int newTextureIndex, final int newNormalIndex, final List<Integer> indices, final List<Vertex> vertices) {
|
||||
private static void dealWithAlreadyProcessedVertex(
|
||||
final Vertex previousVertex,
|
||||
final int newTextureIndex,
|
||||
final int newNormalIndex,
|
||||
final List<Integer> indices,
|
||||
final List<Vertex> vertices) {
|
||||
if (previousVertex.hasSameTextureAndNormal(newTextureIndex, newNormalIndex)) {
|
||||
indices.add(previousVertex.getIndex());
|
||||
} else {
|
||||
final Vertex anotherVertex = previousVertex.getDuplicateVertex();
|
||||
if (anotherVertex != null) {
|
||||
OBJFileLoader.dealWithAlreadyProcessedVertex(anotherVertex, newTextureIndex, newNormalIndex, indices, vertices);
|
||||
OBJFileLoader.dealWithAlreadyProcessedVertex(anotherVertex, newTextureIndex, newNormalIndex, indices,
|
||||
vertices);
|
||||
} else {
|
||||
final Vertex duplicateVertex = new Vertex(vertices.size(), previousVertex.getPosition());
|
||||
duplicateVertex.setTextureIndex(newTextureIndex);
|
||||
@ -100,17 +114,20 @@ public class OBJFileLoader {
|
||||
line = reader.readLine();
|
||||
if (line.startsWith("v ")) {
|
||||
final String[] currentLine = line.split(" ");
|
||||
final Vector3f vertex = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
|
||||
final Vector3f vertex = new Vector3f(Float.parseFloat(currentLine[1]),
|
||||
Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
|
||||
final Vertex newVertex = new Vertex(vertices.size(), vertex);
|
||||
vertices.add(newVertex);
|
||||
|
||||
} else if (line.startsWith("vt ")) {
|
||||
final String[] currentLine = line.split(" ");
|
||||
final Vector2f texture = new Vector2f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]));
|
||||
final Vector2f texture = new Vector2f(Float.parseFloat(currentLine[1]),
|
||||
Float.parseFloat(currentLine[2]));
|
||||
textures.add(texture);
|
||||
} else if (line.startsWith("vn ")) {
|
||||
final String[] currentLine = line.split(" ");
|
||||
final Vector3f normal = new Vector3f(Float.parseFloat(currentLine[1]), Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
|
||||
final Vector3f normal = new Vector3f(Float.parseFloat(currentLine[1]),
|
||||
Float.parseFloat(currentLine[2]), Float.parseFloat(currentLine[3]));
|
||||
normals.add(normal);
|
||||
} else if (line.startsWith("f ")) {
|
||||
break;
|
||||
@ -134,7 +151,8 @@ public class OBJFileLoader {
|
||||
final float[] verticesArray = new float[vertices.size() * 3];
|
||||
final float[] texturesArray = new float[vertices.size() * 2];
|
||||
final float[] normalsArray = new float[vertices.size() * 3];
|
||||
final float furthest = OBJFileLoader.convertDataToArrays(vertices, textures, normals, verticesArray, texturesArray, normalsArray);
|
||||
final float furthest = OBJFileLoader.convertDataToArrays(vertices, textures, normals, verticesArray,
|
||||
texturesArray, normalsArray);
|
||||
final int[] indicesArray = OBJFileLoader.convertIndicesListToArray(indices);
|
||||
final ModelData data = new ModelData(verticesArray, texturesArray, normalsArray, indicesArray, furthest);
|
||||
return data;
|
||||
|
@ -1,76 +0,0 @@
|
||||
package org.atriasoft.loader3d.internal;
|
||||
|
||||
import org.atriasoft.reggol.LogLevel;
|
||||
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(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();
|
||||
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data + " : " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void critical(final String data, final Object... objects) {
|
||||
if (PRINT_CRITICAL || FORCE_ALL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(final String data, final Object... objects) {
|
||||
if (PRINT_DEBUG || FORCE_ALL) {
|
||||
Logger.debug(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(final String data, final Object... objects) {
|
||||
if (PRINT_ERROR || FORCE_ALL) {
|
||||
Logger.error(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void info(final String data, final Object... objects) {
|
||||
if (PRINT_INFO || FORCE_ALL) {
|
||||
Logger.info(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(final String data, final Object... objects) {
|
||||
if (PRINT_PRINT || FORCE_ALL) {
|
||||
Logger.print(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void todo(final String data, final Object... objects) {
|
||||
if (PRINT_TODO || FORCE_ALL) {
|
||||
Logger.todo(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void verbose(final String data, final Object... objects) {
|
||||
if (PRINT_VERBOSE || FORCE_ALL) {
|
||||
Logger.verbose(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warning(final String data, final Object... objects) {
|
||||
if (PRINT_WARNING || FORCE_ALL) {
|
||||
Logger.warning(LIB_NAME_DRAW, data, objects);
|
||||
}
|
||||
}
|
||||
|
||||
private Log() {}
|
||||
|
||||
}
|
@ -6,23 +6,25 @@ import org.atriasoft.egami.Image;
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector4f;
|
||||
import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
|
||||
import org.atriasoft.gale.resource.ResourceProgram;
|
||||
import org.atriasoft.gale.resource.ResourceTexture2;
|
||||
import org.atriasoft.gale.resource.ResourceTextureFile;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Material extends MaterialBase{
|
||||
public class Material extends MaterialBase {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Material.class);
|
||||
|
||||
// values
|
||||
private RenderMode renderMode = RenderMode.TRIANGLE; //!< Select Render mode (triangle/Line/point ...)
|
||||
private ResourceTexture2 texture0 = null;
|
||||
public List<Integer> listIndexFaces;
|
||||
|
||||
public Material() {
|
||||
super();
|
||||
}
|
||||
public void draw(ResourceProgram _prog, MaterialGlId _glID){
|
||||
|
||||
public void draw(final ResourceProgram _prog, final MaterialGlId _glID) {
|
||||
LOGGER.trace("draw Material : (start)");
|
||||
_prog.uniformVector(_glID.oglAmbientFactor(), this.ambientFactor);
|
||||
_prog.uniformVector(_glID.oglDiffuseFactor(), this.diffuseFactor);
|
||||
@ -32,19 +34,18 @@ public class Material extends MaterialBase{
|
||||
LOGGER.trace(" set texture: " + _glID.oglTexture0() + " " + this.texture0.getId());
|
||||
_prog.setTexture0(_glID.oglTexture0(), this.texture0.getRendererId());
|
||||
if (false) {
|
||||
if (_prog.checkIdValidity(_glID.oglTexture0()) == false) {
|
||||
if (!_prog.checkIdValidity(_glID.oglTexture0())) {
|
||||
LOGGER.error("try to set texture on a unexistant shader interface (wrong ID)");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (false) {
|
||||
if (_prog.checkIdValidity(_glID.oglTexture0()) == true) {
|
||||
LOGGER.error("Missing texture to send on the shader ...");
|
||||
}
|
||||
} else if (false) {
|
||||
if (_prog.checkIdValidity(_glID.oglTexture0())) {
|
||||
LOGGER.error("Missing texture to send on the shader ...");
|
||||
}
|
||||
}
|
||||
LOGGER.trace("draw Material: ( end )");
|
||||
}
|
||||
|
||||
public void setRenderMode(RenderMode _val) {
|
||||
switch (_val) {
|
||||
case POINT:
|
||||
@ -84,17 +85,20 @@ public class Material extends MaterialBase{
|
||||
}
|
||||
this.renderMode = _val;
|
||||
}
|
||||
|
||||
public RenderMode getRenderModeOpenGl() {
|
||||
return this.renderMode;
|
||||
}
|
||||
|
||||
public RenderMode getRenderMode() {
|
||||
return this.renderMode;
|
||||
}
|
||||
public void setTexture0( Uri _uri) {
|
||||
Vector2i tmpSize = new Vector2i(256, 256);
|
||||
if (_uri.isEmpty() == false) {
|
||||
|
||||
public void setTexture0(final Uri _uri) {
|
||||
final Vector2i tmpSize = new Vector2i(256, 256);
|
||||
if (!_uri.isEmpty()) {
|
||||
// prevent overloard error :
|
||||
ResourceTexture2 tmpCopy = this.texture0;
|
||||
final ResourceTexture2 tmpCopy = this.texture0;
|
||||
this.texture0 = ResourceTextureFile.create(_uri, tmpSize);
|
||||
if (this.texture0 == null) {
|
||||
LOGGER.error("Can not load specific texture : " + _uri);
|
||||
@ -105,40 +109,46 @@ public class Material extends MaterialBase{
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.texture0 = null;;
|
||||
this.texture0 = null;
|
||||
;
|
||||
}
|
||||
}
|
||||
public void setTexture0Magic( Vector2i _size) {
|
||||
|
||||
public void setTexture0Magic(final Vector2i _size) {
|
||||
// create a simple custum texture :
|
||||
this.texture0 = new ResourceTexture2();
|
||||
setImageSize(_size);
|
||||
Image img = this.texture0.get();
|
||||
for (int xxx=0; xxx<_size.x(); ++xxx) {
|
||||
for (int yyy=0; yyy<_size.y(); ++yyy) {
|
||||
img.setColor(xxx,yyy, Color.RED);
|
||||
final Image img = this.texture0.get();
|
||||
for (int xxx = 0; xxx < _size.x(); ++xxx) {
|
||||
for (int yyy = 0; yyy < _size.y(); ++yyy) {
|
||||
img.setColor(xxx, yyy, Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setImageSize( Vector2i _newSize){
|
||||
if (this.texture0 == null){
|
||||
|
||||
public void setImageSize(final Vector2i _newSize) {
|
||||
if (this.texture0 == null) {
|
||||
return;
|
||||
}
|
||||
this.texture0.setImageSize(_newSize);
|
||||
}
|
||||
// get the reference on this image to draw nomething on it ...
|
||||
public Image get(){
|
||||
if (this.texture0 == null){
|
||||
|
||||
// get the reference on this image to draw nomething on it ...
|
||||
public Image get() {
|
||||
if (this.texture0 == null) {
|
||||
return null;
|
||||
}
|
||||
return this.texture0.get();
|
||||
}
|
||||
// flush the data to send it at the openGl system
|
||||
|
||||
// flush the data to send it at the openGl system
|
||||
public void flush() {
|
||||
if (this.texture0 == null){
|
||||
if (this.texture0 == null) {
|
||||
return;
|
||||
}
|
||||
this.texture0.flush();
|
||||
}
|
||||
|
||||
public boolean haveTexture() {
|
||||
return this.texture0 != null;
|
||||
}
|
||||
|
@ -18,26 +18,30 @@ import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
|
||||
import org.atriasoft.loader3d.Face;
|
||||
import org.atriasoft.loader3d.FaceIndexing;
|
||||
import org.atriasoft.loader3d.NormalMode;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.atriasoft.loader3d.model.Material;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceMesh extends ResourceStaticMesh {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceMesh.class);
|
||||
|
||||
public static ResourceMesh create(final Uri uri) {
|
||||
LOGGER.trace("KEEP: Resource Mesh: " + uri);
|
||||
ResourceMesh object = null;
|
||||
final ResourceMesh object = null;
|
||||
final Resource object2 = Resource.getManager().localKeep(uri);
|
||||
if (object2 != null) {
|
||||
if (object2 instanceof ResourceMesh tmpp) {
|
||||
if (object2 instanceof final ResourceMesh tmpp) {
|
||||
return tmpp;
|
||||
}
|
||||
LOGGER.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
|
||||
LOGGER.error("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
|
||||
System.exit(-1);
|
||||
return null;
|
||||
}
|
||||
LOGGER.debug("CREATE: new Mesh: " + uri);
|
||||
if (uri.getExtention().equals("emf")) {
|
||||
try {
|
||||
return new ResourceMeshEmf(uri);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
LOGGER.warn("Can not load file: " + e.toString());
|
||||
return null;
|
||||
}
|
||||
@ -113,8 +117,8 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _layerName face index to add
|
||||
*/
|
||||
public void addFaceIndexing(final String _layerName) {
|
||||
if (this.listFaces.containsKey(_layerName) == false) {
|
||||
FaceIndexing empty = new FaceIndexing();
|
||||
if (!this.listFaces.containsKey(_layerName)) {
|
||||
final FaceIndexing empty = new FaceIndexing();
|
||||
this.listFaces.put(_layerName, empty);
|
||||
}
|
||||
}
|
||||
@ -123,23 +127,31 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
addLine(_layerName, _pos1, _pos2, _color, _color);
|
||||
}
|
||||
|
||||
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) {
|
||||
LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ...");
|
||||
public void addLine(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Color _color1,
|
||||
final Color _color2) {
|
||||
if (!this.listFaces.containsKey(_layerName) || !this.materials.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) {
|
||||
final RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
|
||||
if (tmpRenderMode != RenderMode.LINE && tmpRenderMode != RenderMode.LINE_STRIP
|
||||
&& tmpRenderMode != RenderMode.LINE_LOOP) {
|
||||
LOGGER.error("try to add Line in a mesh material section that not support Line");
|
||||
return;
|
||||
}
|
||||
// try to find position:
|
||||
int pos1 = findPositionInList(_pos1);
|
||||
int pos2 = findPositionInList(_pos2);
|
||||
final int pos1 = findPositionInList(_pos1);
|
||||
final int pos2 = findPositionInList(_pos2);
|
||||
// try to find UV mapping:
|
||||
int color1 = findColorInList(_color1);
|
||||
int color2 = findColorInList(_color2);
|
||||
Face tmpFace = new Face();
|
||||
final int color1 = findColorInList(_color1);
|
||||
final int color2 = findColorInList(_color2);
|
||||
final Face tmpFace = new Face();
|
||||
tmpFace.setVertex(pos1, pos2);
|
||||
tmpFace.setColor(color1, color2, color2);
|
||||
this.listFaces.get(_layerName).face().add(tmpFace);
|
||||
@ -176,20 +188,22 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
}
|
||||
|
||||
public void addPoint(final String _layerName, final Vector3f _pos, final Color _color) {
|
||||
if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) {
|
||||
LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ...");
|
||||
if (!this.listFaces.containsKey(_layerName) || !this.materials.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();
|
||||
final RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
|
||||
if (tmpRenderMode != RenderMode.POINT) {
|
||||
LOGGER.error("try to add Point in a mesh material section that not support Point");
|
||||
return;
|
||||
}
|
||||
// try to find position:
|
||||
int pos = findPositionInList(_pos);
|
||||
final int pos = findPositionInList(_pos);
|
||||
// try to find UV mapping:
|
||||
int color = findColorInList(_color);
|
||||
Face tmpFace = new Face();
|
||||
final int color = findColorInList(_color);
|
||||
final Face tmpFace = new Face();
|
||||
tmpFace.setVertex(pos);
|
||||
tmpFace.setColor(color, color, color);
|
||||
this.listFaces.get(_layerName).face().add(tmpFace);
|
||||
@ -205,7 +219,13 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _pos4 faurth point position
|
||||
* @param _color color of all elements
|
||||
*/
|
||||
public void addQuad(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector3f _pos4, final Color _color) {
|
||||
public void addQuad(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Vector3f _pos4,
|
||||
final Color _color) {
|
||||
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _color, _color, _color, _color);
|
||||
}
|
||||
|
||||
@ -353,16 +373,33 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _color3 color of the _pos3 element
|
||||
* @param _color4 color of the _pos4 element
|
||||
*/
|
||||
public void addQuad(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector3f _pos4, final Color _color1, final Color _color2, final Color _color3,
|
||||
public void addQuad(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Vector3f _pos4,
|
||||
final Color _color1,
|
||||
final Color _color2,
|
||||
final Color _color3,
|
||||
final Color _color4) {
|
||||
addTriangle(_layerName, _pos1, _pos2, _pos3, _color1, _color2, _color3);
|
||||
addTriangle(_layerName, _pos1, _pos3, _pos4, _color1, _color3, _color4);
|
||||
}
|
||||
|
||||
public void addQuad(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector3f _pos4, final Vector2f _uv1, final Vector2f _uv2, final Vector2f _uv3,
|
||||
public void addQuad(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Vector3f _pos4,
|
||||
final Vector2f _uv1,
|
||||
final Vector2f _uv2,
|
||||
final Vector2f _uv3,
|
||||
final Vector2f _uv4) {
|
||||
|
||||
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _uv1, _uv2, _uv3, _uv4, Color.WHITE, Color.WHITE, Color.WHITE, Color.WHITE);
|
||||
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _uv1, _uv2, _uv3, _uv4, Color.WHITE, Color.WHITE, Color.WHITE,
|
||||
Color.WHITE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -379,8 +416,17 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _uv3 texture position of the _pos3 element
|
||||
* @param _uv4 texture position of the _pos4 element
|
||||
*/
|
||||
public void addQuad(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector3f _pos4, final Vector2f _uv1, final Vector2f _uv2, final Vector2f _uv3,
|
||||
final Vector2f _uv4, final Color _color) {
|
||||
public void addQuad(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Vector3f _pos4,
|
||||
final Vector2f _uv1,
|
||||
final Vector2f _uv2,
|
||||
final Vector2f _uv3,
|
||||
final Vector2f _uv4,
|
||||
final Color _color) {
|
||||
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _uv1, _uv2, _uv3, _uv4, _color, _color, _color, _color);
|
||||
}
|
||||
|
||||
@ -401,8 +447,20 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _color3 color of the _pos3 element
|
||||
* @param _color4 color of the _pos4 element
|
||||
*/
|
||||
public void addQuad(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Vector3f _pos4, final Vector2f _uv1, final Vector2f _uv2, final Vector2f _uv3,
|
||||
final Vector2f _uv4, final Color _color1, final Color _color2, final Color _color3, final Color _color4) {
|
||||
public void addQuad(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Vector3f _pos4,
|
||||
final Vector2f _uv1,
|
||||
final Vector2f _uv2,
|
||||
final Vector2f _uv3,
|
||||
final Vector2f _uv4,
|
||||
final Color _color1,
|
||||
final Color _color2,
|
||||
final Color _color3,
|
||||
final Color _color4) {
|
||||
addTriangle(_layerName, _pos1, _pos2, _pos3, _uv1, _uv2, _uv3, _color1, _color2, _color3);
|
||||
addTriangle(_layerName, _pos1, _pos3, _pos4, _uv1, _uv3, _uv4, _color1, _color3, _color4);
|
||||
}
|
||||
@ -418,7 +476,12 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _color2 color of the _pos2 element
|
||||
* @param _color3 color of the _pos3 element
|
||||
*/
|
||||
public void addTriangle(final String _layerName, final Vector3f _pos1, final Vector3f _pos2, final Vector3f _pos3, final Color _color) {
|
||||
public void addTriangle(
|
||||
final String _layerName,
|
||||
final Vector3f _pos1,
|
||||
final Vector3f _pos2,
|
||||
final Vector3f _pos3,
|
||||
final Color _color) {
|
||||
addTriangle(_layerName, _pos1, _pos2, _pos3, _color, _color, _color);
|
||||
}
|
||||
|
||||
@ -433,25 +496,35 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _color2 color of the _pos2 element
|
||||
* @param _color3 color of the _pos3 element
|
||||
*/
|
||||
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) {
|
||||
LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ...");
|
||||
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) || !this.materials.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();
|
||||
final RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
|
||||
if (tmpRenderMode == RenderMode.QUAD || tmpRenderMode == RenderMode.QUAD_STRIP) {
|
||||
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:
|
||||
int pos1 = findPositionInList(_pos1);
|
||||
int pos2 = findPositionInList(_pos2);
|
||||
int pos3 = findPositionInList(_pos3);
|
||||
final int pos1 = findPositionInList(_pos1);
|
||||
final int pos2 = findPositionInList(_pos2);
|
||||
final int pos3 = findPositionInList(_pos3);
|
||||
// try to find Color:
|
||||
int color1 = findColorInList(_color1);
|
||||
int color2 = findColorInList(_color2);
|
||||
int color3 = findColorInList(_color3);
|
||||
Face tmpFace = new Face(pos1, -1, pos2, -1, pos3, -1);
|
||||
final int color1 = findColorInList(_color1);
|
||||
final int color2 = findColorInList(_color2);
|
||||
final int color3 = findColorInList(_color3);
|
||||
final Face tmpFace = new Face(pos1, -1, pos2, -1, pos3, -1);
|
||||
tmpFace.setColor(color1, color2, color3);
|
||||
this.listFaces.get(_layerName).face().add(tmpFace);
|
||||
} else {
|
||||
@ -459,7 +532,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) {
|
||||
addTriangle(_layerName, _pos1, _pos2, _pos3, _uv1, _uv2, _uv3, Color.WHITE, Color.WHITE, Color.WHITE);
|
||||
}
|
||||
|
||||
@ -492,6 +572,7 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
// tmpElement.addTriangle(index);
|
||||
// }
|
||||
// //LOGGER.critical("kjlkj");
|
||||
// // System.exit(-1);
|
||||
// // Can have only one concave element in a mesh ...
|
||||
// //return this.physics;
|
||||
// }
|
||||
@ -511,7 +592,14 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _uv2 texture position of the _pos2 element
|
||||
* @param _uv3 texture position of the _pos3 element
|
||||
*/
|
||||
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 _color) {
|
||||
addTriangle(_layerName, _pos1, _pos2, _pos3, _uv1, _uv2, _uv3, _color, _color, _color);
|
||||
}
|
||||
@ -530,32 +618,44 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
* @param _uv2 texture position of the _pos2 element
|
||||
* @param _uv3 texture position of the _pos3 element
|
||||
*/
|
||||
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) {
|
||||
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) {
|
||||
|
||||
LOGGER.info("add Triangle: " + _layerName + " ...");
|
||||
if (this.listFaces.containsKey(_layerName) == false || this.materials.containsKey(_layerName) == false) {
|
||||
LOGGER.error("Mesh layer : " + _layerName + " does not exist in list faces=" + this.listFaces.containsKey(_layerName) + " materials=" + this.listFaces.containsKey(_layerName) + " ...");
|
||||
if (!this.listFaces.containsKey(_layerName) || !this.materials.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) {
|
||||
final RenderMode tmpRenderMode = this.materials.get(_layerName).getRenderMode();
|
||||
if (tmpRenderMode != RenderMode.TRIANGLE && tmpRenderMode != RenderMode.TRIANGLE_STRIP
|
||||
&& tmpRenderMode != RenderMode.TRIANGLE_FAN) {
|
||||
LOGGER.error("try to add Line in a mesh material section that not support Line");
|
||||
return;
|
||||
}
|
||||
// try to find position:
|
||||
int pos1 = findPositionInList(_pos1);
|
||||
int pos2 = findPositionInList(_pos2);
|
||||
int pos3 = findPositionInList(_pos3);
|
||||
final int pos1 = findPositionInList(_pos1);
|
||||
final int pos2 = findPositionInList(_pos2);
|
||||
final int pos3 = findPositionInList(_pos3);
|
||||
// try to find UV mapping:
|
||||
int uv1 = findTextureInList(_uv1);
|
||||
int uv2 = findTextureInList(_uv2);
|
||||
int uv3 = findTextureInList(_uv3);
|
||||
final int uv1 = findTextureInList(_uv1);
|
||||
final int uv2 = findTextureInList(_uv2);
|
||||
final int uv3 = findTextureInList(_uv3);
|
||||
// try to find Color:
|
||||
int color1 = findColorInList(_color1);
|
||||
int color2 = findColorInList(_color2);
|
||||
int color3 = findColorInList(_color3);
|
||||
Face tmpFace = new Face(pos1, uv1, pos2, uv2, pos3, uv3);
|
||||
final int color1 = findColorInList(_color1);
|
||||
final int color2 = findColorInList(_color2);
|
||||
final int color3 = findColorInList(_color3);
|
||||
final Face tmpFace = new Face(pos1, uv1, pos2, uv2, pos3, uv3);
|
||||
tmpFace.setColor(color1, color2, color3);
|
||||
this.listFaces.get(_layerName).face().add(tmpFace);
|
||||
LOGGER.info(" nbFace: " + this.listFaces.get(_layerName).face().size());
|
||||
@ -564,21 +664,23 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
private void calculateNormaleEdge(final String _materialName) {
|
||||
this.listVertexNormal.clear();
|
||||
if (this.normalMode == NormalMode.VERTEX) {
|
||||
List<Vector3f> outNormal = new ArrayList<>();
|
||||
final List<Vector3f> outNormal = new ArrayList<>();
|
||||
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) {
|
||||
final RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode();
|
||||
if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE
|
||||
|| tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) {
|
||||
LOGGER.error("calculateNormaleEdge(" + _materialName + ") : can not calculate normal on lines ...");
|
||||
this.normalMode = NormalMode.NONE;
|
||||
return;
|
||||
}
|
||||
for (int iii = 0; iii < this.listVertex.size(); iii++) {
|
||||
List<Face> tmpFaceList = this.listFaces.get(_materialName).face();
|
||||
final List<Face> tmpFaceList = this.listFaces.get(_materialName).face();
|
||||
Vector3f normal = Vector3f.ZERO;
|
||||
// add the vertex from all the element in the list for face when the element in the face ...
|
||||
for (int jjj = 0; jjj < tmpFaceList.size(); jjj++) {
|
||||
outNormal.add(normal);
|
||||
if (tmpFaceList.get(jjj).vertex[0] == iii || tmpFaceList.get(jjj).vertex[1] == iii || tmpFaceList.get(jjj).vertex[2] == iii) {
|
||||
if (tmpFaceList.get(jjj).vertex[0] == iii || tmpFaceList.get(jjj).vertex[1] == iii
|
||||
|| tmpFaceList.get(jjj).vertex[2] == iii) {
|
||||
normal = normal.add(this.listFacesNormal.get(jjj));
|
||||
}
|
||||
}
|
||||
@ -600,8 +702,9 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
protected void calculateNormaleFaceLocal(final String _materialName) {
|
||||
if (this.normalMode == NormalMode.FACE) {
|
||||
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) {
|
||||
final RenderMode tmpRenderMode = this.materials.get(_materialName).getRenderMode();
|
||||
if (tmpRenderMode == RenderMode.POINT || tmpRenderMode == RenderMode.LINE
|
||||
|| tmpRenderMode == RenderMode.LINE_STRIP || tmpRenderMode == RenderMode.LINE_LOOP) {
|
||||
LOGGER.error("calculateNormaleFace(" + _materialName + ") : can not calculate normal on lines ...");
|
||||
this.normalMode = NormalMode.NONE;
|
||||
return;
|
||||
@ -612,17 +715,19 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
} else if (this.listPaletteFaces.containsKey(_materialName)) {
|
||||
faceList = this.listPaletteFaces.get(_materialName);
|
||||
}
|
||||
for (Face it : faceList.face()) {
|
||||
for (final 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])));
|
||||
final 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])));
|
||||
//LOGGER.info("normal: " + normal.normalized());
|
||||
if (normal.isZero()) {
|
||||
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]));
|
||||
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());
|
||||
}
|
||||
int normalID = this.listFacesNormal.size() - 1;
|
||||
final int normalID = this.listFacesNormal.size() - 1;
|
||||
it.normal[0] = normalID;
|
||||
it.normal[1] = normalID;
|
||||
it.normal[2] = normalID;
|
||||
@ -632,7 +737,7 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
|
||||
protected void calculateNormaleFaces(final List<String> materialsNames) {
|
||||
this.listFacesNormal.clear();
|
||||
for (String name : materialsNames) {
|
||||
for (final String name : materialsNames) {
|
||||
LOGGER.warn("generate normal for: '" + name + "'");
|
||||
calculateNormaleFaceLocal(name);
|
||||
}
|
||||
@ -803,9 +908,9 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
public void generateVBO() {
|
||||
this.listFacesDrawIndex.clear();
|
||||
this.outPosition = new ArrayList<>();
|
||||
List<Vector3f> outNormal = new ArrayList<>();
|
||||
List<Vector2f> outTexturePosition = new ArrayList<>();
|
||||
List<Color> outColor = new ArrayList<>();
|
||||
final List<Vector3f> outNormal = new ArrayList<>();
|
||||
final List<Vector2f> outTexturePosition = new ArrayList<>();
|
||||
final List<Color> outColor = new ArrayList<>();
|
||||
// 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 ....
|
||||
@ -813,18 +918,19 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
// calculateNormaleFace(this.listFaces.getKeys()[0]);
|
||||
|
||||
}
|
||||
LOGGER.warn("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
|
||||
// - the index list generation (can be dynamic ... (TODO later))
|
||||
//for (int kkk=0; kkk<this.listFaces.size(); kkk++) {
|
||||
for (Entry<String, FaceIndexing> elem : this.listFaces.entrySet()) {
|
||||
for (final Entry<String, FaceIndexing> elem : this.listFaces.entrySet()) {
|
||||
// clean faces indexes :
|
||||
elem.getValue().index().clear();
|
||||
int outPositionIndewStart = this.outPosition.size();
|
||||
final int outPositionIndewStart = this.outPosition.size();
|
||||
int nbIndicInFace = 3;
|
||||
if (this.materials.containsKey(elem.getKey()) == false) {
|
||||
if (!this.materials.containsKey(elem.getKey())) {
|
||||
LOGGER.warn("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet());
|
||||
continue;
|
||||
}
|
||||
@ -835,12 +941,12 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
case QUAD, QUAD_STRIP -> 4;
|
||||
case POLYGON -> 3;
|
||||
};
|
||||
FaceIndexing tmpFaceList = elem.getValue();
|
||||
for (Face face : tmpFaceList.face()) {
|
||||
int[] vertexVBOId = new int[3];
|
||||
final FaceIndexing tmpFaceList = elem.getValue();
|
||||
for (final Face face : tmpFaceList.face()) {
|
||||
final int[] vertexVBOId = new int[3];
|
||||
for (int indice = 0; indice < nbIndicInFace; indice++) {
|
||||
// get position
|
||||
Vector3f position = this.listVertex.get(face.vertex[indice]);
|
||||
final Vector3f position = this.listVertex.get(face.vertex[indice]);
|
||||
// get Color
|
||||
Color color;
|
||||
if (face.color[indice] != -1) {
|
||||
@ -864,10 +970,11 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
// get Texture Position
|
||||
Vector2f texturepos = Vector2f.ZERO;
|
||||
if (face.uv[indice] >= 0) {
|
||||
texturepos = new Vector2f(this.listUV.get(face.uv[indice]).x(), 1.0f - this.listUV.get(face.uv[indice]).y());
|
||||
texturepos = new Vector2f(this.listUV.get(face.uv[indice]).x(),
|
||||
1.0f - this.listUV.get(face.uv[indice]).y());
|
||||
}
|
||||
// Create the vectex Buffer list:
|
||||
boolean elementFind = false;
|
||||
final boolean elementFind = false;
|
||||
// #ifdef TRY_MINIMAL_VBO
|
||||
// for (int jjj=0; jjj<this.verticesVBO.sizeOnBufferVector3f(MESH_VBO_VERTICES); jjj++) {
|
||||
// if( this.verticesVBO.getOnBufferVector3f(MESH_VBO_VERTICES,jjj) == position
|
||||
@ -882,7 +989,7 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
if (elementFind == false) {
|
||||
if (!elementFind) {
|
||||
this.outPosition.add(position);
|
||||
if (this.normalMode != NormalMode.NONE) {
|
||||
outNormal.add(normal);
|
||||
@ -895,7 +1002,8 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
for (int indice = 0; indice < nbIndicInFace; indice++) {
|
||||
tmpFaceList.index().add(vertexVBOId[indice]);
|
||||
}
|
||||
this.listFacesDrawIndex.put(elem.getKey(), new Vector2i(outPositionIndewStart, this.outPosition.size()));
|
||||
this.listFacesDrawIndex.put(elem.getKey(),
|
||||
new Vector2i(outPositionIndewStart, this.outPosition.size()));
|
||||
}
|
||||
|
||||
// #ifdef TRY_MINIMAL_VBO
|
||||
@ -903,16 +1011,16 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
// #endif
|
||||
}
|
||||
|
||||
List<Integer> outIndex = new ArrayList<>();
|
||||
final List<Integer> outIndex = new ArrayList<>();
|
||||
if (this.listPaletteFaces.size() != 0) {
|
||||
int outPositionIndewStart = this.outPosition.size();
|
||||
FaceIndexing outputIndex = new FaceIndexing();
|
||||
final int outPositionIndewStart = this.outPosition.size();
|
||||
final FaceIndexing outputIndex = new FaceIndexing();
|
||||
//Add palette virtual material:
|
||||
this.listFaces.put("palette", outputIndex);
|
||||
// manage Palette interfaces:
|
||||
for (Entry<String, FaceIndexing> elem : this.listPaletteFaces.entrySet()) {
|
||||
for (final Entry<String, FaceIndexing> elem : this.listPaletteFaces.entrySet()) {
|
||||
int nbIndicInFace = 3;
|
||||
if (this.materials.containsKey(elem.getKey()) == false) {
|
||||
if (!this.materials.containsKey(elem.getKey())) {
|
||||
LOGGER.warn("missing materials : '" + elem.getKey() + "' not in " + this.materials.keySet());
|
||||
continue;
|
||||
}
|
||||
@ -929,26 +1037,28 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
case QUAD:
|
||||
case QUAD_STRIP:
|
||||
case POLYGON:
|
||||
LOGGER.critical("Unsupported palet mode: " + this.materials.get(elem.getKey()).getRenderMode());
|
||||
LOGGER.error("Unsupported palet mode: " + this.materials.get(elem.getKey()).getRenderMode());
|
||||
System.exit(-1);
|
||||
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);
|
||||
LOGGER.error("find color : " + elem.getKey().substring(8) + " ==> " + indexColor + " pos = " + texturepos);
|
||||
final float maxValues = ResourcePaletteFile.getColorMax();
|
||||
final float height = ResourcePaletteFile.getHeight();
|
||||
final int indexColor = ResourcePaletteFile.getColorId(elem.getKey().substring(8));
|
||||
final Vector2f texturepos = new Vector2f((indexColor + 0.5f) / maxValues, 0.5f / height);
|
||||
LOGGER.error(
|
||||
"find color : " + elem.getKey().substring(8) + " ==> " + indexColor + " pos = " + texturepos);
|
||||
int faceId = -1;
|
||||
FaceIndexing tmpFaceList = elem.getValue();
|
||||
for (Face face : tmpFaceList.face()) {
|
||||
final FaceIndexing tmpFaceList = elem.getValue();
|
||||
for (final Face face : tmpFaceList.face()) {
|
||||
faceId++;
|
||||
//LOGGER.warn("Parse faceID = " + faceId);
|
||||
int[] vertexVBOId = new int[3];
|
||||
final int[] vertexVBOId = new int[3];
|
||||
for (int indice = 0; indice < nbIndicInFace; indice++) {
|
||||
//LOGGER.warn("find position indice = " + indice + " / " + face.vertex.length);
|
||||
// get position
|
||||
Vector3f position = this.listVertex.get(face.vertex[indice]);
|
||||
final Vector3f position = this.listVertex.get(face.vertex[indice]);
|
||||
// get Color
|
||||
Color color = Color.WHITE;
|
||||
final Color color = Color.WHITE;
|
||||
// get Normal
|
||||
Vector3f normal = new Vector3f(1, 0, 0);
|
||||
switch (this.normalMode) {
|
||||
@ -1016,7 +1126,7 @@ public class ResourceMesh extends ResourceStaticMesh {
|
||||
LOGGER.info(" - " + elem);
|
||||
}
|
||||
*/
|
||||
Vector2i elements = this.listFacesDrawIndex.get(layerName);
|
||||
final Vector2i elements = this.listFacesDrawIndex.get(layerName);
|
||||
super.render(elements.x(), elements.y());
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,13 @@ import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
|
||||
import org.atriasoft.loader3d.Face;
|
||||
import org.atriasoft.loader3d.FaceIndexing;
|
||||
import org.atriasoft.loader3d.NormalMode;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.atriasoft.loader3d.model.Material;
|
||||
import org.atriasoft.loader3d.model.PhysicShape;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceMeshEmf extends ResourceMesh {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceMeshEmf.class);
|
||||
|
||||
enum emfModuleMode {
|
||||
EMFModuleSkip(-1), //!< skip the current module ==> filtered...
|
||||
@ -45,7 +47,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
|
||||
private final int value;
|
||||
|
||||
emfModuleMode(int value) {
|
||||
emfModuleMode(final int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@ -60,7 +62,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
* @param fileName generic URI if parameter filter is set the mesh is partially loaded applying the filter
|
||||
* @throws Exception pb in parsing the file maybe no vertices inside...
|
||||
*/
|
||||
public ResourceMeshEmf(Uri fileName) throws Exception {
|
||||
public ResourceMeshEmf(final Uri fileName) throws Exception {
|
||||
super(fileName);
|
||||
Pattern filterPattern = null;
|
||||
if (fileName.hasProperty("filter")) {
|
||||
@ -69,23 +71,23 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
this.mode = RenderMode.TRIANGLE;
|
||||
this.checkNormal = true;
|
||||
this.normalMode = NormalMode.NONE;
|
||||
InputStream fileIOStream = Uri.getStream(fileName);
|
||||
final InputStream fileIOStream = Uri.getStream(fileName);
|
||||
if (fileIOStream == null) {
|
||||
LOGGER.error("CAn not get the file named='" + fileName + "'");
|
||||
return; // TODO false;
|
||||
}
|
||||
BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream));
|
||||
final BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream));
|
||||
// get the fileSize ...
|
||||
|
||||
//int size = fileIO.size();
|
||||
|
||||
String inputDataLine;
|
||||
Dynamic<Integer> levelIO = new Dynamic<>(0);
|
||||
final Dynamic<Integer> levelIO = new Dynamic<>(0);
|
||||
// load the first line :
|
||||
inputDataLine = readLine(fileIO, levelIO);
|
||||
if (inputDataLine.startsWith("EMF(STRING)") == true) {
|
||||
if (inputDataLine.startsWith("EMF(STRING)")) {
|
||||
// parse in string mode ...
|
||||
} else if (inputDataLine.startsWith("EMF(BINARY)") == true) {
|
||||
} else if (inputDataLine.startsWith("EMF(BINARY)")) {
|
||||
LOGGER.error(" file binary mode is not supported now : 'EMF(BINARY)'");
|
||||
return; // TODO false;
|
||||
} else {
|
||||
@ -101,14 +103,14 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
String materialName = "";
|
||||
Material material = null;
|
||||
// physical shape:
|
||||
PhysicShape physics = null;
|
||||
final PhysicShape physics = null;
|
||||
boolean haveUVMapping = false;
|
||||
int offsetVertexId = 0;
|
||||
int offsetUV = 0;
|
||||
int offsetFaceNormal = 0;
|
||||
int offsetVertexNormal = 0;
|
||||
while ((inputDataLine = readLine(fileIO, levelIO)) != null) {
|
||||
int level = levelIO.value;
|
||||
final int level = levelIO.value;
|
||||
if (level == -1) {
|
||||
// detect comment;
|
||||
LOGGER.warn("Detect comment");
|
||||
@ -116,11 +118,11 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
}
|
||||
if (level == 0) {
|
||||
// new section ...
|
||||
if (inputDataLine.startsWith("Mesh:") == true) {
|
||||
if (inputDataLine.startsWith("Mesh:")) {
|
||||
currentMode = emfModuleMode.EMFModuleMesh;
|
||||
currentMeshName = inputDataLine.substring(5);
|
||||
if (filterPattern != null) {
|
||||
Matcher m = filterPattern.matcher(currentMeshName);
|
||||
final Matcher m = filterPattern.matcher(currentMeshName);
|
||||
if (!m.matches()) {
|
||||
currentMode = emfModuleMode.EMFModuleSkip;
|
||||
LOGGER.trace("Parse Mesh(SKIP): " + currentMeshName);
|
||||
@ -169,7 +171,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
material = new Material();
|
||||
materialName = inputDataLine.substring(9);
|
||||
LOGGER.trace("Parse Palette: " + materialName);
|
||||
} else if (inputDataLine.startsWith("Physics:") == true) {
|
||||
} else if (inputDataLine.startsWith("Physics:")) {
|
||||
currentMode = emfModuleMode.EMFModulePhysics;
|
||||
LOGGER.trace("Parse global Physics: ");
|
||||
} else {
|
||||
@ -181,25 +183,26 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
// skip the content...
|
||||
continue;
|
||||
}
|
||||
if (currentMode.getValue() >= emfModuleMode.EMFModuleMesh.getValue() && currentMode.getValue() <= emfModuleMode.EMFModuleMesh_END.getValue()) {
|
||||
if (currentMode.getValue() >= emfModuleMode.EMFModuleMesh.getValue()
|
||||
&& currentMode.getValue() <= emfModuleMode.EMFModuleMesh_END.getValue()) {
|
||||
if (level == 1) {
|
||||
if (inputDataLine.startsWith("Vertex:") == true) {
|
||||
if (inputDataLine.startsWith("Vertex:")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshVertex;
|
||||
LOGGER.trace(" Vertex ...");
|
||||
} else if (inputDataLine.startsWith("UV-mapping:") == true) {
|
||||
} else if (inputDataLine.startsWith("UV-mapping:")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshUVMapping;
|
||||
haveUVMapping = true;
|
||||
LOGGER.trace(" UV-mapping ...");
|
||||
} else if (inputDataLine.startsWith("Normal(vertex):") == true) {
|
||||
} else if (inputDataLine.startsWith("Normal(vertex):")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshNormalVertex;
|
||||
LOGGER.trace(" Normal(vertex) ...");
|
||||
} else if (inputDataLine.startsWith("Normal(face):") == true) {
|
||||
} else if (inputDataLine.startsWith("Normal(face):")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshNormalFace;
|
||||
LOGGER.trace(" Normal(face) ...");
|
||||
} else if (inputDataLine.startsWith("Face:") == true) {
|
||||
} else if (inputDataLine.startsWith("Face:")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshFace;
|
||||
LOGGER.trace(" Face ...");
|
||||
} else if (inputDataLine.startsWith("Physics:") == true) {
|
||||
} else if (inputDataLine.startsWith("Physics:")) {
|
||||
currentMode = emfModuleMode.EMFModuleMeshPhysics;
|
||||
LOGGER.trace(" Physics ...");
|
||||
} else {
|
||||
@ -214,16 +217,16 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
LOGGER.error("Unknow ... " + level);
|
||||
break;
|
||||
case EMFModuleMeshVertex: {
|
||||
for (String elem : inputDataLine.split("\\|")) {
|
||||
Vector3f vertex = Vector3f.valueOf(elem);
|
||||
for (final String elem : inputDataLine.split("\\|")) {
|
||||
final Vector3f vertex = Vector3f.valueOf(elem);
|
||||
this.listVertex.add(vertex);
|
||||
}
|
||||
LOGGER.trace(" " + this.listVertex.size() + " vertex");
|
||||
break;
|
||||
}
|
||||
case EMFModuleMeshUVMapping: {
|
||||
for (String elem : inputDataLine.split("\\|")) {
|
||||
Vector2f uvMap = Vector2f.valueOf(elem);
|
||||
for (final String elem : inputDataLine.split("\\|")) {
|
||||
final Vector2f uvMap = Vector2f.valueOf(elem);
|
||||
this.listUV.add(uvMap);
|
||||
}
|
||||
LOGGER.trace(" " + this.listUV.size() + " coord");
|
||||
@ -231,8 +234,8 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
}
|
||||
case EMFModuleMeshNormalVertex: {
|
||||
this.normalMode = NormalMode.VERTEX;
|
||||
for (String elem : inputDataLine.split("\\|")) {
|
||||
Vector3f normal = Vector3f.valueOf(elem);
|
||||
for (final String elem : inputDataLine.split("\\|")) {
|
||||
final Vector3f normal = Vector3f.valueOf(elem);
|
||||
this.listVertexNormal.add(normal);
|
||||
}
|
||||
LOGGER.trace(" " + this.listVertexNormal.size() + " Normals");
|
||||
@ -241,8 +244,8 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
case EMFModuleMeshNormalFace: {
|
||||
LOGGER.error("Change mode in face mode ...");
|
||||
this.normalMode = NormalMode.FACE;
|
||||
for (String elem : inputDataLine.split("\\|")) {
|
||||
Vector3f normal = Vector3f.valueOf(elem);
|
||||
for (final String elem : inputDataLine.split("\\|")) {
|
||||
final Vector3f normal = Vector3f.valueOf(elem);
|
||||
this.listFacesNormal.add(normal);
|
||||
}
|
||||
LOGGER.trace(" " + this.listFacesNormal.size() + " Normals");
|
||||
@ -251,23 +254,21 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
case EMFModuleMeshFace:
|
||||
case EMFModuleMeshFaceMaterial:
|
||||
if (level == 2) {
|
||||
String meshFaceMaterialID = inputDataLine;
|
||||
final String meshFaceMaterialID = inputDataLine;
|
||||
// new material selection
|
||||
currentMode = emfModuleMode.EMFModuleMeshFaceMaterial;
|
||||
if (inputDataLine.startsWith("palette:")) {
|
||||
if (this.listPaletteFaces.containsKey(meshFaceMaterialID) == false) {
|
||||
if (!this.listPaletteFaces.containsKey(meshFaceMaterialID)) {
|
||||
currentFaceIndexing = new FaceIndexing();
|
||||
this.listPaletteFaces.put(meshFaceMaterialID, currentFaceIndexing);
|
||||
} else {
|
||||
currentFaceIndexing = this.listPaletteFaces.get(meshFaceMaterialID);
|
||||
}
|
||||
} else if (!this.listFaces.containsKey(meshFaceMaterialID)) {
|
||||
currentFaceIndexing = new FaceIndexing();
|
||||
this.listFaces.put(meshFaceMaterialID, currentFaceIndexing);
|
||||
} else {
|
||||
if (this.listFaces.containsKey(meshFaceMaterialID) == false) {
|
||||
currentFaceIndexing = new FaceIndexing();
|
||||
this.listFaces.put(meshFaceMaterialID, currentFaceIndexing);
|
||||
} else {
|
||||
currentFaceIndexing = this.listFaces.get(meshFaceMaterialID);
|
||||
}
|
||||
currentFaceIndexing = this.listFaces.get(meshFaceMaterialID);
|
||||
}
|
||||
LOGGER.trace(" " + inputDataLine);
|
||||
} else if (currentMode == emfModuleMode.EMFModuleMeshFaceMaterial) {
|
||||
@ -275,7 +276,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
LOGGER.error("Get elements without material defined ...");
|
||||
continue;
|
||||
}
|
||||
for (String elem : inputDataLine.split("\\|")) {
|
||||
for (final String elem : inputDataLine.split("\\|")) {
|
||||
Face tmp = null;
|
||||
if (this.normalMode == NormalMode.FACE) {
|
||||
tmp = Face.valueOf(elem, offsetVertexId, offsetUV, offsetFaceNormal);
|
||||
@ -316,49 +317,51 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((currentMode.getValue() >= emfModuleMode.EMFModuleMaterial.getValue() && currentMode.getValue() <= emfModuleMode.EMFModuleMaterial_END.getValue())
|
||||
|| (currentMode.getValue() >= emfModuleMode.EMFModulePalette.getValue() && currentMode.getValue() <= emfModuleMode.EMFModulePalette_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())) {
|
||||
if (material == null) {
|
||||
LOGGER.error("material allocation error");
|
||||
continue;
|
||||
}
|
||||
if (inputDataLine.startsWith("Ns ") == true) {
|
||||
float tmpVal = Float.valueOf(inputDataLine.substring(3));
|
||||
if (inputDataLine.startsWith("Ns ")) {
|
||||
final float tmpVal = Float.valueOf(inputDataLine.substring(3));
|
||||
material.setShininess(tmpVal);
|
||||
LOGGER.trace(" Shininess " + tmpVal);
|
||||
} else if (inputDataLine.startsWith("Ka ") == true) {
|
||||
} else if (inputDataLine.startsWith("Ka ")) {
|
||||
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
|
||||
tmp = tmp.withW(1);
|
||||
material.setAmbientFactor(tmp);
|
||||
LOGGER.trace(" AmbientFactor " + tmp);
|
||||
} else if (inputDataLine.startsWith("Kd ") == true) {
|
||||
} else if (inputDataLine.startsWith("Kd ")) {
|
||||
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
|
||||
tmp = tmp.withW(1);
|
||||
material.setDiffuseFactor(tmp);
|
||||
LOGGER.error(" DiffuseFactor " + tmp);
|
||||
} else if (inputDataLine.startsWith("Ks ") == true) {
|
||||
} else if (inputDataLine.startsWith("Ks ")) {
|
||||
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
|
||||
tmp = tmp.withW(1);
|
||||
material.setSpecularFactor(tmp);
|
||||
LOGGER.trace(" SpecularFactor " + tmp);
|
||||
} else if (inputDataLine.startsWith("Ni ") == true) {
|
||||
float tmpVal = Float.valueOf(inputDataLine.substring(3));
|
||||
} else if (inputDataLine.startsWith("Ni ")) {
|
||||
final float tmpVal = Float.valueOf(inputDataLine.substring(3));
|
||||
// TODO : ...
|
||||
LOGGER.trace(" Ni " + tmpVal);
|
||||
} else if (inputDataLine.startsWith("d ") == true) {
|
||||
float tmpVal = Float.valueOf(inputDataLine.substring(2));
|
||||
} else if (inputDataLine.startsWith("d ")) {
|
||||
final float tmpVal = Float.valueOf(inputDataLine.substring(2));
|
||||
// TODO : ...
|
||||
LOGGER.trace(" d " + tmpVal);
|
||||
} else if (inputDataLine.startsWith("illum ") == true) {
|
||||
float tmpVal = Float.valueOf(inputDataLine.substring(6));
|
||||
} else if (inputDataLine.startsWith("illum ")) {
|
||||
final float tmpVal = Float.valueOf(inputDataLine.substring(6));
|
||||
// TODO : ...
|
||||
LOGGER.trace(" illum " + tmpVal);
|
||||
} else if (inputDataLine.startsWith("map_Kd ") == true) {
|
||||
} else if (inputDataLine.startsWith("map_Kd ")) {
|
||||
Uri tmpTexture = fileName.getParent();
|
||||
tmpTexture = tmpTexture.pathAdd(inputDataLine.substring(7));
|
||||
material.setTexture0(tmpTexture);
|
||||
LOGGER.trace(" Texture " + tmpTexture);
|
||||
} else if (inputDataLine.startsWith("renderMode ") == true) {
|
||||
} else if (inputDataLine.startsWith("renderMode ")) {
|
||||
//RenderMode mode;
|
||||
//frothis.string(mode, &inputDataLine[11]);
|
||||
//material.setRenderMode(mode);
|
||||
@ -368,7 +371,8 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
}
|
||||
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) {
|
||||
LOGGER.error("Load shape : " + inputDataLine);
|
||||
// physics = ege::physics::Shape::create(inputDataLine);
|
||||
@ -410,7 +414,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
try {
|
||||
fileIO.close();
|
||||
fileIOStream.close();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -493,7 +497,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
// return null;
|
||||
//}
|
||||
|
||||
private String readLine(BufferedReader _file, Dynamic<Integer> level) {
|
||||
private String readLine(final BufferedReader _file, final Dynamic<Integer> level) {
|
||||
level.value = 0;
|
||||
StringBuffer buf = new StringBuffer();
|
||||
boolean startLine = true;
|
||||
@ -502,7 +506,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
int current = '\0';
|
||||
try {
|
||||
current = _file.read();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -519,11 +523,11 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
startLine = false;
|
||||
if (current == '#') {
|
||||
// detect comment ==> remove to the end of file ==> no data availlable
|
||||
if (differentThanSpace == false) {
|
||||
if (!differentThanSpace) {
|
||||
while (current != '\0' && current != '\n') {
|
||||
try {
|
||||
current = _file.read();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -539,7 +543,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
while (current != '\0' && current != '\n') {
|
||||
try {
|
||||
current = _file.read();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -550,7 +554,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
if (current == '\t' || current == ' ') {
|
||||
hasSpace = true;
|
||||
} else {
|
||||
if (hasSpace == true) {
|
||||
if (hasSpace) {
|
||||
buf.append(' ');
|
||||
hasSpace = false;
|
||||
}
|
||||
@ -559,7 +563,7 @@ public class ResourceMeshEmf extends ResourceMesh {
|
||||
}
|
||||
try {
|
||||
current = _file.read();
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -20,14 +20,16 @@ import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Vector4f;
|
||||
import org.atriasoft.gale.resource.Resource;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.atriasoft.loader3d.model.MaterialBase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* ColorFile is a Resource designed to be specific with the theme (for
|
||||
* example black, or white or orange ...)
|
||||
*/
|
||||
public class ResourcePaletteFile extends Resource {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ResourcePaletteFile.class);
|
||||
private static final int COUNT_HEIGHT_PALETTE = 16;
|
||||
private static final int COUNT_MAX_COLOR_PALETTE = 32;
|
||||
private static final String DEFINE_PALETTE = "palette";
|
||||
@ -42,18 +44,21 @@ public class ResourcePaletteFile extends Resource {
|
||||
static {
|
||||
ResourcePaletteFile.PALETTE_ELEMENTS.add("unknown");
|
||||
}
|
||||
|
||||
public static synchronized int getColorId(final String color) {
|
||||
for (int iii=0; iii<ResourcePaletteFile.PALETTE_ELEMENTS.size(); iii++) {
|
||||
for (int iii = 0; iii < ResourcePaletteFile.PALETTE_ELEMENTS.size(); iii++) {
|
||||
if (ResourcePaletteFile.PALETTE_ELEMENTS.get(iii).equals(color)) {
|
||||
return iii;
|
||||
}
|
||||
}
|
||||
ResourcePaletteFile.PALETTE_ELEMENTS.add(color);
|
||||
return ResourcePaletteFile.PALETTE_ELEMENTS.size()-1;
|
||||
return ResourcePaletteFile.PALETTE_ELEMENTS.size() - 1;
|
||||
}
|
||||
|
||||
public static int getColorMax() {
|
||||
return ResourcePaletteFile.COUNT_MAX_COLOR_PALETTE;
|
||||
}
|
||||
|
||||
public static int getHeight() {
|
||||
return ResourcePaletteFile.COUNT_HEIGHT_PALETTE;
|
||||
}
|
||||
@ -62,13 +67,14 @@ public class ResourcePaletteFile extends Resource {
|
||||
|
||||
public static ResourcePaletteFile create(final Uri uri) {
|
||||
LOGGER.trace("KEEP: ColorFile: " + uri);
|
||||
ResourcePaletteFile object = null;
|
||||
final ResourcePaletteFile object = null;
|
||||
final Resource object2 = Resource.getManager().localKeep(uri);
|
||||
if (object2 != null) {
|
||||
if (object2 instanceof ResourcePaletteFile) {
|
||||
return (ResourcePaletteFile) object2;
|
||||
}
|
||||
LOGGER.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
|
||||
LOGGER.error("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
|
||||
System.exit(-1);
|
||||
return null;
|
||||
}
|
||||
LOGGER.debug("CREATE: FontFreeType: " + uri);
|
||||
@ -79,9 +85,9 @@ public class ResourcePaletteFile extends Resource {
|
||||
private final Color errorColor = Color.ORANGE;
|
||||
private MaterialBase base = new MaterialBase();
|
||||
|
||||
private final SortedMap<String, MaterialBase> listNormal = new TreeMap<String, MaterialBase>(); // !< List of all color in the file
|
||||
private final SortedMap<String, MaterialBase> listOver = new TreeMap<String, MaterialBase>(); // !< List of all color in the file
|
||||
private final SortedMap<String, MaterialBase> listSelect = new TreeMap<String, MaterialBase>(); // !< List of all color in the file
|
||||
private final SortedMap<String, MaterialBase> listNormal = new TreeMap<>(); // !< List of all color in the file
|
||||
private final SortedMap<String, MaterialBase> listOver = new TreeMap<>(); // !< List of all color in the file
|
||||
private final SortedMap<String, MaterialBase> listSelect = new TreeMap<>(); // !< List of all color in the file
|
||||
|
||||
/**
|
||||
* Constructor of the color property file
|
||||
@ -108,18 +114,18 @@ public class ResourcePaletteFile extends Resource {
|
||||
if (id == null) {
|
||||
return this.errorColor;
|
||||
}
|
||||
Vector4f color = this.listNormal.get(id).getAmbientFactor();
|
||||
final Vector4f color = this.listNormal.get(id).getAmbientFactor();
|
||||
return new Color(color.x(), color.y(), color.z(), color.w());
|
||||
}
|
||||
|
||||
private MaterialBase configMaterial(final JsonObject node, final MaterialBase parent) {
|
||||
MaterialBase element = parent.clone();
|
||||
final MaterialBase element = parent.clone();
|
||||
try {
|
||||
if (node != null) {
|
||||
if (node.exist(ResourcePaletteFile.DEFINE_SHINESS)) {
|
||||
final double data = node.get(ResourcePaletteFile.DEFINE_SHINESS).toJsonNumber().getValue();
|
||||
LOGGER.trace(" Shininess " + data);
|
||||
element.setShininess((float)data);
|
||||
element.setShininess((float) data);
|
||||
}
|
||||
if (node.exist(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR)) {
|
||||
final String data = node.get(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR).toJsonString().getValue();
|
||||
@ -166,18 +172,20 @@ public class ResourcePaletteFile extends Resource {
|
||||
Ejson.display(out);
|
||||
return;
|
||||
}
|
||||
for (Entry<String, JsonNode> it : baseObject.getNodes().entrySet()) {
|
||||
JsonObject nodeMaterial = it.getValue().toJsonObject();
|
||||
MaterialBase mat = configMaterial(nodeMaterial, this.base);
|
||||
for (final Entry<String, JsonNode> it : baseObject.getNodes().entrySet()) {
|
||||
final JsonObject nodeMaterial = it.getValue().toJsonObject();
|
||||
final MaterialBase mat = configMaterial(nodeMaterial, this.base);
|
||||
this.listNormal.put(it.getKey(), mat);
|
||||
if (nodeMaterial.exist(ResourcePaletteFile.DEFINE_OVER)) {
|
||||
MaterialBase matOver = configMaterial(nodeMaterial.get(ResourcePaletteFile.DEFINE_OVER).toJsonObject(), mat);
|
||||
final MaterialBase matOver = configMaterial(
|
||||
nodeMaterial.get(ResourcePaletteFile.DEFINE_OVER).toJsonObject(), mat);
|
||||
this.listOver.put(it.getKey(), matOver);
|
||||
} else {
|
||||
this.listOver.put(it.getKey(), mat);
|
||||
}
|
||||
if (nodeMaterial.exist(ResourcePaletteFile.DEFINE_SELECT)) {
|
||||
MaterialBase matSelect = configMaterial(nodeMaterial.get(ResourcePaletteFile.DEFINE_SELECT).toJsonObject(), mat);
|
||||
final MaterialBase matSelect = configMaterial(
|
||||
nodeMaterial.get(ResourcePaletteFile.DEFINE_SELECT).toJsonObject(), mat);
|
||||
this.listSelect.put(it.getKey(), matSelect);
|
||||
} else {
|
||||
this.listSelect.put(it.getKey(), mat);
|
||||
@ -199,25 +207,25 @@ public class ResourcePaletteFile extends Resource {
|
||||
}
|
||||
|
||||
public ImageByte getImageByte() {
|
||||
int width = ResourcePaletteFile.COUNT_MAX_COLOR_PALETTE;
|
||||
int height = ResourcePaletteFile.COUNT_HEIGHT_PALETTE;
|
||||
ImageByteRGBA out = new ImageByteRGBA(width, height);
|
||||
final int width = ResourcePaletteFile.COUNT_MAX_COLOR_PALETTE;
|
||||
final int height = ResourcePaletteFile.COUNT_HEIGHT_PALETTE;
|
||||
final ImageByteRGBA out = new ImageByteRGBA(width, height);
|
||||
//ImageByteRGB out = new ImageByteRGB(width, height);
|
||||
// clear the palette:
|
||||
//float val = 0.0f;
|
||||
for (int xxx=0; xxx < width; xxx++) {
|
||||
for (int yyy=0; yyy < ResourcePaletteFile.COUNT_HEIGHT_PALETTE; yyy++) {
|
||||
for (int xxx = 0; xxx < width; xxx++) {
|
||||
for (int yyy = 0; yyy < ResourcePaletteFile.COUNT_HEIGHT_PALETTE; yyy++) {
|
||||
out.setColorFloat(xxx, yyy, 1, 1, 1, 1);
|
||||
//out.setColorFloat(xxx, yyy, val, val + 0.125f, val + 0.85f, 1);
|
||||
//val += 0.01f;
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<String, MaterialBase> it : this.listNormal.entrySet()) {
|
||||
int id = ResourcePaletteFile.getColorId(it.getKey());
|
||||
MaterialBase mat = it.getValue();
|
||||
MaterialBase matOver = this.listOver.get(it.getKey());
|
||||
MaterialBase matSelect = this.listSelect.get(it.getKey());
|
||||
for (final Entry<String, MaterialBase> it : this.listNormal.entrySet()) {
|
||||
final int id = ResourcePaletteFile.getColorId(it.getKey());
|
||||
final MaterialBase mat = it.getValue();
|
||||
final MaterialBase matOver = this.listOver.get(it.getKey());
|
||||
final MaterialBase matSelect = this.listSelect.get(it.getKey());
|
||||
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);
|
||||
@ -228,11 +236,15 @@ public class ResourcePaletteFile extends Resource {
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private void putColor(final int index, final int offset, final ImageByte image, final MaterialBase mat) {
|
||||
image.setColorFloat(index, 0+offset, mat.getDiffuseFactor().x(), mat.getDiffuseFactor().y(), mat.getDiffuseFactor().z(), mat.getDiffuseFactor().w());
|
||||
image.setColorFloat(index, 4+offset, mat.getSpecularFactor().x(), mat.getSpecularFactor().y(), mat.getSpecularFactor().z(), mat.getSpecularFactor().w());
|
||||
image.setColorFloat(index, 8+offset, mat.getAmbientFactor().x(), mat.getAmbientFactor().y(), mat.getAmbientFactor().z(), mat.getAmbientFactor().w());
|
||||
image.setColorFloat(index, 12+offset, mat.getShininess(), 1.0f, 1.0f, 1.0f);
|
||||
image.setColorFloat(index, 0 + offset, mat.getDiffuseFactor().x(), mat.getDiffuseFactor().y(),
|
||||
mat.getDiffuseFactor().z(), mat.getDiffuseFactor().w());
|
||||
image.setColorFloat(index, 4 + offset, mat.getSpecularFactor().x(), mat.getSpecularFactor().y(),
|
||||
mat.getSpecularFactor().z(), mat.getSpecularFactor().w());
|
||||
image.setColorFloat(index, 8 + offset, mat.getAmbientFactor().x(), mat.getAmbientFactor().y(),
|
||||
mat.getAmbientFactor().z(), mat.getAmbientFactor().w());
|
||||
image.setColorFloat(index, 12 + offset, mat.getShininess(), 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,10 +4,13 @@ import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
|
||||
import org.atriasoft.gale.resource.Resource;
|
||||
import org.atriasoft.loader3d.OBJFileLoader;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.atriasoft.loader3d.model.ModelData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceStaticMeshObj.class);
|
||||
|
||||
public static ResourceStaticMeshObj create(final Uri uriObj) {
|
||||
ResourceStaticMeshObj resource;
|
||||
Resource resource2;
|
||||
@ -22,7 +25,8 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
|
||||
resource2.keep();
|
||||
return (ResourceStaticMeshObj) resource2;
|
||||
}
|
||||
LOGGER.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
|
||||
LOGGER.error("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
|
||||
System.exit(-1);
|
||||
return null;
|
||||
}
|
||||
resource = new ResourceStaticMeshObj(uriObj);
|
||||
|
@ -3,9 +3,11 @@ package org.atriasoft.loader3d.resources;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.gale.resource.Resource;
|
||||
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
|
||||
import org.atriasoft.loader3d.internal.Log;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceStaticMeshObjDynamic.class);
|
||||
|
||||
public static ResourceStaticMeshObjDynamic create(final Uri uriObj) {
|
||||
ResourceStaticMeshObjDynamic resource;
|
||||
@ -17,11 +19,12 @@ public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj {
|
||||
}
|
||||
resource2 = Resource.getManager().localKeep(name);
|
||||
if (resource2 != null) {
|
||||
if (resource2 instanceof ResourceStaticMeshObjDynamic tmpp) {
|
||||
if (resource2 instanceof final ResourceStaticMeshObjDynamic tmpp) {
|
||||
resource2.keep();
|
||||
return tmpp;
|
||||
}
|
||||
LOGGER.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
|
||||
LOGGER.error("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
|
||||
System.exit(-1);
|
||||
return null;
|
||||
}
|
||||
resource = new ResourceStaticMeshObjDynamic(uriObj);
|
||||
|
@ -1,71 +0,0 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'Entry.blend'
|
||||
Mesh:EntryBox_Cube
|
||||
Vertex:16
|
||||
20.042355 7.751226 20.042355|20.042355 7.751226 -20.042355|20.042355 -4.633502 20.042355|20.042355 -4.633502 -20.042355|-20.042355 7.751226 20.042355|-20.042355 7.751226 -20.042355|-20.042355 -4.633502 20.042355|-20.042355 -4.633502 -20.042355|10.127714 -7.726907 10.127714|10.127714 -7.726907 -10.127714|-10.127714 -7.726907 10.127714|-10.127714 -7.726907 -10.127714|-10.127714 -9.146553 -10.127714|-10.127714 -9.146553 10.127714|10.127714 -9.146553 10.127714|10.127714 -9.146553 -10.127714|
|
||||
UV-mapping:
|
||||
0.000100 0.000100|0.999900 0.999900|0.000100 0.999900|0.999900 0.000100|0.074219 0.995849|0.120606 0.943115|0.121582 0.993408|0.112927 0.992387|0.078245 0.948093|0.073324 0.991157|0.101769 0.970961|0.080974 0.959440|0.102023 0.957458|0.111927 0.985005|0.078476 0.953015|0.082167 0.983774|0.074219 0.944092|0.111696 0.944402|0.080720 0.975385|0.113157 0.949323|0.174907 0.947863|0.131613 0.991157|0.132843 0.945402|0.178368 0.944941|0.137534 0.984544|0.142456 0.948632|0.171985 0.949093|0.136074 0.991157|0.137304 0.950323|0.174677 0.949093|0.135074 0.992387|0.136304 0.949093|0.178598 0.993618|0.178368 0.988235|0.173216 0.991157|0.175907 0.989926|0.013265 0.951784|0.051868 0.992387|0.013034 0.993618|0.054098 0.951784|0.137534 0.988235|0.177138 0.947863|0.135074 0.947862|0.172446 0.988465|
|
||||
Normal(face):22
|
||||
0.000000 -1.000000 0.000000|-0.297843 -0.954615 0.000000|0.000000 -0.954615 -0.297843|0.000000 -0.954615 0.297843|0.297843 -0.954615 0.000000|0.000000 0.000000 1.000000|-1.000000 0.000000 0.000000|0.000000 0.000000 -1.000000|1.000000 0.000000 -0.000000|0.000000 1.000000 -0.000000|
|
||||
Face:22
|
||||
gui_dynamic_1
|
||||
14/0/0 12/1/0 15/2/0| 14/0/0 13/3/0 12/1/0|
|
||||
palette:gui_border_1
|
||||
7/4/1 10/5/1 6/6/1| 3/7/2 11/8/2 7/9/2| 6/10/3 8/11/3 2/12/3| 2/13/4 9/14/4 3/15/4| 7/4/1 11/16/1 10/5/1| 3/7/2 9/17/2 11/8/2| 6/10/3 10/18/3 8/11/3| 2/13/4 8/19/4 9/14/4|
|
||||
palette:gui_border_2
|
||||
4/20/5 2/21/5 0/22/5| 6/23/6 5/24/6 7/25/6| 1/26/7 7/27/7 5/28/7| 0/29/8 3/30/8 1/31/8| 4/20/5 6/32/5 2/21/5| 6/23/6 4/33/6 5/24/6| 1/26/7 3/34/7 7/27/7| 0/29/8 2/35/8 3/30/8|
|
||||
palette:gui_center
|
||||
9/36/0 10/37/0 11/38/0| 9/36/0 8/39/0 10/37/0|
|
||||
palette:gui_back
|
||||
5/40/9 0/41/9 1/42/9| 5/40/9 4/43/9 0/41/9|
|
||||
|
||||
Materials:gui_dynamic_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /home/heero/dev/workspace-game/atriasoft/ewol/resources/resources/ewol/theme/shape/empty_area.png
|
||||
# Just for information:
|
||||
Palettes:gui_back
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.000000 0.005632
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_border_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.002615 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_border_2
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.800000 0.170495
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:gui_center
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.438544 0.438544 0.438544
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
@ -1,57 +0,0 @@
|
||||
EMF(STRING)
|
||||
# Blender v2.92.0 EMF File: 'tower.blend'
|
||||
Mesh:tower_Cube
|
||||
Vertex:68
|
||||
1.000000 1.000000 1.968156|1.000000 1.000000 0.509101|1.000000 -1.000000 1.968156|1.000000 -1.000000 0.509101|-1.000000 1.000000 1.968156|-1.000000 1.000000 0.509101|-1.000000 -1.000000 1.968156|-1.000000 -1.000000 0.509101|0.519091 0.519091 2.988363|0.519091 -0.519091 2.988363|-0.519091 0.519091 2.988363|-0.519091 -0.519091 2.988363|1.267435 0.519091 3.279218|1.267435 -0.519091 3.279218|-0.519091 0.519091 3.279218|-0.519091 -0.519091 3.279218|1.267435 0.519091 4.102064|1.267435 -0.519091 4.102064|-0.519091 0.519091 4.102064|-0.519091 -0.519091 4.102064|-1.007701 0.133857 3.584548|-1.007701 -0.133857 3.584548|-1.007701 0.133857 3.796734|-1.007701 -0.133857 3.796734|-3.394721 0.108124 3.604944|-3.394721 -0.108124 3.604944|-3.394721 0.108124 3.776338|-3.394721 -0.108124 3.776338|-3.394721 0.148343 3.573067|-3.394721 -0.148343 3.573067|-3.394721 0.148343 3.808215|-3.394721 -0.148343 3.808215|-3.865651 0.148343 3.573067|-3.865651 -0.148343 3.573067|-3.865651 0.148343 3.808215|-3.865651 -0.148343 3.808215|0.468620 0.227433 3.055862|0.468620 -0.227433 3.055862|-0.227433 0.227433 3.055862|-0.227433 -0.227433 3.055862|0.671236 0.227433 3.376956|0.671236 -0.227433 3.376956|0.216371 0.227433 3.376956|0.216371 -0.227433 3.376956|1.304951 1.304951 0.327262|1.304951 -1.304951 0.327262|-1.304951 1.304951 0.327262|-1.304951 -1.304951 0.327262|1.304951 1.304951 -0.001257|1.304951 -1.304951 -0.001257|-1.304951 1.304951 -0.001257|-1.304951 -1.304951 -0.001257|1.644974 0.319018 3.437792|1.644974 -0.319018 3.437792|1.644974 0.319018 3.943490|1.644974 -0.319018 3.943490|1.469387 0.154815 3.567937|1.469387 -0.154815 3.567937|1.469387 0.154815 3.813344|1.469387 -0.154815 3.813344|-3.865651 0.081533 3.626019|-3.865651 -0.081533 3.626019|-3.865651 0.081533 3.755262|-3.865651 -0.081533 3.755262|0.301836 0.081533 3.626019|0.301836 -0.081533 3.626019|0.301836 0.081533 3.755262|0.301836 -0.081533 3.755262|
|
||||
Normal(face):128
|
||||
-0.000000 0.000000 -1.000000|0.000000 1.000000 -0.000000|0.000000 -0.225474 0.974249|-0.225474 0.000000 0.974249|0.000000 0.000000 1.000000|-0.619140 0.785281 0.000000|0.000000 -1.000000 0.000000|-0.529936 0.000000 0.848038|-0.619140 -0.785281 0.000000|-0.529936 0.000000 -0.848038|1.000000 -0.000000 -0.000000|-1.000000 0.000000 0.000000|0.000000 0.225474 0.974249|0.800875 0.000000 0.598832|0.845703 0.000000 -0.533654|-0.586173 0.000000 0.810186|0.595465 0.000000 0.803381|0.683034 0.730387 0.000000|0.595465 0.000000 -0.803381|0.683034 -0.730387 0.000000|0.468253 0.883595 0.000000|-0.010780 -0.999942 0.000000|-0.008544 0.000000 0.999964|-0.010780 0.999942 0.000000|-0.008544 0.000000 -0.999964|0.387250 0.000000 0.921975|0.468253 -0.883595 0.000000|0.387250 0.000000 -0.921975|-0.008544 0.000000 0.999963|-0.008544 -0.000000 -0.999963|0.000000 0.904541 0.426386|0.000000 -0.904541 0.426386|-0.904541 0.000000 0.426386|0.904541 0.000000 0.426386|-0.000000 -0.512150 0.858896|-0.512150 0.000000 0.858896|0.512150 0.000000 0.858896|-0.000000 0.512150 0.858896|
|
||||
Face:128
|
||||
palette:canon_2
|
||||
15/0 12/0 13/0| 14/1 16/1 12/1| 9/2 39/2 11/2| 36/1 42/1 40/1| 11/3 38/3 10/3| 18/4 17/4 16/4| 14/5 22/5 18/5| 13/6 19/6 15/6| 18/7 23/7 19/7| 19/8 21/8 15/8| 15/9 20/9 14/9| 26/10 31/10 27/10| 28/1 34/1 30/1| 24/10 30/10 26/10| 25/10 28/10 24/10| 27/10 29/10 25/10| 35/11 61/11 33/11| 29/0 32/0 28/0| 31/6 33/6 29/6| 30/4 35/4 31/4| 8/12 38/12 36/12| 8/13 37/13 9/13| 40/4 43/4 41/4| 36/14 41/14 37/14| 37/6 43/6 39/6| 39/15 42/15 38/15| 52/16 57/16 53/16| 56/10 59/10 57/10| 53/17 59/17 55/17| 55/18 58/18 54/18| 54/19 56/19 52/19| 60/6 66/6 62/6| 34/11 63/11 35/11| 32/11 62/11 34/11| 33/11 60/11 32/11| 65/11 66/11 64/11| 61/4 64/4 60/4| 63/1 65/1 61/1| 62/0 67/0 63/0| 15/0 14/0 12/0| 14/1 18/1 16/1| 9/2 37/2 39/2| 36/1 38/1 42/1| 11/3 39/3 38/3| 18/4 19/4 17/4| 14/5 20/5 22/5| 13/6 17/6 19/6| 18/7 22/7 23/7| 19/8 23/8 21/8| 15/9 21/9 20/9| 26/10 30/10 31/10| 28/1 32/1 34/1| 24/10 28/10 30/10| 25/10 29/10 28/10| 27/10 31/10 29/10| 35/11 63/11 61/11| 29/0 33/0 32/0| 31/6 35/6 33/6| 30/4 34/4 35/4| 8/12 10/12 38/12| 8/13 36/13 37/13| 40/4 42/4 43/4| 36/14 40/14 41/14| 37/6 41/6 43/6| 39/15 43/15 42/15| 52/16 56/16 57/16| 56/10 58/10 59/10| 53/17 57/17 59/17| 55/18 59/18 58/18| 54/19 58/19 56/19| 60/6 64/6 66/6| 34/11 62/11 63/11| 32/11 60/11 62/11| 33/11 61/11 60/11| 65/11 67/11 66/11| 61/4 65/4 64/4| 63/1 67/1 65/1| 62/0 66/0 67/0|
|
||||
palette:canon_1
|
||||
16/20 52/20 12/20| 23/21 25/21 21/21| 22/22 27/22 23/22| 20/23 26/23 22/23| 21/24 24/24 20/24| 17/25 54/25 16/25| 13/26 55/26 17/26| 12/27 53/27 13/27| 16/20 54/20 52/20| 23/21 27/21 25/21| 22/28 26/28 27/28| 20/23 24/23 26/23| 21/29 25/29 24/29| 17/25 55/25 54/25| 13/26 53/26 55/26| 12/27 52/27 53/27|
|
||||
palette:user_1
|
||||
4/30 8/30 0/30| 2/6 7/6 3/6| 6/11 5/11 7/11| 0/10 3/10 1/10| 4/1 1/1 5/1| 6/31 9/31 11/31| 6/32 10/32 4/32| 0/33 9/33 2/33| 4/30 10/30 8/30| 2/6 6/6 7/6| 6/11 4/11 5/11| 0/10 2/10 3/10| 4/1 0/1 1/1| 6/31 2/31 9/31| 6/32 11/32 10/32| 0/33 8/33 9/33|
|
||||
palette:bulding_base_1
|
||||
7/34 45/34 3/34| 45/10 48/10 44/10| 5/35 47/35 7/35| 3/36 44/36 1/36| 1/37 46/37 5/37| 48/0 51/0 50/0| 44/1 50/1 46/1| 47/6 49/6 45/6| 46/11 51/11 47/11| 7/34 47/34 45/34| 45/10 49/10 48/10| 5/35 46/35 47/35| 3/36 45/36 44/36| 1/37 44/37 46/37| 48/0 49/0 51/0| 44/1 48/1 50/1| 47/6 51/6 49/6| 46/11 50/11 51/11|
|
||||
|
||||
# Just for information:
|
||||
Palettes:bulding_base_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.014670 0.014670 0.014670
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:canon_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.000000 0.008711
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:canon_2
|
||||
Ns 323.999994
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.001354 0.800000 0.053320
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
# Just for information:
|
||||
Palettes:user_1
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.113655 0.510074 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
vNi 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,2 +0,0 @@
|
||||
# Blender MTL File: 'tree1.blend'
|
||||
# Material Count: 0
|
@ -1,3 +0,0 @@
|
||||
# Blender v2.92.0 OBJ File: 'tree1.blend'
|
||||
# www.blender.org
|
||||
mtllib tree1.mtl
|
File diff suppressed because one or more lines are too long
@ -1,59 +0,0 @@
|
||||
package test.atriasoft.loader3d;
|
||||
|
||||
import org.atriasoft.reggol.LogLevel;
|
||||
import org.atriasoft.reggol.Logger;
|
||||
|
||||
public class Log {
|
||||
private static final String LIB_NAME = "loader3d-test";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
private Log() {}
|
||||
|
||||
public static void print(String data) {
|
||||
if (PRINT_PRINT)
|
||||
Logger.print(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void critical(String data) {
|
||||
if (PRINT_CRITICAL)
|
||||
Logger.critical(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void error(String data) {
|
||||
if (PRINT_ERROR)
|
||||
Logger.error(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void warning(String data) {
|
||||
if (PRINT_WARNING)
|
||||
Logger.warning(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void info(String data) {
|
||||
if (PRINT_INFO)
|
||||
Logger.info(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void debug(String data) {
|
||||
if (PRINT_DEBUG)
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void verbose(String data) {
|
||||
if (PRINT_VERBOSE)
|
||||
Logger.verbose(LIB_NAME_DRAW, data);
|
||||
}
|
||||
|
||||
public static void todo(String data) {
|
||||
if (PRINT_TODO)
|
||||
Logger.todo(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
@ -24,9 +24,8 @@ public class TestBasicLog {
|
||||
@Order(1)
|
||||
public void aaFirstInitialisation() {
|
||||
Gale.init();
|
||||
GaleContextTest tmpContext = new GaleContextTest();
|
||||
final GaleContextTest tmpContext = new GaleContextTest();
|
||||
Uri.setGroup("EMF", "emf");
|
||||
Uri.setApplication(TestBasicLOGGER.class, "");
|
||||
Uri.addLibrary("test", ResourceMeshHeightMap.class, "/resources");
|
||||
|
||||
//ResourceMeshEmf tmp = new ResourceMeshEmf(new Uri("EMF", "tree1.emf", "test"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user