[x3d-public] CubeMap Textures in X3DJSAIL. Breaking bug! Looks like a problem with handleFieldSynonyms().

John Carlson yottzumm at gmail.com
Thu Jun 17 14:50:22 PDT 2021


Oops, there was an issue with the good code, bottomi versus bottom

On 6/17/21 9:10 AM, John Carlson wrote:
>  A workaround would help,  like compilation of X3DJSAIL without code 
> generation.
>
> John
>
> On Thu, Jun 17, 2021 at 2:06 AM John Carlson <yottzumm at gmail.com 
> <mailto:yottzumm at gmail.com>> wrote:
>
>     Bad code in X3DJSAIL is producing bad JSON and  XML output.
>
>     The enclosed code (second block below) has not been
>     updated/reflected in
>     X3DJSAIL, ComposedCubeMapTexture.java.  This causes problems when
>     emitting JSON from X3DJSAIL.  Here is what the code currently
>     looks like
>     for comparison (first block below), obviously there is an error here.
>
>     Please fix this ASAP because I cannot generate good JSON or XML from
>     X3DJSAIL for my ComposedCubeMapTexture's.  The X3dToJson.xslt is
>     not the
>     problem.   The problem is in specifying the containerField for the
>     texture for each of 6 textures.  The intermediate XML shows the
>     problem:
>     6 textures, all pointed at the back containerField.
>
>     It's about time to throw up my hands and get rid of my test cases
>     doing
>     this, and go back to PlayCanvas.
>
>     Or perhaps I should just experiment with PBR.  Hmm.
>
>     BAD CURRENT CODE
>     ==============================================================================================================================================
>
>          private void handleFieldSynonyms()
>          {
>              String correctedContainerField;
>              if (hasAncestorX3D() &&
>     findAncestorX3D().getVersion().startsWith("3"))
>                   correctedContainerField = "back";
>              else correctedContainerField = "backTexture";
>
>              if      (getBackTexture() != null)
>                       ((X3DConcreteNode)
>     getBackTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getBackTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getBackTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>
>              if      (getBottomTexture() != null)
>                       ((X3DConcreteNode)
>     getBottomTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getBottomTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getBottomTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>
>              if      (getFrontTexture() != null)
>                       ((X3DConcreteNode)
>     getFrontTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getFrontTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getFrontTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>
>              if      (getLeftTexture() != null)
>                       ((X3DConcreteNode)
>     getLeftTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getLeftTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getLeftTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>
>              if      (getRightTexture() != null)
>                       ((X3DConcreteNode)
>     getRightTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getRightTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getRightTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>
>              if      (getTopTexture() != null)
>                       ((X3DConcreteNode)
>     getTopTexture()).setContainerFieldOverride(correctedContainerField);
>              else if (getTopTextureProtoInstance() != null)
>                       ((X3DConcreteNode)
>     getTopTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>              }
>
>     On 6/11/21 11:34 AM, John Carlson wrote:
>     GOOD CODE
>     ====================================================================================================================================================================
>     >
>     >     private void handleFieldSynonyms()
>     >     {
>     >         String correctedContainerField;
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "back";
>     >         else correctedContainerField = "backTexture";
>     >
>     >         if      (getBackTexture() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getBackTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getBackTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getBackTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "bottom";
>     >         else correctedContainerField = "bottomiTexture";
>     >
>     >         if      (getBottomTexture() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getBottomTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getBottomTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getBottomTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "front";
>     >         else correctedContainerField = "frontTexture";
>     >
>     >         if      (getFrontTexture() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getFrontTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getFrontTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getFrontTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "left";
>     >         else correctedContainerField = "leftTexture";
>     >
>     >         if      (getLeftTexture() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getLeftTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getLeftTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getLeftTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "right";
>     >         else correctedContainerField = "rightTexture";
>     >
>     >         if      (getRightTexture() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getRightTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getRightTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getRightTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >         if (hasAncestorX3D() &&
>     > findAncestorX3D().getVersion().startsWith("3"))
>     >              correctedContainerField = "top";
>     >         else correctedContainerField = "topTexture";
>     >
>     >         if      (getTopTexture() != null)
>     >                  ((X3DConcreteNode)
>     > getTopTexture()).setContainerFieldOverride(correctedContainerField);
>     >         else if (getTopTextureProtoInstance() != null)
>     >                  ((X3DConcreteNode)
>     >
>     getTopTextureProtoInstance()).setContainerFieldOverride(correctedContainerField);
>     >
>     >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210617/b0b2e902/attachment-0001.html>


More information about the x3d-public mailing list