[DEBUG] set systelm work again

This commit is contained in:
Edouard DUPIN 2021-05-24 00:46:28 +02:00
parent 151aba4a58
commit 5655d3e12b
9 changed files with 31 additions and 24 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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));
}
}