Beispiel #1
0
 /// <summary>
 /// Create VGO_PS_SizeOverLifetimeModule from SizeOverLifetimeModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_SizeOverLifetimeModule CreateVgoModule(SizeOverLifetimeModule module)
 {
     if (module.separateAxes)
     {
         return(new VGO_PS_SizeOverLifetimeModule()
         {
             enabled = module.enabled,
             separateAxes = module.separateAxes,
             x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.x),
             y = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.y),
             z = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.z),
             xMultiplier = module.xMultiplier,
             yMultiplier = module.yMultiplier,
             zMultiplier = module.zMultiplier,
         });
     }
     else
     {
         return(new VGO_PS_SizeOverLifetimeModule()
         {
             enabled = module.enabled,
             separateAxes = module.separateAxes,
             x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.size),
             xMultiplier = module.sizeMultiplier,
         });
     }
 }
Beispiel #2
0
 /// <summary>
 /// Create VGO_PS_TrailModule from TrailModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_TrailModule CreateVgoModule(TrailModule module)
 {
     return(new VGO_PS_TrailModule()
     {
         enabled = module.enabled,
         mode = module.mode,
         ratio = module.ratio,
         lifetime = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.lifetime),
         lifetimeMultiplier = module.lifetimeMultiplier,
         minVertexDistance = module.minVertexDistance,
         worldSpace = module.worldSpace,
         dieWithParticles = module.dieWithParticles,
         ribbonCount = module.ribbonCount,
         splitSubEmitterRibbons = module.splitSubEmitterRibbons,
         attachRibbonsToTransform = module.attachRibbonsToTransform,
         textureMode = module.textureMode,
         sizeAffectsWidth = module.sizeAffectsWidth,
         sizeAffectsLifetime = module.sizeAffectsLifetime,
         inheritParticleColor = module.inheritParticleColor,
         colorOverLifetime = VgoParticleSystemMinMaxGradientConverter.CreateFrom(module.colorOverLifetime),
         widthOverTrail = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.widthOverTrail),
         widthOverTrailMultiplier = module.widthOverTrailMultiplier,
         colorOverTrail = VgoParticleSystemMinMaxGradientConverter.CreateFrom(module.colorOverTrail),
         generateLightingData = module.generateLightingData,
         shadowBias = module.shadowBias,
     });
 }
Beispiel #3
0
 /// <summary>
 /// Create VGO_PS_RotationBySpeedModule from RotationBySpeedModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_RotationBySpeedModule CreateVgoModule(RotationBySpeedModule module)
 {
     if (module.separateAxes)
     {
         return(new VGO_PS_RotationBySpeedModule()
         {
             enabled = module.enabled,
             separateAxes = module.separateAxes,
             x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.x),
             y = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.y),
             z = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.z),
             xMultiplier = module.xMultiplier,
             yMultiplier = module.yMultiplier,
             zMultiplier = module.zMultiplier,
             range = module.range.ToArray(),
         });
     }
     else
     {
         return(new VGO_PS_RotationBySpeedModule()
         {
             enabled = module.enabled,
             separateAxes = module.separateAxes,
             x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.x),
             xMultiplier = module.xMultiplier,
             range = module.range.ToArray(),
         });
     }
 }
