示例#1
0
 /// <summary>
 /// Create VGO_PS_Renderer from ParticleSystemRenderer.
 /// </summary>
 /// <param name="particleSystemRenderer"></param>
 /// <param name="gltf"></param>
 /// <returns></returns>
 protected virtual VGO_PS_Renderer CreateVgoPsRenderer(ParticleSystemRenderer particleSystemRenderer, glTF gltf)
 {
     return(new VGO_PS_Renderer()
     {
         enabled = particleSystemRenderer.enabled,
         renderMode = particleSystemRenderer.renderMode,
         cameraVelocityScale = particleSystemRenderer.cameraVelocityScale,
         velocityScale = particleSystemRenderer.velocityScale,
         lengthScale = particleSystemRenderer.lengthScale,
         normalDirection = particleSystemRenderer.normalDirection,
         sharedMaterial = GetMaterialIndex(particleSystemRenderer.sharedMaterial, gltf),
         trailMaterialIndex = GetMaterialIndex(particleSystemRenderer.trailMaterial, gltf),
         sortMode = particleSystemRenderer.sortMode,
         sortingFudge = particleSystemRenderer.sortingFudge,
         minParticleSize = particleSystemRenderer.minParticleSize,
         maxParticleSize = particleSystemRenderer.maxParticleSize,
         alignment = particleSystemRenderer.alignment,
         flip = particleSystemRenderer.flip.ReverseZ().ToArray(),
         allowRoll = particleSystemRenderer.allowRoll,
         pivot = particleSystemRenderer.pivot.ReverseZ().ToArray(),
         maskInteraction = particleSystemRenderer.maskInteraction,
         enableGPUInstancing = particleSystemRenderer.enableGPUInstancing,
         shadowCastingMode = particleSystemRenderer.shadowCastingMode,
         receiveShadows = particleSystemRenderer.receiveShadows,
         shadowBias = particleSystemRenderer.shadowBias,
         motionVectorGenerationMode = particleSystemRenderer.motionVectorGenerationMode,
         forceRenderingOff = particleSystemRenderer.forceRenderingOff,
         rendererPriority = particleSystemRenderer.rendererPriority,
         renderingLayerMask = particleSystemRenderer.renderingLayerMask,
         sortingLayerID = particleSystemRenderer.sortingLayerID,
         sortingOrder = particleSystemRenderer.sortingOrder,
         lightProbeUsage = particleSystemRenderer.lightProbeUsage,
         reflectionProbeUsage = particleSystemRenderer.reflectionProbeUsage,
         probeAnchor = VgoTransformConverter.CreateFrom(particleSystemRenderer.probeAnchor),
     });
 }
示例#2
0
        /// <summary>
        /// Create VGO_PS_MainModule from MainModule.
        /// </summary>
        /// <param name="module"></param>
        /// <returns></returns>
        protected virtual VGO_PS_MainModule CreateVgoModule(MainModule module)
        {
            var vgoModule = new VGO_PS_MainModule()
            {
                duration                  = module.duration,
                loop                      = module.loop,
                prewarm                   = module.prewarm,
                startDelay                = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startDelay),
                startDelayMultiplier      = module.startDelayMultiplier,
                startLifetime             = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startLifetime),
                startLifetimeMultiplier   = module.startLifetimeMultiplier,
                startSpeed                = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startSpeed),
                startSpeedMultiplier      = module.startSpeedMultiplier,
                startSize3D               = module.startSize3D,
                startRotation3D           = module.startRotation3D,
                flipRotation              = module.flipRotation,
                startColor                = VgoParticleSystemMinMaxGradientConverter.CreateFrom(module.startColor),
                gravityModifier           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.gravityModifier),
                gravityModifierMultiplier = module.gravityModifierMultiplier,
                simulationSpace           = module.simulationSpace,
                simulationSpeed           = module.simulationSpeed,
                customSimulationSpace     = VgoTransformConverter.CreateFrom(module.customSimulationSpace),
                useUnscaledTime           = module.useUnscaledTime,
                scalingMode               = module.scalingMode,
                playOnAwake               = module.playOnAwake,
                emitterVelocityMode       = module.emitterVelocityMode,
                maxParticles              = module.maxParticles,
                stopAction                = module.stopAction,
                cullingMode               = module.cullingMode,
                ringBufferMode            = module.ringBufferMode,
            };

            if (module.startSize3D)
            {
                vgoModule.startSizeX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startSizeX);
                vgoModule.startSizeY           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startSizeY);
                vgoModule.startSizeZ           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startSizeZ);
                vgoModule.startSizeXMultiplier = module.startSizeXMultiplier;
                vgoModule.startSizeYMultiplier = module.startSizeYMultiplier;
                vgoModule.startSizeZMultiplier = module.startSizeZMultiplier;
            }
            else
            {
                vgoModule.startSize           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startSize);
                vgoModule.startSizeMultiplier = module.startSizeMultiplier;
            }

            if (module.startRotation3D)
            {
                vgoModule.startRotationX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startRotationX);
                vgoModule.startRotationY           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startRotationY);
                vgoModule.startRotationZ           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startRotationZ);
                vgoModule.StartRotationXMultiplier = module.startRotationXMultiplier;
                vgoModule.StartRotationYMultiplier = module.startRotationYMultiplier;
                vgoModule.StartRotationZMultiplier = module.startRotationZMultiplier;
            }
            else
            {
                vgoModule.startRotation           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.startRotation);
                vgoModule.StartRotationMultiplier = module.startRotationMultiplier;
            }

            if (module.ringBufferMode == ParticleSystemRingBufferMode.LoopUntilReplaced)
            {
                vgoModule.ringBufferLoopRange = module.ringBufferLoopRange.ToArray();
            }

            return(vgoModule);
        }