|
|
|
|
|
|
CommandBuffer cmd = new CommandBuffer(); |
|
|
|
cmd.name = "Skybox"; |
|
|
|
|
|
|
|
Light sunLight = RenderSettings.sun; |
|
|
|
Color sunColor = new Color(0, 0, 0); |
|
|
|
Vector3 sunDir = new Vector3(0, 0, -1); |
|
|
|
Material mat = RenderSettings.skybox; |
|
|
|
if (sunLight != null) |
|
|
|
if (mat == null) |
|
|
|
sunColor = sunLight.color; |
|
|
|
Transform xform = sunLight.transform; |
|
|
|
sunDir = xform.TransformDirection(sunDir); |
|
|
|
return; |
|
|
|
|
|
|
|
Material mat = RenderSettings.skybox; |
|
|
|
|
|
|
|
bool looksLikeSixSidedShader = true; |
|
|
|
looksLikeSixSidedShader &= (mat.passCount == 6); // should have six passes
|
|
|
|
|
|
|
{ |
|
|
|
CreateMesh(); |
|
|
|
} |
|
|
|
|
|
|
|
cmd.SetGlobalVector("_LightColor0", sunColor); |
|
|
|
cmd.SetGlobalVector("_WorldSpaceLightPos0", sunDir); |
|
|
|
|
|
|
|
float dist = camera.farClipPlane * 10.0f; |
|
|
|
|
|
|
|