-
Notifications
You must be signed in to change notification settings - Fork 25
Migrate to XML3D 5.0
The 5.0 release of XML3D is not backwards compatible to 4.x. Here is a list of changes you have to apply to your scene to migrate to version 5.0:
activeview, fieldofview, wraps, wrapt, wrapu, filtermin, filtermax, filtermip, scaleorientation
- You can still use
getAttribute
andsetAttribute
with camel-cased names (eg. setAttribute("fieldOfView", 0.5) ). These will automatically be lowercased in XML3D 5.0 - Element properties (eg. viewElement.fieldOfView) are still camel-cased.
getBoundingBox() is no longer available on xml3d
, group
, mesh
and model
elements. There are now two separate functions available:
- getLocalBoundingBox() - Get the bounding box of the element in object space
- getWorldBoundingBox() - Get the bounding box of the element in world space (including all parent transformations).
If you are using getBoundingBox() now you should choose one of the two new functions instead, depending on what kind of bounding box you need.
This attribute was renamed for clarity. Like before it should contain a URI to a <data>
element with a <float4x4>
value element named "projection". The supplied matrix will replace the camera's projection matrix.
The definition of lights has changed in XML3D 5.0 (see this issue). The simplest way migrating is to
- Move the value of the lightshader's
script
attribute to the lightsmodel
attribute (specifying the light model) - Rename
urn:xml3d:lightshader:xxx
tourn:xml3d:light:xxx
in the light model defintion - Rename the
<lightshader>
element to<data>
- Rename the light's
shader
attribute tosrc
The texture
attributes to configure the texture sampling were not HTML5 compliant and thus we changed the names and merged some of them:
-
warpS
andwrapT
have been merged towrap
. Specify the wrap type (clamp, repeat) for s and t direction in order or just one value for the same wrap type in all directions -
filterMin
andfilerMag
have been merged tofilter
. Specify the filtering first for minification then for magnification (e.g.filter="linear-mipmap-linear linear"
).
Instead of setting the visibility via attribute like this
One can use the CSS display
property now:
<mesh src="teapot.jsons" style="display: none;"></mesh>
or
document.querySelector("mesh").style.display = "none";
or (given there is a CSS style seletor setting class hidden
)
<mesh src="teapot.jsons" class="hidden"></mesh>
or using jQuery:
$("mesh").hide(); // Hide all meshes
$("mesh").toggle(); // Toggle visibility of meshes
Default is to inherit the display value from the parent element. Works for <xml3d>
, <group>
, <mesh>
, and <model>
.
To migrate from 4.9, just change all occurances of visibility="false"
to style="display: none;"
.
Voilà!