Skip to content

Example Model

­Sollace edited this page Apr 19, 2020 · 7 revisions

Below is an example model (kitchen_sink.json) illustrating every option available to mson at once.

This is merely an example using dummy/junk values. Do not load it in the game and expect it to render anything sensible

{
    "parent": "mson:parent",
    "texture": { "w": 0, "h": 0 },
    "scale": 0.5,
    "locals": {
       "one": 1,
       "two": ["#one", "+", "#one"],
       "three": [["#two", "+", "#two"], "-", "#one"]
    },
    "component_one": {
       "name": "component_one",
       "texture": { "w": 0, "h": 0 }
       "center": ["#one", 0, 0],
       "offset": [0, "#one", 0],
       "rotate": [0, 90, 45],
       "cubes": [
           {
               "from": [0, 0, "#two"],
               "size": [1, "#two", 3],
               "texture": [0, 0, 0, 0],
               "mirror": false,
               "stretch": [0, 0, 0]
           },
           {
               "type": "mson:cone",
               "taper": 0.2,
               "from": [0, 0, 0],
               "size": [1.6, 2.4, 3.7],
               "texture": [0, 0, 0, 0],
               "mirror": false,
               "stretch": [0, 0, 0]
           },
           {
               "type": "mson:plane",
               "position": [0, 0, 0],
               "size": [1, 2],
               "mirror": [false, false, false],
               "stretch": [0, 0, 0],
               "face": "up",
               "texture": {"u": 0, "v": 0, "w": 0, "h": 0}
           }
       ],
       "children": [
           {
               "type": "mson:planar",
               "texture": { "w": 0, "h": 0 },
               "name": "component_two",
               "center": [0, 0, 0],
               "offset": [0, 0, 0],
               "rotate": [0, 90, 45],
               "north": [0, 0, 0, 0, 0],
               "south": [0, 0, 0, 0, 0, 1, 2],
               "east": [0, 0, 0, 0, 0],
               "west": [0, 0, 0, 0, 0],
               "up": [
                   [0, 0, 0, 0, 0, 3, 4],
                   [0, 0, 0, 0, 0]
               ],
               "down": [
                   [0, 0, 0, 0, 0],
                   [0, 0, 0, 0, 0]
               ]
           }
       ]
    },
    "component_three": {
       "type": "mson:slot",
       "name": "component_three",
       "implementation": "com.example.mson.PartClass",
       "content": "mson:another_model",
       "locals": {
           "example_value": 34
       }
    },
    "component_four": {
       "type": "mson:slot",
       "name": "component_four",
       "implementation": "com.example.mson.PartClass",
       "content": {
           "parent": "mson:another_model",
           "stuff": {
              "cubes": [
                 {
                    "type": "mson:quads",
                    "u": 0,
                    "v": 0,
                    "vertices": [
                        [ 0, 0, 0, 0, 0 ],
                        [ 1, 1, 1, 1, 1 ]
                    ],
                    "faces": [
                        {
                           "x": 0,
                           "__comment": "Look at me! I'm a comment!",
                           "__comment": "We have no effect on anything",
                           "y": 0,
                           "w": 1,
                           "h": 1,
                           "vertices": [0, 1, 0, 1]
                        }
                    ]
                 }
              ]
           },
           "locals": {
               "example_value": 34
           }
       }
    }
}
Clone this wiki locally