나는 카메라가 회전하지 않을 때 잘 작동하고 내 시차 배경시차 XY 및 회전 - 타일 계산
pGLState.pushModelViewGLMatrix();
final float cameraWidth = pCamera.getWidth();
final float cameraHeight = pCamera.getHeight();
final float shapeWidthScaled = this.mShape.getWidthScaled();
final float shapeHeightScaled = this.mShape.getHeightScaled();
//reposition
float baseOffsetX = (pParallaxValueX * this.mParallaxFactorX);
if (this.mRepeatX) {
baseOffsetX = baseOffsetX % shapeWidthScaled;
while(baseOffsetX > 0) {
baseOffsetX -= shapeWidthScaled;
}
}
float baseOffsetY = (pParallaxValueY * this.mParallaxFactorY);
if (this.mRepeatY) {
baseOffsetY = baseOffsetY % shapeHeightScaled;
while(baseOffsetY > 0) {
baseOffsetY -= shapeHeightScaled;
}
}
//draw
pGLState.translateModelViewGLMatrixf(baseOffsetX, baseOffsetY, 0);
float currentMaxX = baseOffsetX;
float currentMaxY = baseOffsetY;
do {
//rows
this.mShape.onDraw(pGLState, pCamera);
if (this.mRepeatY) {
currentMaxY = baseOffsetY;
//columns
do {
pGLState.translateModelViewGLMatrixf(0, shapeHeightScaled, 0);
currentMaxY += shapeHeightScaled;
this.mShape.onDraw(pGLState, pCamera);
} while(currentMaxY < cameraHeight);
//end columns
pGLState.translateModelViewGLMatrixf(0, -currentMaxY + baseOffsetY, 0);
}
pGLState.translateModelViewGLMatrixf(shapeWidthScaled, 0, 0);
currentMaxX += shapeWidthScaled;
} while (this.mRepeatX && currentMaxX < cameraWidth);
//end rows
pGLState.popModelViewGLMatrix();
모든 도면이 코드가 있습니다.
회전 할 때, 타일 (this.mShape
)을 4 번 더 (위, 아래, 왼쪽 및 오른쪽) 그려야한다고 생각하므로 모서리에 빈 공간이 표시되지 않습니다. 예를 들어, 회전이 45도이지만이 작업을 수행하는 방법을 알 수 없습니다.
문제를 설명하는 이미지를 올릴 수 있습니까? 나는 네가 의미하는 바를 알고 있다고 생각하지만, 나는 단지 확신하고 싶다. – Tim