@@ -63,6 +63,7 @@ public class Dome extends PGraphics3D {
6363
6464 protected boolean cubeMapInit = false ;
6565 protected int cubeMapSize = 1024 ;
66+ protected boolean cubeMapSizeNeedsManualSetting = true ;
6667
6768 protected boolean renderDomeQuad = true ;
6869 protected int currentFace ;
@@ -71,6 +72,7 @@ public class Dome extends PGraphics3D {
7172 protected boolean requestedRenderDome ;
7273
7374 private boolean [] faceDraw = {true , true , true , true , true , false };
75+ private String [] faceNames = {"X+" , "X-" , "Y+" , "Y-" , "Z+" , "Z-" };
7476
7577 protected float domeLeft , domeRight , domeTop , domeBottom ;
7678 protected float domeDX , domeDY , domeDZ ;
@@ -332,22 +334,25 @@ private void initDomeQuad() {
332334 if (cubeMapQuadShader == null ) {
333335 cubeMapQuadShader = parent .loadShader ("cubeMapQuadFrag.glsl" , "cubeMapQuadVert.glsl" );
334336 cubeMapQuadShader .set ("cubemap" , 1 );
335- setDomeAperture (1f );
337+ setDomeAperture (domeAperture );
336338 }
337339
338340 if (!cubeMapInit ) {
339341 PGL pgl = beginPGL ();
340342
341- cubeMapSize = PApplet .min (nextPowerOfTwo (resolution ), maxTextureSize );
342-
343+ if (cubeMapSizeNeedsManualSetting ) {
344+ cubeMapSize = PApplet .min (nextPowerOfTwo (resolution ), maxTextureSize );
345+ cubeMapSizeNeedsManualSetting = false ;
346+ }
347+
343348 cubeMapTex = IntBuffer .allocate (1 );
344349 pgl .genTextures (1 , cubeMapTex );
345350 pgl .bindTexture (PGL .TEXTURE_CUBE_MAP , cubeMapTex .get (0 ));
346351 pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_WRAP_S , PGL .CLAMP_TO_EDGE );
347352 pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_WRAP_T , PGL .CLAMP_TO_EDGE );
348353 pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_WRAP_R , PGL .CLAMP_TO_EDGE );
349- pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_MIN_FILTER , PGL .NEAREST );
350- pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_MAG_FILTER , PGL .NEAREST );
354+ pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_MIN_FILTER , PGL .LINEAR );
355+ pgl .texParameteri (PGL .TEXTURE_CUBE_MAP , PGL .TEXTURE_MAG_FILTER , PGL .LINEAR );
351356 for (int i = PGL .TEXTURE_CUBE_MAP_POSITIVE_X ; i < PGL .TEXTURE_CUBE_MAP_POSITIVE_X + 6 ; i ++) {
352357 pgl .texImage2D (i , 0 , PGL .RGBA8 , cubeMapSize , cubeMapSize , 0 , PGL .RGBA , PGL .UNSIGNED_BYTE , null );
353358 }
@@ -456,11 +461,11 @@ protected void setDomeAperture(float theAperture) {
456461 if (cubeMapQuadShader != null ) {
457462 try {
458463 cubeMapQuadShader .set ("aperture" , theAperture );
459- domeAperture = theAperture ;
460464 } catch (Exception e ) {
461465 e .printStackTrace ();
462466 }
463467 }
468+ domeAperture = theAperture ;
464469 }
465470
466471 protected boolean getFaceDraw (int theFace ) {
@@ -473,9 +478,16 @@ protected boolean getFaceDraw(int theFace) {
473478 protected void setFaceDraw (int theFace , boolean doDraw ) {
474479 if (theFace >= 0 && theFace <= faceDraw .length ) {
475480 faceDraw [theFace ] = doDraw ;
476- System .out .println ("face no. " + theFace + " rendering " + doDraw );
481+ System .out .println ("Face no. " + theFace + " (" + faceNames [ theFace ] + ") rendering " + doDraw );
477482 }
478483 }
484+
485+ protected void setCubemapSize (int theSize ) {
486+ cubeMapSize = PApplet .min (nextPowerOfTwo (theSize ),maxTextureSize );
487+
488+ System .out .println ("Setting cubemap size to: " + cubeMapSize );
489+ cubeMapInit = false ;
490+ }
479491
480492 private void welcome () {
481493 System .out .println ("##library.name## ##library.prettyVersion## by ##author##" );
0 commit comments