[x3d-public] Topics for Discussion at JSON meeting: SFNode/MFNode field/fieldValue content, ProtoBody, regexes

Don Brutzman brutzman at nps.edu
Sat Feb 6 15:11:19 PST 2016


Testing reconsideration:  using "-value" for children SFNode/MFNode content inside a fieldValue can be improved.

Better: use "-children" instead.  Common semantics, simpler encoding rules, easier to remember, less failure prone.

Next version (test suite in progress) will use "-children" instead of "-value" for contained content.

Test suite conversion checks appear to be performing well, update should be complete late tonite.

Examples attached.  As always, comments are welcome.

p.s. here's one comment:  i had great trouble getting "-value" to work properly.  "-children" fell right into place and seems like an obvious improvement, since the earlier "-value" was an arbitrary choice.


On 2/5/2016 7:04 PM, Don Brutzman wrote:
> Summary: Once again the X3D JSON design is looking pretty solid, and our tool suites are pretty powerful at detecting edge-case issues.
>
> On 2/5/2016 10:37 AM, Don Brutzman wrote:
>> [correction: shifted to x3d-public]
>> [...]
>> On 2/4/2016 10:56 AM, Roy Walmsley wrote:
>>> Topics for Discussion for JSON encoding meeting February 5^th 2016 at 1000 PST, 1800 GMT.
>>> [...]
>>> 2) *Encoding of node fields in ‘field’ and ‘fieldValue’ elements within Script and Prototypes.*
>>> [...snip/shuffle...]
>>> Illustration of 2) above is in X3D Example Archives: Basic, CAD, Cad Geometry Extern Prototypes (see http://www.web3d.org/x3d/content/examples/Basic/CAD/_pages/page02.html)
>>>
>>> Find the ProtoInstance named ‘IndexedQuadSet’. It has two fieldValue children. The second has the name ‘coord’, and a child Coordinate node. When converted into JSON this Coordinate node is allocated to a field /-coord/, which is the default containerField name for this node. This is incorrect. It should be allocated to the /-value/ field. This is because the element fieldValue has attributes of ‘name’ and ‘value’.
>>>
>>> A similar issue arises with default values for node fields within the field element.
>
> OK this change is worth close scrutiny to avoid confusion later.
>
> For <field> and <fieldValue>, when the "@value" attribute is used for simple types, everything works OK.
>
> For <field> and <fieldValue>, with contained SFNode/MFNode content or contained comments or contained ROUTEs, the key is now "-value" (hyphen instead of ampersand).
> [...]

Summary, revising the prior sentence:

For <field> and <fieldValue>, with contained SFNode/MFNode content or contained comments or contained ROUTEs, the key is now "-children" as with most other child content.

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman
-------------- next part --------------
{ "X3D": {
    "@profile":"Immersive",
    "@version":3.3,
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"CubeWithLabeledSidesViewpointSequencer.x3d"
          },
          {
            "@name":"description",
            "@content":"ViewpointSequencer animation of a cube-shaped test model with faces on each side individually labeled."
          },
          {
            "@name":"creator",
            "@content":"Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"14 November 2014"
          },
          {
            "@name":"modified",
            "@content":"30 December 2015"
          },
          {
            "@name":"TODO",
            "@content":"add ability for prototype to hide text"
          },
          {
            "@name":"reference",
            "@content":"BoxSwitch.x3d"
          },
          {
            "@name":"reference",
            "@content":"CubeWithLabeledSidesViewpointSequencer.png"
          },
          {
            "@name":"drawing",
            "@content":"CubeWithLabeledSidesViewpointSequencer.vsd"
          },
          {
            "@name":"reference",
            "@content":"../GeometricShapes/CubeWithLabeledSides.x3d"
          },
          {
            "@name":"reference",
            "@content":"http://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/TestCube.x3d"
          },
          {
            "@name":"drawing",
            "@content":"http://www.web3d.org/x3d/content/examples/Basic/DistributedInteractiveSimulation/images/TestBoxImages.vsd"
          },
          {
            "@name":"identifier",
            "@content":"http://x3dGraphics.com/examples/X3dForAdvancedModeling/Animation/CubeWithLabeledSidesViewpointSequencer.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Background":
            {
              "@skyColor":[0.3,0.3,0.3]
            }
          },
          { "Inline":
            {
              "@url":["../GeometricShapes/CubeWithLabeledSides.x3d","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.x3d","../GeometricShapes/CubeWithLabeledSides.wrl","http://x3dGraphics.com/examples/X3dForAdvancedModeling/GeometricShapes/CubeWithLabeledSides.wrl"]
            }
          },
          { "#comment":"===================="
          },
          { "ExternProtoDeclare":
            {
              "@name":"ViewpointSequencer",
              "@appinfo":"Sequentially binds each Viewpoint in a set of Viewpoint USE nodes, creating an automatic tour for a scene",
              "@url":["../../Savage/Tools/Animation/ViewpointSequencerPrototype.x3d#ViewpointSequencer","https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerPrototype.x3d#ViewpointSequencer","../../Savage/Tools/Animation/ViewpointSequencerPrototype.wrl#ViewpointSequencer","https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerPrototype.wrl#ViewpointSequencer"],
              "field": [
                {
                  "@name":"viewpoints",
                  "@accessType":"initializeOnly",
                  "@appinfo":"Viewpoint USE nodes that are sequentially bound",
                  "@type":"MFNode"
                },
                {
                  "@name":"interval",
                  "@accessType":"inputOutput",
                  "@appinfo":"number of seconds between viewpoint shifts",
                  "@type":"SFTime"
                },
                {
                  "@name":"enabled",
                  "@accessType":"inputOutput",
                  "@appinfo":"whether ViewpointSequencer is enabled or not",
                  "@type":"SFBool"
                },
                {
                  "@name":"set_enabled",
                  "@accessType":"inputOnly",
                  "@appinfo":"whether ViewpointSequencer is enabled or not",
                  "@type":"SFBool"
                },
                {
                  "@name":"previous",
                  "@accessType":"inputOnly",
                  "@appinfo":"bind previous Viewpoint in list",
                  "@type":"SFBool"
                },
                {
                  "@name":"next",
                  "@accessType":"inputOnly",
                  "@appinfo":"bind next Viewpoint in list",
                  "@type":"SFBool"
                },
                {
                  "@name":"toggleMessage",
                  "@accessType":"inputOutput",
                  "@appinfo":"Select message to toggle ViewpointSequencer",
                  "@type":"MFString"
                },
                {
                  "@name":"toggleMessageFontSize",
                  "@accessType":"initializeOnly",
                  "@appinfo":"Font size for toggleMessage text",
                  "@type":"SFFloat"
                },
                {
                  "@name":"toggleMessageColor",
                  "@accessType":"inputOutput",
                  "@appinfo":"Color for toggleMessage text",
                  "@type":"SFColor"
                },
                {
                  "@name":"traceEnabled",
                  "@accessType":"inputOutput",
                  "@appinfo":"enable console output",
                  "@type":"SFBool"
                }
              ]
            }
          },
          { "Transform":
            {
              "@scale":[0.5,0.5,0.5],
              "@translation":[0,-2,0],
              "-children":[
                { "#comment":"Only one copy of a given ExternProtoDeclare is needed in a scene. Multiple ProtoInstance nodes can be created like the following:"
                },
                { "ProtoInstance":
                  {
                    "@name":"ViewpointSequencer",
                    "@DEF":"ViewpointSequencerExample",
                    "fieldValue": [
                      {
                        "@name":"interval",
                        "@value":2
                      },
                      {
                        "@name":"viewpoints",
                        "-children":[
                          { "#comment":"These viewpoints were copied from the Inline scene above. Authors can also DEF/USE other Viewpoint nodes used elsewhere in a scene"
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"FrontViewSequenced",
                              "@description":"Front view, sequenced",
                              "@orientation":[0,1,0,1.57],
                              "@position":[8,0,0]
                            }
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"LeftViewSequenced",
                              "@description":"Left view, sequenced",
                              "@orientation":[0,1,0,3.1416],
                              "@position":[0,0,-8]
                            }
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"TopViewSequenced",
                              "@description":"Top view, sequenced",
                              "@orientation":[1,0,0,-1.57],
                              "@position":[0,8,0]
                            }
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"BackViewSequenced",
                              "@description":"Back view, sequenced",
                              "@orientation":[0,1,0,-1.57],
                              "@position":[-8,0,0]
                            }
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"RightViewSequenced",
                              "@description":"Right view, sequenced",
                              "@position":[0,0,8]
                            }
                          },
                          { "Viewpoint":
                            {
                              "@DEF":"BottomViewSequenced",
                              "@description":"Bottom view, sequenced",
                              "@orientation":[1,0,0,1.57],
                              "@position":[0,-8,0]
                            }
                          }
                        ]
                      },
                      {
                        "@name":"enabled",
                        "@value":false
                      }
                    ],
                    "-children":[
                      { "#comment":"initially enabled field is off (false), scene provides selectable text to activate"
                      }
                    ]
                  }
                },
                { "#comment":"Example use can be found at https://savage.nps.edu/Savage/Tools/Animation/ViewpointSequencerExample.x3d"
                }
              ]
            }
          },
          { "#comment":"===================="
          }
        ]
    }
  }
}
-------------- next part --------------
{ "X3D": {
    "@profile":"Immersive",
    "@version":3.1,
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.1.xsd",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"CadGeometryPrototypes.x3d"
          },
          {
            "@name":"description",
            "@content":"This scene provides tool developers with X3D Amendment 1 CAD Component node prototypes, providing backwards compatibility with VRML97 and X3D v3.0."
          },
          {
            "@name":"creator",
            "@content":"Travis Rauch, Alan Shaffer, Mounir Sidhom, Patrick Sullivan and Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"28 April 2005"
          },
          {
            "@name":"modified",
            "@content":"6 December 2015"
          },
          {
            "@name":"warning",
            "@content":"Do not use these prototypes in an up-to-date X3D browser that already provides CAD support."
          },
          {
            "@name":"information",
            "@content":"Recommended practice: avoid using these prototypes, instead use native definitions for CAD nodes using an up-to-date X3D browser."
          },
          {
            "@name":"information",
            "@content":"These scenes are not intended for regular authoring - use X3D v3.2 CAD component instead. Example scenes using these prototypes do not get support for making embdedded metadata values visible at run time, though metadata can certainly be saved in the scene file OK."
          },
          {
            "@name":"reference",
            "@content":"CadGeometryExternPrototypes.x3d"
          },
          {
            "@name":"reference",
            "@content":"http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/components/CADGeometry.html"
          },
          {
            "@name":"reference",
            "@content":"http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/CADInterchange.html"
          },
          {
            "@name":"subject",
            "@content":"CADAssembly CADFace CADLayer CADPart IndexedQuadSet QuadSet"
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "#comment":"==========================================="
          },
          { "ProtoDeclare":
            {
              "@name":"IndexedQuadSet",
              "@appinfo":"The IndexedQuadSet node represents a 3D shape composed of a collection of individual quadrilaterals (quads). IndexedQuadSet uses the indices in its index field to specify the vertices of each quad from the coord field. Each quad is formed from a set of four vertices of the Coordinate node identified by four consecutive indices from the index field If the index field does not contain a multiple of four coordinate values the remaining vertices shall be ignored.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#IndexedQuadSet",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"set_index",
                      "@accessType":"inputOnly",
                      "@appinfo":"range [0..∞) or -1",
                      "@type":"MFInt32",
                      "-children":[
                        { "#comment":"No specific initialization value"
                        }
                      ]
                    },
                    {
                      "@name":"attrib",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DVertexAttributeNode]",
                      "@type":"MFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"color",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DColorNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"coord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DCoordinateNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"fogCoord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[FogCoordinate]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"normal",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DNormalNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"texCoord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DTextureCoordinateNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"ccw",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"colorPerVertex",
                      "@accessType":"initializeOnly",
                      "@appinfo":"colorPerVertex ignored in IndexedQuadSet, and always treated as true",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"normalPerVertex",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"solid",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"index",
                      "@accessType":"initializeOnly",
                      "@appinfo":"range [0..∞) or -1",
                      "@type":"MFInt32",
                      "-children":[
                        { "#comment":"No specific initialization value"
                        }
                      ]
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "IndexedFaceSet":
                      {
                        "@DEF":"RenderedIQS",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"attrib",
                                "@protoField":"attrib"
                              },
                              {
                                "@nodeField":"color",
                                "@protoField":"color"
                              },
                              {
                                "@nodeField":"colorPerVertex",
                                "@protoField":"colorPerVertex"
                              },
                              {
                                "@nodeField":"coord",
                                "@protoField":"coord"
                              },
                              {
                                "@nodeField":"fogCoord",
                                "@protoField":"fogCoord"
                              },
                              {
                                "@nodeField":"normal",
                                "@protoField":"normal"
                              },
                              {
                                "@nodeField":"texCoord",
                                "@protoField":"texCoord"
                              },
                              {
                                "@nodeField":"ccw",
                                "@protoField":"ccw"
                              },
                              {
                                "@nodeField":"normalPerVertex",
                                "@protoField":"normalPerVertex"
                              },
                              {
                                "@nodeField":"solid",
                                "@protoField":"solid"
                              }
                            ]
                        }
                      }
                    },
                    { "#comment":"Initial node in the PROTO body is actual node type, and the only node rendered. Remaining ProtoBody nodes not rendered"
                    },
                    { "Group":
                      {
                        "@DEF":"UnrenderedIQS",
                        "-children":[
                          { "Script":
                            {
                              "@DEF":"IndexedQuadSetToIndexedFaceSet",
                              "@directOutput":true,
                              "field": [
                                {
                                  "@name":"index",
                                  "@accessType":"initializeOnly",
                                  "@type":"MFInt32"
                                },
                                {
                                  "@name":"set_index",
                                  "@accessType":"inputOnly",
                                  "@type":"MFInt32"
                                },
                                {
                                  "@name":"renderedIQS",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFNode",
                                  "-children":[
                                    { "IndexedFaceSet":
                                      {
                                        "@USE":"RenderedIQS"
                                      }
                                    }
                                  ]
                                },
                                {
                                  "@name":"localTraceEnabled",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFBool",
                                  "@value":true
                                },
                                {
                                  "@name":"coordIndexNew",
                                  "@accessType":"initializeOnly",
                                  "@type":"MFInt32",
                                  "-children":[
                                    { "#comment":"constructed during initialization"
                                    }
                                  ]
                                }
                              ],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"index",
                                      "@protoField":"index"
                                    },
                                    {
                                      "@nodeField":"set_index",
                                      "@protoField":"set_index"
                                    }
                                  ]
                              },
                              "#sourceText":[
"ecmascript:",
"",
"function initialize()",
"{",
"//colorPerVertex ignored in IndexedQuadSet, and always treated as \"true\"",
"RenderedIQS.colorPerVertex = true;",
"",
"// index is an array of quad indices. The ordering of",
"// the vertices is ccw (counter-clockwise).",
"",
"// ensure legal index values",
"for (ii=0; ii <= index.length-1; ii++)",
"{",
"  if (index[ii] < -1)",
"  {",
"\talwaysPrint ('error, index[' + ii + ']=' + index[ii] + ' is illegal value');",
"\treturn;",
"  }",
"}",
"tracePrint ('index.length=' + index.length);",
"tracePrint ('index=' + index);",
"",
"if (index.length < 4)",
"{",
"\talwaysPrint ('warning, index.length=' + index.length + ' insufficient to construct a quad, IQS ignored');",
"\treturn;",
"}",
"",
"coordIndexNew = new MFInt32 ();",
"",
"// ii walks through index array,",
"// goal is to initialize coordIndexNew list to match quads",
"for (ii=0; ii <= index.length-1; ii+=4)",
"{",
"\tif ((index[ii]   == index[ii+1]) || (index[ii]   == index[ii+2]) || (index[ii] == index[ii+3]) ||",
"\t\t(index[ii+1] == index[ii+2]) || (index[ii+1] == index[ii+3]) ||",
"\t\t(index[ii+2] == index[ii+3]))",
"\t{",
"\t\talwaysPrint ('index=' + index);",
"\t\talwaysPrint ('error, pair of equal indices in quad');",
"\t\treturn;",
"\t}",
"",
"\tif (index[ii] >= 0)",
"\t{",
"\t\t// add another quad from latest 4 points of fan set to IQS",
"\t\t// order is ccw, i.e. in correct halfplane direction",
"\t\t// note: there is an implicit \"malloc\" here for the'length' element of the array",
"\t\tcoordIndexNew [coordIndexNew.length] = index[ii];",
"\t\tcoordIndexNew [coordIndexNew.length] = index[ii+1];",
"\t\tcoordIndexNew [coordIndexNew.length] = index[ii+2];",
"\t\tcoordIndexNew [coordIndexNew.length] = index[ii+3];",
"\t\tcoordIndexNew [coordIndexNew.length] = -1;",
"\t}",
"",
"\tif (index.length % 4 != 0) {",
"\t\talwaysPrint ('error, index field does not contain a multiple of four coordinate values.');",
"\t\talwaysPrint ('The remaining vertices shall be ignored');",
"\t\treturn;",
"\t}",
"",
"  // incremental trace of array being built",
"  tracePrint ('coordIndexNew=' + coordIndexNew);",
"}",
"renderedIQS.set_coordIndex = coordIndexNew;",
"tracePrint ('renderedIQS.coordIndex=' + renderedIQS.coordIndex);",
"// match colorIndex if any Color node exists",
"//\tif (nodesHolder.color)",
"//\t{",
"//\t  if (nodesHolder.color.color.length > 0)",
"//\t  {",
"\t//  Could implement color count check here",
"//\t  }",
"//\t}",
"",
"// no need to set colorIndex since indexedFaceSet semantics handles this",
"}",
"function set_index (value, timestamp)",
"{",
"index = value;",
"initialize ();",
"}",
"function tracePrint(outputString)",
"{",
"if (localTraceEnabled)",
"  Browser.print ('[IndexedQuadSet]' + outputString);",
"}",
"function alwaysPrint(outputString)",
"{",
"Browser.print ('[IndexedQuadSet]' + outputString);",
"}"
]
                            }
                          },
                          { "Group":
                            {
                              "-metadata":[
                                { "MetadataString":
                                  {
                                    "@name":"metadataHolder",
                                    "IS": {
                                        "connect": [
                                          {
                                            "@nodeField":"metadata",
                                            "@protoField":"metadata"
                                          }
                                        ]
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"==========================================="
          },
          { "ProtoDeclare":
            {
              "@name":"QuadSet",
              "@appinfo":"The QuadSet node represents a 3D shape that represents a collection of individual planar quadrilaterals. The coord field contains a Coordinate node that defines the 3D vertices that define the quad. Each quad is formed from a consecutive set of four vertices of the coordinate node. If the coordinate node does not contain a multiple of four coordinate values the remaining vertices shall be ignored.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CadGeometry.html#QuadSet",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"attrib",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DVertexAttributeNode]",
                      "@type":"MFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"color",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DColorNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"coord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DCoordinateNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"fogCoord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[FogCoordinate]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"normal",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DNormalNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"texCoord",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DTextureCoordinateNode]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"ccw",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"colorPerVertex",
                      "@accessType":"initializeOnly",
                      "@appinfo":"colorPerVertex ignored in QuadSet, and always treated as true",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"normalPerVertex",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"solid",
                      "@accessType":"initializeOnly",
                      "@type":"SFBool",
                      "@value":true
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "IndexedFaceSet":
                      {
                        "@DEF":"RenderedQS",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"attrib",
                                "@protoField":"attrib"
                              },
                              {
                                "@nodeField":"color",
                                "@protoField":"color"
                              },
                              {
                                "@nodeField":"colorPerVertex",
                                "@protoField":"colorPerVertex"
                              },
                              {
                                "@nodeField":"coord",
                                "@protoField":"coord"
                              },
                              {
                                "@nodeField":"fogCoord",
                                "@protoField":"fogCoord"
                              },
                              {
                                "@nodeField":"normal",
                                "@protoField":"normal"
                              },
                              {
                                "@nodeField":"texCoord",
                                "@protoField":"texCoord"
                              },
                              {
                                "@nodeField":"ccw",
                                "@protoField":"ccw"
                              },
                              {
                                "@nodeField":"normalPerVertex",
                                "@protoField":"normalPerVertex"
                              },
                              {
                                "@nodeField":"solid",
                                "@protoField":"solid"
                              }
                            ]
                        }
                      }
                    },
                    { "#comment":"Initial node in the PROTO body is actual node type, and the only node rendered. Remaining ProtoBody nodes not rendered"
                    },
                    { "Group":
                      {
                        "@DEF":"UnrenderedQS",
                        "-children":[
                          { "Script":
                            {
                              "@DEF":"QuadSetToIndexedFaceSet",
                              "@directOutput":true,
                              "field": [
                                {
                                  "@name":"index",
                                  "@accessType":"initializeOnly",
                                  "@type":"MFInt32",
                                  "-children":[
                                    { "#comment":"initialized in ecmascript"
                                    }
                                  ]
                                },
                                {
                                  "@name":"set_index",
                                  "@accessType":"inputOnly",
                                  "@type":"MFInt32"
                                },
                                {
                                  "@name":"renderedQS",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFNode",
                                  "-children":[
                                    { "IndexedFaceSet":
                                      {
                                        "@USE":"RenderedQS"
                                      }
                                    }
                                  ]
                                },
                                {
                                  "@name":"localTraceEnabled",
                                  "@accessType":"initializeOnly",
                                  "@type":"SFBool",
                                  "@value":true
                                },
                                {
                                  "@name":"coordIndexNew",
                                  "@accessType":"initializeOnly",
                                  "@type":"MFInt32",
                                  "-children":[
                                    { "#comment":"constructed during initialization"
                                    }
                                  ]
                                }
                              ],
                              "#sourceText":[
"ecmascript:",
"",
"function initialize()",
"{",
"\t//colorPerVertex ignored in QuadSet, and always treated as \"true\"",
"\tRenderedQS.colorPerVertex = true;",
"",
"\t// calculate index value from QuadSet coord values",
"\tif (renderedQS.coord)",
"\t{",
"\t\tnumberOfCoordinatePoints = renderedQS.coord.point.length;",
"\t}",
"\telse",
"\t{",
"\t\ttracePrint ('no Coordinate node found');",
"\t\treturn;",
"\t}",
"\tif (numberOfCoordinatePoints < 4)",
"\t{",
"\t\talwaysPrint ('warning, numberOfCoordinatePoints=' + numberOfCoordinatePoints + ' insufficient to construct a quad, QuadSet ignored');",
"\t\treturn;",
"\t}",
"",
"\tcoordIndexNew = new MFInt32 ();",
"",
"\t// ii walks through index array,",
"\t// goal is to initialize coordIndexNew list to match quads",
"\tfor (ii=0; ii <= numberOfCoordinatePoints-1; ii+=4)",
"\t{",
"\t\t// check if at least 4 vertices remaining to build a quad",
"\t\tif ((numberOfCoordinatePoints - ii) < 4)",
"\t\t{",
"\t\t\talwaysPrint ('error, index field does not contain a multiple' +",
"' of four coordinate values.');",
"\t\t\talwaysPrint ('The remaining vertices shall be ignored');",
"\t\t\treturn;",
"\t\t}",
"",
"\t\tif ((index[ii]   == index[ii+1]) || (index[ii]   == index[ii+2]) || (index[ii] == index[ii+3]) ||",
"\t\t    (index[ii+1] == index[ii+2]) || (index[ii+1] == index[ii+3]) ||",
"\t\t    (index[ii+2] == index[ii+3]))",
"\t\t{",
"\t\t\talwaysPrint ('index=' + index);",
"\t\t\talwaysPrint ('error, pair of equal indices in quad');",
"\t\t\treturn;",
"\t\t}",
"",
"\t\tif (index[ii] >= 0)",
"\t\t{",
"\t\t\t// add another quad from latest 4 points of fan set to QS",
"\t\t\t// order is ccw, i.e. in correct halfplane direction",
"\t\t\t// note: there is an implicit \"malloc\" here for the'length' element of the array",
"\t\t\tcoordIndexNew [coordIndexNew.length] = index[ii];",
"\t\t\tcoordIndexNew [coordIndexNew.length] = index[ii+1];",
"\t\t\tcoordIndexNew [coordIndexNew.length] = index[ii+2];",
"\t\t\tcoordIndexNew [coordIndexNew.length] = index[ii+3];",
"\t\t\tcoordIndexNew [coordIndexNew.length] = -1;",
"\t\t}",
"",
"\t  // incremental trace of array being built",
"\t  tracePrint ('coordIndexNew=' + coordIndexNew);",
"\t}",
"\trenderedQS.set_coordIndex = coordIndexNew;",
"\ttracePrint ('renderedQS.coordIndex=' + renderedQS.coordIndex);",
"\t// match colorIndex if any Color node exists",
"//\tif (nodesHolder.color)",
"//\t{",
"//\t  if (nodesHolder.color.color.length > 0)",
"//\t  {",
"\t\t//  Could implement color count check here",
"//\t  }",
"//\t}",
"",
"\t// no need to set colorIndex since indexedFaceSet semantics handles this",
"}",
"function set_index (value, timestamp)",
"{",
"\tindex = value;",
"\tinitialize ();",
"}",
"function tracePrint(outputString)",
"{",
"    if (localTraceEnabled)",
"\t  Browser.print ('[IndexedQuadSet]' + outputString);",
"}",
"function alwaysPrint(outputString)",
"{",
"\tBrowser.print ('[IndexedQuadSet]' + outputString);",
"}"
]
                            }
                          },
                          { "Group":
                            {
                              "-metadata":[
                                { "MetadataString":
                                  {
                                    "@name":"metadataHolder",
                                    "IS": {
                                        "connect": [
                                          {
                                            "@nodeField":"metadata",
                                            "@protoField":"metadata"
                                          }
                                        ]
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"========================================"
          },
          { "ProtoDeclare":
            {
              "@name":"CADAssembly",
              "@appinfo":"The CADAssembly node holds a set of assemblies or parts grouped together.",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"addChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"removeChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"children",
                      "@accessType":"inputOutput",
                      "@appinfo":"The children field can contain X3DProductStructureChildNode types. Each child will be either a sub-assembly or a part.",
                      "@type":"MFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"name",
                      "@accessType":"inputOutput",
                      "@appinfo":"The name field documents the name of this CADAssembly.",
                      "@type":"SFString"
                    },
                    {
                      "@name":"bboxCenter",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box center: position offset from origin of local coordinate system.",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"bboxSize",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box size: automatically calculated can be specified as an optimization or constraint.",
                      "@type":"SFVec3f",
                      "@value":[-1,-1,-1]
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Group":
                      {
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"addChildren",
                                "@protoField":"addChildren"
                              },
                              {
                                "@nodeField":"removeChildren",
                                "@protoField":"removeChildren"
                              },
                              {
                                "@nodeField":"children",
                                "@protoField":"children"
                              },
                              {
                                "@nodeField":"bboxCenter",
                                "@protoField":"bboxCenter"
                              },
                              {
                                "@nodeField":"bboxSize",
                                "@protoField":"bboxSize"
                              }
                            ]
                        }
                      }
                    },
                    { "Group":
                      {
                        "-metadata":[
                          { "MetadataString":
                            {
                              "@name":"metadataHolder",
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"metadata",
                                      "@protoField":"metadata"
                                    }
                                  ]
                              }
                            }
                          }
                        ],
                        "-children":[
                          { "#comment":"name holder"
                          },
                          { "Anchor":
                            {
                              "@url":["#hideWarning1"],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"description",
                                      "@protoField":"name"
                                    }
                                  ]
                              }
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"========================================"
          },
          { "ProtoDeclare":
            {
              "@name":"ShapeHolder",
              "@appinfo":"local dummy node to hold value for CADFace",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"shape",
                      "@accessType":"inputOutput",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"no initialization value"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Script":
                      {
                        "@DEF":"HoldShapeNodeScript",
                        "@directOutput":true,
                        "field": [
                          {
                            "@name":"shape",
                            "@accessType":"inputOutput",
                            "@appinfo":"holder for IS field",
                            "@type":"SFNode",
                            "-children":[
                              { "#comment":"no initialization node"
                              }
                            ]
                          }
                        ],
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"shape",
                                "@protoField":"shape"
                              }
                            ]
                        },
                        "#sourceText":[
"ecmascript:",
"// no script code, this node is simply a container",
"",
"// silence warning: no function provided that includes shape = something;"
]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"= = = = ="
          },
          { "ProtoDeclare":
            {
              "@name":"CADFace",
              "@appinfo":"The CADFace node holds the geometry representing a face of a part.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CadGeometry.html#CADPart",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"name",
                      "@accessType":"inputOutput",
                      "@appinfo":"The name field documents the name of this CADFace.",
                      "@type":"SFString"
                    },
                    {
                      "@name":"shape",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DShapeNode | LOD]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"bboxCenter",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box center: position offset from origin of local coordinate system.",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"bboxSize",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box size: automatically calculated can be specified as an optimization or constraint.",
                      "@type":"SFVec3f",
                      "@value":[-1,-1,-1]
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "ProtoInstance":
                      {
                        "@name":"ShapeHolder",
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"shape",
                                "@protoField":"shape"
                              }
                            ]
                        }
                      }
                    },
                    { "Group":
                      {
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"bboxCenter",
                                "@protoField":"bboxCenter"
                              },
                              {
                                "@nodeField":"bboxSize",
                                "@protoField":"bboxSize"
                              }
                            ]
                        },
                        "-metadata":[
                          { "MetadataString":
                            {
                              "@name":"metadataHolder",
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"metadata",
                                      "@protoField":"metadata"
                                    }
                                  ]
                              }
                            }
                          }
                        ],
                        "-children":[
                          { "#comment":"name holder"
                          },
                          { "Anchor":
                            {
                              "@url":["#hideWarning2"],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"description",
                                      "@protoField":"name"
                                    }
                                  ]
                              }
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"========================================"
          },
          { "ProtoDeclare":
            {
              "@name":"CADLayer",
              "@appinfo":"The CADLayer node defines a hierarchy of nodes used for showing layer structure.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CadGeometry.html#CADPart",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"addChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"removeChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"children",
                      "@accessType":"inputOutput",
                      "@appinfo":"The children field can contain X3DChildNode types.",
                      "@type":"MFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"name",
                      "@accessType":"inputOutput",
                      "@appinfo":"The name field documents the name of this CADLayer.",
                      "@type":"SFString"
                    },
                    {
                      "@name":"visible",
                      "@accessType":"inputOutput",
                      "@appinfo":"specifies whether a particular child and its subchildren are visible. If the number of values is less than the number of children the remaining children shall be visible.",
                      "@type":"MFBool"
                    },
                    {
                      "@name":"bboxCenter",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box center: position offset from origin of local coordinate system.",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"bboxSize",
                      "@accessType":"initializeOnly",
                      "@appinfo":"Bounding box size: automatically calculated can be specified as an optimization or constraint.",
                      "@type":"SFVec3f",
                      "@value":[-1,-1,-1]
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Group":
                      {
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"addChildren",
                                "@protoField":"addChildren"
                              },
                              {
                                "@nodeField":"removeChildren",
                                "@protoField":"removeChildren"
                              },
                              {
                                "@nodeField":"children",
                                "@protoField":"children"
                              },
                              {
                                "@nodeField":"bboxCenter",
                                "@protoField":"bboxCenter"
                              },
                              {
                                "@nodeField":"bboxSize",
                                "@protoField":"bboxSize"
                              }
                            ]
                        }
                      }
                    },
                    { "Group":
                      {
                        "-metadata":[
                          { "MetadataString":
                            {
                              "@name":"metadataHolder",
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"metadata",
                                      "@protoField":"metadata"
                                    }
                                  ]
                              }
                            }
                          }
                        ],
                        "-children":[
                          { "#comment":"name holder"
                          },
                          { "Anchor":
                            {
                              "@url":["#hideWarning3"],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"description",
                                      "@protoField":"name"
                                    }
                                  ]
                              }
                            }
                          }
                        ]
                      }
                    },
                    { "Script":
                      {
                        "@DEF":"HoldMFBoolFieldScript",
                        "field": [
                          {
                            "@name":"visible",
                            "@accessType":"inputOutput",
                            "@type":"MFBool",
                            "-children":[
                              { "#comment":"no initialization node"
                              }
                            ]
                          }
                        ],
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"visible",
                                "@protoField":"visible"
                              }
                            ]
                        },
                        "#sourceText":[
"ecmascript:",
"// no script code, this node is simply a container"
]
                      }
                    },
                    { "#comment":"No support for MFBool in VRML97, so no functionality provided for visible"
                    }
                  ]
              }
            }
          },
          { "#comment":"========================================"
          },
          { "ProtoDeclare":
            {
              "@name":"CADPart",
              "@appinfo":"CADPart represents the location and faces that constitute apart",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CadGeometry.html#CADPart",
              "ProtoInterface": {
                  "field": [
                    {
                      "@name":"addChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"removeChildren",
                      "@accessType":"inputOnly",
                      "@type":"MFNode"
                    },
                    {
                      "@name":"children",
                      "@accessType":"inputOutput",
                      "@appinfo":"The children field can only contain CADFace nodes.",
                      "@type":"MFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    },
                    {
                      "@name":"name",
                      "@accessType":"inputOutput",
                      "@type":"SFString"
                    },
                    {
                      "@name":"translation",
                      "@accessType":"inputOutput",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"rotation",
                      "@accessType":"inputOutput",
                      "@type":"SFRotation",
                      "@value":[0,0,1,0]
                    },
                    {
                      "@name":"center",
                      "@accessType":"inputOutput",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"scale",
                      "@accessType":"inputOutput",
                      "@type":"SFVec3f",
                      "@value":[1,1,1]
                    },
                    {
                      "@name":"scaleOrientation",
                      "@accessType":"inputOutput",
                      "@type":"SFRotation",
                      "@value":[0,0,1,0]
                    },
                    {
                      "@name":"bboxCenter",
                      "@accessType":"initializeOnly",
                      "@type":"SFVec3f",
                      "@value":[0,0,0]
                    },
                    {
                      "@name":"bboxSize",
                      "@accessType":"initializeOnly",
                      "@type":"SFVec3f",
                      "@value":[-1,-1,-1]
                    },
                    {
                      "@name":"metadata",
                      "@accessType":"inputOutput",
                      "@appinfo":"[X3DMetadataObject]",
                      "@type":"SFNode",
                      "-children":[
                        { "#comment":"Specification initialization: NULL node"
                        }
                      ]
                    }
                  ]
              },
              "ProtoBody": {
                  "-children":[
                    { "Transform":
                      {
                        "IS": {
                            "connect": [
                              {
                                "@nodeField":"children",
                                "@protoField":"children"
                              },
                              {
                                "@nodeField":"addChildren",
                                "@protoField":"addChildren"
                              },
                              {
                                "@nodeField":"removeChildren",
                                "@protoField":"removeChildren"
                              },
                              {
                                "@nodeField":"translation",
                                "@protoField":"translation"
                              },
                              {
                                "@nodeField":"rotation",
                                "@protoField":"rotation"
                              },
                              {
                                "@nodeField":"center",
                                "@protoField":"center"
                              },
                              {
                                "@nodeField":"scale",
                                "@protoField":"scale"
                              },
                              {
                                "@nodeField":"scaleOrientation",
                                "@protoField":"scaleOrientation"
                              },
                              {
                                "@nodeField":"bboxCenter",
                                "@protoField":"bboxCenter"
                              },
                              {
                                "@nodeField":"bboxSize",
                                "@protoField":"bboxSize"
                              }
                            ]
                        }
                      }
                    },
                    { "Group":
                      {
                        "-metadata":[
                          { "MetadataString":
                            {
                              "@name":"metadataHolder",
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"metadata",
                                      "@protoField":"metadata"
                                    }
                                  ]
                              }
                            }
                          }
                        ],
                        "-children":[
                          { "#comment":"name holder"
                          },
                          { "Anchor":
                            {
                              "@url":["#hideWarning4"],
                              "IS": {
                                  "connect": [
                                    {
                                      "@nodeField":"description",
                                      "@protoField":"name"
                                    }
                                  ]
                              }
                            }
                          }
                        ]
                      }
                    }
                  ]
              }
            }
          },
          { "#comment":"========================================"
          },
          { "Anchor":
            {
              "@description":"CadGeometryExternPrototypes",
              "@parameter":["target=_blank"],
              "@url":["CadGeometryExternPrototypes.x3d","http://www.web3d.org/x3d/content/examples/Basic/development/CadGeometryExternPrototypes.x3d","CadGeometryExternPrototypes.wrl","http://www.web3d.org/x3d/content/examples/Basic/development/CadGeometryExternPrototypes.wrl"],
              "-children":[
                { "Shape":
                  {
                    "-geometry":[
                      { "Text":
                        {
                          "@string":["CadGeometryExternPrototypes","defines prototype examples","","Click text to see","CadGeometryExternPrototypes"],
                          "-fontStyle":[
                            { "FontStyle":
                              {
                                "@justify":["MIDDLE","MIDDLE"],
                                "@size":0.9
                              }
                            }
                          ]
                        }
                      }
                    ],
                    "-appearance":[
                      { "Appearance":
                        {
                          "-material":[
                            { "Material":
                              {
                                "@diffuseColor":[1,1,0.2]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "Transform":
            {
              "@translation":[-3,2,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":[
                      { "Appearance":
                        {
                          "@DEF":"White",
                          "-material":[
                            { "Material":
                              {
                                "@diffuseColor":[1,1,1]
                              }
                            }
                          ]
                        }
                      }
                    ],
                    "-geometry":[
                      { "ProtoInstance":
                        {
                          "@name":"IndexedQuadSet",
                          "fieldValue": [
                            {
                              "@name":"index",
                              "@value":[0,3,2,1,4,5,6,7,2,7,9,8,2,3,4,7]
                            },
                            {
                              "@name":"coord",
                              "-children":[
                                { "Coordinate":
                                  {
                                    "@point":[-1.5,0,0,-1.5,1,-1,-0.5,1,-1,-0.5,0,0,0.5,0,0,1.5,0,0,1.5,1,-1,0.5,1,-1,-0.5,2,-1,0.5,2,-1]
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@translation":[3,2,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":[
                      { "Appearance":
                        {
                          "@USE":"White"
                        }
                      }
                    ],
                    "-geometry":[
                      { "ProtoInstance":
                        {
                          "@name":"QuadSet",
                          "fieldValue": [
                            {
                              "@name":"coord",
                              "-children":[
                                { "Coordinate":
                                  {
                                    "@point":[-1.5,0,0,-1.5,1,-1,-0.5,1,-1,-0.5,0,0,0.5,0,0,1.5,0,0,1.5,1,-1,0.5,1,-1]
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "#comment":"Silence scene warnings by providing ordered ProtoInstance examples. Note warning above that this scene is for developmental use. The ProtoInstance form of the CAD nodes should not be used, native X3D encoding should be used instead."
          },
          { "ProtoInstance":
            {
              "@name":"CADLayer",
              "fieldValue": [
                {
                  "@name":"children",
                  "-children":[
                    { "ProtoInstance":
                      {
                        "@name":"CADAssembly",
                        "fieldValue": [
                          {
                            "@name":"children",
                            "-children":[
                              { "ProtoInstance":
                                {
                                  "@name":"CADPart",
                                  "fieldValue": [
                                    {
                                      "@name":"children",
                                      "-children":[
                                        { "ProtoInstance":
                                          {
                                            "@name":"CADFace",
                                            "fieldValue": [
                                              {
                                                "@name":"shape",
                                                "-children":[
                                                  { "Shape":
                                                    {
                                                      "-geometry":[
                                                        { "Cylinder":
                                                          {
                                                            "@bottom":false,
                                                            "@height":0.000001,
                                                            "@radius":0.000001,
                                                            "@side":false
                                                          }
                                                        }
                                                      ],
                                                      "-appearance":[
                                                        { "Appearance":
                                                          {
                                                            "-material":[
                                                              { "Material":
                                                                {
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  }
                                                ]
                                              }
                                            ]
                                          }
                                        }
                                      ]
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          }
        ]
    }
  }
}
-------------- next part --------------
{ "X3D": {
    "@profile":"Immersive",
    "@version":3.1,
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.1.xsd",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"CadGeometryExternPrototypes.x3d"
          },
          {
            "@name":"description",
            "@content":"This scene provides tool developers with X3D Amendment 1 CAD Component node prototypes, providing backwards compatibility with VRML97 and X3D v3.0."
          },
          {
            "@name":"creator",
            "@content":"Travis Rauch, Alan Shaffer, Mounir Sidhom, Patrick Sullivan and Don Brutzman"
          },
          {
            "@name":"created",
            "@content":"28 April 2005"
          },
          {
            "@name":"modified",
            "@content":"26 October 2015"
          },
          {
            "@name":"warning",
            "@content":"Do not use these prototypes in an up-to-date X3D browser that already provides CAD support."
          },
          {
            "@name":"information",
            "@content":"Recommended practice: avoid using these prototypes, instead use native definitions for CAD nodes using an up-to-date X3D browser."
          },
          {
            "@name":"information",
            "@content":"These scenes are not intended for regular authoring - use X3D v3.2 CAD component instead. Example scenes using these prototypes do not get support for making embdedded metadata values visible at run time, though metadata can certainly be saved in the scene file OK."
          },
          {
            "@name":"information",
            "@content":"Example scenes using these prototypes do not get support for making embedded metadata values visible at run time, though separate metadata nodes can certainly be saved in the scene file OK."
          },
          {
            "@name":"reference",
            "@content":"CadGeometryPrototypes.x3d"
          },
          {
            "@name":"reference",
            "@content":"CadTeapot.x3d"
          },
          {
            "@name":"subject",
            "@content":"CADAssembly CADFace CADLayer CADPart IndexedQuadSet QuadSet"
          },
          {
            "@name":"reference",
            "@content":"http://www.web3d.org/files/specifications/19775-1/V3.3/Part01/components/CADGeometry.html"
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryExternPrototypes.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "ExternProtoDeclare":
            {
              "@name":"IndexedQuadSet",
              "@appinfo":"The IndexedQuadSet node represents a 3D shape composed of a collection of individual quadrilaterals (quads). IndexedQuadSet uses the indices in its index field to specify the vertices of each quad from the coord field. Each quad is formed from a set of four vertices of the Coordinate node identified by four consecutive indices from the index field If the index field does not contain a multiple of four coordinate values the remaining vertices shall be ignored.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#IndexedQuadSet",
              "@url":["CadGeometryPrototypes.x3d#IndexedQuadSet","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#IndexedQuadSet","CadGeometryPrototypes.wrl#IndexedQuadSet","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#IndexedQuadSet"],
              "field": [
                {
                  "@name":"set_index",
                  "@accessType":"inputOnly",
                  "@type":"MFInt32"
                },
                {
                  "@name":"color",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DColorNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"coord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DCoordinateNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"fogCoord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[FogCoordinate]",
                  "@type":"SFNode"
                },
                {
                  "@name":"normal",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DNormalNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"texCoord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DTextureCoordinateNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"ccw",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"colorPerVertex",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"normalPerVertex",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"solid",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"index",
                  "@accessType":"initializeOnly",
                  "@type":"MFInt32"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"==========================================="
          },
          { "ExternProtoDeclare":
            {
              "@name":"QuadSet",
              "@appinfo":"The QuadSet node represents a 3D shape that represents a collection of individual planar quadrilaterals. The coord field contains a Coordinate node that defines the 3D vertices that define the quad. Each quad is formed from a consecutive set of four vertices of the coordinate node. If the coordinate node does not contain a multiple of four coordinate values the remaining vertices shall be ignored.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#QuadSet",
              "@url":["CadGeometryPrototypes.x3d#QuadSet","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#QuadSet","CadGeometryPrototypes.wrl#QuadSet","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#QuadSet"],
              "field": [
                {
                  "@name":"attrib",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DVertexAttributeNode]",
                  "@type":"MFNode"
                },
                {
                  "@name":"color",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DColorNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"coord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DCoordinateNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"fogCoord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[FogCoordinate]",
                  "@type":"SFNode"
                },
                {
                  "@name":"normal",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DNormalNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"texCoord",
                  "@accessType":"inputOutput",
                  "@appinfo":"[X3DTextureCoordinateNode]",
                  "@type":"SFNode"
                },
                {
                  "@name":"ccw",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"colorPerVertex",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"normalPerVertex",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"solid",
                  "@accessType":"initializeOnly",
                  "@type":"SFBool"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "ExternProtoDeclare":
            {
              "@name":"CADLayer",
              "@appinfo":"The CADLayer node defines a hierarchy of nodes used for showing layer structure.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#CADLayer",
              "@url":["CadGeometryPrototypes.x3d#CADLayer","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#CADLayer","CadGeometryPrototypes.wrl#CADLayer","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#CADLayer"],
              "field": [
                {
                  "@name":"addChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"removeChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"children",
                  "@accessType":"inputOutput",
                  "@type":"MFNode"
                },
                {
                  "@name":"name",
                  "@accessType":"inputOutput",
                  "@type":"SFString"
                },
                {
                  "@name":"visible",
                  "@accessType":"inputOutput",
                  "@type":"MFBool"
                },
                {
                  "@name":"bboxCenter",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"bboxSize",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "ExternProtoDeclare":
            {
              "@name":"CADAssembly",
              "@appinfo":"The CADAssembly node holds a set of assemblies or parts grouped together.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#CADAssembly",
              "@url":["CadGeometryPrototypes.x3d#CADAssembly","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#CADAssembly","CadGeometryPrototypes.wrl#CADAssembly","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#CADAssembly"],
              "field": [
                {
                  "@name":"addChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"removeChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"children",
                  "@accessType":"inputOutput",
                  "@type":"MFNode"
                },
                {
                  "@name":"name",
                  "@accessType":"inputOutput",
                  "@type":"SFString"
                },
                {
                  "@name":"bboxCenter",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"bboxSize",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "ExternProtoDeclare":
            {
              "@name":"CADPart",
              "@appinfo":"CADPart represents the location and faces that constitute a part",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#CADPart",
              "@url":["CadGeometryPrototypes.wrl#CADPart","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#CADPart","CadGeometryPrototypes.x3d#CADPart","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#CADPart"],
              "field": [
                {
                  "@name":"addChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"removeChildren",
                  "@accessType":"inputOnly",
                  "@type":"MFNode"
                },
                {
                  "@name":"children",
                  "@accessType":"inputOutput",
                  "@type":"MFNode"
                },
                {
                  "@name":"name",
                  "@accessType":"inputOutput",
                  "@type":"SFString"
                },
                {
                  "@name":"translation",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"rotation",
                  "@accessType":"inputOutput",
                  "@type":"SFRotation"
                },
                {
                  "@name":"center",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"scale",
                  "@accessType":"inputOutput",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"scaleOrientation",
                  "@accessType":"inputOutput",
                  "@type":"SFRotation"
                },
                {
                  "@name":"bboxCenter",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"bboxSize",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "ExternProtoDeclare":
            {
              "@name":"CADFace",
              "@appinfo":"The CADFace node holds the geometry representing a face of a part.",
              "@documentation":"http://www.web3d.org/x3d/specifications/ISO-IEC-19775-Amendment1-PDAM-X3DAbstractSpecification/Part01/components/CADGeometry.html#CADFace",
              "@url":["CadGeometryPrototypes.x3d#CADFace","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.x3d#CADFace","CadGeometryPrototypes.wrl#CADFace","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadGeometryPrototypes.wrl#CADFace"],
              "field": [
                {
                  "@name":"name",
                  "@accessType":"inputOutput",
                  "@type":"SFString"
                },
                {
                  "@name":"shape",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                },
                {
                  "@name":"bboxCenter",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"bboxSize",
                  "@accessType":"initializeOnly",
                  "@type":"SFVec3f"
                },
                {
                  "@name":"metadata",
                  "@accessType":"inputOutput",
                  "@type":"SFNode"
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "Transform":
            {
              "@translation":[0,-2,0],
              "-children":[
                { "Anchor":
                  {
                    "@description":"CAD Teapot",
                    "@url":["CadTeapot.x3d","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadTeapot.x3d","CadTeapot.wrl","http://www.web3d.org/x3d/content/examples/Basic/CAD/CadTeapot.wrl"],
                    "-children":[
                      { "Shape":
                        {
                          "-geometry":[
                            { "Text":
                              {
                                "@string":["Example CAD structure nodes","are,found,in,CadTeapot.x3d"],
                                "-fontStyle":[
                                  { "FontStyle":
                                    {
                                      "@justify":["MIDDLE","MIDDLE"],
                                      "@size":0.9
                                    }
                                  }
                                ]
                              }
                            }
                          ],
                          "-appearance":[
                            { "Appearance":
                              {
                                "-material":[
                                  { "Material":
                                    {
                                      "@diffuseColor":[1,1,0.2]
                                    }
                                  }
                                ]
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@translation":[-3,2,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":[
                      { "Appearance":
                        {
                          "@DEF":"White",
                          "-material":[
                            { "Material":
                              {
                                "@diffuseColor":[1,1,1]
                              }
                            }
                          ]
                        }
                      }
                    ],
                    "-geometry":[
                      { "ProtoInstance":
                        {
                          "@name":"IndexedQuadSet",
                          "fieldValue": [
                            {
                              "@name":"index",
                              "@value":[0,3,2,1,4,5,6,7,2,7,9,8,2,3,4,7]
                            },
                            {
                              "@name":"coord",
                              "-children":[
                                { "Coordinate":
                                  {
                                    "@point":[-1.5,0,0,-1.5,1,-1,-0.5,1,-1,-0.5,0,0,0.5,0,0,1.5,0,0,1.5,1,-1,0.5,1,-1,-0.5,2,-1,0.5,2,-1]
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "Transform":
            {
              "@translation":[3,2,0],
              "-children":[
                { "Shape":
                  {
                    "-appearance":[
                      { "Appearance":
                        {
                          "@USE":"White"
                        }
                      }
                    ],
                    "-geometry":[
                      { "ProtoInstance":
                        {
                          "@name":"QuadSet",
                          "fieldValue": [
                            {
                              "@name":"coord",
                              "-children":[
                                { "Coordinate":
                                  {
                                    "@point":[-1.5,0,0,-1.5,1,-1,-0.5,1,-1,-0.5,0,0,0.5,0,0,1.5,0,0,1.5,1,-1,0.5,1,-1]
                                  }
                                }
                              ]
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          { "#comment":"========================================"
          },
          { "#comment":"Silence scene warnings by providing ordered ProtoInstance examples. Note warning above that this scene is for developmental use. The ProtoInstance form of the CAD nodes should not be used, native X3D encoding should be used instead."
          },
          { "ProtoInstance":
            {
              "@name":"CADLayer",
              "fieldValue": [
                {
                  "@name":"children",
                  "-children":[
                    { "ProtoInstance":
                      {
                        "@name":"CADAssembly",
                        "fieldValue": [
                          {
                            "@name":"children",
                            "-children":[
                              { "ProtoInstance":
                                {
                                  "@name":"CADPart",
                                  "fieldValue": [
                                    {
                                      "@name":"children",
                                      "-children":[
                                        { "ProtoInstance":
                                          {
                                            "@name":"CADFace",
                                            "fieldValue": [
                                              {
                                                "@name":"shape",
                                                "-children":[
                                                  { "Shape":
                                                    {
                                                      "-geometry":[
                                                        { "Cylinder":
                                                          {
                                                            "@bottom":false,
                                                            "@height":0.000001,
                                                            "@radius":0.000001,
                                                            "@side":false
                                                          }
                                                        }
                                                      ],
                                                      "-appearance":[
                                                        { "Appearance":
                                                          {
                                                            "-material":[
                                                              { "Material":
                                                                {
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  }
                                                ]
                                              }
                                            ]
                                          }
                                        }
                                      ]
                                    }
                                  ]
                                }
                              }
                            ]
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          }
        ]
    }
  }
}


More information about the x3d-public mailing list