Compare commits

..

No commits in common. "dev" and "main" have entirely different histories.
dev ... main

35 changed files with 153 additions and 3215 deletions

25
.classpath Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/atriasoft-etk">
<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/"/>
</classpath>

43
.gitignore vendored
View File

@ -1,43 +0,0 @@
# ---> Java
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.class
*~
*.bck
build.number
/extern/
/out/
/.settings/
/junit/
/target/
/__pycache__/
*.pdfd
*.dbc
SchedulerConfig.txt
scenicView.properties
ScenariumConfig.txt
*.blend*

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?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>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,73 +0,0 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
import realog.debug as debug
import lutin.image as image
import os
import lutin.multiprocess as lutinMultiprocess
def get_type():
return "LIBRARY_DYNAMIC"
def get_desc():
return "Ewol Tool Kit"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "org"
def get_compagny_name():
return "atria-soft"
#def get_maintainer():
# return "authors.txt"
#def get_version():
# return "version.txt"
def configure(target, my_module):
my_module.add_src_file([
'src/module-info.java',
'src/org/atriasoft/loader3d/FaceIndexing.java',
'src/org/atriasoft/loader3d/model/Vertex.java',
'src/org/atriasoft/loader3d/model/MaterialBase.java',
'src/org/atriasoft/loader3d/model/Material.java',
'src/org/atriasoft/loader3d/model/PhysicShape.java',
'src/org/atriasoft/loader3d/model/ModelData.java',
'src/org/atriasoft/loader3d/model/MaterialGlId.java',
'src/org/atriasoft/loader3d/internal/LOGGER.java',
'src/org/atriasoft/loader3d/Loader3d.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticColoredMesh.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticMeshObj.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticTexturedMesh.java',
'src/org/atriasoft/loader3d/resources/ResourceMesh.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticMeshObjBynamic.java',
'src/org/atriasoft/loader3d/resources/ResourcePaletteFile.java',
'src/org/atriasoft/loader3d/resources/ResourceMeshEmf.java',
'src/org/atriasoft/loader3d/resources/ResourceStaticMesh.java',
'src/org/atriasoft/loader3d/resources/ResourceListTexturedMesh.java',
'src/org/atriasoft/loader3d/OBJFileLoader.java',
'src/org/atriasoft/loader3d/Face.java',
'src/org/atriasoft/loader3d/NormalMode.java',
])
my_module.add_path('src/', type='java')
my_module.add_depend([
'org-atriasoft-gale',
'org-atriasoft-ejson',
])
#my_module.add_path([
# 'lib/spotbugs-annotations-4.2.2.jar'
# ],
# type='java',
# export=True
#);
my_module.add_flag('java', "RELEASE_15_PREVIEW");
return True

148
pom.xml
View File

@ -1,148 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<licenses>
<license>
<name>Mozilla Public License 2.0</name>
<url>https://opensource.org/licenses/MPL-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>dev1</id>
<name>Edouard DUPIN</name>
<email>edouard.dupin@proton.me</email>
<roles>
<role>Lead Developer</role>
</roles>
</developer>
</developers>
<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.atriasoft</groupId>
<artifactId>egami</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.1.0-alpha1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<resources>
<resource>
<directory>${basedir}/src/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<!-- Create the source bundle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.1</version>
<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.2.5</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.3.0</version>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -1,129 +0,0 @@
package org.atriasoft.loader3d;
public class Face {
public static Face valueOf(String data, int offsetVertex, int offsetUV, int offsetNormal) {
while (data.length() >= 1 && data.charAt(0) == ' ') {
data = data.substring(1);
}
String[] elem = data.split(" |,|/");
if (elem.length != 6 && elem.length != 9) {
return null;
}
Face out = new Face();
if (elem.length == 9) {
out.vertex[0] = Integer.valueOf(elem[0]) + offsetVertex;
out.uv[0] = Integer.valueOf(elem[1]) + offsetUV;
out.normal[0] = Integer.valueOf(elem[2]) + offsetNormal;
out.vertex[1] = Integer.valueOf(elem[3]) + offsetVertex;
out.uv[1] = Integer.valueOf(elem[4]) + offsetUV;
out.normal[1] = Integer.valueOf(elem[5]) + offsetNormal;
out.vertex[2] = Integer.valueOf(elem[6]) + offsetVertex;
out.uv[2] = Integer.valueOf(elem[7]) + offsetUV;
out.normal[2] = Integer.valueOf(elem[8]) + offsetNormal;
} else {
out.vertex[0] = Integer.valueOf(elem[0]) + offsetVertex;
out.normal[0] = Integer.valueOf(elem[1]) + offsetNormal;
out.vertex[1] = Integer.valueOf(elem[2]) + offsetVertex;
out.normal[1] = Integer.valueOf(elem[3]) + offsetNormal;
out.vertex[2] = Integer.valueOf(elem[4]) + offsetVertex;
out.normal[2] = Integer.valueOf(elem[5]) + offsetNormal;
}
return out;
}
public byte nbElement;
public final int[] vertex = new int[3];
public final int[] uv = new int[3];
public final int[] normal = new int[3];
public final int[] color = new int[3];
public Face() {
this.nbElement = 1;
this.vertex[0] = -1;
this.vertex[1] = -1;
this.vertex[2] = -1;
this.uv[0] = -1;
this.uv[1] = -1;
this.uv[2] = -1;
this.normal[0] = -1;
this.normal[1] = -1;
this.normal[2] = -1;
this.color[0] = -1;
this.color[1] = -1;
this.color[2] = -1;
}
public Face(int _v1, int _t1, int _v2, int _t2, int _v3, int _t3) {
this.nbElement = 3;
this.vertex[0] = _v1;
this.vertex[1] = _v2;
this.vertex[2] = _v3;
this.uv[0] = _t1;
this.uv[1] = _t2;
this.uv[2] = _t3;
this.normal[0] = -1;
this.normal[1] = -1;
this.normal[2] = -1;
this.color[0] = -1;
this.color[1] = -1;
this.color[2] = -1;
}
public Face(int _v1, int _t1, int _n1, int _v2, int _t2, int _n2, int _v3, int _t3, int _n3) {
this.nbElement = 3;
this.vertex[0] = _v1;
this.vertex[1] = _v2;
this.vertex[2] = _v3;
this.uv[0] = _t1;
this.uv[1] = _t2;
this.uv[2] = _t3;
this.normal[0] = _n1;
this.normal[1] = _n2;
this.normal[2] = _n3;
this.color[0] = -1;
this.color[1] = -1;
this.color[2] = -1;
}
public void setColor(int _c1, int _c2, int _c3) {
this.color[0] = _c1;
this.color[1] = _c2;
this.color[2] = _c3;
}
public void setNormal(int _n) {
this.normal[0] = _n;
this.normal[1] = _n;
this.normal[2] = _n;
}
public void setNormal(int _n1, int _n2, int _n3) {
this.normal[0] = _n1;
this.normal[1] = _n2;
this.normal[2] = _n3;
}
public void setTexture(int _t1, int _t2, int _t3) {
this.uv[0] = _t1;
this.uv[1] = _t2;
this.uv[2] = _t3;
}
public void setVertex(int _v1) {
this.nbElement = 1;
this.vertex[0] = _v1;
}
public void setVertex(int _v1, int _v2) {
this.nbElement = 2;
this.vertex[0] = _v1;
this.vertex[1] = _v2;
}
public void setVertex(int _v1, int _v2, int _v3) {
this.nbElement = 3;
this.vertex[0] = _v1;
this.vertex[1] = _v2;
this.vertex[2] = _v3;
}
}

