The PerCameraMesh Module provides a way to allow each camera to render a different mesh, for a given object. How the meshes are assigned, is by deriving your own version of PerCameraMeshAndMaterials, and overriding the abstract functions in it.
Using material property blocks, cashed mesh's, camera references, and the DrawMesh unity function, each camera can display a different mesh for the object. The object will be placed, scaled and oriented based upon the PerCemeraMeshAndMaterials component's transform. Note: the CallbackCamera component will need to be assigned to each camera GameObject that you want to draw the PerCemeraMeshAndMaterials.
Only one concrete component is included, though it does not have anything to display in the editor:
Classes | |
class | CallbackCamera |
This component is added to Camera Objects by the PerCameraMeshDrawer class. It is used to get a callback notification when a particular condition occurs. | |
class | MaterialConfig |
Simple class used to store a single Material and MaterialPropertyBlock in one object. | |
class | MeshAndMaterialConfigSet |
Storable objects that combines a mesh and a list of materials and MaterialPropertyBlock blocks, (in the form of a MaterialsBlock class array) | |
class | PerCameraMeshAndMaterials |
Class that creates/updates and stores a separate mesh for rendering to each camera. Each camera is assigned a mesh to be drawn, and may have multiple materials assigned to this mesh. This mesh is initially assigned by overriding GenerateMeshForCamera to return the appropriate mesh. So, to use this class, you will need to derive your own class from it, and override the function: GenerateMeshForCamera to provide the mesh to be drawn in the specified camera. UpdateMeshForCamera can be overridden to recompute the mesh, should the mesh need to be changed when the camera changes position/orientation. | |