This function takes a mesh and validates it. The mesh should be a list with "shapes", "materials", "vertices", "texcoords", "normals", and "material_hashes" entries.
validate_mesh(mesh, validate_materials = TRUE)A mesh.
Each "shapes" entry should be a list with "mesh", "name", and "material" entries. Each "mesh" entry should have "indices", "tex_indices", "norm_indices", "material_ids", "has_vertex_tex", and "has_vertex_normals". The indices should not exceed the number of rows in their corresponding vertex/normal/texcoord data. There should be no NA/NaN values in the vertex/normal/texcoord data.
Each "materials" entry is expected to be a list with several entries with specific required lengths, as listed below:
| Attribute | Length | Type |
| diffuse | 3 | Numeric |
| ambient | 3 | Numeric |
| specular | 3 | Numeric |
| transmittance | 3 | Numeric |
| emission | 3 | Numeric |
| shininess | 1 | Numeric |
| ior | 1 | Numeric |
| dissolve | 1 | Numeric |
| illum | 1 | Numeric |
| diffuse_texname | 1 | Character |
| normal_texname | 1 | Character |
| bump_texname | 1 | Character |
| specular_texname | 1 | Character |
| ambient_texname | 1 | Character |
| emissive_texname | 1 | Character |
| diffuse_intensity | 1 | Numeric |
| bump_intensity | 1 | Numeric |
| specular_intensity | 1 | Numeric |
| emission_intensity | 1 | Numeric |
| ambient_intensity | 1 | Numeric |
| culling | 1 | Character |
| type | 1 | Character |
| translucent | 1 | Logical |
| toon_levels | 1 | Numeric |
| toon_outline_width | 1 | Numeric |
| toon_outline_color | 3 | Numeric |
| reflection_intensity | 1 | Numeric |
| reflection_sharpness | 1 | Numeric |
| two_sided | 1 | Logical |
Note: This materials validation only applies to the rayvertex package. Other renderers might choose to use their own information in the material list.
# validate a mesh
mesh = validate_mesh(sphere_mesh())