[DEV] commit all with new insland

This commit is contained in:
Edouard DUPIN 2022-03-20 23:39:27 +01:00
parent 57c759c0f7
commit 343934129a
5 changed files with 94 additions and 32 deletions

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
# ---> 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*

2
out/.gitignore vendored
View File

@ -1 +1,3 @@
/__pycache__/
/eclipse/

View File

@ -195,6 +195,20 @@ public class ResourceMesh extends ResourceStaticMesh {
this.listFaces.get(_layerName).face().add(tmpFace);
}
/**
* @not_in_doc
* @brief draw a colored quad (usefull for debug and test)
* @param _layerName Material and face indexing layer name
* @param _pos1 First point position
* @param _pos2 Second point position
* @param _pos3 Third point position
* @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) {
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _color, _color, _color, _color);
}
// public void draw(Matrix4f _positionMatrix) {
// draw(_positionMatrix, true, true);
// }
@ -326,20 +340,6 @@ public class ResourceMesh extends ResourceStaticMesh {
// Log.verbose("draw Mesh : " + this.name + " ( end )");
// }
/**
* @not_in_doc
* @brief draw a colored quad (usefull for debug and test)
* @param _layerName Material and face indexing layer name
* @param _pos1 First point position
* @param _pos2 Second point position
* @param _pos3 Third point position
* @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) {
addQuad(_layerName, _pos1, _pos2, _pos3, _pos4, _color, _color, _color, _color);
}
/**
* @not_in_doc
* @brief draw a colored quad (usefull for debug and test)
@ -459,6 +459,10 @@ 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) {
addTriangle(_layerName, _pos1, _pos2, _pos3, _uv1, _uv2, _uv3, Color.WHITE, Color.WHITE, Color.WHITE);
}
// public List<ege::physics::Shape> getPhysicalProperties() {
// for (auto it: this.physics) {
// if (it == null) {
@ -495,10 +499,6 @@ public class ResourceMesh extends ResourceStaticMesh {
// return this.physics;
// }
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);
}
/**
* @not_in_doc
* @brief draw a textured colored triangle (usefull for debug and test)
@ -630,6 +630,14 @@ public class ResourceMesh extends ResourceStaticMesh {
}
}
protected void calculateNormaleFaces(final List<String> materialsNames) {
this.listFacesNormal.clear();
for (String name : materialsNames) {
Log.warning("generate normal for: '" + name + "'");
calculateNormaleFaceLocal(name);
}
}
// public void createViewBox( String _materialName,float _size=1.0){
// this.normalMode = NormalMode.NONE;
// ege::viewBox::create(this.materials, this.listFaces, this.listVertex, this.listUV,
@ -646,14 +654,6 @@ public class ResourceMesh extends ResourceStaticMesh {
//private boolean loadOBJ( Uri _fileName);
//private boolean loadEMF( Uri _fileName);
protected void calculateNormaleFaces(final List<String> materialsNames) {
this.listFacesNormal.clear();
for (String name : materialsNames) {
Log.warning("generate normal for: '" + name + "'");
calculateNormaleFaceLocal(name);
}
}
void clean() {
//this.physics.clear();
this.materials.clear();
@ -678,6 +678,23 @@ public class ResourceMesh extends ResourceStaticMesh {
this.vao = ResourceVirtualArrayObject.createDynamic();
}
public void clearData() {
this.listVertex = new ArrayList<>(); //!< List of all vertex in the element
this.listUV = new ArrayList<>(); //!< List of all UV point in the mesh (for the specify texture)
this.listColor = new ArrayList<>(); //!< List of all Color point in the mesh
this.listFacesNormal = new ArrayList<>(); //!< List of all Face normal, when calculated
this.listVertexNormal = new ArrayList<>(); //!< List of all Face normal, when calculated
this.listFaces = new HashMap<>(); //!< List of all Face for the mesh
this.listFacesDrawIndex = new HashMap<>(); //!< List of all Face for the mesh
this.listPaletteFaces = new HashMap<>(); //!< List of all Face for the mesh
this.materials = new HashMap<>();
this.palettes = new HashMap<>(); // this is for information when we use external palette
this.normalMode = NormalMode.NONE;
this.mode = RenderMode.QUAD_STRIP;
this.checkNormal = false;
this.outPosition = null;
}
protected int findColorInList(final Color _color) {
for (int iii = 0; iii < this.listColor.size(); ++iii) {
if (this.listColor.get(iii) == _color) {

View File

@ -124,7 +124,7 @@ public class ResourceMeshHeightMap extends ResourceMesh {
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 + 1]);
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);

View File

@ -8,18 +8,18 @@
******************************************************************************/
package test.atriasoft.loader3d;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.atriasoft.etk.Uri;
import org.atriasoft.gale.Gale;
import org.atriasoft.gale.context.GaleContextTest;
import org.atriasoft.loader3d.resources.ResourceMeshHeightMap;
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
@TestMethodOrder(OrderAnnotation.class)
public class TestBasicLog {
@Test
@Order(1)
public void aaFirstInitialisation() {
@ -30,8 +30,8 @@ public class TestBasicLog {
Uri.addLibrary("test", ResourceMeshHeightMap.class, "/resources");
//ResourceMeshEmf tmp = new ResourceMeshEmf(new Uri("EMF", "tree1.emf", "test"));
ResourceMeshHeightMap tmp = new ResourceMeshHeightMap(new Uri("FILE", "/home/heero/dev/workspace-game/atriasoft/loader3d/out/eclipse/classes/resources/emf/tree1.emf"));
//ResourceMeshHeightMap tmp = new ResourceMeshHeightMap(new Uri("FILE", "/home/heero/dev/workspace-game/atriasoft/loader3d/out/eclipse/classes/resources/emf/tree1.emf"));
}
}