1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 |
local ZO_FOUR_PI = ZO_TWO_PI * 2.0
ZO_BACKGROUND_TEXTURE_FILE_HEIGHT = 2048
ZO_BACKGROUND_TEXTURE_FILE_WIDTH = 2048
ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT = 1080
ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH = 1920
ZO_BACKGROUND_TEXTURE_IMAGE_ASPECT_RATIO = ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH / ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT
ZO_BACKGROUND_TEXTURE_COORD_BOTTOM = ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT / ZO_BACKGROUND_TEXTURE_FILE_HEIGHT
ZO_BACKGROUND_TEXTURE_COORD_RIGHT = ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH / ZO_BACKGROUND_TEXTURE_FILE_WIDTH
ZO_BACKGROUND_NUM_FOREGROUND_TEXTURES = 8
ZO_BACKGROUND_FOREGROUND_TEXTURE_INDICES =
{
PURPLE_FLOWERS_1 = 5 ,
YELLOW_MUSHROOMS_1 = 8 ,
}
ZO_BACKGROUND_DAY_SCENE_INDEX = 2
ZO_BACKGROUND_NIGHT_SCENE_INDEX = 1
-- Parameters
-- Scene Time
-- 24 hour clock time units
ZO_BACKGROUND_DAY_START_TIME_HOURS = 6.0
ZO_BACKGROUND_NIGHT_START_TIME_HOURS = 18.0
ZO_BACKGROUND_DAY_END_TIME_HOURS = ( ZO_BACKGROUND_NIGHT_START_TIME_HOURS + 2.0 ) % 24.0
ZO_BACKGROUND_NIGHT_END_TIME_HOURS = ( ZO_BACKGROUND_DAY_START_TIME_HOURS + 2.0 ) % 24.0
ZO_BACKGROUND_SCENE_TIME_HOURS_PER_SECOND = 0.03
-- Intro
-- 24 hour clock time units
ZO_BACKGROUND_INTRO_START_TIME_HOURS = 10
ZO_BACKGROUND_INTRO_SCENE_TIME_HOURS_PER_SECOND = 3
ZO_BACKGROUND_INTRO_SCENE_TIME_INTERVAL_SECONDS = 5
-- Grass
ZO_BACKGROUND_GRASS_WAVE_BOUND_X_MIN = 0.0009
ZO_BACKGROUND_GRASS_WAVE_BOUND_X_MAX = 0.0009
ZO_BACKGROUND_GRASS_WAVE_BOUND_Y_MIN = 0.0003
ZO_BACKGROUND_GRASS_WAVE_BOUND_Y_MAX = 0.0
ZO_BACKGROUND_GRASS_WAVE_ANGLE_RADIANS = 0.0
ZO_BACKGROUND_GRASS_WAVE_FREQUENCY = 4.8
ZO_BACKGROUND_GRASS_WAVE_SPEED = 16.0
ZO_BACKGROUND_GRASS_WAVE_TIME_COEFFICIENT = 0.25
ZO_BACKGROUND_FLORA_WAVE_INTERVAL_COEFFICIENT = 1.0
-- Dandelion / Allergens
ZO_BACKGROUND_DANDELION_HEIGHT = 28
ZO_BACKGROUND_DANDELION_WIDTH = 28
ZO_BACKGROUND_DANDELION_INSTANCES_MAX = 5
ZO_BACKGROUND_DANDELION_LIFETIME_SECONDS_MAX = 9
ZO_BACKGROUND_DANDELION_LIFETIME_SECONDS_MIN = 6
ZO_BACKGROUND_DANDELION_SCALE_MAX = 1.0
ZO_BACKGROUND_DANDELION_SCALE_MIN = 0.5
ZO_BACKGROUND_DANDELION_SPAWN_INTERVAL_SECONDS = 0.65
-- Ouroboros
ZO_BACKGROUND_OUROBOROS_ACTIVE_INTERVAL_SECONDS = 8
ZO_BACKGROUND_OUROBOROS_INACTIVE_INTERVAL_SECONDS = 96
ZO_BACKGROUND_OUROBOROS_MASK_THRESHOLD_MIN = 0.9
ZO_BACKGROUND_OUROBOROS_NORMALIZED_ORIGINS =
{
{ centerOffsetX = - 0.19 , centerOffsetY = 0.15 , radiusX = 0.01 , radiusY = 0.01 , soundFxId = 1 } ,
{ centerOffsetX = 0 , centerOffsetY = 0.15 , radiusX = 0.03 , radiusY = 0.03 , soundFxId = 3 } ,
{ centerOffsetX = 0.4 , centerOffsetY = 0.12 , radiusX = 0.04 , radiusY = 0.07 , soundFxId = 2 } ,
}
-- Sky
ZO_BACKGROUND_GOD_RAY_NORMALIZED_LENGTH = 0.3
ZO_BACKGROUND_SKY_ALPHA_MAX = 0.5
ZO_BACKGROUND_SUN_ORIGIN_X = 0.5
ZO_BACKGROUND_SUN_ORIGIN_Y = 0.0
ZO_BACKGROUND_SUN_RADIAL_BLUR_NUM_SAMPLES = 20
ZO_BACKGROUND_SUN_RADIAL_BLUR_OFFSET = 0.0
ZO_BACKGROUND_SUN_RADIUS_AZIMUTH = 2.0
ZO_BACKGROUND_SUN_RADIUS_ZENITH = 1.0
-- Title
ZO_BACKGROUND_TITLE_ANIMATION_DELAY_SECONDS = 1.0
ZO_BACKGROUND_TITLE_ANIMATION_DURATION_SECONDS = 3.0
ZO_BACKGROUND_TITLE_BLUR_KERNEL_SIZE = 7
-- Torchbug
ZO_BACKGROUND_TORCHBUG_INSTANCES_MAX = 24
ZO_BACKGROUND_TORCHBUG_LIFETIME_SECONDS_MAX = 2
ZO_BACKGROUND_TORCHBUG_LIFETIME_SECONDS_MIN = 1.5
ZO_BACKGROUND_TORCHBUG_OFFSET_UV_MAX = 0.075
ZO_BACKGROUND_TORCHBUG_ORIGIN_X = 0.55
ZO_BACKGROUND_TORCHBUG_ORIGIN_Y = 0.5
ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_X_MAX = 0.4
ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_X_MIN = 0.2
ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_Y_MAX = 0.4
ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_Y_MIN = 0.25
ZO_BACKGROUND_TORCHBUG_PULSE_COEFFICIENT = 2
ZO_BACKGROUND_TORCHBUG_SAMPLING_MAX = 2
ZO_BACKGROUND_TORCHBUG_SAMPLING_MIN = 1
ZO_BACKGROUND_TORCHBUG_SCALE_MAX = 1.75
ZO_BACKGROUND_TORCHBUG_SCALE_MIN = 0.65
ZO_BACKGROUND_TORCHBUG_SPAWN_INTERVAL_SECONDS = 0.1
-- Shader Effects
ZO_BACKGROUND_ENABLE_SHADER_EFFECT_GAUSSIAN_BLUR = true
ZO_BACKGROUND_ENABLE_SHADER_EFFECT_RADIAL_BLUR = true
ZO_BACKGROUND_ENABLE_SHADER_EFFECT_WAVE = true
-- Background Animation Scene
if newState == SCENE_SHOWING then
elseif newState == SCENE_HIDDEN then
end
end )
end )
end
end , "UpdateLayout" )
end
local sceneNames = { "NightScene" , "DayScene" }
sceneControl . foregroundTextures = { }
for foregroundIndex = 1 , ZO_BACKGROUND_NUM_FOREGROUND_TEXTURES do
sceneControl . foregroundTextures [ foregroundIndex ] = sceneControl : GetNamedChild ( string . format ( "Foreground%u" , foregroundIndex ) )
end
if sceneControl . skyTexture then
end
end
end
self . introTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ZO_MagmaBackgroundAnimation_Intro" , control )
self . particleLoopTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ZO_MagmaBackgroundAnimation_ParticleLoop" , control )
self . floraLoopTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ZO_MagmaBackgroundAnimation_FloraLoop" , control )
self . sceneTimeLoopTimeline = ANIMATION_MANAGER : CreateTimelineFromVirtual ( "ZO_MagmaBackgroundAnimation_SceneTimeLoop" , control )
end
local screenAspectRatio = screenWidth / screenHeight
local fullScreenWidth , fullScreenHeight
local heightScale , widthScale = 1 , 1
if screenAspectRatio < ZO_BACKGROUND_TEXTURE_IMAGE_ASPECT_RATIO then
widthScale = screenHeight / ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT
fullScreenWidth , fullScreenHeight = ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH * widthScale , screenHeight
else
heightScale = screenWidth / ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH
fullScreenWidth , fullScreenHeight = screenWidth , ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT * heightScale
end
return fullScreenWidth , fullScreenHeight , widthScale , heightScale
end
end
local radialBlurShaderEffectType = ZO_BACKGROUND_ENABLE_SHADER_EFFECT_RADIAL_BLUR and SHADER_EFFECT_TYPE_RADIAL_BLUR or SHADER_EFFECT_TYPE_NONE
local waveShaderEffectType = ZO_BACKGROUND_ENABLE_SHADER_EFFECT_WAVE and SHADER_EFFECT_TYPE_WAVE or SHADER_EFFECT_TYPE_NONE
sceneControl . sceneAlpha = 0
sceneControl . grassTexture : SetWaveBounds ( ZO_BACKGROUND_GRASS_WAVE_BOUND_X_MIN , ZO_BACKGROUND_GRASS_WAVE_BOUND_X_MAX , ZO_BACKGROUND_GRASS_WAVE_BOUND_Y_MIN , ZO_BACKGROUND_GRASS_WAVE_BOUND_Y_MAX )
sceneControl . grassTexture : SetWave ( ZO_BACKGROUND_GRASS_WAVE_ANGLE_RADIANS , ZO_BACKGROUND_GRASS_WAVE_FREQUENCY , ZO_BACKGROUND_GRASS_WAVE_SPEED , 0 )
local foregroundTextureControls = sceneControl . foregroundTextures
end
end
if sceneControl . ouroborosInnerTexture then
end
if sceneControl . skyTexture then
end
end
do
sceneControl . startHours = ZO_BACKGROUND_NIGHT_START_TIME_HOURS
sceneControl . endHours = ZO_BACKGROUND_NIGHT_END_TIME_HOURS
end
do
sceneControl . startHours = ZO_BACKGROUND_DAY_START_TIME_HOURS
sceneControl . endHours = ZO_BACKGROUND_DAY_END_TIME_HOURS
end
end
end
local elapsedHours , totalHours = nil , nil
if startHour < endHour then
totalHours = endHour - startHour
elapsedHours = sceneTimeHours - startHour
else
totalHours = 24.0 - ( startHour - endHour )
if sceneTimeHours >= startHour then
elapsedHours = sceneTimeHours - startHour
else
end
end
return elapsedHours / totalHours
end
end
textureControl : SetTextureCoords ( 0 , ZO_BACKGROUND_TEXTURE_COORD_RIGHT , 0 , ZO_BACKGROUND_TEXTURE_COORD_BOTTOM )
end
local widthRatio = guiWidth / ZO_BACKGROUND_TEXTURE_IMAGE_WIDTH
local heightRatio = guiHeight / ZO_BACKGROUND_TEXTURE_IMAGE_HEIGHT
end
local scale = widthRatio > heightRatio and widthRatio or heightRatio
textureWidth = textureWidth * scale
textureHeight = textureHeight * scale
end
end
end
end
local waveIntervalSeconds = ( intervalSeconds * ZO_BACKGROUND_FLORA_WAVE_INTERVAL_COEFFICIENT ) % 3600
local grassOffset = waveIntervalSeconds * ZO_BACKGROUND_GRASS_WAVE_TIME_COEFFICIENT
local textureIndices = ZO_BACKGROUND_FOREGROUND_TEXTURE_INDICES
local foregroundTextures = sceneControl . foregroundTextures
local ouroborosInnerTexture = sceneControl . ouroborosInnerTexture
if ouroborosInnerTexture then
local totalInnerInterval = ZO_BACKGROUND_OUROBOROS_ACTIVE_INTERVAL_SECONDS + ZO_BACKGROUND_OUROBOROS_INACTIVE_INTERVAL_SECONDS
local normalizedInnerInterval = zo_max ( ( intervalSeconds % totalInnerInterval ) - ZO_BACKGROUND_OUROBOROS_INACTIVE_INTERVAL_SECONDS , 0 ) / ZO_BACKGROUND_OUROBOROS_ACTIVE_INTERVAL_SECONDS
local maskInterval = ZO_EaseOutQuartic ( normalizedInnerInterval < 0.5 and ( normalizedInnerInterval * 2 ) or ( 1.0 - ( normalizedInnerInterval - 0.5 ) * 2 ) )
local maskThreshold = zo_lerp ( 1 , ZO_BACKGROUND_OUROBOROS_MASK_THRESHOLD_MIN , zo_min ( 1 , maskInterval * 2 ) )
if parentAlpha < 0.25 then
-- Suppress this instance because we want these to spawn, including the accompanying audio,
-- only when the containing scene has not fully interpolated toward zero alpha.
else
local numOrigins = # ZO_BACKGROUND_OUROBOROS_NORMALIZED_ORIGINS
local normalizedOrigin = ZO_BACKGROUND_OUROBOROS_NORMALIZED_ORIGINS [ normalizedOriginIndex ]
local originOffsetX = normalizedOrigin . centerOffsetX + zo_lerp ( - normalizedOrigin . radiusX , normalizedOrigin . radiusX , zo_random ( ) )
local originOffsetY = normalizedOrigin . centerOffsetY + zo_lerp ( - normalizedOrigin . radiusY , normalizedOrigin . radiusY , zo_random ( ) )
end
end
end
end
end
end
return
end
if alphaCoefficient > 0.2 then
alphaCoefficient = ( alphaCoefficient - 0.2 ) * 1.25
-- Spawn a new dandelion.
particle . objectKey = objectKey
local origin = particle . origin
if not origin then
origin = { x = 0 , y = 0 , z = 0 }
particle . origin = origin
end
origin . z = z
local scaleFactor = z * z * z * z
local scale = zo_lerp ( ZO_BACKGROUND_DANDELION_SCALE_MIN , ZO_BACKGROUND_DANDELION_SCALE_MAX , scaleFactor )
local forward = particle . forward
if not forward then
forward = { x = 0 , y = 0 , z = 0 }
particle . forward = forward
end
particle . startTimeSeconds = intervalSeconds
particle . lifetimeSeconds = zo_lerp ( ZO_BACKGROUND_DANDELION_LIFETIME_SECONDS_MIN , ZO_BACKGROUND_DANDELION_LIFETIME_SECONDS_MAX , zo_random ( ) )
end
end
-- Animate active dandelions.
local recycleParticle = false
local interval = ( intervalSeconds - particle . startTimeSeconds ) / particle . lifetimeSeconds
if interval >= 1.0 then
recycleParticle = true
else
-- Animate this dandelion.
local origin = particle . origin
local forward = particle . forward
if x == 0.0 or x == 1.0 or y == 0.0 or y == 1.0 then
recycleParticle = true
else
local z = origin . z
end
end
if recycleParticle then
-- Release and recycle this dandelion.
end
end
end
end
-- Intro scene time speed override.
local hoursPerSecond = ZO_BACKGROUND_SCENE_TIME_HOURS_PER_SECOND
if introIntervalSeconds < ZO_BACKGROUND_INTRO_SCENE_TIME_INTERVAL_SECONDS then
easedIntroInterval = 1 - ( easedIntroInterval * easedIntroInterval )
hoursPerSecond = zo_lerp ( ZO_BACKGROUND_INTRO_SCENE_TIME_HOURS_PER_SECOND , hoursPerSecond , easedIntroInterval )
end
-- Advance scene time.
local sceneTimeNormalized = sceneTimeHours / 24.0
-- Calculate sun position.
local sunAngleRadians = ( sceneTimeNormalized * ZO_TWO_PI + ZO_BACKGROUND_SUN_ANGLE_OFFSET_RADIANS ) % ZO_TWO_PI
local altitude = ZO_BACKGROUND_SUN_ORIGIN_Y + zo_cos ( sunAngleRadians ) * ZO_BACKGROUND_SUN_RADIUS_ZENITH
local azimuth = ZO_BACKGROUND_SUN_ORIGIN_X + zo_sin ( sunAngleRadians ) * ZO_BACKGROUND_SUN_RADIUS_AZIMUTH
-- Update scene alphas and sun positions.
local startHours , endHours = sceneControl . startHours , sceneControl . endHours
local alpha = ZO_EaseOutQuintic ( sceneInterval < 0.5 and ( sceneInterval * 2.0 ) or ( 1.0 - ( sceneInterval - 0.5 ) * 2.0 ) )
sceneControl . sceneAlpha = alpha
if sceneControl . sceneAlpha > 0.001 then
if sceneControl . skyTexture then
-- Calculate god ray blur parameters.
local numBlurSamples = blurCoefficient > 0.0 and ZO_BACKGROUND_SUN_RADIAL_BLUR_NUM_SAMPLES or 1
if isIntroPlaying then
sceneControl . skyTexture : SetAlpha ( blurCoefficient * alpha * zo_lerp ( 0.75 , ZO_BACKGROUND_SKY_ALPHA_MAX , ZO_EaseInQuadratic ( introProgress ) ) )
else
sceneControl . skyTexture : SetAlpha ( blurCoefficient * zo_lerp ( 0.0 , ZO_BACKGROUND_SKY_ALPHA_MAX , alpha ) )
end
if ZO_BACKGROUND_ENABLE_SHADER_EFFECT_RADIAL_BLUR then
sceneControl . skyTexture : SetRadialBlur ( azimuth , altitude , numBlurSamples , ZO_BACKGROUND_GOD_RAY_NORMALIZED_LENGTH , ZO_BACKGROUND_SUN_RADIAL_BLUR_OFFSET )
end
end
end
else
end
end
local nightSceneAlpha = sceneControls [ ZO_BACKGROUND_NIGHT_SCENE_INDEX ] . sceneAlpha
-- Torchbugs use the same alpha as the night time scene.
local daySceneAlpha = sceneControls [ ZO_BACKGROUND_DAY_SCENE_INDEX ] . sceneAlpha
-- Dandelions use the same alpha as the day time scene.
if not isIntroPlaying then
end
-- Update audio with the current time of day.
end
if deltaXYSigns > 0.5 then
deltaX = - deltaX
end
if deltaXYSigns <= 0.25 or deltaXYSigns > 0.75 then
deltaY = - deltaY
end
return deltaX , deltaY
end
return
end
if alphaCoefficient > 0.2 then
alphaCoefficient = ( alphaCoefficient - 0.2 ) * 1.25
if ( numTorchbugs1 + numTorchbugs2 ) < ZO_BACKGROUND_TORCHBUG_INSTANCES_MAX then
-- Spawn a new torchbug.
local originAngle = zo_lerp ( ZO_BACKGROUND_TORCHBUG_ORIGIN_ANGLE_MIN , ZO_BACKGROUND_TORCHBUG_ORIGIN_ANGLE_MAX , scaleFactor )
local normalizedX = ZO_BACKGROUND_TORCHBUG_ORIGIN_X + sinAngle * zo_lerp ( ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_X_MIN , ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_X_MAX , zo_random ( ) )
local normalizedY = ZO_BACKGROUND_TORCHBUG_ORIGIN_Y + cosAngle * zo_lerp ( ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_Y_MIN , ZO_BACKGROUND_TORCHBUG_ORIGIN_DISTANCE_Y_MAX , zo_random ( ) )
-- Ensure that the torchbug texture that includes the "spotlight" beneath it is only shown in the lower half of the scene
-- as it illuminates the ground that is guaranteed to be below the torchbugs; use the torchbug-only texture for torchbugs
-- in the upper half of the scene as many of these fly far above the ground.
particle . objectKey = objectKey
particle . startTimeSeconds = intervalSeconds
particle . lifetimeSeconds = zo_lerp ( ZO_BACKGROUND_TORCHBUG_LIFETIME_SECONDS_MAX , ZO_BACKGROUND_TORCHBUG_LIFETIME_SECONDS_MIN , scaleFactor )
particle : SetTextureSampleProcessingWeight ( TEX_SAMPLE_PROCESSING_RGB , zo_lerp ( ZO_BACKGROUND_TORCHBUG_SAMPLING_MIN , ZO_BACKGROUND_TORCHBUG_SAMPLING_MAX , normalizedY ) )
particle . scale = zo_lerp ( ZO_BACKGROUND_TORCHBUG_SCALE_MIN , ZO_BACKGROUND_TORCHBUG_SCALE_MAX , normalizedY * normalizedY ) -- Eased scaling for perspective.
particle . startOriginX , particle . startOriginY = 0.5 + startX , 0.5 + startY
particle . endOriginX , particle . endOriginY = 0.5 - endX , 0.5 - endY
end
end
-- Animate active torchbugs.
local interval = ( intervalSeconds - particle . startTimeSeconds ) / particle . lifetimeSeconds
if interval >= 1.0 then
-- Release and recycle this torchbug.
else
-- Animate this torchbug.
local easedInterval = 1.0 - ( interval * interval )
if alpha < 0.3 and interval > 0.35 and interval < 0.65 then
alpha = 0.3
end
end
end
end
end
end
--Events
end
local effectType = ZO_BACKGROUND_ENABLE_SHADER_EFFECT_GAUSSIAN_BLUR and SHADER_EFFECT_TYPE_GAUSSIAN_BLUR or SHADER_EFFECT_TYPE_NONE
end
end
local sampleWeight = progress < 0.5 and ( 2 * ZO_EaseInQuadratic ( progress * 2 ) ) or ( 2 - ZO_EaseInQuadratic ( ( progress - 0.5 ) * 2 ) )
self . titleNightTexture : SetAlpha ( alpha * self . sceneControls [ ZO_BACKGROUND_NIGHT_SCENE_INDEX ] . sceneAlpha )
end
end
end
end
--Global XML Handlers
end
end
end
end
end
end
end
end |