|
|
|
|
|
|
|
|
|
|
public MaterialGraphPreviewGenerator() |
|
|
|
{ |
|
|
|
EditorUtility.SetCameraAnimateMaterials(utility.m_Camera, true); |
|
|
|
EditorUtility.SetCameraAnimateMaterials(utility.camera, true); |
|
|
|
|
|
|
|
if (s_Meshes[0] == null) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
if (mode == PreviewMode.Preview3D) |
|
|
|
{ |
|
|
|
utility.m_Camera.transform.position = -Vector3.forward * 5; |
|
|
|
utility.m_Camera.transform.rotation = Quaternion.identity; |
|
|
|
utility.camera.transform.position = -Vector3.forward * 5; |
|
|
|
utility.camera.transform.rotation = Quaternion.identity; |
|
|
|
utility.m_Camera.projectionMatrix = Matrix4x4.identity; |
|
|
|
utility.camera.projectionMatrix = Matrix4x4.identity; |
|
|
|
EditorUtility.SetCameraAnimateMaterialsTime(utility.m_Camera, time); |
|
|
|
utility.m_Light[0].intensity = 1.0f; |
|
|
|
utility.m_Light[0].transform.rotation = Quaternion.Euler(50f, 50f, 0); |
|
|
|
utility.m_Light[1].intensity = 1.0f; |
|
|
|
InternalEditorUtility.SetCustomLighting(utility.m_Light, Color.black); |
|
|
|
EditorUtility.SetCameraAnimateMaterialsTime(utility.camera, time); |
|
|
|
utility.lights[0].intensity = 1.0f; |
|
|
|
utility.lights[0].transform.rotation = Quaternion.Euler(50f, 50f, 0); |
|
|
|
utility.lights[1].intensity = 1.0f; |
|
|
|
InternalEditorUtility.SetCustomLighting(utility.lights, Color.black); |
|
|
|
utility.m_Camera.clearFlags = CameraClearFlags.Depth; |
|
|
|
utility.camera.clearFlags = CameraClearFlags.Depth; |
|
|
|
|
|
|
|
utility.DrawMesh( |
|
|
|
mode == PreviewMode.Preview3D ? s_Meshes[0] : quad, |
|
|
|
|
|
|
0); |
|
|
|
utility.m_Camera.Render(); |
|
|
|
utility.camera.Render(); |
|
|
|
|
|
|
|
Unsupported.SetRenderSettingsUseFogNoDirty(oldFog); |
|
|
|
InternalEditorUtility.RemoveCustomLighting(); |
|
|
|