YAML 101
But of course it would be cumbersome and error-prone, so what YAML provides is a much simpler representation of the same data:
All quotation marks and commas can be omitted
key2: unquoted string
Like Python, indentation is part of the syntax, representing hierarchy of the data1
object1:
key1: false
object2:
key2: 3.14
key3: 0xdeadbeef
nestedObject:
key4: 'quoted string'
With these in mind, the effect manifest at the beginning of this document can be re-write as follows:
techniques:
- passes:
- vert: skybox-vs
cullMode: none
# ...
Another YAML feature that comes in handy is referencing and inheriting between data.
Reference
object1: &o1
key1: value1
object2:
key2: value2
key3: *o1
This is its corresponding JSON:
-
object1: &o1
key1: value1
key2: value2
object2:
<<: *o1
The corresponding JSON:
"object1": {
"key1": "value1",
"key2": "value2"
},
"object2": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
}
For our purposes, like when multiple pass has the same properties, etc. it could be really helpful:
Finally, before writing any YAML, wrap it in a CCEffect block first:
CCEffect %{
}%
You can always refer to any to play around ideas.
- The YAML standard doesn’t support tabs, so the effect compiler will try to replace all the tabs in file with 2 spaces first, to avoid the trivial yet annoying trouble of accidentally inserting tabs somewhere. But overall, please try to avoid doing that completely to make sure the compilation goes smoothly.