Hello. I’ve been noticing that the castle engine doesn’t seem to support protos in the X3D XML code format. My scene node contains the following:
<Material diffuseColor='1 1 1'/>
When run in View3DScene, it produces this error message:
VRML/X3D: Unknown X3D node type "Cube"
VRML/X3D Unknown X3D field name (indicated by containerField value)
"" by node "Cube" inside node "inside node "Shape"
Note that protos do seem to be supported if VRML code is used.
Do you know what’s wrong? Does the castle engine use an alternative to the ProtoDeclare command?
Billy in Seattle
view3dscene does support X3D prototypes in both classic and XML encodings
Some working examples are on https://github.com/castle-engine/demo-models/blob/master/multi_texturing/modes_blend.x3d , or https://x3dgraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/HudKelpForestIndex.html from https://x3dgraphics.com/examples/X3dForWebAuthors/#Chapter14Prototypes .
In XML encoding, you cannot use
<Cube/>. Instead you need to use
<ProtoInstance name="Cube" />.
As far as I know, this was done to enable validating X3D XML (e.g. using official XSD, https://www.web3d.org/specifications/ ) – a validator cannot allow an element name
Cube, since the name
Cube is only “known” to software that understands the prototypes (previous
ProtoDeclare), and validation using XSD (or maybe some other validation approaches) would not be able to understand this .
I’m attaching a working version of your example. a.x3d (611 Bytes)