public NodeFactory() {
     builtin["Anchor"] = new AnchorNode();
     builtin["Appearance"] = new AppearanceNode();
     builtin["Background"] = new BackgroundNode();
     builtin["Box"] = new BoxNode();
     builtin["Color"] = new ColorNode();
     builtin["Coordinate"] = new CoordinateNode();
     builtin["CoordinateInterpolator"] = new CoordinateInterpolatorNode();
     builtin["Cylinder"] = new CylinderNode();
     builtin["DirectionalLight"] = new DirectionalLightNode();
     builtin["Extrusion"] = new ExtrusionNode();
     builtin["Group"] = new GroupNode();
     builtin["IndexedFaceSet"] = new IndexedFaceSetNode();
     builtin["Material"] = new MaterialNode();
     builtin["NavigationInfo"] = new NavigationInfoNode();
     builtin["OrientationInterpolator"] = new OrientationInterpolatorNode();
     builtin["Normal"] = new NormalNode();
     builtin["PixelTexture"] = new PixelTextureNode();
     builtin["PointLight"] = new PointLightNode();
     builtin["PositionInterpolator"] = new PositionInterpolatorNode();
     builtin["ScalarInterpolator"] = new ScalarInterpolationNode();
     builtin["Shape"] = new ShapeNode();
     builtin["Sphere"] = new SphereNode();
     builtin["TextureCoordinate"] = new TextureCoordinateNode();
     builtin["TimeSensor"] = new TimeSensorNode();
     builtin["Transform"] = new TransformNode();
     builtin["Viewpoint"] = new ViewpointNode();
 }
 private Shape3D ConvertShapeNode(ShapeNode node, float[,] transformation)
 {
     AppearanceNode appearance = (AppearanceNode)node.appearance.Node;
     MaterialNode material = appearance.material.Node as MaterialNode;
     if (node.geometry.Node is SphereNode) {
         SphereNode sphereNode = (SphereNode)node.geometry.Node;
         Sphere3D sphere = new Sphere3D();
         //sphere.Position = new Graph3D.Framework.Math.Vector3D(0, 0, 0);
         sphere.Radius = sphereNode.radius.Value;
         SetAppearance(sphere, appearance);
         return sphere;
     }
     if (node.geometry.Node is BoxNode) {
         return null;
     }
     if (node.geometry.Node is IndexedFaceSetNode) {
         IndexedFaceSetNode faceSetNode = (IndexedFaceSetNode)node.geometry.Node;
         Shape3DComposite composite = new Shape3DComposite();
         int facesCount = 0;
         for (int i = 0; i < faceSetNode.coordIndex.length; i++)
             if (faceSetNode.coordIndex[i] == -1) facesCount++;
         MFVec3f coords = ((CoordinateNode)faceSetNode.coord.Node).point;
         for (int faceOffsetIndex = 0; faceOffsetIndex < faceSetNode.coordIndex.length; faceOffsetIndex++) {
             Triangle3D triangle;
             triangle = new Triangle3D();
             SFVec3f a = coords[faceSetNode.coordIndex[faceOffsetIndex]];
             SFVec3f b = coords[faceSetNode.coordIndex[faceOffsetIndex + 1]];
             SFVec3f c = coords[faceSetNode.coordIndex[faceOffsetIndex + 2]];
             triangle.A = ConvertVector3D(a, transformation);
             triangle.B = ConvertVector3D(b, transformation);
             triangle.C = ConvertVector3D(c, transformation);
             SetAppearance(triangle, appearance);
             composite.Add(triangle);
             faceOffsetIndex += 3;
             while (faceSetNode.coordIndex[faceOffsetIndex] != -1) {
                 faceOffsetIndex++;
             }
         }
         triangles += facesCount;
         return composite;
     }
     return null;
 }