[x3d-public] X3DJSAIL, possible bug in JS generation

John Carlson yottzumm at gmail.com
Tue Oct 16 18:21:43 PDT 2018

I confirmed that the override is there, and it is set to setMaterial.  So there’s no current way to addShaders, since I believe that setMaterial is the most common containerField.  How does X3dToJava.xslt handle this choice for containerFields?  We can discuss this at the meeting tomorrow at 2pm PST, but this is likely a widespread problem with mapToMethod*.js

The parent element is Appearance, and the ProtoInstance is the child.  How can we automatically choose either setMaterial or addShaders?  Do I need to look at the ProtoBody?

Does this have something to do with ExternProtoDeclare validation?  Would X3DUOM resolve it if I just looked closer (and put it in mapToMethod.js which is autogenerated?)

Seems like we’re getting to some really gnarly bugs which require looking at the scenegraph or extended scenegraph in more detail.



Sent from Mail for Windows 10

From: John Carlson
Sent: Tuesday, October 16, 2018 9:01 PM
To: X3D Graphics public mailing list
Subject: X3DJSAIL, possible bug in JS generation

It looks like the JS generation (JavaScriptSerializer.js) may have an issue with addShaders being
generated for ProtoInstanceObject’s. This happens when mapToMethod2.js has no override for the ProtoInstance child I think, but
I will check soon.

Here is the JS code:

coderextreme at DESKTOP-DOPK2VD MINGW64 /c/x3d-code/www.web3d.org/x3d/stylesheets/java/nashorn/examples
$ grep addShaders *
HelloWorldProgramOutput.Nashorn.js:            .addShaders(new ProgramShaderObject().setDEF("TestShader1")
HelloWorldProgramOutput.Nashorn.js:            .addShaders(new ComposedShaderObject().setDEF("TestShader4")

Here is the original Java code:

HelloWorldProgram.java:                        .addShaders(new ProgramShaderObject("TestShader1")
HelloWorldProgram.java:                        .addShaders(new ProtoInstanceObject("ShaderProto","TestShader3"))
HelloWorldProgram.java:                        .addShaders(new ComposedShaderObject("TestShader4")

Here is the generated Java code:

HelloWorldProgramOutput.java:        .addShaders(new ProgramShaderObject()
HelloWorldProgramOutput.java:        .addShaders(new ProtoInstanceObject("ShaderProto", "TestShader3"))
HelloWorldProgramOutput.java:        .addShaders(new ComposedShaderObject()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20181016/fdbfe4b1/attachment.html>

More information about the x3d-public mailing list