| | 1 | | using System; |
| | 2 | | using System.Collections; |
| | 3 | | using System.Collections.Generic; |
| | 4 | | using UnityEngine; |
| | 5 | | using DCL.Helpers; |
| | 6 | |
|
| | 7 | | namespace DCL.Skybox |
| | 8 | | { |
| | 9 | | //[CreateAssetMenu(fileName = "Skybox Configuration", menuName = "ScriptableObjects/SkyboxConfiguration", order = 1) |
| | 10 | | public class SkyboxConfiguration : ScriptableObject |
| | 11 | | { |
| | 12 | | public delegate void TimelineEvents(string tag, bool enable, bool trigger); |
| | 13 | | public event TimelineEvents OnTimelineEvent; |
| | 14 | |
|
| | 15 | | // ID |
| | 16 | | public string skyboxID; |
| | 17 | |
|
| | 18 | | // Background Color |
| 0 | 19 | | public Gradient skyColor = new Gradient(); |
| 0 | 20 | | public Gradient horizonColor = new Gradient(); |
| 0 | 21 | | public Gradient groundColor = new Gradient(); |
| | 22 | |
|
| | 23 | | // Horizon Layer |
| 0 | 24 | | public List<TransitioningFloat> horizonWidth = new List<TransitioningFloat>(); |
| 0 | 25 | | public List<TransitioningFloat> horizonHeight = new List<TransitioningFloat>(); |
| | 26 | | public Texture2D horizonMask; |
| 0 | 27 | | public Vector3 horizonMaskValues = new Vector3(0, 0, 0); |
| 0 | 28 | | public Gradient horizonPlaneColor = new Gradient(); |
| 0 | 29 | | public List<TransitioningFloat> horizonPlaneHeight = new List<TransitioningFloat>(); |
| | 30 | |
|
| | 31 | | // Ambient Color |
| 0 | 32 | | public bool ambientTrilight = true; |
| 0 | 33 | | public Gradient ambientSkyColor = new Gradient(); |
| 0 | 34 | | public Gradient ambientEquatorColor = new Gradient(); |
| 0 | 35 | | public Gradient ambientGroundColor = new Gradient(); |
| | 36 | |
|
| | 37 | | // Avatar Color |
| 0 | 38 | | public bool useAvatarGradient = true; |
| 0 | 39 | | public Gradient avatarTintGradient = new Gradient(); |
| 0 | 40 | | public Color avatarTintColor = Color.white; |
| 0 | 41 | | public bool useAvatarRealtimeDLDirection = true; |
| 0 | 42 | | public Vector3 avatarLightConstantDir = new Vector3(-18f, 144f, -72f); |
| 0 | 43 | | public bool useAvatarRealtimeLightColor = true; |
| 0 | 44 | | public Gradient avatarLightColorGradient = new Gradient(); |
| | 45 | |
|
| | 46 | | // Avatar Editor Color |
| 0 | 47 | | public Color avatarEditorTintColor = Color.white; |
| 0 | 48 | | public Vector3 avatarEditorLightDir = new Vector3(-18f, 144f, -72f); |
| 0 | 49 | | public Color avatarEditorLightColor = Color.white; |
| | 50 | |
|
| | 51 | | // Fog Properties |
| | 52 | | public bool useFog = false; |
| 0 | 53 | | public FogMode fogMode = FogMode.ExponentialSquared; |
| 0 | 54 | | public Gradient fogColor = new Gradient(); |
| 0 | 55 | | public float fogDensity = 0.05f; |
| | 56 | | public float fogStartDistance = 0; |
| 0 | 57 | | public float fogEndDistance = 300; |
| | 58 | |
|
| | 59 | | // DirectionalLight Properties |
| 0 | 60 | | public bool useDirectionalLight = true; |
| 0 | 61 | | public DirectionalLightAttributes directionalLightLayer = new DirectionalLightAttributes(); |
| | 62 | |
|
| | 63 | | // Layers |
| 0 | 64 | | public List<TextureLayer> layers = new List<TextureLayer>(); |
| | 65 | |
|
| | 66 | | // Timeline Tags |
| 0 | 67 | | public List<TimelineTagsDuration> timelineTags = new List<TimelineTagsDuration>(); |
| | 68 | |
|
| 0 | 69 | | private float cycleTime = 24; |
| | 70 | |
|
| | 71 | | public void ApplyOnMaterial(Material selectedMat, float dayTime, float normalizedDayTime, int slotCount = 5, Lig |
| | 72 | | { |
| 0 | 73 | | float percentage = normalizedDayTime * 100; |
| | 74 | |
|
| | 75 | | // General Values |
| 0 | 76 | | selectedMat.SetColor(SkyboxShaderUtils.LightTint, directionalLightLayer.tintColor.Evaluate(normalizedDayTime |
| 0 | 77 | | selectedMat.SetVector(SkyboxShaderUtils.LightDirection, directionalLightGO.transform.rotation.eulerAngles); |
| | 78 | |
|
| | 79 | | // Apply Base Values |
| 0 | 80 | | selectedMat.SetColor(SkyboxShaderUtils.SkyColor, skyColor.Evaluate(normalizedDayTime)); |
| 0 | 81 | | selectedMat.SetColor(SkyboxShaderUtils.GroundColor, groundColor.Evaluate(normalizedDayTime)); |
| | 82 | |
|
| | 83 | | // Apply Horizon Values |
| 0 | 84 | | selectedMat.SetColor(SkyboxShaderUtils.HorizonColor, horizonColor.Evaluate(normalizedDayTime)); |
| 0 | 85 | | selectedMat.SetFloat(SkyboxShaderUtils.HorizonHeight, GetTransitionValue(horizonHeight, percentage, 0f)); |
| 0 | 86 | | selectedMat.SetFloat(SkyboxShaderUtils.HorizonWidth, GetTransitionValue(horizonWidth, percentage, 0f)); |
| 0 | 87 | | selectedMat.SetTexture(SkyboxShaderUtils.HorizonMask, horizonMask); |
| 0 | 88 | | selectedMat.SetVector(SkyboxShaderUtils.HorizonMaskValues, horizonMaskValues); |
| 0 | 89 | | selectedMat.SetColor(SkyboxShaderUtils.HorizonPlaneColor, horizonPlaneColor.Evaluate(normalizedDayTime)); |
| 0 | 90 | | selectedMat.SetFloat(SkyboxShaderUtils.HorizonPlaneHeight, GetTransitionValue(horizonPlaneHeight, percentage |
| | 91 | |
|
| | 92 | |
|
| | 93 | | // Apply Ambient colors to the rendering settings |
| 0 | 94 | | if (ambientTrilight) |
| | 95 | | { |
| 0 | 96 | | RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Trilight; |
| 0 | 97 | | RenderSettings.ambientSkyColor = ambientSkyColor.Evaluate(normalizedDayTime); |
| 0 | 98 | | RenderSettings.ambientEquatorColor = ambientEquatorColor.Evaluate(normalizedDayTime); |
| 0 | 99 | | RenderSettings.ambientGroundColor = ambientGroundColor.Evaluate(normalizedDayTime); |
| 0 | 100 | | } |
| | 101 | | else |
| | 102 | | { |
| 0 | 103 | | RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Skybox; |
| | 104 | | } |
| | 105 | |
|
| | 106 | | //Fog Values |
| 0 | 107 | | RenderSettings.fog = useFog; |
| 0 | 108 | | if (useFog) |
| | 109 | | { |
| 0 | 110 | | RenderSettings.fogColor = fogColor.Evaluate(normalizedDayTime); |
| 0 | 111 | | RenderSettings.fogMode = fogMode; |
| 0 | 112 | | switch (fogMode) |
| | 113 | | { |
| | 114 | | case FogMode.Linear: |
| 0 | 115 | | RenderSettings.fogStartDistance = fogStartDistance; |
| 0 | 116 | | RenderSettings.fogEndDistance = fogEndDistance; |
| 0 | 117 | | break; |
| | 118 | | default: |
| 0 | 119 | | RenderSettings.fogDensity = fogDensity; |
| | 120 | | break; |
| | 121 | | } |
| | 122 | | } |
| | 123 | |
|
| | 124 | | //Directional List |
| 0 | 125 | | if (useDirectionalLight) |
| | 126 | | { |
| | 127 | | // Apply Direction light color |
| 0 | 128 | | directionalLightGO.color = directionalLightLayer.lightColor.Evaluate(normalizedDayTime); |
| | 129 | |
|
| | 130 | | // Apply direction |
| 0 | 131 | | ApplyDLDirection(normalizedDayTime, directionalLightGO); |
| | 132 | |
|
| | 133 | | // Apply Intensity |
| 0 | 134 | | ApplyDLIntensity(normalizedDayTime, directionalLightGO); |
| 0 | 135 | | } |
| | 136 | | else |
| | 137 | | { |
| 0 | 138 | | directionalLightGO.gameObject.SetActive(false); |
| | 139 | | } |
| | 140 | |
|
| | 141 | | // Check and Fire timeline events |
| 0 | 142 | | CheckAndFireTimelineEvents(dayTime); |
| | 143 | |
|
| 0 | 144 | | ApplyAllSlots(selectedMat, dayTime, normalizedDayTime, slotCount, cycleTime); |
| 0 | 145 | | } |
| | 146 | |
|
| | 147 | | public void ApplyInWorldAvatarColor(float normalizedDayTime, GameObject directionalLightGO) |
| | 148 | | { |
| 0 | 149 | | if (useAvatarGradient) |
| | 150 | | { |
| 0 | 151 | | Shader.SetGlobalColor(ShaderUtils.TintColor, avatarTintGradient.Evaluate(normalizedDayTime)); |
| 0 | 152 | | } |
| | 153 | | else |
| | 154 | | { |
| 0 | 155 | | Shader.SetGlobalColor(ShaderUtils.TintColor, avatarTintColor); |
| | 156 | | } |
| | 157 | |
|
| | 158 | | // Apply Avatar Light Direction |
| 0 | 159 | | if (!useAvatarRealtimeDLDirection || directionalLightGO == null || !useDirectionalLight) |
| | 160 | | { |
| 0 | 161 | | Shader.SetGlobalVector(ShaderUtils.LightDir, avatarLightConstantDir / 180); |
| 0 | 162 | | } |
| | 163 | | else |
| | 164 | | { |
| 0 | 165 | | Vector3 tempDir = directionalLightGO.transform.rotation.eulerAngles; |
| 0 | 166 | | Shader.SetGlobalVector(ShaderUtils.LightDir, tempDir / 180); |
| | 167 | | } |
| | 168 | |
|
| | 169 | | // Apply Avatar Light Color |
| 0 | 170 | | if (!useAvatarRealtimeLightColor || directionalLightGO == null || !useDirectionalLight) |
| | 171 | | { |
| 0 | 172 | | Shader.SetGlobalColor(ShaderUtils.LightColor, avatarLightColorGradient.Evaluate(normalizedDayTime)); |
| 0 | 173 | | } |
| | 174 | | else |
| | 175 | | { |
| 0 | 176 | | Shader.SetGlobalColor(ShaderUtils.LightColor, directionalLightLayer.lightColor.Evaluate(normalizedDayTim |
| | 177 | | } |
| 0 | 178 | | } |
| | 179 | |
|
| | 180 | | public void ApplyEditorAvatarColor() |
| | 181 | | { |
| 0 | 182 | | Shader.SetGlobalColor(ShaderUtils.TintColor, avatarEditorTintColor); |
| 0 | 183 | | Shader.SetGlobalVector(ShaderUtils.LightDir, avatarEditorLightDir / 180); |
| 0 | 184 | | Shader.SetGlobalColor(ShaderUtils.LightColor, avatarEditorLightColor); |
| 0 | 185 | | } |
| | 186 | |
|
| | 187 | | void ApplyAllSlots(Material selectedMat, float dayTime, float normalizedDayTime, int slotCount = 5, float cycleT |
| | 188 | | { |
| 0 | 189 | | for (int i = 0; i < slotCount; i++) |
| | 190 | | { |
| 0 | 191 | | TextureLayer layer = GetActiveLayer(dayTime, i); |
| | 192 | |
|
| 0 | 193 | | if (layer == null || !layer.enabled) |
| | 194 | | { |
| 0 | 195 | | ResetSlot(selectedMat, i); |
| 0 | 196 | | continue; |
| | 197 | | } |
| | 198 | |
|
| 0 | 199 | | ApplyTextureLayer(selectedMat, dayTime, normalizedDayTime, i, layer, cycleTime); |
| | 200 | | } |
| 0 | 201 | | } |
| | 202 | |
|
| | 203 | | public TextureLayer GetActiveLayer(float currentTime, int slotID) |
| | 204 | | { |
| 0 | 205 | | TextureLayer temp = null; |
| | 206 | |
|
| 0 | 207 | | for (int i = 0; i < layers.Count; i++) |
| | 208 | | { |
| 0 | 209 | | if (layers[i].slotID != slotID) |
| | 210 | | { |
| | 211 | | continue; |
| | 212 | | } |
| | 213 | |
|
| 0 | 214 | | float endTimeEdited = layers[i].timeSpan_End; |
| 0 | 215 | | float dayTimeEdited = currentTime; |
| | 216 | |
|
| 0 | 217 | | if (layers[i].timeSpan_End < layers[i].timeSpan_start) |
| | 218 | | { |
| 0 | 219 | | endTimeEdited = cycleTime + layers[i].timeSpan_End; |
| 0 | 220 | | if (currentTime < layers[i].timeSpan_start) |
| | 221 | | { |
| 0 | 222 | | dayTimeEdited = cycleTime + currentTime; |
| | 223 | | } |
| | 224 | | } |
| | 225 | |
|
| 0 | 226 | | if (dayTimeEdited >= layers[i].timeSpan_start && dayTimeEdited <= endTimeEdited) |
| | 227 | | { |
| 0 | 228 | | if (layers[i].enabled) |
| | 229 | | { |
| 0 | 230 | | if (temp == null) |
| | 231 | | { |
| 0 | 232 | | layers[i].renderType = LayerRenderType.Rendering; |
| 0 | 233 | | temp = layers[i]; |
| 0 | 234 | | } |
| | 235 | | else |
| | 236 | | { |
| 0 | 237 | | temp.renderType = LayerRenderType.Conflict_Playing; |
| 0 | 238 | | layers[i].renderType = LayerRenderType.Conflict_NotPlaying; |
| | 239 | | } |
| 0 | 240 | | } |
| | 241 | | else |
| | 242 | | { |
| 0 | 243 | | layers[i].renderType = LayerRenderType.NotRendering; |
| | 244 | | } |
| 0 | 245 | | } |
| | 246 | | else |
| | 247 | | { |
| 0 | 248 | | layers[i].renderType = LayerRenderType.NotRendering; |
| | 249 | | } |
| | 250 | |
|
| | 251 | |
|
| | 252 | | } |
| 0 | 253 | | return temp; |
| | 254 | | } |
| | 255 | |
|
| | 256 | | #region Timeline Events |
| | 257 | |
|
| | 258 | | /// <summary> |
| | 259 | | /// Check if any event has to be fired |
| | 260 | | /// TODO:: Can be optimised. |
| | 261 | | /// </summary> |
| | 262 | | /// <param name="dayTime">Current day time</param> |
| | 263 | | private void CheckAndFireTimelineEvents(float dayTime) |
| | 264 | | { |
| 0 | 265 | | float endTimeEdited = 0; |
| 0 | 266 | | float dayTimeEdited = dayTime; |
| 0 | 267 | | for (int i = 0; i < timelineTags.Count; i++) |
| | 268 | | { |
| | 269 | | // If current event is a trigger event, fire trigger event. It's boolean will be disable when cycle rese |
| 0 | 270 | | if (timelineTags[i].isTrigger) |
| | 271 | | { |
| 0 | 272 | | if (dayTime > timelineTags[i].startTime && !timelineTags[i].startEventExecuted) |
| | 273 | | { |
| 0 | 274 | | OnTimelineEvent?.Invoke(timelineTags[i].tag, true, true); |
| 0 | 275 | | timelineTags[i].startEventExecuted = true; |
| | 276 | | } |
| 0 | 277 | | continue; |
| | 278 | | } |
| | 279 | |
|
| | 280 | |
|
| 0 | 281 | | endTimeEdited = timelineTags[i].endTime; |
| 0 | 282 | | dayTimeEdited = dayTime; |
| | 283 | |
|
| | 284 | | // Change time if this is over a day scenario |
| 0 | 285 | | if (timelineTags[i].endTime < timelineTags[i].startTime) |
| | 286 | | { |
| 0 | 287 | | endTimeEdited = cycleTime + timelineTags[i].endTime; |
| | 288 | |
|
| 0 | 289 | | if (dayTime < timelineTags[i].startTime) |
| | 290 | | { |
| 0 | 291 | | dayTimeEdited = cycleTime + dayTime; |
| | 292 | | } |
| | 293 | | } |
| | 294 | |
|
| | 295 | | // If current time is between start and end time and start event is not executed, Fire start event |
| 0 | 296 | | if (dayTimeEdited >= timelineTags[i].startTime && dayTimeEdited < endTimeEdited && !timelineTags[i].star |
| | 297 | | { |
| 0 | 298 | | OnTimelineEvent?.Invoke(timelineTags[i].tag, true, false); |
| 0 | 299 | | timelineTags[i].startEventExecuted = true; |
| | 300 | | } |
| | 301 | |
|
| | 302 | | // If current time is greater than end time and start event is executed, fire end event |
| 0 | 303 | | if (dayTimeEdited >= endTimeEdited && timelineTags[i].startEventExecuted) |
| | 304 | | { |
| 0 | 305 | | OnTimelineEvent?.Invoke(timelineTags[i].tag, false, false); |
| 0 | 306 | | timelineTags[i].startEventExecuted = false; |
| | 307 | | } |
| | 308 | |
|
| | 309 | | } |
| 0 | 310 | | } |
| | 311 | |
|
| | 312 | | public void CycleResets() |
| | 313 | | { |
| | 314 | | // Resets all timeline triggers and normal flow events |
| 0 | 315 | | for (int i = 0; i < timelineTags.Count; i++) |
| | 316 | | { |
| 0 | 317 | | if (timelineTags[i].isTrigger) |
| | 318 | | { |
| 0 | 319 | | timelineTags[i].startEventExecuted = false; |
| 0 | 320 | | continue; |
| | 321 | | } |
| | 322 | |
|
| 0 | 323 | | if (timelineTags[i].endTime > timelineTags[i].startTime) |
| | 324 | | { |
| 0 | 325 | | timelineTags[i].startEventExecuted = false; |
| | 326 | | } |
| | 327 | | } |
| 0 | 328 | | } |
| | 329 | |
|
| | 330 | | #endregion |
| | 331 | |
|
| | 332 | | #region Directional Light |
| | 333 | |
|
| | 334 | | void ApplyDLIntensity(float normalizedDayTime, Light lightGO) |
| | 335 | | { |
| 0 | 336 | | if (lightGO == null) |
| | 337 | | { |
| 0 | 338 | | Debug.LogError("Directional Light option is on, with light reference"); |
| 0 | 339 | | return; |
| | 340 | | } |
| | 341 | |
|
| 0 | 342 | | if (directionalLightLayer.intensity.Count == 0) |
| | 343 | | { |
| 0 | 344 | | Debug.Log("Directional Light option is on with no intensity data"); |
| 0 | 345 | | return; |
| | 346 | | } |
| | 347 | |
|
| 0 | 348 | | if (directionalLightLayer.intensity.Count == 1) |
| | 349 | | { |
| 0 | 350 | | lightGO.intensity = directionalLightLayer.intensity[0].value; |
| 0 | 351 | | return; |
| | 352 | | } |
| | 353 | |
|
| | 354 | |
|
| 0 | 355 | | lightGO.intensity = GetTransitionValue(directionalLightLayer.intensity, normalizedDayTime * 100); |
| 0 | 356 | | } |
| | 357 | |
|
| | 358 | | void ApplyDLDirection(float normalizedDayTime, Light lightGO) |
| | 359 | | { |
| 0 | 360 | | if (lightGO == null) |
| | 361 | | { |
| 0 | 362 | | Debug.LogError("Directional Light option is on, with light reference"); |
| 0 | 363 | | return; |
| | 364 | | } |
| | 365 | |
|
| 0 | 366 | | if (directionalLightLayer.lightDirection.Count == 0) |
| | 367 | | { |
| 0 | 368 | | Debug.Log("Directional Light option is on with no rotation data"); |
| 0 | 369 | | return; |
| | 370 | | } |
| | 371 | |
|
| 0 | 372 | | if (directionalLightLayer.lightDirection.Count == 1) |
| | 373 | | { |
| 0 | 374 | | lightGO.transform.rotation = directionalLightLayer.lightDirection[0].value; |
| 0 | 375 | | return; |
| | 376 | | } |
| | 377 | |
|
| 0 | 378 | | float percentage = normalizedDayTime * 100; |
| 0 | 379 | | TransitioningQuaternion min = directionalLightLayer.lightDirection[0], max = directionalLightLayer.lightDire |
| | 380 | |
|
| | 381 | | // Apply Direction |
| 0 | 382 | | for (int i = 0; i < directionalLightLayer.lightDirection.Count; i++) |
| | 383 | | { |
| 0 | 384 | | if (percentage <= directionalLightLayer.lightDirection[i].percentage) |
| | 385 | | { |
| 0 | 386 | | max = directionalLightLayer.lightDirection[i]; |
| | 387 | |
|
| 0 | 388 | | if ((i - 1) > 0) |
| | 389 | | { |
| 0 | 390 | | min = directionalLightLayer.lightDirection[i - 1]; |
| | 391 | | } |
| | 392 | |
|
| 0 | 393 | | break; |
| | 394 | | } |
| | 395 | | } |
| | 396 | |
|
| 0 | 397 | | float t = Mathf.InverseLerp(min.percentage, max.percentage, percentage); |
| 0 | 398 | | lightGO.transform.rotation = Quaternion.Lerp(min.value, max.value, t); |
| 0 | 399 | | } |
| | 400 | |
|
| | 401 | | #endregion |
| | 402 | |
|
| | 403 | | #region Apply texture layers |
| | 404 | |
|
| | 405 | | void ApplyTextureLayer(Material selectedMat, float dayTime, float normalizedDayTime, int slotNum, TextureLayer l |
| | 406 | | { |
| 0 | 407 | | float endTimeEdited = layer.timeSpan_End; |
| 0 | 408 | | float dayTimeEdited = dayTime; |
| 0 | 409 | | if (layer.timeSpan_End < layer.timeSpan_start) |
| | 410 | | { |
| 0 | 411 | | endTimeEdited = cycleTime + layer.timeSpan_End; |
| 0 | 412 | | if (dayTime < layer.timeSpan_start) |
| | 413 | | { |
| 0 | 414 | | dayTimeEdited = cycleTime + dayTime; |
| | 415 | | } |
| | 416 | | } |
| 0 | 417 | | float normalizedLayerTime = Mathf.InverseLerp(layer.timeSpan_start, endTimeEdited, dayTimeEdited); |
| | 418 | |
|
| 0 | 419 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_layerType_" + slotNum), (int)layer.layerType); |
| | 420 | |
|
| 0 | 421 | | bool fadeInChange = CheckFadingIn(selectedMat, dayTime, normalizedDayTime, slotNum, layer, cycleTime); |
| | 422 | |
|
| 0 | 423 | | bool fadeOutChange = CheckFadingOut(selectedMat, dayTime, normalizedDayTime, slotNum, layer, cycleTime); |
| | 424 | |
|
| 0 | 425 | | if (!fadeInChange && !fadeOutChange) |
| | 426 | | { |
| 0 | 427 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_fadeTime_" + slotNum), 1); |
| | 428 | | } |
| | 429 | |
|
| 0 | 430 | | switch (layer.layerType) |
| | 431 | | { |
| | 432 | | case LayerType.Planar: |
| | 433 | | case LayerType.Radial: |
| 0 | 434 | | ApplyPlanarTextureLayer(selectedMat, dayTime, normalizedLayerTime, slotNum, layer, true); |
| 0 | 435 | | break; |
| | 436 | | case LayerType.Satellite: |
| 0 | 437 | | ApplySatelliteTextureLayer(selectedMat, dayTime, normalizedLayerTime, slotNum, layer, true); |
| 0 | 438 | | break; |
| | 439 | | case LayerType.Cubemap: |
| 0 | 440 | | ApplyCubemapTextureLayer(selectedMat, dayTime, normalizedLayerTime, slotNum, layer, true); |
| 0 | 441 | | break; |
| | 442 | | case LayerType.Particles: |
| 0 | 443 | | ApplyParticleTextureLayer(selectedMat, dayTime, normalizedLayerTime, slotNum, layer, true); |
| | 444 | | break; |
| | 445 | | default: |
| | 446 | | break; |
| | 447 | | } |
| 0 | 448 | | } |
| | 449 | |
|
| | 450 | | private bool CheckFadingIn(Material selectedMat, float dayTime, float normalizedDayTime, int slotNum, TextureLay |
| | 451 | | { |
| 0 | 452 | | bool fadeChanged = false; |
| 0 | 453 | | float fadeInCompletionTime = layer.timeSpan_start + layer.fadingInTime; |
| 0 | 454 | | float dayTimeEdited = dayTime; |
| 0 | 455 | | if (dayTime < layer.timeSpan_start) |
| | 456 | | { |
| 0 | 457 | | dayTimeEdited = 24 + dayTime; |
| | 458 | | } |
| | 459 | |
|
| 0 | 460 | | if (dayTimeEdited < fadeInCompletionTime) |
| | 461 | | { |
| 0 | 462 | | float percentage = Mathf.InverseLerp(layer.timeSpan_start, fadeInCompletionTime, dayTimeEdited); |
| 0 | 463 | | fadeChanged = true; |
| 0 | 464 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_fadeTime_" + slotNum), percentage); |
| | 465 | | } |
| | 466 | |
|
| 0 | 467 | | return fadeChanged; |
| | 468 | | } |
| | 469 | |
|
| | 470 | | private bool CheckFadingOut(Material selectedMat, float dayTime, float normalizedDayTime, int slotNum, TextureLa |
| | 471 | | { |
| 0 | 472 | | bool fadeChanged = false; |
| 0 | 473 | | float endTimeEdited = layer.timeSpan_End; |
| 0 | 474 | | float dayTimeEdited = dayTime; |
| | 475 | |
|
| 0 | 476 | | if (layer.timeSpan_End < layer.timeSpan_start) |
| | 477 | | { |
| 0 | 478 | | endTimeEdited = cycleTime + layer.timeSpan_End; |
| | 479 | | } |
| | 480 | |
|
| 0 | 481 | | if (dayTime < layer.timeSpan_start) |
| | 482 | | { |
| 0 | 483 | | dayTimeEdited = cycleTime + dayTime; |
| | 484 | | } |
| | 485 | |
|
| | 486 | |
|
| 0 | 487 | | float fadeOutStartTime = endTimeEdited - layer.fadingOutTime; |
| | 488 | |
|
| 0 | 489 | | if (dayTimeEdited > fadeOutStartTime) |
| | 490 | | { |
| 0 | 491 | | float percentage = Mathf.InverseLerp(endTimeEdited, fadeOutStartTime, dayTimeEdited); |
| 0 | 492 | | fadeChanged = true; |
| 0 | 493 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_fadeTime_" + slotNum), percentage); |
| | 494 | | } |
| | 495 | |
|
| 0 | 496 | | return fadeChanged; |
| | 497 | | } |
| | 498 | |
|
| | 499 | | void ApplyCubemapTextureLayer(Material selectedMat, float dayTime, float normalizedLayerTime, int layerNum, Text |
| | 500 | | { |
| 0 | 501 | | if (changeAlllValues) |
| | 502 | | { |
| 0 | 503 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_RenderDistance_" + layerNum), 0); |
| 0 | 504 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_tex_" + layerNum), null); |
| 0 | 505 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_cubemap_" + layerNum), layer.cubemap); |
| 0 | 506 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_normals_" + layerNum), null); |
| 0 | 507 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_timeFrame_" + layerNum), new Vector4(layer.ti |
| 0 | 508 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_lightIntensity_" + layerNum), layer.tintPercen |
| 0 | 509 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_normalIntensity_" + layerNum), 0); |
| 0 | 510 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortIntAndSize_" + layerNum), Vector2.zero |
| 0 | 511 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortSpeedAndSharp_" + layerNum), Vector4.z |
| | 512 | | // Particles |
| 0 | 513 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_rowAndCollumns_" + layerNum), Vector2.zero); |
| 0 | 514 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesMainParameters_" + layerNum), Vector |
| 0 | 515 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesSecondaryParameters_" + layerNum), V |
| | 516 | | } |
| | 517 | |
|
| | 518 | |
|
| 0 | 519 | | selectedMat.SetColor(SkyboxShaderUtils.GetLayerProperty("_color_" + layerNum), layer.color.Evaluate(normaliz |
| | 520 | |
|
| | 521 | | // Set cubemap rotation. (Shader variable reused) |
| 0 | 522 | | if (layer.movementTypeCubemap == MovementType.PointBased) |
| | 523 | | { |
| 0 | 524 | | Vector3 currentRotation = GetTransitionValue(layer.rotations_Vector3, normalizedLayerTime * 100); |
| 0 | 525 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), new Vector4(cu |
| 0 | 526 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(0 |
| 0 | 527 | | } |
| | 528 | | else |
| | 529 | | { |
| 0 | 530 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), new Vector4(0, |
| 0 | 531 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(l |
| | 532 | | } |
| | 533 | |
|
| 0 | 534 | | } |
| | 535 | |
|
| | 536 | | void ApplyPlanarTextureLayer(Material selectedMat, float dayTime, float normalizedLayerTime, int layerNum, Textu |
| | 537 | | { |
| 0 | 538 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_RenderDistance_" + layerNum), GetTransitionValue(l |
| 0 | 539 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_tex_" + layerNum), layer.texture); |
| 0 | 540 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_normals_" + layerNum), layer.textureNormal); |
| 0 | 541 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_cubemap_" + layerNum), null); |
| | 542 | |
|
| 0 | 543 | | selectedMat.SetColor(SkyboxShaderUtils.GetLayerProperty("_color_" + layerNum), layer.color.Evaluate(normaliz |
| | 544 | |
|
| | 545 | |
|
| 0 | 546 | | if (layer.movementTypePlanar_Radial == MovementType.Speed) |
| | 547 | | { |
| | 548 | | // speed and Rotation |
| 0 | 549 | | float rot = 0; |
| 0 | 550 | | if (layer.layerType == LayerType.Planar) |
| | 551 | | { |
| 0 | 552 | | rot = GetTransitionValue(layer.rotations_float, normalizedLayerTime * 100); |
| | 553 | | } |
| | 554 | |
|
| 0 | 555 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(l |
| | 556 | |
|
| | 557 | | // Tiling and Offset |
| 0 | 558 | | Vector4 t = new Vector4(layer.tiling.x, layer.tiling.y, 0, 0); |
| 0 | 559 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), t); |
| 0 | 560 | | } |
| | 561 | | else |
| | 562 | | { |
| | 563 | | // speed and Rotation |
| 0 | 564 | | float rot = 0; |
| 0 | 565 | | if (layer.layerType == LayerType.Planar) |
| | 566 | | { |
| 0 | 567 | | rot = GetTransitionValue(layer.rotations_float, normalizedLayerTime * 100); |
| | 568 | | } |
| | 569 | |
|
| 0 | 570 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(0 |
| | 571 | |
|
| | 572 | | // Tiling and Offset |
| 0 | 573 | | Vector2 currentOffset = GetTransitionValue(layer.offset, normalizedLayerTime * 100); |
| 0 | 574 | | Vector4 t = new Vector4(layer.tiling.x, layer.tiling.y, currentOffset.x, currentOffset.y); |
| 0 | 575 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), t); |
| | 576 | | } |
| | 577 | |
|
| | 578 | |
|
| | 579 | | // Time frame |
| 0 | 580 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_timeFrame_" + layerNum), new Vector4(layer.timeSp |
| | 581 | | // normal intensity |
| 0 | 582 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_normalIntensity_" + layerNum), layer.normalIntensi |
| | 583 | | // Tint |
| 0 | 584 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_lightIntensity_" + layerNum), layer.tintPercentage |
| | 585 | |
|
| | 586 | | // Reset Particle related Params |
| 0 | 587 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_rowAndCollumns_" + layerNum), layer.flipbookRowsA |
| 0 | 588 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesMainParameters_" + layerNum), new Vector |
| 0 | 589 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesSecondaryParameters_" + layerNum), Vecto |
| | 590 | |
|
| | 591 | | // Apply Distortion Values |
| 0 | 592 | | Vector2 distortIntAndSize = new Vector2(GetTransitionValue(layer.distortIntensity, normalizedLayerTime * 100 |
| 0 | 593 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortIntAndSize_" + layerNum), distortIntAndSiz |
| | 594 | |
|
| 0 | 595 | | Vector2 distortSpeed = GetTransitionValue(layer.distortSpeed, normalizedLayerTime * 100); |
| 0 | 596 | | Vector2 distortSharpness = GetTransitionValue(layer.distortSharpness, normalizedLayerTime * 100); |
| 0 | 597 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortSpeedAndSharp_" + layerNum), new Vector4(d |
| 0 | 598 | | } |
| | 599 | |
|
| | 600 | | void ApplySatelliteTextureLayer(Material selectedMat, float dayTime, float normalizedLayerTime, int layerNum, Te |
| | 601 | | { |
| 0 | 602 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_tex_" + layerNum), layer.texture); |
| 0 | 603 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_normals_" + layerNum), layer.textureNormal); |
| 0 | 604 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_cubemap_" + layerNum), null); |
| | 605 | |
|
| 0 | 606 | | selectedMat.SetColor(SkyboxShaderUtils.GetLayerProperty("_color_" + layerNum), layer.color.Evaluate(normaliz |
| | 607 | |
|
| 0 | 608 | | if (layer.movementTypeSatellite == MovementType.Speed) |
| | 609 | | { |
| | 610 | | // Tiling and Offset |
| 0 | 611 | | Vector2 currentWidthHeight = GetTransitionValue(layer.satelliteWidthHeight, normalizedLayerTime * 100, n |
| 0 | 612 | | Vector4 t = new Vector4(currentWidthHeight.x, currentWidthHeight.y, 0, 0); |
| 0 | 613 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), t); |
| | 614 | |
|
| | 615 | |
|
| | 616 | | // speed and Rotation |
| 0 | 617 | | float rot = GetTransitionValue(layer.rotations_float, normalizedLayerTime * 100); |
| 0 | 618 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(l |
| 0 | 619 | | } |
| | 620 | | else |
| | 621 | | { |
| | 622 | | // Tiling and Offset |
| 0 | 623 | | Vector2 currentOffset = GetTransitionValue(layer.offset, normalizedLayerTime * 100); |
| 0 | 624 | | Vector2 currentWidthHeight = GetTransitionValue(layer.satelliteWidthHeight, normalizedLayerTime * 100, n |
| 0 | 625 | | Vector4 t = new Vector4(currentWidthHeight.x, currentWidthHeight.y, currentOffset.x, currentOffset.y); |
| 0 | 626 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), t); |
| | 627 | |
|
| | 628 | | // speed and Rotation |
| 0 | 629 | | float rot = GetTransitionValue(layer.rotations_float, normalizedLayerTime * 100); |
| 0 | 630 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), new Vector4(0 |
| | 631 | | } |
| | 632 | |
|
| | 633 | | // Time frame |
| 0 | 634 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_timeFrame_" + layerNum), new Vector4(layer.timeSp |
| | 635 | | // normal intensity |
| 0 | 636 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_normalIntensity_" + layerNum), layer.normalIntensi |
| | 637 | | // Tint |
| 0 | 638 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_lightIntensity_" + layerNum), layer.tintPercentage |
| | 639 | |
|
| | 640 | | // Reset Particle related Params |
| 0 | 641 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_rowAndCollumns_" + layerNum), layer.flipbookRowsA |
| 0 | 642 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesMainParameters_" + layerNum), new Vector |
| 0 | 643 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesSecondaryParameters_" + layerNum), Vecto |
| | 644 | |
|
| | 645 | | // Reset Distortion values |
| 0 | 646 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortIntAndSize_" + layerNum), Vector2.zero); |
| 0 | 647 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortSpeedAndSharp_" + layerNum), Vector4.zero) |
| | 648 | |
|
| 0 | 649 | | } |
| | 650 | |
|
| | 651 | | void ApplyParticleTextureLayer(Material selectedMat, float dayTime, float normalizedLayerTime, int layerNum, Tex |
| | 652 | | { |
| | 653 | | // Reset Unused params |
| 0 | 654 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_RenderDistance_" + layerNum), 0); |
| 0 | 655 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_cubemap_" + layerNum), null); |
| 0 | 656 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortIntAndSize_" + layerNum), Vector2.zero); |
| 0 | 657 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortSpeedAndSharp_" + layerNum), Vector4.zero) |
| | 658 | |
|
| | 659 | |
|
| | 660 | | // Time frame |
| 0 | 661 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_timeFrame_" + layerNum), new Vector4(layer.timeSp |
| | 662 | | // Tint |
| 0 | 663 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_lightIntensity_" + layerNum), layer.tintPercentage |
| | 664 | |
|
| | 665 | | // Particles |
| 0 | 666 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_tex_" + layerNum), layer.texture); |
| 0 | 667 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_normals_" + layerNum), layer.textureNormal); |
| 0 | 668 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_normalIntensity_" + layerNum), layer.normalIntensi |
| 0 | 669 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_rowAndCollumns_" + layerNum), layer.flipbookRowsA |
| 0 | 670 | | selectedMat.SetColor(SkyboxShaderUtils.GetLayerProperty("_color_" + layerNum), layer.color.Evaluate(normaliz |
| 0 | 671 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + layerNum), new Vector4(layer. |
| 0 | 672 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + layerNum), GetTransitionValu |
| 0 | 673 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesMainParameters_" + layerNum), new Vector |
| 0 | 674 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesSecondaryParameters_" + layerNum), new V |
| | 675 | |
|
| | 676 | |
|
| 0 | 677 | | } |
| | 678 | |
|
| | 679 | | #endregion |
| | 680 | |
|
| | 681 | | #region Transition Values Utility Methods |
| | 682 | |
|
| | 683 | | float GetTransitionValue(List<TransitioningFloat> list, float percentage, float defaultVal = 0) |
| | 684 | | { |
| 0 | 685 | | if (list == null || list.Count < 1) |
| | 686 | | { |
| 0 | 687 | | return defaultVal; |
| | 688 | | } |
| | 689 | |
|
| 0 | 690 | | if (list.Count == 1) |
| | 691 | | { |
| 0 | 692 | | return list[0].value; |
| | 693 | | } |
| | 694 | |
|
| 0 | 695 | | TransitioningFloat min = list[0], max = list[0]; |
| | 696 | |
|
| | 697 | |
|
| 0 | 698 | | for (int i = 0; i < list.Count; i++) |
| | 699 | | { |
| 0 | 700 | | if (percentage <= list[i].percentage) |
| | 701 | | { |
| 0 | 702 | | max = list[i]; |
| | 703 | |
|
| 0 | 704 | | if ((i - 1) > 0) |
| | 705 | | { |
| 0 | 706 | | min = list[i - 1]; |
| | 707 | | } |
| | 708 | |
|
| 0 | 709 | | break; |
| | 710 | | } |
| | 711 | | } |
| | 712 | |
|
| 0 | 713 | | float t = Mathf.InverseLerp(min.percentage, max.percentage, percentage); |
| 0 | 714 | | return Mathf.Lerp(min.value, max.value, t); |
| | 715 | | } |
| | 716 | |
|
| | 717 | | Vector2 GetTransitionValue(List<TransitioningVector2> list, float percentage, Vector2 defaultVal = default(Vecto |
| | 718 | | { |
| 0 | 719 | | Vector2 offset = defaultVal; |
| | 720 | |
|
| 0 | 721 | | if (list == null || list.Count == 0) |
| | 722 | | { |
| 0 | 723 | | return offset; |
| | 724 | | } |
| | 725 | |
|
| 0 | 726 | | if (list.Count == 1) |
| | 727 | | { |
| 0 | 728 | | offset = list[0].value; |
| 0 | 729 | | return offset; |
| | 730 | | } |
| | 731 | |
|
| | 732 | |
|
| 0 | 733 | | TransitioningVector2 min = list[0], max = list[0]; |
| | 734 | |
|
| 0 | 735 | | for (int i = 0; i < list.Count; i++) |
| | 736 | | { |
| 0 | 737 | | if (percentage <= list[i].percentage) |
| | 738 | | { |
| 0 | 739 | | max = list[i]; |
| | 740 | |
|
| 0 | 741 | | if ((i - 1) > 0) |
| | 742 | | { |
| 0 | 743 | | min = list[i - 1]; |
| | 744 | | } |
| | 745 | |
|
| 0 | 746 | | break; |
| | 747 | | } |
| | 748 | | } |
| 0 | 749 | | float t = Mathf.InverseLerp(min.percentage, max.percentage, percentage); |
| 0 | 750 | | offset = Vector2.Lerp(min.value, max.value, t); |
| | 751 | |
|
| 0 | 752 | | return offset; |
| | 753 | | } |
| | 754 | |
|
| | 755 | | Vector3 GetTransitionValue(List<TransitioningVector3> list, float percentage) |
| | 756 | | { |
| 0 | 757 | | Vector3 offset = new Vector3(0, 0, 0); |
| | 758 | |
|
| 0 | 759 | | if (list == null || list.Count == 0) |
| | 760 | | { |
| 0 | 761 | | return offset; |
| | 762 | | } |
| | 763 | |
|
| 0 | 764 | | if (list.Count == 1) |
| | 765 | | { |
| 0 | 766 | | offset = list[0].value; |
| 0 | 767 | | return offset; |
| | 768 | | } |
| | 769 | |
|
| | 770 | |
|
| 0 | 771 | | TransitioningVector3 min = list[0], max = list[0]; |
| | 772 | |
|
| 0 | 773 | | for (int i = 0; i < list.Count; i++) |
| | 774 | | { |
| 0 | 775 | | if (percentage <= list[i].percentage) |
| | 776 | | { |
| 0 | 777 | | max = list[i]; |
| | 778 | |
|
| 0 | 779 | | if ((i - 1) > 0) |
| | 780 | | { |
| 0 | 781 | | min = list[i - 1]; |
| | 782 | | } |
| | 783 | |
|
| 0 | 784 | | break; |
| | 785 | | } |
| | 786 | | } |
| | 787 | |
|
| 0 | 788 | | float t = Mathf.InverseLerp(min.percentage, max.percentage, percentage); |
| 0 | 789 | | offset = Vector3.Lerp(min.value, max.value, t); |
| | 790 | |
|
| 0 | 791 | | return offset; |
| | 792 | | } |
| | 793 | |
|
| | 794 | | #endregion |
| | 795 | |
|
| | 796 | | public void ResetMaterial(Material selectedMat, int slotCount) |
| | 797 | | { |
| 0 | 798 | | for (int i = 0; i < slotCount; i++) |
| | 799 | | { |
| 0 | 800 | | ResetSlot(selectedMat, i); |
| | 801 | | } |
| 0 | 802 | | } |
| | 803 | |
|
| | 804 | | public void ResetSlot(Material selectedMat, int slotCount) |
| | 805 | | { |
| 0 | 806 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_layerType_" + slotCount), 0); |
| 0 | 807 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_tex_" + slotCount), null); |
| 0 | 808 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_cubemap_" + slotCount), null); |
| 0 | 809 | | selectedMat.SetTexture(SkyboxShaderUtils.GetLayerProperty("_normals_" + slotCount), null); |
| 0 | 810 | | selectedMat.SetColor(SkyboxShaderUtils.GetLayerProperty("_color_" + slotCount), new Color(1, 1, 1, 0)); |
| 0 | 811 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_tilingAndOffset_" + slotCount), new Vector4(1, 1, |
| 0 | 812 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_speedAndRotation_" + slotCount), new Vector4(0, 0 |
| 0 | 813 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_timeFrame_" + slotCount), new Vector4(0, 0)); |
| 0 | 814 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_fadeTime_" + slotCount), 1); |
| 0 | 815 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_normalIntensity_" + slotCount), 0); |
| 0 | 816 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_lightIntensity_" + slotCount), 0); |
| 0 | 817 | | selectedMat.SetFloat(SkyboxShaderUtils.GetLayerProperty("_RenderDistance_" + slotCount), 3.4f); |
| 0 | 818 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortIntAndSize_" + slotCount), new Vector2(0, |
| 0 | 819 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_distortSpeedAndSharp_" + slotCount), new Vector4( |
| 0 | 820 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_rowAndCollumns_" + slotCount), new Vector4(1, 1)) |
| 0 | 821 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesMainParameters_" + slotCount), new Vecto |
| 0 | 822 | | selectedMat.SetVector(SkyboxShaderUtils.GetLayerProperty("_particlesSecondaryParameters_" + slotCount), new |
| 0 | 823 | | } |
| | 824 | |
|
| 0 | 825 | | Quaternion Vector4ToQuaternion(Vector4 val) { return new Quaternion(val.x, val.y, val.z, val.w); } |
| | 826 | | } |
| | 827 | | } |