View File

@ -1,12 +0,0 @@
package org.atriasoft.loader3d;
import java.util.ArrayList;
import java.util.List;
public record FaceIndexing(
List<Face> face,
List<Integer> index) {
public FaceIndexing() {
this(new ArrayList<>(), new ArrayList<>());
}
}

View File

@ -1,7 +0,0 @@
package org.atriasoft.loader3d;
public enum NormalMode {
NONE,
FACE,
VERTEX,
}

View File

@ -1,155 +0,0 @@
package org.atriasoft.loader3d.model;
import java.util.List;
import org.atriasoft.egami.Image;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2i;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
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() {
}
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);
_prog.uniformVector(_glID.oglSpecularFactor(), this.specularFactor);
_prog.uniformFloat(_glID.oglShininess(), this.shininess);
if (this.texture0 != null) {
LOGGER.trace(" set texture: " + _glID.oglTexture0() + " " + this.texture0.getId());
_prog.setTexture0(_glID.oglTexture0(), this.texture0.getRendererId());
if (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())) {
LOGGER.error("Missing texture to send on the shader ...");
}
}
LOGGER.trace("draw Material: ( end )");
}
public void setRenderMode(RenderMode _val) {
switch (_val) {
case POINT:
break;
case LINE:
break;
case LINE_STRIP:
LOGGER.info("Does not support " + _val + " auto convert it in 'LINE'");
_val = RenderMode.LINE;
break;
case LINE_LOOP:
LOGGER.info("Does not support " + _val + " auto convert it in 'LINE'");
_val = RenderMode.LINE;
break;
case TRIANGLE:
break;
case TRIANGLE_STRIP:
LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'");
_val = RenderMode.TRIANGLE;
break;
case TRIANGLE_FAN:
LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'");
_val = RenderMode.TRIANGLE;
break;
case QUAD:
LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'");
_val = RenderMode.TRIANGLE;
break;
case QUAD_STRIP:
LOGGER.info("Does not support " + _val + " auto convert it in 'TRIANGLE'");
_val = RenderMode.TRIANGLE;
break;
case POLYGON:
LOGGER.error("Does not support " + _val + " try convert it in 'TRIANGLE'");
_val = RenderMode.TRIANGLE;
break;
}
this.renderMode = _val;
}
public RenderMode getRenderModeOpenGl() {
return this.renderMode;
}
public RenderMode getRenderMode() {
return this.renderMode;
}
public void setTexture0(final Uri _uri) {
final Vector2i tmpSize = new Vector2i(256, 256);
if (!_uri.isEmpty()) {
// prevent overloard error :
final ResourceTexture2 tmpCopy = this.texture0;
this.texture0 = ResourceTextureFile.create(_uri, tmpSize);
if (this.texture0 == null) {
LOGGER.error("Can not load specific texture : " + _uri);
// retreave previous texture:
this.texture0 = tmpCopy;
if (this.texture0 != null) {
return;
}
}
} else {
this.texture0 = null;
;
}
}
public void setTexture0Magic(final Vector2i _size) {
// create a simple custum texture :
this.texture0 = new ResourceTexture2();
setImageSize(_size);
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(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) {
return null;
}
return this.texture0.get();
}
// flush the data to send it at the openGl system
public void flush() {
if (this.texture0 == null) {
return;
}
this.texture0.flush();
}
public boolean haveTexture() {
return this.texture0 != null;
}
}

View File

@ -1,53 +0,0 @@
package org.atriasoft.loader3d.model;
import org.atriasoft.etk.math.Vector4f;
public class MaterialBase {
public MaterialBase() {
}
public MaterialBase(Vector4f ambientFactor, Vector4f diffuseFactor, Vector4f specularFactor, float shininess) {
this.ambientFactor = ambientFactor;
this.diffuseFactor = diffuseFactor;
this.specularFactor = specularFactor;
this.shininess = shininess;
}
@Override
public String toString() {
return "MaterialBase [ambientFactor=" + ambientFactor + ", diffuseFactor=" + diffuseFactor + ", specularFactor=" + specularFactor + ", shininess=" + shininess + "]";
}
protected Vector4f ambientFactor = Vector4f.ONE;
protected Vector4f diffuseFactor = Vector4f.ONE_W;
protected Vector4f specularFactor = Vector4f.ONE_W;
protected float shininess = 1;
public void setAmbientFactor( Vector4f _val) {
this.ambientFactor = _val;
}
public void setDiffuseFactor( Vector4f _val){
//LOGGER.error("**************** set difuse factor:" + _val);
this.diffuseFactor = _val;
}
public void setSpecularFactor( Vector4f _val){
this.specularFactor = _val;
}
public void setShininess(float _val){
this.shininess = _val;
}
public Vector4f getAmbientFactor() {
return ambientFactor;
}
public Vector4f getDiffuseFactor() {
return diffuseFactor;
}
public Vector4f getSpecularFactor() {
return specularFactor;
}
public float getShininess() {
return shininess;
}
@Override
public MaterialBase clone() {
return new MaterialBase(ambientFactor, diffuseFactor, specularFactor, shininess);
}
}

