Skip navigation.
Home

MMOX LODS Vocabulary Schema Example

jwatte's picture
MMOX LODS Vocabulary Schema Example
Version 0.1, 2009-03-01
Jon Watte (jwatte@gmail.com)


This is an example vocabulary schema, defining the possible object components and properties.
For more information, see the Live Object Description Schema definition.

<?xml version="1.0"?>
<!--
  The "meaning" of properties is important, because it is the well-defined term that 
  lets the two ends agree on what the property means. This is similar to "semantic" 
  in HLSL shaders, for example. In general, the separate description of what the 
  meanings mean (which is a programmer-level specification in free text) also defines 
  what the data type should be, but making it clear in the schema means that we can 
  write transfer encoders separate from the code that uses the meaning. It also 
  provides a safeguard against two sides disagreeing on what the type of the meaning 
  should be.
  Some things to work out:
  Perhaps add update="once/rare/frequent" to properties?
  Serialization of 'var' type (each known type needs an id, and perhaps parameters)
    Type serializations should be known a priori
    Peers do not subscribe to properties of types they don't understand
  method type:
    there is the signature of the method -- is that the value of the property?
    "call method" goes backwards -- is there also "request set property" backwards?
    RPC calls probably should result in a "method result" return message type
  communication framing:
    the actual communication protocol could almost be described in this schema 
    However, we have to draw the line of flexibility somewhere!
  -->
