Mesh Queries
This page is a work in progress. It will be updated within the next weeks.
For the time being, here's an example instead:
// The mesh queries define how meshes are generated using
// the BrushMesh surface layer information
MeshQuery[] meshQueries =
{
new MeshQuery(
// Create meshes, one for each surface layer (layerParameter1)
// with a different type of 'Material'.
// Does not select surface layers with a layerParameter1 of 0.
// Ignores all other layer parameters.
parameterIndex: LayerParameterIndex.RenderMaterial,
// Uses all vertex channels.
vertexChannels: VertexChannelFlags.All,
// Find surface layers with 'Renderable', 'CastShadows'
// and/or 'ReceiveShadows' flags.
mask: LayerUsageFlags.RenderReceiveCastShadows,
// Only select the ones that have them all set.
query: LayerUsageFlags.RenderReceiveCastShadows
),
new MeshQuery(
// Create meshes, one for each surface layer (layerParameter1)
// with a different type of 'Material'.
// Does not select surface layers with a layerParameter1 of 0.
// Ignores all other layer parameters.
parameterIndex: LayerParameterIndex.RenderMaterial,
// Uses all vertex channels.
vertexChannels: VertexChannelFlags.All,
// Find surface layers with 'Renderable', 'CastShadows'
// and/or 'ReceiveShadows' flags.
mask: LayerUsageFlags.RenderReceiveCastShadows,
// Only select the ones that have both 'Renderable' and
// 'Cast Shadows' set. Will reject any surface layer that
// has the 'ReceiveShadows' flag set.
query: LayerUsageFlags.RenderCastShadows
),
new MeshQuery(
// Create meshes, one for each surface layer (layerParameter1)
// with a different type of 'Material'.
// Does not select surface layers with a layerParameter1 of 0.
// Ignores all other layer parameters.
parameterIndex: LayerParameterIndex.RenderMaterial,
// Uses all vertex channels.
vertexChannels: VertexChannelFlags.All,
// Find surface layers with 'Renderable', 'CastShadows'
// and/or 'ReceiveShadows' flags.
mask: LayerUsageFlags.RenderReceiveCastShadows,
// Only select the ones that have both 'Renderable' and
// 'Receive Shadows' set. Will reject any surface layer
// that has the 'CastShadows' flag set.
query: LayerUsageFlags.RenderReceiveShadows
),
Note: See "Create Unity Mesh" on how to create a Unity Mesh using this MeshQuery