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.
|
virtual void | DrawMeshForCamera (Camera cam) |
| Override this function if you would like to change the way the mesh is rendered, or add additional functionality. This function is called for each camera's OnPreCull Event. This version will use Grapics.DrawMesh to render the mesh to the camera during the next render cycle.
If the camera is not yet registered with this object, it will register it, generate the mesh for it, and finally, actually render it.
|
|
void | ForceAllCameraMaterialsToDefaultNow () |
| Resets all the camera specific materials into the default materials.
|
|
void | ForceMaterialBlockUpdateForAllCamerasNow () |
| Resets all the camera specific materials into the default materials.
|
|
void | ForceMeshRegenerationForAllCamerasNow () |
| Immediately calls UpdateMesh for all registered cameras. Not called internally.
|
|
void | ForceMeshUpdateInAllCamerasNow () |
| Immediately calls UpdateMesh for all registered cameras. Not called internally.
|
|
delegate Object | GetEditorSelectedObjectDelegate () |
| Defines the signature an EditorAdapeter will use to find the selected object, when running in the unity editor.
|
|
override void | GetPropertyBlock (out MaterialPropertyBlock dest) |
| Invokes the version of this function takes an material index parameter, and passes a 0 for the materialIndex.
|
|
override void | GetPropertyBlock (out MaterialPropertyBlock dest, int materialIndex) |
| Gets the MaterialPropertyBlock assigned to whichever camera is referenced by the accessorReferenceCamera member.
|
|
override void | OnRenderObject () |
| Does nothing. Configurable camera callbacks have been implemented instead.
|
|
override void | RebuildPropertyBlock (int materialIndex) |
| Clears the materials property block for the indexed material, on the accessorReferenceCamera.
|
|
void | RegisterCamera (Camera cam) |
| This function is called internally when a new camera is detected. It creates a mesh via GenerateMeshForCamera, and stores it, along with the camera reference in the perCameraMesh Dictionary.
It also registers with ObjectCallbackCamera, to create an ObjectCallbackCamera component on the camera that will issues callbacks to this object. The type of ObjectCallbackCamera class will determine what conditions will issue a callback. The ObjectCallbackCamera class variant used, can be changed by overriding the ObjectCallbackCameraTypeToRegister function.
|
|
override void | SetPropertyBlock (MaterialPropertyBlock source) |
| Invokes the version of this function takes an material index parameter, and passes a 0 for the materialIndex.
|
|
override void | SetPropertyBlock (MaterialPropertyBlock source, int materialIndex) |
| Sets the MaterialPropertyBlock assigned to whichever camera is referenced by the accessorReferenceCamera member, to the value specified in the source parameter.
|
|
virtual bool | TryGetMeshAndMaterialBlockForCamera (Camera cam, out MeshAndMaterialConfigSet meshAndMatsFound) |
| Attempts to get the MeshAnd Material block that has been assigned to the provided camera.
|
|
void | UnRegisterCamera (Camera cam) |
| Remove the specified camera from rendering this object, and removes the cache mesh reference from the perCameraMesh dictionary. Not used internally. If the camera has already been registered, this function will do nothing.
|
|
virtual void | GetClosestReflectionProbes (List< ReflectionProbeBlendInfo > result) |
|
virtual bool | HasColor () |
| Specifies if the material this instance uses has a _Color
|
|
virtual bool | HasColor (int matIndex) |
| Specifies if the material this instance uses, specified by the index has a _Color
|
|
virtual bool | HasTexture () |
| Specifies if the material this instance uses has a _MainTexture
|
|
virtual bool | HasTexture (int matIndex) |
| Specifies if the material this instance uses, specified by the index has a _MainTexture
|
|
virtual void | RebuildPropertyBlock () |
| This function will be invoked wen the property block needs to be rebuilt. For example, if it contains a texture, and a texture is added
|
|
|
Camera | accessorReferenceCamera |
| Internal stored and automatically updated, this member specifies which camera will be used when accessing and any other camera-dependent members (like the "materials", or "bound" members). Public for Editor Only: Do not use.
|
|
Material[] | defaultMaterials |
| Material used to render the mesh. Each material is rendered to a different sub-mesh of the mesh. If this array contains more materials, than the mesh contains sub-meshes, the additional materials will be applied to sub-mesh index [0], the main mesh, and rendered to the camera again.
|
|
UpdateOption | materialPropertiesUpdateOption |
| Specifies when the MaterialPropertyBlovk should be updated for each/all cameras.
|
|
UpdateOption | meshRecomputeOption |
| Specifies when the mesh should be recomputed for each/all cameras. This will invoke the abstract (defined in derived classes) GenerateMeshForCamera member function.
|
|
UpdateOption | meshUpdateOption |
| Specifies when the mesh should be reassigned to each/all cameras. This will invoke the abstract (defined in derived classes) UpdateMeshForCamera member function. This is useful when the mesh can be updated, faster than it can be completely regenerated.
|
|
Dictionary< Camera, MeshAndMaterialConfigSet > | perCameraMesh |
| dictionary class the uses each camera as the key, and the mesh that will drawn to it, as each key's Value.
|
|
Material[] | localSharedMats |
|
bool | m_allowOcclusionWhenDynamic |
|
int | m_lightmapIndex |
|
Vector4 | m_lightmapScaleOffset |
|
GameObject | m_lightProbeProxyVolumeOverride |
|
LightProbeUsage | m_lightProbeUsage |
|
MotionVectorGenerationMode | m_motionVectorGenerationMode |
|
Transform | m_probeAnchor |
|
int | m_realtimeLightmapIndex |
|
Vector4 | m_realtimeLightmapScaleOffset |
|
bool | m_receiveShadows |
|
ReflectionProbeUsage | m_reflectionProbeUsage |
|
ShadowCastingMode | m_shadowCastingMode |
|
int | m_sortingLayerID |
|
int | m_sortingOrder |
|
|
void | CameraCallback (Camera cam, Matrix4x4 view, Matrix4x4 projection) |
| This function is called by registered cameras when, by default, their transform changes. Using a different (derived) type of ObjectCallbackCamera class can change (override) what condition will trigger a call to this function. When called, it updates the mesh stored for the provided camera (using the UpdateMeshForCamera function). The matrices are passed along to this update function.
|
|
abstract void | GenerateMeshForCamera (Camera cam, ref Mesh meshToFill) |
| This function generates the mesh that will be drawn for the provided camera. It is called by internal code when registering a camera, but functionality is provided by descendant classes.
|
|
virtual System.Type | ObjectCallbackCameraTypeToRegister () |
| Specifies the type of ObjectCallbackCamera class that will be added to a camera during RegisterCamera. You can override this function to return a custom CallbackCamera class, which can invoke callbacks under different conditions.
|
|
virtual void | OnDisable () |
| Unregister from Editor Callbacks and ObjectCallbackCamera. Does not remove existing camera and cashed meshes from storage, they are just not used.
|
|
override void | OnEnable () |
| On Enable will register for continual updates in editor mode, register with Camer.OnPreCull, and register any cashed camera with ObjectCallbackCamera.
|
|
virtual void | Reset () |
| Resets all local members to default values
|
|
virtual void | Update () |
| This standard function simply calls UpdateMaterialPropertyBlock. If in unity editor it is registered OnEnable to be called every cycle with UnityEditor.EditorApplication.update Override to add additional functionality.
|
|
virtual void | UpdateMaterialPropertyBlockForCamera (Camera cam, ref MaterialConfig[] matProperties) |
| This function is called every update cycle. This property block will be used when rendering the mesh in all registered cameras. This function does need to actually contain any functionality, unless desired.
|
|
virtual void | UpdateMeshForCamera (Camera cam, ref Mesh meshToFill, Matrix4x4 view, Matrix4x4 projection) |
| This function updates the mesh that will be drawn for the provided camera. It is called by internal callback-code when a registered camera's transform has changed, but functionality is provided by descendant classes. It is intended to facilitate a more efficient mesh recomputation than a full Generation process. If descendant classes do not override this function, it will do nothing.
|
|
|
Camera | accessorReferenceCameraOrCurrentOrMain [get] |
| This renderer requires a camera be specified in order to access its materials and mesh.
So, the following accessor will use the Camera referenced by this variable, to lookup the appropriate variables. Returns the last value assigned to it. If no value, or null has been assigned: will return the Camera.current or Camera.main, in that order of existence.
|
|
override Bounds | bounds [get] |
| finds/computes the bounds for the mesh drawn by the camera specified in the accessorReferenceCamera
|
|
override Material[] | sharedMaterials [get, set] |
| gets the materials for this object, that is associated with the current accessorReferenceCamera.
|
|
virtual bool | allowOcclusionWhenDynamic [get, set] |
|
abstract Bounds | bounds [get] |
|
virtual bool | castShadows [get] |
|
virtual Color | color [get, set] |
| Provides IGraphicsColorInterface functionality. will get/set the default color in the first material of this object
|
|
virtual bool | colorInterfaceEnabled [get, set] |
|
virtual Material[] | drawMaterials [get] |
|
bool | isPartOfStaticBatch [get] |
|
virtual bool | isViewable [get, set] |
|
virtual bool | isVisible [get, set] |
|
virtual int | lightmapIndex [get, set] |
|
virtual Vector4 | lightmapScaleOffset [get, set] |
|
virtual Vector4 | lightmapTilingOffset [get, set] |
|
virtual Transform | lightProbeAnchor [get, set] |
|
virtual GameObject | lightProbeProxyVolumeOverride [get, set] |
|
virtual LightProbeUsage | lightProbeUsage [get, set] |
|
Matrix4x4 | localToWorldMatrix [get] |
|
virtual Material | Material [get, set] |
|
virtual Material[] | Materials [get, set] |
|
virtual MotionVectorGenerationMode | motionVectorGenerationMode [get, set] |
|
virtual bool | motionVectors [get, set] |
|
virtual Transform | probeAnchor [get, set] |
|
virtual int | realtimeLightmapIndex [get, set] |
|
virtual Vector4 | realtimeLightmapScaleOffset [get, set] |
|
virtual bool | receiveShadows [get, set] |
|
virtual ReflectionProbeUsage | reflectionProbeUsage [get, set] |
|
virtual ShadowCastingMode | shadowCastingMode [get, set] |
|
virtual Material | sharedMaterial [get, set] |
|
virtual Material[] | sharedMaterials [get, set] |
|
virtual int | sortingLayerID [get, set] |
|
virtual string | sortingLayerName [get] |
|
virtual int | sortingOrder [get, set] |
|
virtual bool | useLightProbes [get, set] |
|
Matrix4x4 | worldToLocalMatrix [get] |
|
Color | color [get, set] |
| Accessor that stores and retries the color itself.
|
|
bool | colorInterfaceEnabled [get, set] |
| When set to false, the color is not actually changed.
|
|
Bounds | bounds [get] |
| local bounds of object.
|
|
Transform | transform [get] |
| reference to the Transform of this object. Used when providing the bounds relative to another transform in the hierarchy.
|
|
bool | isViewable [get, set] |
| Accessor used to set/get the current isViewable state.
|
|