[x3d-public] Proposal: implicit fields in x3dv

Yves Piguet yves.piguet at gmail.com
Tue Apr 19 07:21:44 PDT 2016


Hi,

In X3D XML encoding, all predefined nodes have a default container field, so that most of the time you don't have to specify it: the X3D loader knows automatically what to do with child elements without containderField attribute. This also permits to have implicit arrays: multiple child elements with the same implicit containerField are gathered in an array.

I suggest to have a similar mechanism in Classic encoding, optionally replacing implicit unambiguous field names with a fixed symbol, e.g. "!" (unquoted), and making arrays where required. This would reduce some clutter.

E.g. the following snippet:

Transform {
  rotation 1 0 0 1.57
  children [
    Shape {
      geometry Box {
        size 3 0.5 3
      }
      appearance Appearance {
        material Material {
          diffuseColor 1 0 0
        }
      }
    }
    Shape {
      geometry Sphere {}
      appearance Appearance {
        texture ImageTexture {
          url "texture:checkerboard"
        }
      }
    }
  ]
}

could be reduced to

Transform {
  rotation 1 0 0 1.58
  !Shape {
    !Box {
      size 3 0.5 3
    }
    !Appearance {
      !Material {
        diffuseColor 1 0 0
      }
    }
  }
  !Shape {
    !Sphere {}
    !Appearance {
    !ImageTexture {
      url "texture:checkerboard"
    }
  }
}

Yves




More information about the x3d-public mailing list