diff --git a/samples/resources/res/cube-one.obj b/samples/resources/res/cube-one.obj index e69c3c4..6a4210b 100644 --- a/samples/resources/res/cube-one.obj +++ b/samples/resources/res/cube-one.obj @@ -2,14 +2,14 @@ # www.blender.org mtllib cube.mtl o Cube -v 0.499999 0.499999 -0.499999 -v 0.499999 -0.499999 -0.499999 -v 0.499999 0.499999 0.499999 -v 0.499999 -0.499999 0.499999 -v -0.499999 0.499999 -0.499999 -v -0.499999 -0.499999 -0.499999 -v -0.499999 0.499999 0.499999 -v -0.499999 -0.499999 0.499999 +v 0.5 0.5 -0.5 +v 0.5 -0.5 -0.5 +v 0.5 0.5 0.5 +v 0.5 -0.5 0.5 +v -0.5 0.5 -0.5 +v -0.5 -0.5 -0.5 +v -0.5 0.5 0.5 +v -0.5 -0.5 0.5 vt 0.875000 0.500000 vt 0.625000 0.750000 vt 0.625000 0.500000 diff --git a/samples/resources/testDataLoxelEngine/data/basic.vert b/samples/resources/testDataLoxelEngine/data/basic.vert index c0dcaa7..62bc6b6 100644 --- a/samples/resources/testDataLoxelEngine/data/basic.vert +++ b/samples/resources/testDataLoxelEngine/data/basic.vert @@ -6,8 +6,8 @@ precision mediump int; #endif // Input: -in vec3 in_position; -in vec2 in_textureCoords; +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec2 in_textureCoords; uniform mat4 in_matrixTransformation; uniform mat4 in_matrixProjection; uniform mat4 in_matrixView; diff --git a/samples/resources/testDataLoxelEngine/data/basicMaterial.vert b/samples/resources/testDataLoxelEngine/data/basicMaterial.vert index c75190f..a707aa7 100644 --- a/samples/resources/testDataLoxelEngine/data/basicMaterial.vert +++ b/samples/resources/testDataLoxelEngine/data/basicMaterial.vert @@ -13,9 +13,9 @@ struct Light { const int MAX_LIGHT_NUMBER = 8; // Input: -in vec3 in_position; -in vec3 in_normal; -in vec2 in_textureCoords; +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec2 in_textureCoords; +layout (location = 2) in vec3 in_normal; // 2 light for suns and other for locals ... uniform Light in_lights[MAX_LIGHT_NUMBER]; diff --git a/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java b/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java index 73d01b1..dfab758 100644 --- a/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java +++ b/samples/src/sample/atriasoft/ege/lowPoly/LowPolyApplication.java @@ -48,6 +48,12 @@ public class LowPolyApplication extends GaleApplication { @Override public void onCreate(final GaleContext context) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.env = new Environement(); setSize(new Vector2f(800, 600)); setTitle("Low Poly sample"); @@ -60,9 +66,9 @@ public class LowPolyApplication extends GaleApplication { // add a cube to show where in the light ... final Entity localLight = new Entity(this.env); - this.lightPosition = new ComponentPosition(new Transform3D(new Vector3f(-10, -10, 0))); + this.lightPosition = new ComponentPosition(new Transform3D(new Vector3f(-10, -10, 1))); localLight.addComponent(this.lightPosition); - localLight.addComponent(new ComponentStaticMesh(new Uri("RES", "cube.obj"))); + localLight.addComponent(new ComponentStaticMesh(new Uri("RES", "cube-one.obj"))); localLight.addComponent(new ComponentTexture(new Uri("RES", "grass.png"))); localLight.addComponent(new ComponentLight(new Light(new Vector3f(0, 2, 0), new Vector3f(0, 0, 0), new Vector3f(0.8f, 0.01f, 0.002f)))); localLight.addComponent(new ComponentRenderTexturedStaticMesh(new Uri("DATA", "basic.vert", "loxelEngine"), new Uri("DATA", "basic.frag", "loxelEngine"))); @@ -80,11 +86,12 @@ public class LowPolyApplication extends GaleApplication { this.materialCube = new Material(); basicTree.addComponent(new ComponentMaterial(this.materialCube)); basicTree.addComponent(new ComponentStaticMesh(new Uri("RES", "cube.obj"))); - basicTree.addComponent(new ComponentTexture(new Uri("RES", "grass.png"))); + basicTree.addComponent(new ComponentTexture(new Uri("RES", "mud.png"))); + //basicTree.addComponent(new ComponentRenderTexturedStaticMesh(new Uri("DATA", "basic.vert", "loxelEngine"), new Uri("DATA", "basic.frag", "loxelEngine"))); basicTree.addComponent(new ComponentRenderTexturedMaterialsStaticMesh(new Uri("DATA", "basicMaterial.vert", "loxelEngine"), new Uri("DATA", "basicMaterial.frag", "loxelEngine"), (EngineLight) this.env.getEngine(EngineLight.ENGINE_NAME))); this.env.addEntity(basicTree); - + for (int xxx = -10; xxx < 10; xxx++) { for (int yyy = -10; yyy < 10; yyy++) { final Entity superGrass = new Entity(this.env); diff --git a/samples/src/sample/atriasoft/ege/lowPoly/basic.frag b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basic.frag similarity index 100% rename from samples/src/sample/atriasoft/ege/lowPoly/basic.frag rename to samples/src/sample/atriasoft/ege/lowPoly/kkk_basic.frag diff --git a/samples/src/sample/atriasoft/ege/lowPoly/basic.vert b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basic.vert similarity index 81% rename from samples/src/sample/atriasoft/ege/lowPoly/basic.vert rename to samples/src/sample/atriasoft/ege/lowPoly/kkk_basic.vert index c0dcaa7..62bc6b6 100644 --- a/samples/src/sample/atriasoft/ege/lowPoly/basic.vert +++ b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basic.vert @@ -6,8 +6,8 @@ precision mediump int; #endif // Input: -in vec3 in_position; -in vec2 in_textureCoords; +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec2 in_textureCoords; uniform mat4 in_matrixTransformation; uniform mat4 in_matrixProjection; uniform mat4 in_matrixView; diff --git a/samples/src/sample/atriasoft/ege/lowPoly/basicMaterial.frag b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basicMaterial.frag similarity index 100% rename from samples/src/sample/atriasoft/ege/lowPoly/basicMaterial.frag rename to samples/src/sample/atriasoft/ege/lowPoly/kkk_basicMaterial.frag diff --git a/samples/src/sample/atriasoft/ege/lowPoly/basicMaterial.vert b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basicMaterial.vert similarity index 92% rename from samples/src/sample/atriasoft/ege/lowPoly/basicMaterial.vert rename to samples/src/sample/atriasoft/ege/lowPoly/kkk_basicMaterial.vert index c75190f..a707aa7 100644 --- a/samples/src/sample/atriasoft/ege/lowPoly/basicMaterial.vert +++ b/samples/src/sample/atriasoft/ege/lowPoly/kkk_basicMaterial.vert @@ -13,9 +13,9 @@ struct Light { const int MAX_LIGHT_NUMBER = 8; // Input: -in vec3 in_position; -in vec3 in_normal; -in vec2 in_textureCoords; +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec2 in_textureCoords; +layout (location = 2) in vec3 in_normal; // 2 light for suns and other for locals ... uniform Light in_lights[MAX_LIGHT_NUMBER]; diff --git a/src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMesh.java b/src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMesh.java index fd08f63..46d770b 100644 --- a/src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMesh.java +++ b/src/org/atriasoft/ege/components/ComponentRenderTexturedMaterialsStaticMesh.java @@ -104,8 +104,8 @@ public class ComponentRenderTexturedMaterialsStaticMesh extends ComponentRender this.program.uniformVector(this.GLlights[iii].oGLcolor, lights[iii].getColor()); this.program.uniformVector(this.GLlights[iii].oGLattenuation, lights[iii].getAttenuation()); } else { - this.program.uniformVector(this.GLlights[iii].oGLposition, new Vector3f(0, 0, 0)); - this.program.uniformVector(this.GLlights[iii].oGLcolor, new Vector3f(0, 0, 0)); + this.program.uniformVector(this.GLlights[iii].oGLposition, Vector3f.ZERO); + this.program.uniformVector(this.GLlights[iii].oGLcolor, Vector3f.ZERO); this.program.uniformVector(this.GLlights[iii].oGLattenuation, new Vector3f(1, 0, 0)); } }