<vocabulary>
  <typedef def="vec3f" type="vec(3,float(32))"/>
  <typedef def="color" type="vec(3,uint(0,255))"/>
  <typedef def="quat" type="vec(4,float(32))"/>
  <typedef def="mat33f" type="vec(3,vec(3,float(32)))"/>
  <typedef def="mat43f" type="vec(4,vec(3,float(32)))"/>
  <typedef def="interface_ref" type="int"/>
  <typedef def="enum_animation" type="int">
    <value label="Dance">1</value>
    <value label="Wave">2</value>
    <value label="Yawn">3</value>
  </typedef>

  <interface iid="1" meaning="root">
    <required>
      <switch>
        <case>
          <required>
            <property pid="1" meaning="pos" type="vec3f"/>
            <property pid="2" meaning="ori" type="quat"/>
          </required>
          <optional>
            <property pid="3" meaning="scale" type="vec3f"/>
          </optional>
        </case>
        <case>
          <required>
            <property pid="4" meaning="configure" type="ui"/>
          </required>
        </case>
      </switch>
    </required>
    <optional>
      <property pid="5" meaning="label" type="text"/>
      <property pid="6" meaning="owner" type="uri" schema="owner_schema"/>
      <property pid="7" meaning="lineage" type="uri" schema="lineage_schema"/>
      <property pid="8" meaning="restrictions" type="uri" schema="restrictions_schema"/>
      <list pid="9" meaning="interactions" type="interaction"/>
    </optional>
  </interface>

  <interface iid="2" meaning="display">
    <required>
      <property pid="1" meaning="mesh" type="uri" schema="mesh_schema"/>
    </required>
    <optional>
      <required>
        <list pid="2" meaning="animations" type="uri" schema="animation_schema"/>
        <property pid="3" meaning="current_animation" type="str"/>
        <property pid="5" meaning="current_animation_time" type="float(32)"/>
      </required>
      <list pid="4" meaning="pose" type="mat34"/>
    </optional>
  </interface>

  <interface iid="3" meaning="physics">
    <required>
      <property pid="1" meaning="lvel" type="vec3f"/>
      <property pid="2" meaning="avel" type="vec3f"/>
    </required>
    <optional>
      <list pid="3" meaning="link" type="objectlink"/>
    </optional>
  </interface>

  <interface iid="4" meaning="audio">
  </interface>

  <interface iid="5" meaning="ui">
  </interface>

  <interface iid="7" meaning="scripting">
  </interface>

  <interface iid="8" meaning="displaymesh">
  </interface>

  <interface iid="10" meaning="displaymaterial">
  </interface>

  <interface iid="11" meaning="physicsproxy">
    <required>
      <property pid="1" meaning="weight" type="float(32)"/>
      <property pid="2" meaning="localpos" type="vec3f"/>
      <property pid="3" meaning="localori" type="quat"/>
    </required>
    <optional>
      <property pid="4" meaning="inertia" type="mat33f"/>
    </optional>
  </interface>

  <interface iid="12" meaning="physicsbox" inherit="physicsproxy">
    <required>
      <property pid="5" meaning="extents" type="vec3f"/>
    </required>
  </interface>

  <interface iid="13" meaning="physicssphere" inherit="physicsproxy">
    <required>
      <property pid="5" meaning="radius" type="float(32)"/>
    </required>
  </interface>

  <interface iid="13" meaning="interaction">
    <required>
      <property pid="1" meaning="label" type="str"/>
      <switch>
        <case>
          <required>
            <!-- a URI is just that -- some resource that will be opened if you perform the interaction. Some mechanism should probably be in effect to prevent "cross-site scripting" attacks... -->
            <property pid="2" meaning="url" type="uri"/>
          </required>
        </case>
        <case>
          <required>
            <!-- note that "method" says that this will be a reference to a type-specific method by id. See the type schema. -->
            <property pid="3" meaning="command" type="method"/>
          </required>
        </case>
        <case>
          <required>
            <!-- a "tweaker" lets me change some property of you. -->
            <property pid="4" meaning="propref" type="tweaker"/>
          </required>
        </case>
      </switch>
    </required>
    <optional>
      <required>
        <property pid="5" meaning="localpos" type="vec3f"/>
        <property pid="6" meaning="localori" type="quat"/>
      </required>
    </optional>
  </interface>

  <interface iid="14" meaning="tweaker">
    <required>
      <!-- this describes a path from root of object through component/property to the actual property tweaked -->
      <list pid="1" meaning="path" type="int"/>
    </required>
    <optional>
      <!-- some annotations that could be useful for constructing a UI for the tweaker -->
      <property pid="2" meaning="min" type="var"/>
      <property pid="3" meaning="max" type="var"/>
      <property pid="4" meaning="power" type="float"/>
      <property pid="5" meaning="min_label" type="str"/>
      <property pid="6" meaning="max_label" type="str"/>
    </optional>
  </interface>

  <interface iid="15" meaning="objectlink">
    <required>
      <property pid="1" meaning="object" type="oid"/>
    </required>
    <optional>
      <property pid="2" meaning="joint" type="joint"/>
    </optional>
  </interface>

  <interface iid="16" meaning="joint">
    <required>
      <property pid="1" meaning="localpos" type="vec3f"/>
    </required>
  </interface>

  <interface iid="17" meaning="ballsocketjoint" inherit="joint">
    <required>
      <property pid="2" meaning="linklocalpos" type="vec3f"/>
    </required>
    <optional>
      <required>
        <property pid="3" meaning="targetlocalori" type="quat"/>
        <property pid="4" meaning="torque" type="float(32)"/>
      </required>
    </optional>
  </interface>

  <interface iid="18" meaning="hingejoint" inherit="joint">
    <required>
      <property pid="2" meaning="localaxis" type="vec3f"/>
      <property pid="3" meaning="linklocalpos" type="vec3f"/>
    </required>
    <optional>
      <property pid="4" meaning="lowstop" type="float(32)"/>
      <property pid="5" meaning="highstop" type="float(32)"/>
      <property pid="6" meaning="torque" type="float(32)"/>
    </optional>
  </interface>

  <interface iid="19" meaning="sliderjoint" inherit="joint">
    <required>
      <property pid="2" meaning="localaxis" type="vec3f"/>
      <property pid="3" meaning="linklocalpos" type="vec3f"/>
    </required>
    <optional>
      <property pid="4" meaning="lowstop" type="float(32)"/>
      <property pid="5" meaning="highstop" type="float(32)"/>
      <property pid="6" meaning="force" type="float(32)"/>
    </optional>
  </interface>

  <interface iid="19" meaning="fixedjoint" inherit="joint">
    <required>
      <property pid="2" meaning="localori" type="quat"/>
    </required>
  </interface>
</vocabulary>