[x3d-public] X3DJSAIL. I thought I already sent this, but can't find it in sent folder. New code format! DirectionalLight

Don Brutzman brutzman at nps.edu
Sun Mar 26 16:57:02 PDT 2017


thanks: bug found and fixed in upcoming build, results attached.

On 3/25/2017 1:06 PM, yottzumm at gmail.com wrote:
> Code is attached.   One thing this new code brings up is possible code sharing (PhD thesis?) Thanks, John
>
> $ java www_web3d_org/x3d/content/examples/Basic/X3dSpecifications/DirectionalLight
>
> org.web3d.x3d.sai.InvalidFieldValueException: Appearance USE='App' is not allowed to have contained MFNode shaders
>
> org.web3d.x3d.sai.InvalidFieldValueException: Appearance USE='App' is not allowed to have contained MFNode shaders
>
>         at org.web3d.x3d.jsail.Shape.AppearanceObject.validate(AppearanceObject.java:2021)
>
>         at org.web3d.x3d.jsail.Shape.ShapeObject.validate(ShapeObject.java:1332)
>
>         at org.web3d.x3d.jsail.Grouping.TransformObject.validate(TransformObject.java:1696)
>
>         at org.web3d.x3d.jsail.Grouping.GroupObject.validate(GroupObject.java:1257)
>
>         at org.web3d.x3d.jsail.Grouping.GroupObject.validate(GroupObject.java:1257)
>
>         at org.web3d.x3d.jsail.Core.SceneObject.validate(SceneObject.java:561)
>
>         at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.java:1741)
>
>         at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:758)
>
>         at www_web3d_org.x3d.content.examples.Basic.X3dSpecifications.DirectionalLight.main(DirectionalLight.java:85)
>
> Exception in thread "main" org.web3d.x3d.sai.InvalidFieldValueException: Appearance USE='App' is not allowed to have contained MFNode shaders
>
>         at org.web3d.x3d.jsail.Shape.AppearanceObject.validate(AppearanceObject.java:2021)
>
>         at org.web3d.x3d.jsail.Shape.ShapeObject.validate(ShapeObject.java:1332)
>
>         at org.web3d.x3d.jsail.Grouping.TransformObject.validate(TransformObject.java:1696)
>
>         at org.web3d.x3d.jsail.Grouping.GroupObject.validate(GroupObject.java:1257)
>
>         at org.web3d.x3d.jsail.Grouping.GroupObject.validate(GroupObject.java:1257)
>
>         at org.web3d.x3d.jsail.Core.SceneObject.validate(SceneObject.java:561)
>
>         at org.web3d.x3d.jsail.Core.X3DObject.validate(X3DObject.java:1741)
>
>         at org.web3d.x3d.jsail.Core.X3DObject.toFileJSON(X3DObject.java:758)
>
>         at www_web3d_org.x3d.content.examples.Basic.X3dSpecifications.DirectionalLight.main(DirectionalLight.java:85)
>
>
>


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 --------------
A non-text attachment was scrubbed...
Name: DirectionalLight.new.json.intermediate.x3d
Type: model/x3d+xml
Size: 2568 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170326/84a2a30b/attachment-0001.x3d>
-------------- next part --------------

