diff --git a/shaders/ObjectGlTexColor/frag.glsl b/shaders/ObjectGlTexColor/frag.glsl index 554ab5f..758da47 100644 --- a/shaders/ObjectGlTexColor/frag.glsl +++ b/shaders/ObjectGlTexColor/frag.glsl @@ -9,5 +9,5 @@ uniform sampler2D texture1; void main() { - FragColor = texture(texture1, texCoord) * color; + FragColor = mix(texture(texture1, texCoord), color, 0.5); } \ No newline at end of file diff --git a/src/engine/Engine.java b/src/engine/Engine.java index b0774ba..cd37062 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -151,7 +151,7 @@ public class Engine { public static void main(String[] args) { Engine engine = new Engine(); - int speed = 2 ; //vitesse déplacement Object + int speed = 10 ; //vitesse déplacement Object engine.init(); // Add objects to render @@ -205,13 +205,7 @@ public class Engine { if(engine.shouldClose()) engine.setRunning(false); } } - -// public static void input(ObjectGl token, int speed) { -// if (Input.isKeyDown(GLFW.GLFW_KEY_W))token.translate(new Vector3f ( 0.0f, speed * 5.0f, 0.0f)); -// if (Input.isKeyDown(GLFW.GLFW_KEY_A))token.translate(new Vector3f (speed *-5.0f, 0.0f, 0.0f)); -// if (Input.isKeyDown(GLFW.GLFW_KEY_S))token.translate(new Vector3f ( 0.0f,speed * -5.0f, 0.0f)); -// if (Input.isKeyDown(GLFW.GLFW_KEY_D))token.translate(new Vector3f (speed * 5.0f, 0.0f, 0.0f)); -// } + private static void gamepadInput(ObjectGl token, int speed) { ByteBuffer gamepadButton = glfwGetJoystickButtons(GLFW_JOYSTICK_1); FloatBuffer gamepadAxes = glfwGetJoystickAxes(GLFW_JOYSTICK_1); @@ -287,5 +281,4 @@ public class Engine { token.setTextureWrap(178,0,62,82); } } - } diff --git a/src/engine/object/ObjectGl.java b/src/engine/object/ObjectGl.java index f22e1ca..72edfbb 100644 --- a/src/engine/object/ObjectGl.java +++ b/src/engine/object/ObjectGl.java @@ -32,7 +32,7 @@ public class ObjectGl { } /** - * Create a rectangle shape + * Create a rectangle shape, use setTextureWrap to correctly align the texture with the model * @param z depth of your model the larger it is the more it will be "close" to the camera * @param h height of the rectangle * @param w width of the rectangle @@ -112,6 +112,7 @@ public class ObjectGl { } public void setTextureWrap(float x, float y, float w, float h){ + // TODO set sticky property this.vertexArray.swapVertexBufferObject(Primitive.createRectangle(this.zPos, w, h)); int texWidth = this.texture.getWidth(); int texHeight = this.texture.getHeight(); @@ -128,7 +129,7 @@ public class ObjectGl { this.setTextureWrap(result); } - public void setTextureWrap(float[] texture){ + private void setTextureWrap(float[] texture){ this.vertexArray.swapTextureBufferObject(texture); }