View File

@ -1,18 +0,0 @@
package org.atriasoft.loader3d.model;
import org.atriasoft.gale.resource.ResourceProgram;
public record MaterialGlId (
int oglAmbientFactor,
int oglDiffuseFactor,
int oglSpecularFactor,
int oglShininess,
int oglTexture0) {
public MaterialGlId(ResourceProgram _prog, String _baseName) {
this( _prog.getUniform(_baseName+".ambientFactor"),
_prog.getUniform(_baseName+".diffuseFactor"),
_prog.getUniform(_baseName+".specularFactor"),
_prog.getUniform(_baseName+".shininess"),
_prog.getUniform("EW_texID"));
}
}

View File

@ -1,5 +0,0 @@
package org.atriasoft.loader3d.model;
public class PhysicShape {
}

File diff suppressed because it is too large Load Diff

View File

@ -1,578 +0,0 @@
package org.atriasoft.loader3d.resources;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.math.Vector4f;
import org.atriasoft.etk.util.Dynamic;
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.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...
EMFModuleNone(0), //!< Nothing in parsing
EMFModuleMesh(1), //!<
EMFModuleMeshVertex(2), //!<
EMFModuleMeshUVMapping(3), //!<
EMFModuleMeshNormalVertex(4), //!<
EMFModuleMeshNormalFace(5), //!<
EMFModuleMeshFace(6), //!<
EMFModuleMeshFaceMaterial(7), //!<
EMFModuleMeshPhysics(8), //!<
EMFModuleMeshPhysicsNamed(9), //!<
EMFModuleMesh_END(100), //!<
EMFModuleMaterial(101), //!<
EMFModuleMaterial_END(200), //!<
EMFModulePalette(201), //!<
EMFModulePalette_END(300), //!<
EMFModulePhysics(301), //!<
EMFModulePhysicsNamed(302), //!<
EMFModulePhysics_END(400); //!<
private final int value;
emfModuleMode(final int value) {
this.value = value;
}
int getValue() {
return this.value;
}
}
// TODO : rework with string line extractor
/**
* Create a mesh from Ewol Mesh File.
* @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(final Uri fileName) throws Exception {
super(fileName);
Pattern filterPattern = null;
if (fileName.hasProperty("filter")) {
filterPattern = Pattern.compile(fileName.getProperty("filter"));
}
this.mode = RenderMode.TRIANGLE;
this.checkNormal = true;
this.normalMode = NormalMode.NONE;
final InputStream fileIOStream = Uri.getStream(fileName);
if (fileIOStream == null) {
LOGGER.error("CAn not get the file named='" + fileName + "'");
return; // TODO false;
}
final BufferedReader fileIO = new BufferedReader(new InputStreamReader(fileIOStream));
// get the fileSize ...
//int size = fileIO.size();
String inputDataLine;
final Dynamic<Integer> levelIO = new Dynamic<>(0);
// load the first line :
inputDataLine = readLine(fileIO, levelIO);
if (inputDataLine.startsWith("EMF(STRING)")) {
// parse in string mode ...
} else if (inputDataLine.startsWith("EMF(BINARY)")) {
LOGGER.error(" file binary mode is not supported now : 'EMF(BINARY)'");
return; // TODO false;
} else {
LOGGER.error(" file mode is not supported now : 'EMF(? ? ?)' = '" + inputDataLine + "'");
return; // TODO false;
}
emfModuleMode currentMode = emfModuleMode.EMFModuleNone;
LOGGER.trace("Start parsing Mesh file : " + fileName);
// mesh global param :
String currentMeshName = "";
FaceIndexing currentFaceIndexing = null;
// material global param :
String materialName = "";
Material material = null;
// physical shape:
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) {
final int level = levelIO.value;
if (level == -1) {
// detect comment;
LOGGER.warn("Detect comment");
continue;
}
if (level == 0) {
// new section ...
if (inputDataLine.startsWith("Mesh:")) {
currentMode = emfModuleMode.EMFModuleMesh;
currentMeshName = inputDataLine.substring(5);
if (filterPattern != null) {
final Matcher m = filterPattern.matcher(currentMeshName);
if (!m.matches()) {
currentMode = emfModuleMode.EMFModuleSkip;
LOGGER.trace("Parse Mesh(SKIP): " + currentMeshName);
} else {
LOGGER.trace("Parse Mesh: " + currentMeshName);
}
} else {
LOGGER.trace("Parse Mesh: " + currentMeshName);
}
offsetVertexId = this.listVertex.size();
offsetUV = this.listUV.size();
offsetFaceNormal = this.listFacesNormal.size();
offsetVertexNormal = this.listVertexNormal.size();
//LOGGER.error("new offset: " + offsetVertexId + " " + offsetUV + " " + offsetFaceNormal + " " + offsetVertexNormal);
} else if (inputDataLine.startsWith("Materials:")) {
// add previous material:
if (materialName != "" && material != null) {
if (currentMode == emfModuleMode.EMFModulePalette) {
this.palettes.put(materialName, material);
// TODO Remove this later ...
this.materials.put("palette:" + materialName, material);
} else {
this.materials.put(materialName, material);
}
materialName = "";
material = null;
}
currentMode = emfModuleMode.EMFModuleMaterial;
material = new Material();
materialName = inputDataLine.substring(10);
LOGGER.trace("Parse Material: " + materialName);
} else if (inputDataLine.startsWith("Palettes:")) {
// add previous material:
if (materialName != "" && material != null) {
if (currentMode == emfModuleMode.EMFModulePalette) {
this.palettes.put(materialName, material);
// TODO Remove this later ...
this.materials.put("palette:" + materialName, material);
} else {
this.materials.put(materialName, material);
}
materialName = "";
material = null;
}
currentMode = emfModuleMode.EMFModulePalette;
material = new Material();
materialName = inputDataLine.substring(9);
LOGGER.trace("Parse Palette: " + materialName);
} else if (inputDataLine.startsWith("Physics:")) {
currentMode = emfModuleMode.EMFModulePhysics;
LOGGER.trace("Parse global Physics: ");
} else {
currentMode = emfModuleMode.EMFModuleNone;
}
continue;
}
if (currentMode == emfModuleMode.EMFModuleSkip) {
// skip the content...
continue;
}
if (currentMode.getValue() >= emfModuleMode.EMFModuleMesh.getValue()
&& currentMode.getValue() <= emfModuleMode.EMFModuleMesh_END.getValue()) {
if (level == 1) {
if (inputDataLine.startsWith("Vertex:")) {
currentMode = emfModuleMode.EMFModuleMeshVertex;
LOGGER.trace(" Vertex ...");
} else if (inputDataLine.startsWith("UV-mapping:")) {
currentMode = emfModuleMode.EMFModuleMeshUVMapping;
haveUVMapping = true;
LOGGER.trace(" UV-mapping ...");
} else if (inputDataLine.startsWith("Normal(vertex):")) {
currentMode = emfModuleMode.EMFModuleMeshNormalVertex;
LOGGER.trace(" Normal(vertex) ...");
} else if (inputDataLine.startsWith("Normal(face):")) {
currentMode = emfModuleMode.EMFModuleMeshNormalFace;
LOGGER.trace(" Normal(face) ...");
} else if (inputDataLine.startsWith("Face:")) {
currentMode = emfModuleMode.EMFModuleMeshFace;
LOGGER.trace(" Face ...");
} else if (inputDataLine.startsWith("Physics:")) {
currentMode = emfModuleMode.EMFModuleMeshPhysics;
LOGGER.trace(" Physics ...");
} else {
LOGGER.error(" Unknow mesh property '" + inputDataLine + "'");
currentMode = emfModuleMode.EMFModuleMesh;
}
continue;
}
// level > 1
switch (currentMode) {
default:
LOGGER.error("Unknow ... " + level);
break;
case EMFModuleMeshVertex: {
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 (final String elem : inputDataLine.split("\\|")) {
final Vector2f uvMap = Vector2f.valueOf(elem);
this.listUV.add(uvMap);
}
LOGGER.trace(" " + this.listUV.size() + " coord");
break;
}
case EMFModuleMeshNormalVertex: {
this.normalMode = NormalMode.VERTEX;
for (final String elem : inputDataLine.split("\\|")) {
final Vector3f normal = Vector3f.valueOf(elem);
this.listVertexNormal.add(normal);
}
LOGGER.trace(" " + this.listVertexNormal.size() + " Normals");
break;
}
case EMFModuleMeshNormalFace: {
LOGGER.error("Change mode in face mode ...");
this.normalMode = NormalMode.FACE;
for (final String elem : inputDataLine.split("\\|")) {
final Vector3f normal = Vector3f.valueOf(elem);
this.listFacesNormal.add(normal);
}
LOGGER.trace(" " + this.listFacesNormal.size() + " Normals");
break;
}
case EMFModuleMeshFace:
case EMFModuleMeshFaceMaterial:
if (level == 2) {
final String meshFaceMaterialID = inputDataLine;
// new material selection
currentMode = emfModuleMode.EMFModuleMeshFaceMaterial;
if (inputDataLine.startsWith("palette:")) {
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 {
currentFaceIndexing = this.listFaces.get(meshFaceMaterialID);
}
LOGGER.trace(" " + inputDataLine);
} else if (currentMode == emfModuleMode.EMFModuleMeshFaceMaterial) {
if (currentFaceIndexing == null) {
LOGGER.error("Get elements without material defined ...");
continue;
}
for (final String elem : inputDataLine.split("\\|")) {
Face tmp = null;
if (this.normalMode == NormalMode.FACE) {
tmp = Face.valueOf(elem, offsetVertexId, offsetUV, offsetFaceNormal);
} else {
tmp = Face.valueOf(elem, offsetVertexId, offsetUV, offsetVertexNormal);
}
currentFaceIndexing.face().add(tmp);
}
LOGGER.trace(" " + currentFaceIndexing.face().size() + " faces");
} else {
// insert element without material ...
LOGGER.error(" try to add face without material selection ...");
}
break;
case EMFModuleMeshPhysics:
case EMFModuleMeshPhysicsNamed:
/*
if (level == 2) {
physics = ege::physics::Shape::create(inputDataLine);
if (physics == null) {
LOGGER.error("Allocation error when creating physical shape ...");
continue;
}
addPhysicElement(physics);
LOGGER.trace(" " + this.physics.size() + " " + inputDataLine);
currentMode = emfModuleMode.EMFModuleMeshPhysicsNamed;
} else if (currentMode == EMFModuleMeshPhysicsNamed) {
if (physics == null) {
LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ...");
continue;
}
if (physics.parse(&inputDataLine[0]) == false) {
LOGGER.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ...");
}
}
*/
break;
}
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 (material == null) {
LOGGER.error("material allocation error");
continue;
}
if (inputDataLine.startsWith("Ns ")) {
final float tmpVal = Float.valueOf(inputDataLine.substring(3));
material.setShininess(tmpVal);
LOGGER.trace(" Shininess " + tmpVal);
} 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 ")) {
Vector4f tmp = Vector4f.valueOf(inputDataLine.substring(3));
tmp = tmp.withW(1);
material.setDiffuseFactor(tmp);
LOGGER.error(" DiffuseFactor " + tmp);
} 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 ")) {
final float tmpVal = Float.valueOf(inputDataLine.substring(3));
// TODO : ...
LOGGER.trace(" Ni " + tmpVal);
} else if (inputDataLine.startsWith("d ")) {
final float tmpVal = Float.valueOf(inputDataLine.substring(2));
// TODO : ...
LOGGER.trace(" d " + tmpVal);
} else if (inputDataLine.startsWith("illum ")) {
final float tmpVal = Float.valueOf(inputDataLine.substring(6));
// TODO : ...
LOGGER.trace(" illum " + tmpVal);
} 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 ")) {
//RenderMode mode;
//frothis.string(mode, &inputDataLine[11]);
//material.setRenderMode(mode);
LOGGER.trace(" Texture " + this.mode);
} else {
LOGGER.error("unknow material property ... : '" + inputDataLine + "'");
}
continue;
}
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);
// if (physics == null) {
// LOGGER.error("Allocation error when creating physical shape ...");
// continue;
// }
// addPhysicElement(physics);
// LOGGER.trace(" " + this.physics.size() + " " + inputDataLine);
// currentMode = emfModuleMode.EMFModulePhysicsNamed;
} else if (currentMode == emfModuleMode.EMFModulePhysicsNamed) {
// if (physics == null) {
// LOGGER.error("Can not parse :'" + inputDataLine + "' in physical shape ...");
// continue;
// }
// if (physics.parse(&inputDataLine[0]) == false) {
// LOGGER.error("ERROR when parsing :'" + inputDataLine + "' in physical shape ...");
// }
}
continue;
}
// unknown ...
LOGGER.warn("Unknown type of line == > jump end of line ... " + inputDataLine);
}
// add last material ...
if (materialName != "" && material != null) {
if (currentMode == emfModuleMode.EMFModulePalette) {
this.palettes.put(materialName, material);
// TODO Remove this later ...
this.materials.put("palette:" + materialName, material);
} else {
this.materials.put(materialName, material);
}
materialName = "";
material = null;
}
LOGGER.trace("Stop parsing Mesh file");
try {
fileIO.close();
fileIOStream.close();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LOGGER.trace("New mesh : ");
LOGGER.trace(" nb vertex: " + this.listVertex.size());
LOGGER.trace(" nb UV: " + this.listUV.size());
LOGGER.trace(" nb Colors: " + this.listColor.size());
LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size());
LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size());
LOGGER.trace(" nb Faces: " + this.listFaces.size());
LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.size());
LOGGER.trace(" nb material: " + this.materials.size());
LOGGER.trace(" nb palettes: " + this.palettes.size());
//LOGGER.trace(" nb physic: " + this.physics.size());
if (this.listVertex.size() == 0) {
throw new Exception("unable to load the mesh file: " + fileName + " ==> no vertex available.");
}
generateVBO();
}
//private String loadNextData(int _maxData,
// BufferedReader _file) {
// return loadNextData(_maxData, _file, false, false, true);
//}
//
//private String loadNextData(int _maxData,
// BufferedReader _file,
// boolean _removeTabs,
// boolean _stopColomn,
// boolean _stopPipe) {
// StringBuffer buf = new StringBuffer();
// int outSize = 0;
// /*
// if (this.zipReadingOffset >= this.zipContent.size()) {
// element[0] = '\0';
// return null;
// }
// */
// int current = '\0';
// try {
// current = _file.read();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// while (current != '\0') {
// if( _removeTabs == false
// || buf.length() == 0) {
// buf.append((char)current);
// }
// if( current == '\n'
// || current == '\r'
// || ( current == '|'
// && _stopPipe == true)
// || ( current == ':'
// && _stopColomn == true) )
// {
// //LOGGER.debug(" plop : '" + _elementLine + "'" );
// return buf.toString();
// } else if( buf.length() == 0
// && current != '\t') {
// buf.append((char)current);
// }
// // check maxData size ...
// if (outSize >= _maxData-1) {
// return buf.toString();
// }
// try {
// current = _file.read();
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// if (outSize != 0) {
// // send last line
// return buf.toString();
// }
// return null;
//}
private String readLine(final BufferedReader _file, final Dynamic<Integer> level) {
level.value = 0;
StringBuffer buf = new StringBuffer();
boolean startLine = true;
boolean differentThanSpace = false;
boolean hasSpace = false;
int current = '\0';
try {
current = _file.read();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
while (current != '\0' && current != -1) {
if (current == '\r') {
// nothing to do ...
} else if (current == '\t' && startLine) {
level.value++;
} else if (current == '\n') {
if (!startLine) {
break;
}
} else {
startLine = false;
if (current == '#') {
// detect comment ==> remove to the end of file ==> no data availlable
if (!differentThanSpace) {
while (current != '\0' && current != '\n') {
try {
current = _file.read();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
buf = new StringBuffer();
startLine = true;
differentThanSpace = false;
hasSpace = false;
level.value = 0;
continue;
}
// end of data removed
while (current != '\0' && current != '\n') {
try {
current = _file.read();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
}
differentThanSpace = true;
if (current == '\t' || current == ' ') {
hasSpace = true;
} else {
if (hasSpace) {
buf.append(' ');
hasSpace = false;
}
buf.append((char) current);
}
}
try {
current = _file.read();
} catch (final IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
LOGGER.error("Read line: offset=" + level.value + "\n" + buf.toString());
if (buf.length() == 0) {
return null;
}
return buf.toString();
}
}

View File

@ -1,168 +0,0 @@
package org.atriasoft.loader3d.resources;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.atriasoft.etk.math.Vector3f;
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.model.Material;
public class ResourceMeshHeightMap extends ResourceMesh {
/*
* 0 1 2 3
* 0 *-------*-------*-------*
* \ OO / \ 02 / \ 04 / \
* \ / \ / \ / \
* \ / 01 \ / 03 \ / 05 \
* *-------*-------*-------*
* / \ / \ / \ /
* / \ / \ / \ /
* / \ / \ / \ /
* *-------*-------*-------*
*/
public ResourceMeshHeightMap() {
this.normalMode = NormalMode.FACE;
this.vao.setName("[VBO] of heightmap");
}
void addPalette(String key, Material mat) {
this.palettes.put(key, mat);
}
Map<String, Material> getPalette() {
return this.palettes;
}
public void udateData(float[][] heightMap, String[][] colorMap, int sizeX, int sizeY) throws Exception {
float ratio = 1;
setMode(RenderMode.TRIANGLE);
//cleanPartial();
List<String> materialsNames = new ArrayList<>();
for (int yyy = 0; yyy < sizeY - 1; yyy++) {
for (int xxx = 0; xxx < sizeX - 1; xxx++) {
if (xxx % 2 == 0) {
float offsetA = 0.5f;
{
int pos = this.listVertex.size();
Vector3f vertex1 = new Vector3f(ratio * xxx, ratio * yyy, ratio * heightMap[yyy][xxx]);
this.listVertex.add(vertex1);
Vector3f vertex2 = new Vector3f(ratio * (xxx + 1), ratio * (yyy + offsetA), ratio * heightMap[yyy][xxx + 1]);
this.listVertex.add(vertex2);
Vector3f vertex3 = new Vector3f(ratio * xxx, ratio * (yyy + 1.0f), ratio * heightMap[yyy + 1][xxx]);
this.listVertex.add(vertex3);
FaceIndexing currentFaceIndexing = null;
String meshFaceMaterialID = colorMap[yyy][xxx * 2];
if (!materialsNames.contains(meshFaceMaterialID)) {
materialsNames.add(meshFaceMaterialID);
}
if (!this.listPaletteFaces.containsKey(meshFaceMaterialID)) {
currentFaceIndexing = new FaceIndexing();
this.listPaletteFaces.put(meshFaceMaterialID, currentFaceIndexing);
} else {
currentFaceIndexing = this.listPaletteFaces.get(meshFaceMaterialID);
}
Face face = new Face();
face.setVertex(pos, pos + 1, pos + 2);
currentFaceIndexing.face().add(face);
}
{
int pos = this.listVertex.size();
Vector3f vertex1 = new Vector3f(ratio * (xxx + 1), ratio * (yyy + 1 + offsetA), ratio * heightMap[yyy + 1][xxx + 1]);
this.listVertex.add(vertex1);
Vector3f vertex2 = new Vector3f(ratio * (xxx + 1), ratio * (yyy + offsetA), ratio * heightMap[yyy][xxx + 1]);
this.listVertex.add(vertex2);
Vector3f vertex3 = new Vector3f(ratio * xxx, ratio * (yyy + 1), ratio * heightMap[yyy + 1][xxx]);
this.listVertex.add(vertex3);
FaceIndexing currentFaceIndexing = null;
String meshFaceMaterialID = colorMap[yyy][xxx * 2 + 1];
if (!materialsNames.contains(meshFaceMaterialID)) {
materialsNames.add(meshFaceMaterialID);
}
if (!this.listPaletteFaces.containsKey(meshFaceMaterialID)) {
currentFaceIndexing = new FaceIndexing();
this.listPaletteFaces.put(meshFaceMaterialID, currentFaceIndexing);
} else {
currentFaceIndexing = this.listPaletteFaces.get(meshFaceMaterialID);
}
Face face = new Face();
face.setVertex(pos, pos + 1, pos + 2);
currentFaceIndexing.face().add(face);
}
} else {
float offsetA = 0.5f;
{
int pos = this.listVertex.size();
Vector3f vertex1 = new Vector3f(ratio * xxx, ratio * (yyy + offsetA), ratio * heightMap[yyy][xxx]);
this.listVertex.add(vertex1);
Vector3f vertex2 = new Vector3f(ratio * (xxx + 1), ratio * yyy, ratio * heightMap[yyy][xxx + 1]);
this.listVertex.add(vertex2);
Vector3f vertex3 = new Vector3f(ratio * (xxx + 1), ratio * (yyy + 1.0f), ratio * heightMap[yyy + 1][xxx + 1]);
this.listVertex.add(vertex3);
FaceIndexing currentFaceIndexing = null;
String meshFaceMaterialID = colorMap[yyy][xxx * 2];
if (!materialsNames.contains(meshFaceMaterialID)) {
materialsNames.add(meshFaceMaterialID);
}
if (!this.listPaletteFaces.containsKey(meshFaceMaterialID)) {
currentFaceIndexing = new FaceIndexing();
this.listPaletteFaces.put(meshFaceMaterialID, currentFaceIndexing);
} else {
currentFaceIndexing = this.listPaletteFaces.get(meshFaceMaterialID);
}
Face face = new Face();
face.setVertex(pos, pos + 1, pos + 2);
currentFaceIndexing.face().add(face);
}
{
int pos = this.listVertex.size();
Vector3f vertex1 = new Vector3f(ratio * (xxx + 1), ratio * (yyy + 1), ratio * heightMap[yyy + 1][xxx + 1]);
this.listVertex.add(vertex1);
Vector3f vertex2 = new Vector3f(ratio * (xxx), ratio * (yyy + 1 + offsetA), ratio * heightMap[yyy + 1][xxx]);
this.listVertex.add(vertex2);
Vector3f vertex3 = new Vector3f(ratio * xxx, ratio * (yyy + offsetA), ratio * heightMap[yyy][xxx]);
this.listVertex.add(vertex3);
FaceIndexing currentFaceIndexing = null;
String meshFaceMaterialID = colorMap[yyy][xxx * 2 + 1];
if (!materialsNames.contains(meshFaceMaterialID)) {
materialsNames.add(meshFaceMaterialID);
}
if (!this.listPaletteFaces.containsKey(meshFaceMaterialID)) {
currentFaceIndexing = new FaceIndexing();
this.listPaletteFaces.put(meshFaceMaterialID, currentFaceIndexing);
} else {
currentFaceIndexing = this.listPaletteFaces.get(meshFaceMaterialID);
}
Face face = new Face();
face.setVertex(pos, pos + 1, pos + 2);
currentFaceIndexing.face().add(face);
}
}
}
}
//LOGGER.warn("this.listVertex: " + this.listVertex.size());
//LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size());
calculateNormaleFaces(materialsNames);
//LOGGER.warn("this.listVertex: " + this.listVertex.size());
//LOGGER.warn("this.listFacesNormal: " + this.listFacesNormal.size());
// LOGGER.trace("New heightmap mesh : ");
// LOGGER.trace(" nb vertex: " + this.listVertex.size());
// LOGGER.trace(" nb UV: " + this.listUV.size());
// LOGGER.trace(" nb Colors: " + this.listColor.size());
// LOGGER.trace(" nb Normal face: " + this.listFacesNormal.size());
// LOGGER.trace(" nb Normal vertex: " + this.listVertexNormal.size());
// LOGGER.trace(" nb Faces: " + this.listFaces.size());
// LOGGER.trace(" nb Faces (palette): " + this.listPaletteFaces.get(0).face().size());
// LOGGER.trace(" nb material: " + this.materials.size());
// LOGGER.trace(" nb palettes: " + this.palettes.size());
generateVBO();
}
}

View File

@ -1,250 +0,0 @@
package org.atriasoft.loader3d.resources;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
import org.atriasoft.egami.ImageByte;
import org.atriasoft.egami.ImageByteRGBA;
import org.atriasoft.ejson.Ejson;
import org.atriasoft.ejson.model.JsonNode;
import org.atriasoft.ejson.model.JsonObject;
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.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";
private static final String DEFINE_DEFAULT = "default";
private static final String DEFINE_OVER = "over";
private static final String DEFINE_SELECT = "select";
private static final String DEFINE_SHINESS = "Ns";
private static final String DEFINE_AMBIANT_FACTOR = "Ka";
private static final String DEFINE_SPECULAR_FACTOR = "Ks";
private static final String DEFINE_DIFFUSE_FACTOR = "Kd";
private static final List<String> PALETTE_ELEMENTS = new ArrayList<>(ResourcePaletteFile.COUNT_MAX_COLOR_PALETTE);
static {
ResourcePaletteFile.PALETTE_ELEMENTS.add("unknown");
}
public static synchronized int getColorId(final String color) {
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;
}
public static int getColorMax() {
return ResourcePaletteFile.COUNT_MAX_COLOR_PALETTE;
}
public static int getHeight() {
return ResourcePaletteFile.COUNT_HEIGHT_PALETTE;
}
private Runnable updatePostAction = null;
public static ResourcePaletteFile create(final Uri uri) {
LOGGER.trace("KEEP: ColorFile: " + uri);
final ResourcePaletteFile object = null;
final Resource object2 = Resource.getManager().localKeep(uri);
if (object2 != null) {
if (object2 instanceof ResourcePaletteFile) {
return (ResourcePaletteFile) object2;
}
LOGGER.error("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
System.exit(-1);
return null;
}
LOGGER.debug("CREATE: FontFreeType: " + uri);
// need to crate a new one ...
return new ResourcePaletteFile(uri);
}
private final Color errorColor = Color.ORANGE;
private MaterialBase base = new MaterialBase();
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
* @param uri Name of the file needed
*/
public ResourcePaletteFile(final Uri uri) {
super(uri);
LOGGER.debug("CF : load '" + uri + "'");
reload();
// LOGGER.debug("List of all color : " + this.list.keySet());
}
@Override
public void cleanUp() {
}
/**
* Get the associated color of the ID.
* @param id Id of the color.
* @return The requested color.
*/
public Color get(final String id) {
if (id == null) {
return this.errorColor;
}
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) {
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);
}
if (node.exist(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_AMBIANT_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1);
LOGGER.trace(" AmbientFactor " + tmp);
element.setAmbientFactor(tmp);
}
if (node.exist(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_DIFFUSE_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1);
LOGGER.trace(" DiffuseFactor " + tmp);
element.setDiffuseFactor(tmp);
}
if (node.exist(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR)) {
final String data = node.get(ResourcePaletteFile.DEFINE_SPECULAR_FACTOR).toJsonString().getValue();
Vector4f tmp = Vector4f.valueOf(data);
tmp = tmp.withW(1);
LOGGER.trace(" SpecularFactor " + tmp);
element.setSpecularFactor(tmp);
}
}
} catch (final Exception e) {
LOGGER.error("chach exception in parsing config file... " + e.getMessage());
e.printStackTrace();
}
return element;
}
@Override
public synchronized void reload() {
this.listNormal.clear();
this.base = new MaterialBase();
try {
final JsonObject out = Ejson.parse(Uri.valueOf(this.name)).toJsonObject();
final JsonObject baseDefault = out.get(ResourcePaletteFile.DEFINE_DEFAULT).toJsonObject();
this.base = configMaterial(baseDefault, this.base);
final JsonObject baseObject = out.get(ResourcePaletteFile.DEFINE_PALETTE).toJsonObject();
if (baseObject == null) {
LOGGER.error("Can not get basic object : 'palette' in file:" + this.name);
Ejson.display(out);
return;
}
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)) {
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)) {
final MaterialBase matSelect = configMaterial(
nodeMaterial.get(ResourcePaletteFile.DEFINE_SELECT).toJsonObject(), mat);
this.listSelect.put(it.getKey(), matSelect);
} else {
this.listSelect.put(it.getKey(), mat);
}
}
} catch (final Exception e) {
LOGGER.error("chach exception in parsing config file... " + e.getMessage());
e.printStackTrace();
}
if (this.updatePostAction != null) {
LOGGER.warn("Detect auto_update on onthe element ...");
this.updatePostAction.run();
LOGGER.warn("Detect auto_update on onthe element ... (DONE)");
}
}
public void onUpdate(final Runnable object) {
this.updatePostAction = object;
}
public ImageByte getImageByte() {
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++) {
out.setColorFloat(xxx, yyy, 1, 1, 1, 1);
//out.setColorFloat(xxx, yyy, val, val + 0.125f, val + 0.85f, 1);
//val += 0.01f;
}
}
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);
putColor(id, 1, out, matOver);
putColor(id, 2, out, matSelect);
putColor(id, 3, out, mat);
// Note: this model permit to have interpolation of color normal <-> over ; normal <-> select ; over <-> select
}
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);
}
}

