[X3D-Public] X3D to X3Dom > how store protoinstance fieldValues?

doug sanden highaspirations at hotmail.com
Mon Dec 1 06:45:20 PST 2014


I've had some success using MetadataSet, MetadataString and MetadataFloat as a place to store initializeOnly data from a singleton (one-per-scene) proto/script. If a script/proto field has MFVec3f, I use MetadataFloat, and then in html script extract tuples via index*3, index*3+1 index*3+2
To access the fields directly by id, I use id="prototypename_fieldname" naming convention. If there were multiple script/proto instances I might use id="DEF_prototypename_fieldname".
-Doug
more..
I'm using MetadataSet containerfield="metadata" in the scene -which has a metadata field- for my singletons, but you could use "children" for more general placement I think.
more..
my example use of metadata for storing in x3dom what was protoInstance/script iniitializeOnly in X3D:
http://dug9.users.sourceforge.net/web3d/townsite_2014/townside_withHud_x3dom.html
navigate in the model to see buildings, then use the year slidebar to show buildings by year - the building eras are in metadataFloat.



----------------------------------------
> From: highaspirations at hotmail.com
> To: x3d-public at web3d.org
> Date: Sun, 30 Nov 2014 08:56:25 -0700
> Subject: [X3D-Public] X3D to X3Dom> how store protoinstance fieldValues?
>
> Q. Where/how is a good way to store data that was previously in X3D ProtoInstance fields, so new html scripts can be written against it for x3dom?
> Thanks,
> -Doug
> more..
> In general, to store data in X3D, you can define a proto
> <ProdoDeclare ...>
> <field type name ..>
> </ProtoDeclare>
> <ProtoInstance ...>
> <fieldValue name='' value='...our custom data...'>
> </ProtoInstance>
>
> Scripts in the proto can access the data.
> Q. when converting animated scenes from x3d to x3dom, where's a good place to store our custom data?
>
> more..
>
> I'm converting my pet project from x3d to x3dom. It's, a virtual tour of a 100 year old townsite, recsontructed with virtual reality:
> http://dug9.users.sourceforge.net/web3d/townsite_2014/townsite_withHud.x3d
> It has 2 modes: a building tour, with a slidebar for the year (I animated buildings below ground if there era of existance doesn't match the slidebar year), and a photo tour - 100 year old photos scanned in and positioned in 3D space to their original location, with year, caption, description, and a transparency slidebar so you can see how well the building geometry behind the photo lines up with the photo details.
> With about 100 photos and 50 buildings, there's lots of data to store, and I stored it in long fieldValues of my big animation proto.
> Now for X3Dom I want to re-animate, taking out the x3d proto, and putting the slidebars and buttons in html outside the scene, and redo the script in html javascript.
> Here's what I have so far:
> http://dug9.users.sourceforge.net/web3d/townsite_2014/townside_withHud_x3dom.html
>
> Where's a good place to put these custom fields in html?
> - if some of the fields are/could-be MF types, such as viewpoint pose parameters
> - so that html scripts can access it
> Q. is there an x3dom / html equivalent to a proto, just for storing custom data?
> Q. or can I just define a custom html element and attributes without worrying about document validation schemas? (I know just a little html)
> Q. or should I embed it somehow within an html <script> element as static vars?
> Q. or can/should I leave it in an Inlined x3d proto?
>
> more..
>
> In X3D, I stored a lot of parameters in fields of the protoInstance:
> <ProtoInstance ...>
> 6 field values for photo tour: urls, viewpoint pose for each photo, cute name, description, and year/epoch of each photo:
> <fieldValue name='urlstrings' value=' "photo1.jpg" "photo2.jpg" ...' />
> ..
> 3 fieldValues for buildings, era of building, name of building, SFNode of building
> <fieldValue name='BuildingEras' value='1925.0 1965.0, ...
> ...
>
>
>
>
> _______________________________________________
> X3D-Public mailing list
> X3D-Public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
 		 	   		  


More information about the X3D-Public mailing list