Libgdx 混合两个面具?
Libgdx blending two masks?
屏幕被分成两部分,我有两组纹理。
我想裁剪每个纹理组以适合屏幕的每个部分。
如何使用混合(蒙版)实现这一点?
这是我用 MSPaint 制作的一张图片来描述情况:
我不知道如何用混合蒙版做,但你可以用剪刀测试做。
private Rectangle leftSide;
private Rectangle rightSide;
public void resize (int width, int height) {
//...
leftSide = new Rectangle(0, 0, width/2, height);
rightSide = new Rectangle(width/2, 0, width/2, height);
}
public void render() {
//...
spriteBatch.begin();
//draw background
spriteBatch.flush();
ScissorStack.pushScissors(leftSide);
//draw left side stuff that is cropped
spriteBatch.flush();
ScissorStack.popScissors();
ScissorStack.pushScissors(rightSide);
//draw right side stuff that is cropped
spriteBatch.flush();
ScissorStack.popScissors();
//draw any other stuff that is not cropped on top of everything else
spriteBatch.end();
}
屏幕被分成两部分,我有两组纹理。
我想裁剪每个纹理组以适合屏幕的每个部分。 如何使用混合(蒙版)实现这一点?
这是我用 MSPaint 制作的一张图片来描述情况:
我不知道如何用混合蒙版做,但你可以用剪刀测试做。
private Rectangle leftSide;
private Rectangle rightSide;
public void resize (int width, int height) {
//...
leftSide = new Rectangle(0, 0, width/2, height);
rightSide = new Rectangle(width/2, 0, width/2, height);
}
public void render() {
//...
spriteBatch.begin();
//draw background
spriteBatch.flush();
ScissorStack.pushScissors(leftSide);
//draw left side stuff that is cropped
spriteBatch.flush();
ScissorStack.popScissors();
ScissorStack.pushScissors(rightSide);
//draw right side stuff that is cropped
spriteBatch.flush();
ScissorStack.popScissors();
//draw any other stuff that is not cropped on top of everything else
spriteBatch.end();
}