Proto support in castle

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:

<ProtoDeclare name='Cube'>
<Box />
<Material diffuseColor='1 1 1'/>
<Cube />

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 :slight_smile:

Some working examples are on , or from .

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, ) – 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)