我目前拥有的:在给定矩形的宽度和高度以及纹理的比例因子的情况下生成纹理坐标。这很好:
vertices = new float[] {
0, 0, 0, this.height / (this.texture.height * this.texScaleHeight),
this.width, 0, this.width / (this.texture.width * this.texScaleWidth), height / (this.texture.height * this.texScaleHeight),
this.width, this.height, this.width / (this.texture.width * this.texScaleWidth), 0,
0, this.height, 0, 0 };
我现在想要做的是,一些具有不同位置(即彼此相邻)的矩形具有无缝的纹理渐变。我尝试了以下但没有好的结果。
vertices = new float[] {
0, 0, -this.getPosition().x * this.texScaleWidth, this.height / (this.texture.height * this.texScaleHeight) -this.getPosition().y * this.texScaleHeight,
this.width, 0, this.width / (this.texture.width * this.texScaleWidth) -this.getPosition().x * this.texScaleWidth, height / (this.texture.height * this.texScaleHeight)-this.getPosition().y * this.texScaleHeight,
this.width, this.height, this.width / (this.texture.width * this.texScaleWidth) -this.getPosition().x * this.texScaleWidth, -this.getPosition().y * this.texScaleHeight,
0, this.height, -this.getPosition().x * this.texScaleWidth, -this.getPosition().y * this.texScaleHeight };
我怎样才能实现纹理“与世界对齐”而不是它们所在的矩形?