@@ -71,7 +71,7 @@ public class PanoramaRendererUtility {
7171 * In PanoramaRenderer, before ``cubeMap.render``, set viewPort to (0, 0, 256, 256)
7272 * then call this method after ``cubeMap.render``
7373 *
74- * @param matrix The GUI matrix
74+ * @param matrix The 2D GUI matrix
7575 * @param textureView The texture we are drawing to
7676 * @param width Screen width
7777 * @param height Screen Height
@@ -82,7 +82,7 @@ public void render(Matrix3x2f matrix, GlTextureView textureView, int width, int
8282 writeAndBlitBlurTexture (matrix , renderTarget , textureView , width , height );
8383 }
8484
85- renderFinalTexture (renderTarget , textureView , width , height );
85+ renderFinalTexture (matrix , renderTarget , textureView , width , height );
8686 }
8787
8888 private void writeAndBlitBlurTexture (Matrix3x2f matrix , RenderTarget renderTarget , GlTextureView texture , int width , int height ) {
@@ -118,23 +118,24 @@ private void writeAndBlitBlurTexture(Matrix3x2f matrix, RenderTarget renderTarge
118118 /**
119119 * Renders the final full image to the screen
120120 *
121+ * @param matrix The 2D GUI matrix
121122 * @param renderTarget The render target we are drawing to
122123 * @param texture The temporary texture
123124 * @param width Screen width
124125 * @param height Screen height
125126 */
126- private void renderFinalTexture (RenderTarget renderTarget , GlTextureView texture , int width , int height ) {
127+ private void renderFinalTexture (Matrix3x2f matrix , RenderTarget renderTarget , GlTextureView texture , int width , int height ) {
127128 float aspect = 120.0F / (float ) (Math .max (width , height ));
128129 float sw = (float ) width * aspect / 256.0F ;
129130 float sh = (float ) height * aspect / 256.0F ;
130131 final int color = ARGB .white (1.0F );
131132 final RenderPipeline pipeline = BASIC_TEXTURED_PIPELINE ;
132133 try (ByteBufferBuilder byteBufferBuilder = new ByteBufferBuilder (pipeline .getVertexFormat ().getVertexSize () * 4 )) {
133134 final BufferBuilder bufferBuilder = new BufferBuilder (byteBufferBuilder , pipeline .getVertexFormatMode (), pipeline .getVertexFormat ());
134- bufferBuilder .addVertex ( 0.0F , height , 0.0F ).setUv (0.5F - sh , 0.5F + sw ).setColor (color );
135- bufferBuilder .addVertex ( width , height , 0.0F ).setUv (0.5F - sh , 0.5F - sw ).setColor (color );
136- bufferBuilder .addVertex ( width , 0.0F , 0.0F ).setUv (0.5F + sh , 0.5F - sw ).setColor (color );
137- bufferBuilder .addVertex ( 0.0F , 0.0F , 0.0F ).setUv (0.5F + sh , 0.5F + sw ).setColor (color );
135+ bufferBuilder .addVertexWith2DPose ( matrix , 0.0F , height ).setUv (0.5F - sh , 0.5F + sw ).setColor (color );
136+ bufferBuilder .addVertexWith2DPose ( matrix , width , height ).setUv (0.5F - sh , 0.5F - sw ).setColor (color );
137+ bufferBuilder .addVertexWith2DPose ( matrix , width , 0.0F ).setUv (0.5F + sh , 0.5F - sw ).setColor (color );
138+ bufferBuilder .addVertexWith2DPose ( matrix , 0.0F , 0.0F ).setUv (0.5F + sh , 0.5F + sw ).setColor (color );
138139 RenderUtils .drawBuffer (pipeline , renderTarget , bufferBuilder .buildOrThrow (), (pass ) -> pass .bindSampler ("Sampler0" , texture ));
139140 }
140141 }
0 commit comments