Hi,
> // Create a new mesh component:
> var mymesh = new x.ec.Mesh();
> mymesh.src = "teapot.xml#meshData"; //this can validate the attribute
> etc. - i don't know if that's possible with plain DOM setAttribute
we have that for all simple data types in XML3D. The general semantic
adapted from HTML and SVG:
You can set whatever values you want using the generic string-based DOM
API. If the string does not evaluate to a valid 'typed' value, the
internal typed value is reset to the default value
e.g.:
document.querySelector("view")
1. <view id="defaultView" position="1 1.5 12.90000057220459"></view>
var v = document.querySelector("view");
undefined
v.fieldOfView = 0.5
0.5
v.getAttribute("fieldOfView")
"0.5"
v.setAttribute("fieldOfView", "asd")
undefined
v.fieldOfView
0.785398
For complex types (e.g. XML3DVec), the behavior is similar, but it's not
possible to set the value directly (the DOM element 'owns' the reference
to the object):
var t = document.querySelector("transform");
undefined
t.translation = new XML3DVec3(0,0,10);
Error: Can't set transform::translation: it's readonly
t.translation.set(new XML3DVec3(0,0,10));
undefined
t.getAttribute("translation")
"0 0 10"
t.translation.set(0,20,0);
undefined
t.getAttribute("translation")
"0 20 0"
For boolean values and enumerations there are some differences in the
behavior. Again, we analyzed and copied the behavior of similar APIs in
HTML and SVG DOM elements.
Best,
Kristian
--
_______________________________________________________________________________
Kristian Sons
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
Agenten und Simulierte Realität
Campus, Geb. D 3 2, Raum 0.77
66123 Saarbrücken, Germany
Phone: +49 681 85775-3833
Phone: +49 681 302-3833
Fax: +49 681 85775--2235
kristian.sons at dfki.de
http://www.xml3d.org
Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
_______________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-miwi/attachments/20131009/86f07e8f/attachment.html>
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy