-
Notifications
You must be signed in to change notification settings - Fork 69
Material Validation
bsupnik edited this page Sep 17, 2015
·
2 revisions
This is a proposed algorithm to validate that materials for an export are correct. The validation algorithm needs to know the "export" context, one of:
- scenery object
- instanced scenery object
- aircraft-attached object
TODO: do we want to include version compatibility in this matrix?
The algorithm can return:
-
whether the export is valid or there are material conflicts and
-
the 'key' materials (the materials defining global properties) for all of: the panel texture, the object texture, and the draped texture.
The algorithm:
Gather a list of all materials
For each material
Is the material valid (requires the export context be passed in - this lets us mark illegal manipulators in scenery objects).
If the material is not valid, we fail export on an invalid material error.
Is the material class valid for this export context (e.g. no textured materials in instanced object, no panel material in scenery object, no draped material in aircraft object). This comes from the first table.
If the material class is not valid, we fail export on an invalid material class error.
For each material
Based on its material class, find its 'key slot' - one of panel, object or draped.
If that slot is empty
This material fills this slot.
Else
Compare this material to the material already in the slot for "compatibility" along all _bolded_ attributes from table 2.
If all attributes match
Continue - this is not a conflict
Else
Fail and return false - we have a material property conflict in a multi-material object.
When we are done, none, some, or all of the key material slots will be filled. This tells us what we have in the object. Note that is legal for ANY or ALL of the slots to be empty, e.g. in a "lights only" object.