We use proprietary and third party's cookies to improve your experience and our services, identifying your Internet Browsing preferences on our website; develop analytic activities and display advertising based on your preferences. If you keep browsing, you accept its use. You can get more information on our Cookie Policy
Cookies Policy
XML3D Open API Specification - FIWARE Forge Wiki

XML3D Open API Specification

From FIWARE Forge Wiki

Jump to: navigation, search

Contents

For a complete API documentation please see the latest Specification


For more tutorials and general help see the XML3D Github Wiki.

XML3D Elements

3D scenes that are described in XML3D are assembled from a number of DOM nodes that extend the standard HTML5 DOM nodes. Each node can carry one or more attributes to specify the respective element further. Operations on node attributes result on immediate changes in the visible scene.

xml3d

Root node of the scene graph, defines size and appearance of the rendering area

  • Attributes:
    • height: height of the canvas drawing the 3D scene in pixels
    • width: width of the canvas drawing the 3D scene in pixels
    • view: id reference to the view element that is used to render the scene
  • Example:
 <xml3d width = "800" height = "600" view = "#camera1"></xml3d>

view

The view node interface represents a camera in 3D world coordinates

  • Attributes:
    • fovVertical: the vertical field of view of the camera, in radians
  • Example:
 <view id="camera1">
   <float name="fovVertical">0.9</float>
 </view>

light

The light node represents a light in the 3D scene. Parameters can be set with value or data elements as children, similar to <material>

  • Attributes:
    • model: a URN string for the type of light ("urn:xml3d:light:directional|point|spot")
 <light model="urn:xml3d:light:point">
    <float3 name="attenuation">1 0 0</float3>
 </light>


data

Data node which combines multiple named value elements and can be referred and contained by data containers. Can be used as input or output for Xflow dataflow graphs.

  • Attributes:
    • compute: Xflow expression that defines a computation for this data element
    • src: Reference to another data element or data file as URI. Can be a location (URL) to a data file or an xml3d data element. If src is defined, all child elements are ignored. Thus, the data table defined by the referred content is reused directly.
    • dataflow: Reference to a dataflow node that should be treated as a template.
    • filter: Defines a filter to specify which elements of the data node should be exposed as output of an Xflow computation
  • Example:
 <data id="myData">
    <float3 name="position">0 1 0</float3>
 </data>

group

Grouping node with transformation capabilities and surface shader assignment

  • Attributes:
    • visible: If "false", the element and all it's children are not taken into account during rendering. This flag does not affect children referenced from other parts of the scene graph.
    • transform: Reference to an element that can provide a 3D transformation (i.e. <transform> or <data> with a float4x4 entry with name="transform")
    • material: Reference to an element that can provide a surface material (i.e. <material>)
  • Example:
 <group id="meshGroup" transform="#transform1" material="#shader1"></group>

transform

General geometric transformation element, that allows to define a transformation matrix using five well understandable entities.

  • Attributes:
    • translation: The translation part of the transformation.
    • scale: The scaling part of the transformation.
    • rotation: The rotation part of the transformation. (as axis-angle)
    • center: Origin for scale and rotation
    • scaleOrientation: Rotational orientation for scale
  • Example:
 <transform id="transform1" translation="0 10 10" rotation="0 0 1 1.57" scale="1 1 1.5"></transform>

material

The material element describes a surface shader for a geometry.

  • Attributes:
    • model: Reference to the shader script as URI. Can be a location (URL) or one of the pre-defined shaders as URN. TODO: Should be of type "AnyURI"
  • Example:
 <shader id="shader1" script="urn:xml3d:material:phong">
   <float3 name="diffuseColor">1 0 0</float3>
 </shader>

mesh

  • Attributes:
    • type: The type of geometric primitive described by this mesh element.
    • src: Reference to another data element or data file as URI. Can be a location (URL) to a data file or an xml3d data element. If src is defined, all child elements are ignored. Thus, the data table defined by the referred content is reused directly.
 <mesh src="externalMeshData.xml" type="triangles"></mesh>

CSS

XML3D support various CSS properties on elements:

  • <group>, <mesh> and <model>:
    • display : Makes a group or object invisible
    • transform : A CSS3 transform
    • z-index : Follows CSS z-index rules, allows some objects to always be drawn over or under others
  <group style="display: none; transform: translate3d(0, 5px, 10px) scale3d(0.5, 0.5, 0.5);"></group>
  • <view>, <light>
    • transform : A CSS3 transform


XML3D Scripting

XML3D scenes can be scripted entirely using the standard DOM scripting API. Changing attribute values of XML3D nodes leads to an immediate change of the scene.

Personal tools
Create a book