swapTexWrap added
This commit is contained in:
@ -5,6 +5,7 @@ import engine.graphics.Shader;
|
||||
import engine.graphics.Texture;
|
||||
import engine.graphics.VertexArray;
|
||||
import engine.math.Matrix4f;
|
||||
import engine.math.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -35,6 +36,23 @@ public class ObjectGlTex extends ObjectGl{
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextureWrap(float x, float y, float w, float h){
|
||||
int texWidth = this.textures.get(0).getWidth();
|
||||
int texHeight = this.textures.get(0).getHeight();
|
||||
float[] result = {
|
||||
x / texWidth, y / texHeight,
|
||||
x + w / texWidth, y / texHeight,
|
||||
x + w / texWidth, y + h / texHeight,
|
||||
x / texWidth, y + h / texHeight,
|
||||
};
|
||||
// TODO scaling object
|
||||
this.setTextureWrap(result);
|
||||
}
|
||||
|
||||
public void setTextureWrap(float[] texture){
|
||||
this.vertexArray.swapTextureBufferObject(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render() {
|
||||
this.shader.enable();
|
||||
|
Reference in New Issue
Block a user