2626package org .visuals .legacy .animatium .util ;
2727
2828import com .mojang .blaze3d .opengl .GlStateManager ;
29- import com .mojang .blaze3d .opengl .GlTexture ;
30- import com .mojang .blaze3d .opengl .GlTextureView ;
3129import com .mojang .blaze3d .pipeline .BlendFunction ;
3230import com .mojang .blaze3d .pipeline .RenderPipeline ;
3331import com .mojang .blaze3d .pipeline .RenderTarget ;
3634import com .mojang .blaze3d .systems .GpuDevice ;
3735import com .mojang .blaze3d .systems .RenderSystem ;
3836import com .mojang .blaze3d .textures .FilterMode ;
37+ import com .mojang .blaze3d .textures .GpuTexture ;
38+ import com .mojang .blaze3d .textures .GpuTextureView ;
3939import com .mojang .blaze3d .textures .TextureFormat ;
4040import com .mojang .blaze3d .vertex .BufferBuilder ;
4141import com .mojang .blaze3d .vertex .ByteBufferBuilder ;
@@ -72,22 +72,24 @@ public class PanoramaRendererUtility {
7272 .withLocation (Animatium .location ("pipeline/basic_texture" ))
7373 .build ();
7474
75- private GlTextureView backgroundTextureView = null ;
75+ private GpuTextureView backgroundTextureView = null ;
7676 private float spin = 0.0F ;
7777
78+ /**
79+ * In PanoramaRenderer, call this method before ``cubeMap.render``
80+ */
7881 public void setup () {
7982 if (backgroundTextureView == null ) {
8083 final GpuDevice device = RenderSystem .getDevice ();
81- final GlTexture animatium$backgroundTexture = ( GlTexture ) device .createTexture (() -> "Background texture" , 15 , TextureFormat .RGBA8 , 256 , 256 , 1 , 1 );
82- backgroundTextureView = ( GlTextureView ) device .createTextureView (animatium$backgroundTexture );
84+ final GpuTexture animatium$backgroundTexture = device .createTexture (() -> "Background texture" , 15 , TextureFormat .RGBA8 , 256 , 256 , 1 , 1 );
85+ backgroundTextureView = device .createTextureView (animatium$backgroundTexture );
8386 }
8487
8588 GlStateManager ._viewport (0 , 0 , 256 , 256 );
8689 }
8790
8891 /**
89- * In PanoramaRenderer, before ``cubeMap.render``, set viewPort to (0, 0, 256, 256)
90- * then call this method after ``cubeMap.render``
92+ * In PanoramaRenderer, call this method after ``cubeMap.render``
9193 *
9294 * @param matrix The 2D GUI matrix
9395 * @param width Screen width
@@ -102,6 +104,11 @@ public void render(Matrix3x2f matrix, int width, int height) {
102104 renderFinalTexture (matrix , renderTarget , backgroundTextureView , width , height );
103105 }
104106
107+ /**
108+ * In PanoramaRenderer, call this method before ``cubeMap.render`` and after PanoramaRenderUtility#setup
109+ *
110+ * @param tickDelta The current game tick value
111+ */
105112 public void update (float tickDelta ) {
106113 spin += tickDelta ;
107114 }
@@ -123,7 +130,7 @@ public float getYRot() {
123130 * @param width Screen width
124131 * @param height Screen Height
125132 */
126- private void writeAndBlitBlurTexture (Matrix3x2f matrix , RenderTarget renderTarget , GlTextureView texture , int width , int height ) {
133+ private void writeAndBlitBlurTexture (Matrix3x2f matrix , RenderTarget renderTarget , GpuTextureView texture , int width , int height ) {
127134 texture .texture ().setTextureFilter (FilterMode .LINEAR , FilterMode .LINEAR , false );
128135 // Ensures enough width/height for it to not crash when window is resized
129136 if (renderTarget .width >= 256 && renderTarget .height >= 256 ) {
@@ -162,7 +169,7 @@ private void writeAndBlitBlurTexture(Matrix3x2f matrix, RenderTarget renderTarge
162169 * @param width Screen width
163170 * @param height Screen height
164171 */
165- private void renderFinalTexture (Matrix3x2f matrix , RenderTarget renderTarget , GlTextureView texture , int width , int height ) {
172+ private void renderFinalTexture (Matrix3x2f matrix , RenderTarget renderTarget , GpuTextureView texture , int width , int height ) {
166173 float aspect = 120.0F / (float ) (Math .max (width , height ));
167174 float sw = (float ) width * aspect / 256.0F ;
168175 float sh = (float ) height * aspect / 256.0F ;
0 commit comments