10
src/module-info.java Normal file
View File

@ -0,0 +1,10 @@
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;
}

View File

@ -11,20 +11,12 @@ 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 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,
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++) {
@ -46,7 +38,7 @@ public class OBJFileLoader {
}
return furthestPoint;
}
private static int[] convertIndicesListToArray(final List<Integer> indices) {
final int[] indicesArray = new int[indices.size()];
for (int i = 0; i < indicesArray.length; i++) {
@ -54,20 +46,14 @@ 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);
@ -76,14 +62,14 @@ public class OBJFileLoader {
vertices.add(duplicateVertex);
indices.add(duplicateVertex.getIndex());
}
}
}
public static ModelData loadOBJ(final Uri objFileName) {
final InputStream stream = Uri.getStream(objFileName);
if (stream == null) {
LOGGER.error("Can not read file: " + objFileName + " ==> load OBJ");
Log.error("Can not read file: " + objFileName + " ==> load OBJ");
return null;
}
/*
@ -100,7 +86,7 @@ public class OBJFileLoader {
try {
reader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
} catch (final UnsupportedEncodingException e1) {
LOGGER.error("Error in loading file: " + objFileName + " ==> load OBJ");
Log.error("Error in loading file: " + objFileName + " ==> load OBJ");
e1.printStackTrace();
return null;
}
@ -114,20 +100,17 @@ 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;
@ -151,13 +134,12 @@ 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;
}
private static void processVertex(final String[] vertex, final List<Vertex> vertices, final List<Integer> indices) {
final int index = Integer.parseInt(vertex[0]) - 1;
final Vertex currentVertex = vertices.get(index);
@ -171,7 +153,7 @@ public class OBJFileLoader {
OBJFileLoader.dealWithAlreadyProcessedVertex(currentVertex, textureIndex, normalIndex, indices, vertices);
}
}
private static void removeUnusedVertices(final List<Vertex> vertices) {
for (final Vertex vertex : vertices) {
if (!vertex.isSet()) {
@ -180,5 +162,5 @@ public class OBJFileLoader {
}
}
}
}

View File

@ -0,0 +1,68 @@
package org.atriasoft.loader3d.internal;
import io.scenarium.logger.LogLevel;
import io.scenarium.logger.Logger;
public class Log {
private static final String LIB_NAME = "loader3d";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.DEBUG);
private static final boolean PRINT_ERROR = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.ERROR);
private static final boolean PRINT_INFO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.INFO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.VERBOSE);
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
public static void critical(final String data) {
if (Log.PRINT_CRITICAL) {
Logger.critical(Log.LIB_NAME_DRAW, data);
}
}
public static void debug(final String data) {
if (Log.PRINT_DEBUG) {
Logger.debug(Log.LIB_NAME_DRAW, data);
}
}
public static void error(final String data) {
if (Log.PRINT_ERROR) {
Logger.error(Log.LIB_NAME_DRAW, data);
}
}
public static void info(final String data) {
if (Log.PRINT_INFO) {
Logger.info(Log.LIB_NAME_DRAW, data);
}
}
public static void print(final String data) {
if (Log.PRINT_PRINT) {
Logger.print(Log.LIB_NAME_DRAW, data);
}
}
public static void todo(final String data) {
if (Log.PRINT_TODO) {
Logger.todo(Log.LIB_NAME_DRAW, data);
}
}
public static void verbose(final String data) {
if (Log.PRINT_VERBOSE) {
Logger.verbose(Log.LIB_NAME_DRAW, data);
}
}
public static void warning(final String data) {
if (Log.PRINT_WARNING) {
Logger.warning(Log.LIB_NAME_DRAW, data);
}
}
private Log() {}
}

View File

@ -14,6 +14,7 @@ public class ResourceStaticColoredMesh extends ResourceStaticMesh {
protected float[] vertices = null;
protected float[] colors = null;
protected float[] normals = null;
protected int[] indices = null;
protected ResourceStaticColoredMesh(final float[] vertices, final float[] colors, final float[] normals, final int[] indices, final RenderMode mode) {

View File

@ -6,7 +6,7 @@ import org.atriasoft.gale.resource.Resource;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
public class ResourceStaticMesh extends Resource {
protected RenderMode mode = RenderMode.QUAD_STRIP;
protected RenderMode mode = RenderMode.quadStrip;
protected ResourceVirtualArrayObject vao = null;
protected ResourceStaticMesh(final RenderMode mode) {
@ -39,12 +39,6 @@ public class ResourceStaticMesh extends Resource {
}
this.vao.render(this.mode);
}
public void renderArrays() {
if (this.vao == null) {
return;
}
this.vao.renderArrays(this.mode);
}
public void setMode(final RenderMode mode) {
this.mode = mode;
@ -56,12 +50,5 @@ public class ResourceStaticMesh extends Resource {
}
this.vao.unBindForRendering();
}
public void render(final int start, final int stop) {
if (this.vao == null) {
return;
}
this.vao.render(this.mode, start, stop);
}
}

View File

@ -4,19 +4,16 @@ 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;
final String name = uriObj.getValue();
if (name.isEmpty() || name.equals("---")) {
LOGGER.error("Can not create a shader without a filaname");
Log.error("Can not create a shader without a filaname");
return null;
}
resource2 = Resource.getManager().localKeep(name);
@ -25,8 +22,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
resource2.keep();
return (ResourceStaticMeshObj) resource2;
}
LOGGER.error("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
System.exit(-1);
Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
return null;
}
resource = new ResourceStaticMeshObj(uriObj);
@ -46,7 +42,7 @@ public class ResourceStaticMeshObj extends ResourceStaticTexturedMesh {
this.textureCoords = data.textureCoords();
this.normals = data.normals();
this.indices = data.indices();
this.mode = RenderMode.TRIANGLE;
this.mode = RenderMode.triangle;
flush();
}

View File

@ -3,36 +3,33 @@ package org.atriasoft.loader3d.resources;
import org.atriasoft.etk.Uri;
import org.atriasoft.gale.resource.Resource;
import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.atriasoft.loader3d.internal.Log;
public class ResourceStaticMeshObjDynamic extends ResourceStaticMeshObj {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceStaticMeshObjDynamic.class);
public class ResourceStaticMeshObjBynamic extends ResourceStaticMeshObj {
public static ResourceStaticMeshObjDynamic create(final Uri uriObj) {
ResourceStaticMeshObjDynamic resource;
public static ResourceStaticMeshObjBynamic create(final Uri uriObj) {
ResourceStaticMeshObjBynamic resource;
Resource resource2;
final String name = uriObj.getValue();
if (name.isEmpty() || name.equals("---")) {
LOGGER.error("Can not create a shader without a filaname");
Log.error("Can not create a shader without a filaname");
return null;
}
resource2 = Resource.getManager().localKeep(name);
if (resource2 != null) {
if (resource2 instanceof final ResourceStaticMeshObjDynamic tmpp) {
if (resource2 instanceof ResourceStaticMeshObjBynamic tmpp) {
resource2.keep();
return tmpp;
}
LOGGER.error("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
System.exit(-1);
Log.critical("Request resource file : '" + name + "' With the wrong type (dynamic cast error)");
return null;
}
resource = new ResourceStaticMeshObjDynamic(uriObj);
resource = new ResourceStaticMeshObjBynamic(uriObj);
Resource.getManager().localAdd(resource);
return resource;
}
protected ResourceStaticMeshObjDynamic(final Uri uriFile) {
protected ResourceStaticMeshObjBynamic(final Uri uriFile) {
super(uriFile);
}

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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

File diff suppressed because one or more lines are too long

View File

@ -1,2 +0,0 @@
# Blender MTL File: 'tree1.blend'
# Material Count: 0

View File

@ -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