Beispiel #4
0
        /// <summary>
        /// Create VGO_PS_VelocityOverLifetimeModule from VelocityOverLifetimeModule.
        /// </summary>
        /// <param name="module"></param>
        /// <returns></returns>
        protected virtual VGO_PS_LimitVelocityOverLifetimeModule CreateVgoModule(LimitVelocityOverLifetimeModule module)
        {
            var vgoModule = new VGO_PS_LimitVelocityOverLifetimeModule()
            {
                enabled                        = module.enabled,
                separateAxes                   = module.separateAxes,
                space                          = module.space,
                dampen                         = module.dampen,
                drag                           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.drag),
                dragMultiplier                 = module.dragMultiplier,
                multiplyDragByParticleSize     = module.multiplyDragByParticleSize,
                multiplyDragByParticleVelocity = module.multiplyDragByParticleVelocity,
            };

            if (module.separateAxes)
            {
                vgoModule.limitX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.limitX);
                vgoModule.limitY           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.limitY);
                vgoModule.limitZ           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.limitZ);
                vgoModule.limitXMultiplier = module.limitXMultiplier;
                vgoModule.limitYMultiplier = module.limitYMultiplier;
                vgoModule.limitZMultiplier = module.limitZMultiplier;
            }
            else
            {
                vgoModule.limitX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.limit);
                vgoModule.limitXMultiplier = module.limitMultiplier;
            }

            return(vgoModule);
        }
Beispiel #5
0
 /// <summary>
 /// Create VGO_PS_VelocityOverLifetimeModule from VelocityOverLifetimeModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_VelocityOverLifetimeModule CreateVgoModule(VelocityOverLifetimeModule module)
 {
     return(new VGO_PS_VelocityOverLifetimeModule()
     {
         enabled = module.enabled,
         x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.x),
         y = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.y),
         z = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.z),
         xMultiplier = module.xMultiplier,
         yMultiplier = module.yMultiplier,
         zMultiplier = module.zMultiplier,
         space = module.space,
         orbitalX = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalX),
         orbitalY = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalY),
         orbitalZ = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalZ),
         orbitalXMultiplier = module.orbitalXMultiplier,
         orbitalYMultiplier = module.orbitalYMultiplier,
         orbitalZMultiplier = module.orbitalZMultiplier,
         orbitalOffsetX = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalOffsetX),
         orbitalOffsetY = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalOffsetY),
         orbitalOffsetZ = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.orbitalOffsetZ),
         orbitalOffsetXMultiplier = module.orbitalOffsetXMultiplier,
         orbitalOffsetYMultiplier = module.orbitalOffsetYMultiplier,
         orbitalOffsetZMultiplier = module.orbitalOffsetZMultiplier,
         radial = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.radial),
         radialMultiplier = module.radialMultiplier,
         speedModifier = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.speedModifier),
         speedModifierMultiplier = module.speedModifierMultiplier,
     });
 }
Beispiel #6
0
        /// <summary>
        /// Create VGO_PS_EmissionModule from EmissionModule.
        /// </summary>
        /// <param name="module"></param>
        /// <returns></returns>
        protected virtual VGO_PS_EmissionModule CreateVgoModule(EmissionModule module)
        {
            var vgoModule = new VGO_PS_EmissionModule()
            {
                enabled                    = module.enabled,
                rateOverTime               = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.rateOverTime),
                rateOverTimeMultiplier     = module.rateOverTimeMultiplier,
                rateOverDistance           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.rateOverDistance),
                rateOverDistanceMultiplier = module.rateOverDistanceMultiplier,
                //BurstCount = module.burstCount,
            };

            if (module.burstCount > 0)
            {
                Burst[] bursts = new Burst[module.burstCount];

                module.GetBursts(bursts);

                if ((bursts != null) && bursts.Any())
                {
                    vgoModule.bursts = new VGO_PS_Burst[bursts.Length];

                    for (int idx = 0; idx < bursts.Length; idx++)
                    {
                        vgoModule.bursts[idx] = VgoParticleSystemBurstConverter.CreateFrom(bursts[idx]);
                    }
                }
            }

            return(vgoModule);
        }
