gpt4 book ai didi

java - Libgdx 混合两个蒙版?

转载 作者:行者123 更新时间:2023-11-30 03:33:33 27 4
gpt4 key购买 nike

屏幕分为两部分,我有两组纹理。

我想裁剪每个纹理组以适合屏幕的每个部分。如何使用混合(蒙版)来实现这一点?

这是我用 MSPaint 制作的图像来描述这种情况: description image

最佳答案

我不知道如何使用混合蒙版来做到这一点,但你可以通过剪刀测试来做到这一点。

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

关于java - Libgdx 混合两个蒙版?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28497466/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com