import org.web3d.x3d.jsail.*;
import org.web3d.x3d.jsail.CADGeometry.*;
import org.web3d.x3d.jsail.Core.*;
import org.web3d.x3d.jsail.CubeMapTexturing.*;
import org.web3d.x3d.jsail.DIS.*;
import org.web3d.x3d.jsail.EnvironmentalEffects.*;
import org.web3d.x3d.jsail.EnvironmentalSensor.*;
import org.web3d.x3d.jsail.EventUtilities.*;
import org.web3d.x3d.jsail.Followers.*;
import org.web3d.x3d.jsail.Geometry2D.*;
import org.web3d.x3d.jsail.Geometry3D.*;
import org.web3d.x3d.jsail.Geospatial.*;
import org.web3d.x3d.jsail.Grouping.*;
import org.web3d.x3d.jsail.HAnim.*;
import org.web3d.x3d.jsail.Interpolation.*;
import org.web3d.x3d.jsail.KeyDeviceSensor.*;
import org.web3d.x3d.jsail.Layering.*;
import org.web3d.x3d.jsail.Layout.*;
import org.web3d.x3d.jsail.Lighting.*;
import org.web3d.x3d.jsail.NURBS.*;
import org.web3d.x3d.jsail.Navigation.*;
import org.web3d.x3d.jsail.Networking.*;
import org.web3d.x3d.jsail.ParticleSystems.*;
import org.web3d.x3d.jsail.Picking.*;
import org.web3d.x3d.jsail.PointingDeviceSensor.*;
import org.web3d.x3d.jsail.Rendering.*;
import org.web3d.x3d.jsail.RigidBodyPhysics.*;
import org.web3d.x3d.jsail.Scripting.*;
import org.web3d.x3d.jsail.Shaders.*;
import org.web3d.x3d.jsail.Shape.*;
import org.web3d.x3d.jsail.Sound.*;
import org.web3d.x3d.jsail.Text.*;
import org.web3d.x3d.jsail.Texturing3D.*;
import org.web3d.x3d.jsail.Texturing.*;
import org.web3d.x3d.jsail.Time.*;
import org.web3d.x3d.jsail.VolumeRendering.*;
import org.web3d.x3d.jsail.fields.*;
import org.web3d.x3d.sai.*;
import org.web3d.x3d.sai.CADGeometry.*;
import org.web3d.x3d.sai.Core.*;
import org.web3d.x3d.sai.CubeMapTexturing.*;
import org.web3d.x3d.sai.DIS.*;
import org.web3d.x3d.sai.EnvironmentalEffects.*;
import org.web3d.x3d.sai.EnvironmentalSensor.*;
import org.web3d.x3d.sai.EventUtilities.*;
import org.web3d.x3d.sai.Followers.*;
import org.web3d.x3d.sai.Geometry2D.*;
import org.web3d.x3d.sai.Geometry3D.*;
import org.web3d.x3d.sai.Geospatial.*;
import org.web3d.x3d.sai.Grouping.*;
import org.web3d.x3d.sai.HAnim.*;
import org.web3d.x3d.sai.Interpolation.*;
import org.web3d.x3d.sai.KeyDeviceSensor.*;
import org.web3d.x3d.sai.Layering.*;
import org.web3d.x3d.sai.Layout.*;
import org.web3d.x3d.sai.Lighting.*;
import org.web3d.x3d.sai.NURBS.*;
import org.web3d.x3d.sai.Navigation.*;
import org.web3d.x3d.sai.Networking.*;
import org.web3d.x3d.sai.ParticleSystems.*;
import org.web3d.x3d.sai.Picking.*;
import org.web3d.x3d.sai.PointingDeviceSensor.*;
import org.web3d.x3d.sai.Rendering.*;
import org.web3d.x3d.sai.RigidBodyPhysics.*;
import org.web3d.x3d.sai.Scripting.*;
import org.web3d.x3d.sai.Shaders.*;
import org.web3d.x3d.sai.Shape.*;
import org.web3d.x3d.sai.Sound.*;
import org.web3d.x3d.sai.Text.*;
import org.web3d.x3d.sai.Texturing3D.*;
import org.web3d.x3d.sai.Texturing.*;
import org.web3d.x3d.sai.Time.*;
import org.web3d.x3d.sai.VolumeRendering.*;
public class DirectionalLight {
	public static void main(String[] args) {
        ConfigurationProperties.setShowDefaultAttributes(true);
        ConfigurationProperties.setIndentCharacter(ConfigurationProperties.indentCharacter_DEFAULT);
        ConfigurationProperties.setIndentIncrement(ConfigurationProperties.indentIncrement_DEFAULT);
        ConfigurationProperties.setX3dCanonicalForm();
        ConfigurationProperties.initialize();
	ConfigurationProperties.setXsltEngine(ConfigurationProperties.XSLT_ENGINE_nativeJava);
	ConfigurationProperties.setDeleteIntermediateFiles(false);
new DirectionalLight().X3D_0()
	.toFileJSON("DirectionalLight.new.json");
	}
private X3DObject X3D_0() {
	return new X3DObject()
	.setProfile("Interchange")
	.setVersion("3.3")
	.setHead(head_1())
	.setScene(Scene_12())
;
}
private headObject head_1() {
	return new headObject()
	.addMeta(meta_2())
	.addMeta(meta_3())
	.addMeta(meta_4())
	.addMeta(meta_5())
	.addMeta(meta_6())
	.addMeta(meta_7())
	.addMeta(meta_8())
	.addMeta(meta_9())
	.addMeta(meta_10())
	.addMeta(meta_11())
;
}
private metaObject meta_2() {
	return new metaObject()
	.setName("title")
	.setContent("DirectionalLight.x3d")
;
}
private metaObject meta_3() {
	return new metaObject()
	.setName("description")
	.setContent("X3D encodings example: a DirectionalLight source illuminates only the objects in its enclosing grouping node. The light illuminates everything within this coordinate system, including the objects that precede it in the scene graph.")
;
}
private metaObject meta_4() {
	return new metaObject()
	.setName("creators")
	.setContent("Don Brutzman and Joe Williams")
;
}
private metaObject meta_5() {
	return new metaObject()
	.setName("created")
	.setContent("1 June 2002")
;
}
private metaObject meta_6() {
	return new metaObject()
	.setName("modified")
	.setContent("20 November 2015")
;
}
private metaObject meta_7() {
	return new metaObject()
	.setName("specificationSection")
	.setContent("X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.9 Directional light")
;
}
private metaObject meta_8() {
	return new metaObject()
	.setName("specificationUrl")
	.setContent("http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#DirectionalLight")
;
}
private metaObject meta_9() {
	return new metaObject()
	.setName("identifier")
	.setContent("http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/DirectionalLight.x3d")
;
}
private metaObject meta_10() {
	return new metaObject()
	.setName("generator")
	.setContent("X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit")
;
}
private metaObject meta_11() {
	return new metaObject()
	.setName("license")
	.setContent("../license.html")
;
}
private SceneObject Scene_12() {
	return new SceneObject()
	.addChild(Group_13())
;
}
private GroupObject Group_13() {
	return new GroupObject()
	.addChild(Transform_14())
	.addChild(Group_19())
	.addChild(Transform_29())
;
}
private TransformObject Transform_14() {
	return new TransformObject()
	.setDEF("UnlitShapeOne")
	.setTranslation(new float[] {-3f,0f,0f})
	.addChild(Shape_15())
;
}
private ShapeObject Shape_15() {
	return new ShapeObject()
	.setGeometry(Box_16())
	.setAppearance(Appearance_17())
;
}
private BoxObject Box_16() {
	return new BoxObject()
;
}
private AppearanceObject Appearance_17() {
	return new AppearanceObject()
	.setDEF("App")
	.setMaterial(Material_18())
;
}
private MaterialObject Material_18() {
	return new MaterialObject()
	.setDiffuseColor(new float[] {0.8f,0.4f,0.2f})
;
}
private GroupObject Group_19() {
	return new GroupObject()
	.setDEF("LitParent")
	.addChild(Transform_20())
	.addChild(DirectionalLight_24())
	.addChild(Transform_25())
;
}
private TransformObject Transform_20() {
	return new TransformObject()
	.setDEF("LitShapeOne")
	.setTranslation(new float[] {0f,2f,0f})
	.addChild(Shape_21())
;
}
private ShapeObject Shape_21() {
	return new ShapeObject()
	.setGeometry(Sphere_22())
	.setAppearance(Appearance_23())
;
}
private SphereObject Sphere_22() {
	return new SphereObject()
;
}
private AppearanceObject Appearance_23() {
	return new AppearanceObject()
	.setUSE("App")
;
}
private DirectionalLightObject DirectionalLight_24() {
	return new DirectionalLightObject()
;
}
private TransformObject Transform_25() {
	return new TransformObject()
	.setDEF("LitShapeTwo")
	.setTranslation(new float[] {0f,-2f,0f})
	.addChild(Shape_26())
;
}
private ShapeObject Shape_26() {
	return new ShapeObject()
	.setGeometry(Cylinder_27())
	.setAppearance(Appearance_28())
;
}
private CylinderObject Cylinder_27() {
	return new CylinderObject()
;
}
private AppearanceObject Appearance_28() {
	return new AppearanceObject()
	.setUSE("App")
;
}
private TransformObject Transform_29() {
	return new TransformObject()
	.setDEF("UnlitShapeTwo")
	.setTranslation(new float[] {3f,0f,0f})
	.addChild(Shape_30())
;
}
private ShapeObject Shape_30() {
	return new ShapeObject()
	.setGeometry(Cone_31())
	.setAppearance(Appearance_32())
;
}
private ConeObject Cone_31() {
	return new ConeObject()
;
}
private AppearanceObject Appearance_32() {
	return new AppearanceObject()
	.setUSE("App")
;
}
}
-------------- next part --------------
{ "X3D": {
    "encoding":"UTF-8",
    "@profile":"Interchange",
    "@version":"3.3",
    "@xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd",
    "JSON schema":"http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json",
    "head": {
        "meta": [
          {
            "@name":"title",
            "@content":"DirectionalLight.x3d"
          },
          {
            "@name":"description",
            "@content":"X3D encodings example: a DirectionalLight source illuminates only the objects in its enclosing grouping node. The light illuminates everything within this coordinate system, including the objects that precede it in the scene graph."
          },
          {
            "@name":"creators",
            "@content":"Don Brutzman and Joe Williams"
          },
          {
            "@name":"created",
            "@content":"1 June 2002"
          },
          {
            "@name":"modified",
            "@content":"20 November 2015"
          },
          {
            "@name":"specificationSection",
            "@content":"X3D encodings, ISO/IEC 19776-1.3, Part 1: XML encoding, Annex C.9 Directional light"
          },
          {
            "@name":"specificationUrl",
            "@content":"http://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/examples.html#DirectionalLight"
          },
          {
            "@name":"identifier",
            "@content":"http://www.web3d.org/x3d/content/examples/Basic/X3dSpecifications/DirectionalLight.x3d"
          },
          {
            "@name":"generator",
            "@content":"X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
          },
          {
            "@name":"license",
            "@content":"../license.html"
          },
          {
            "@name":"translated",
            "@content":"26 March 2017"
          },
          {
            "@name":"generator",
            "@content":"X3dToJson.xslt, http://www.web3d.org/x3d/stylesheets/X3dToJson.html"
          },
          {
            "@name":"warning",
            "@content":"An experimental version of X3D JSON encoding is used for this scene.  Status online at http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding"
          }
        ]
    },
    "Scene": {
        "-children":[
          { "Group":
            {
              "-children":[
                { "Transform":
                  {
                    "@DEF":"UnlitShapeOne",
                    "@translation":[-3,0,0],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "@DEF":"App",
                                "-material":
                                  { "Material":
                                    {
                                      "@diffuseColor":[0.8,0.4,0.2]
                                    }
                                  }
                              }
                            },
                          "-geometry":
                            { "Box":
                              {
                              }
                            }
                        }
                      }
                    ]
                  }
                },
                { "Group":
                  {
                    "@DEF":"LitParent",
                    "-children":[
                      { "Transform":
                        {
                          "@DEF":"LitShapeOne",
                          "@translation":[0,2,0],
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"App"
                                    }
                                  },
                                "-geometry":
                                  { "Sphere":
                                    {
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      },
                      { "DirectionalLight":
                        {
                        }
                      },
                      { "Transform":
                        {
                          "@DEF":"LitShapeTwo",
                          "@translation":[0,-2,0],
                          "-children":[
                            { "Shape":
                              {
                                "-appearance":
                                  { "Appearance":
                                    {
                                      "@USE":"App"
                                    }
                                  },
                                "-geometry":
                                  { "Cylinder":
                                    {
                                    }
                                  }
                              }
                            }
                          ]
                        }
                      }
                    ]
                  }
                },
                { "Transform":
                  {
                    "@DEF":"UnlitShapeTwo",
                    "@translation":[3,0,0],
                    "-children":[
                      { "Shape":
                        {
                          "-appearance":
                            { "Appearance":
                              {
                                "@USE":"App"
                              }
                            },
                          "-geometry":
                            { "Cone":
                              {
                              }
                            }
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
    }
  }
}


More information about the x3d-public mailing list