Beispiel #7
0
        /// <summary>
        /// Create VGO_PS_ShapeModule from ShapeModule.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="gltf"></param>
        /// <returns></returns>
        /// <remarks>
        /// @notice TextureIO.ExportTexture() may export the same texture multiple times.
        /// </remarks>
        protected virtual VGO_PS_ShapeModule CreateVgoModule(ShapeModule module, glTF gltf)
        {
            var vgoShapeModule = new VGO_PS_ShapeModule()
            {
                enabled               = module.enabled,
                shapeType             = module.shapeType,
                angle                 = module.angle,
                radius                = module.radius,
                donutRadius           = module.donutRadius,
                radiusMode            = module.radiusMode,
                radiusSpread          = module.radiusSpread,
                radiusSpeed           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.radiusSpeed),
                radiusSpeedMultiplier = module.radiusSpeedMultiplier,
                radiusThickness       = module.radiusThickness,
                boxThickness          = module.boxThickness.ReverseZ().ToArray(),
                arc                      = module.arc,
                arcMode                  = module.arcMode,
                arcSpread                = module.arcSpread,
                arcSpeed                 = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.arcSpeed),
                arcSpeedMultiplier       = module.arcSpeedMultiplier,
                length                   = module.length,
                meshShapeType            = module.meshShapeType,
                meshSpawnMode            = module.meshSpawnMode,
                meshSpawnSpread          = module.meshSpawnSpread,
                meshSpawnSpeed           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.meshSpawnSpread),
                meshSpawnSpeedMultiplier = module.meshSpawnSpeedMultiplier,
                //mesh
                //meshRenderer
                //skinnedMeshRenderer
                useMeshMaterialIndex = module.useMeshMaterialIndex,
                meshMaterialIndex    = module.meshMaterialIndex,
                useMeshColors        = module.useMeshColors,
                //sprite
                //spriteRenderer
                normalOffset                 = module.normalOffset,
                textureIndex                 = -1,
                textureClipChannel           = module.textureClipChannel,
                textureClipThreshold         = module.textureClipThreshold,
                textureColorAffectsParticles = module.textureColorAffectsParticles,
                textureAlphaAffectsParticles = module.textureAlphaAffectsParticles,
                textureBilinearFiltering     = module.textureBilinearFiltering,
                textureUVChannel             = module.textureUVChannel,
                position                 = module.position.ReverseZ().ToArray(),
                rotation                 = module.rotation.ReverseZ().ToArray(),
                scale                    = module.scale.ToArray(),
                alignToDirection         = module.alignToDirection,
                randomPositionAmount     = module.randomPositionAmount,
                sphericalDirectionAmount = module.sphericalDirectionAmount,
                randomDirectionAmount    = module.randomDirectionAmount,
            };

            if (module.texture != null)
            {
                vgoShapeModule.textureIndex = TextureIO.ExportTexture(gltf, gltf.buffers.Count - 1, module.texture, glTFTextureTypes.Unknown);
            }

            return(vgoShapeModule);
        }
Beispiel #8
0
 /// <summary>
 /// Create VGO_PS_InheritVelocityModule from InheritVelocityModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_InheritVelocityModule CreateVgoModule(InheritVelocityModule module)
 {
     return(new VGO_PS_InheritVelocityModule()
     {
         enabled = module.enabled,
         mode = module.mode,
         curve = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.curve),
         curveMultiplier = module.curveMultiplier,
     });
 }
Beispiel #9
0
 /// <summary>
 /// Create VGO_PS_ExternalForcesModule from ExternalForcesModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_ExternalForcesModule CreateVgoModule(ExternalForcesModule module)
 {
     return(new VGO_PS_ExternalForcesModule()
     {
         enabled = module.enabled,
         multiplierCurve = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.multiplierCurve),
         multiplier = module.multiplier,
         influenceFilter = module.influenceFilter,
         influenceMask = module.influenceMask.value,
     });
 }
 /// <summary>
 /// Create VGO_PS_Burst from Burst.
 /// </summary>
 /// <param name="minMaxCurve"></param>
 /// <returns></returns>
 public static VGO_PS_Burst CreateFrom(Burst burst)
 {
     return(new VGO_PS_Burst()
     {
         time = burst.time,
         count = VgoParticleSystemMinMaxCurveConverter.CreateFrom(burst.count),
         cycleCount = burst.cycleCount,
         repeatInterval = burst.repeatInterval,
         probability = burst.probability,
     });
 }
Beispiel #11
0
        /// <summary>
        /// Create VGO_PS_NoiseModule from NoiseModule.
        /// </summary>
        /// <param name="module"></param>
        /// <returns></returns>
        protected virtual VGO_PS_NoiseModule CreateVgoModule(NoiseModule module)
        {
            var vgoModule = new VGO_PS_NoiseModule()
            {
                enabled               = module.enabled,
                separateAxes          = module.separateAxes,
                frequency             = module.frequency,
                scrollSpeed           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.scrollSpeed),
                scrollSpeedMultiplier = module.scrollSpeedMultiplier,
                damping               = module.damping,
                octaveCount           = module.octaveCount,
                octaveMultiplier      = module.octaveMultiplier,
                octaveScale           = module.octaveScale,
                quality               = module.quality,
                remapEnabled          = module.remapEnabled,
                positionAmount        = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.positionAmount),
                rotationAmount        = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.rotationAmount),
                sizeAmount            = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.sizeAmount),
            };

            if (module.separateAxes)
            {
                vgoModule.strengthX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.strengthX);
                vgoModule.strengthY           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.strengthY);
                vgoModule.strengthZ           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.strengthZ);
                vgoModule.strengthXMultiplier = module.strengthXMultiplier;
                vgoModule.strengthYMultiplier = module.strengthYMultiplier;
                vgoModule.strengthZMultiplier = module.strengthZMultiplier;

                if (module.remapEnabled)
                {
                    vgoModule.remapX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.remapX);
                    vgoModule.remapY           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.remapY);
                    vgoModule.remapZ           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.remapZ);
                    vgoModule.remapXMultiplier = module.remapXMultiplier;
                    vgoModule.remapYMultiplier = module.remapYMultiplier;
                    vgoModule.remapZMultiplier = module.remapZMultiplier;
                }
            }
            else
            {
                vgoModule.strengthX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.strengthX);
                vgoModule.strengthXMultiplier = module.strengthXMultiplier;

                if (module.remapEnabled)
                {
                    vgoModule.remapX           = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.remapX);
                    vgoModule.remapXMultiplier = module.remapXMultiplier;
                }
            }

            return(vgoModule);
        }
Beispiel #12
0
 /// <summary>
 /// Create VGO_PS_ForceOverLifetimeModule from ForceOverLifetimeModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_ForceOverLifetimeModule CreateVgoModule(ForceOverLifetimeModule module)
 {
     return(new VGO_PS_ForceOverLifetimeModule()
     {
         enabled = module.enabled,
         x = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.x),
         y = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.y),
         z = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.z),
         xMultiplier = module.xMultiplier,
         yMultiplier = module.yMultiplier,
         zMultiplier = module.zMultiplier,
         space = module.space,
         randomized = module.randomized,
     });
 }
Beispiel #13
0
 /// <summary>
 /// Create VGO_PS_LightsModule from LightsModule.
 /// </summary>
 /// <param name="module"></param>
 /// <returns></returns>
 protected virtual VGO_PS_LightsModule CreateVgoModule(LightsModule module)
 {
     return(new VGO_PS_LightsModule()
     {
         enabled = module.enabled,
         ratio = module.ratio,
         useRandomDistribution = module.useRandomDistribution,
         light = VgoLightConverter.CreateFrom(module.light),
         useParticleColor = module.useParticleColor,
         sizeAffectsRange = module.sizeAffectsRange,
         alphaAffectsIntensity = module.alphaAffectsIntensity,
         range = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.range),
         rangeMultiplier = module.rangeMultiplier,
         intensity = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.intensity),
         intensityMultiplier = module.intensityMultiplier,
         maxLights = module.maxLights,
     });
 }
Beispiel #14
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);
        }