Пример #1
0
        private void LoadEffectNow(IResource resource)
        {
            if (resource.Equals(CurrentResource))
            {
                return;
            }
            CurrentResource = null;
            emptyEffect     = new EffectCombiner();

            effectRenderer?.Dispose();
            effectRenderer = new EffectCombinerRenderer(diContainer, resource);
            effectRenderer.Location.LocalPosition = Vector3.Zero;
            effectRenderer.Location.LocalRotation = Quaternion.Identity;

            editor.ClearInfoSections();
            editor.AddInfoSection("Info", HandleInfoContent);
            editor.AddInfoSection("Playback", HandlePlaybackContent);
            foreach (var(partRenderer, i) in effectRenderer.Parts.Indexed())
            {
                var part = Effect.parts[i];
                editor.AddInfoSection($"{part.Type} \"{part.Name}\"", part switch
                {
                    MovingPlanes mp => () => HandlePart(mp, (MovingPlanesRenderer)partRenderer),
                    RandomPlanes rp => () => HandlePart(rp, (RandomPlanesRenderer)partRenderer),
                    ParticleEmitter pe => () => HandlePart(pe, (ParticleEmitterRenderer)partRenderer),
                    BeamStar bs => () => HandlePart(bs, (BeamStarRenderer)partRenderer),
                    _ => () => { } // ignore for now
                }, defaultOpen: false, () => HandlePartPreContent(i));
Пример #2
0
        public RandomPlanesRenderer(ITagContainer diContainer, DeviceBufferRange locationRange, RandomPlanes data)
        {
            this.data = data;
            var textureLoader = diContainer.GetTag <IAssetLoader <Texture> >();
            var camera        = diContainer.GetTag <Camera>();

            quadMeshBuffer = diContainer.GetTag <IQuadMeshBuffer <EffectVertex> >();
            material       = EffectMaterial.CreateFor(data.renderMode, diContainer);
            material.LinkTransformsTo(camera);
            material.World.BufferRange                 = locationRange;
            material.Uniforms.Value                    = EffectMaterialUniforms.Default;
            material.Uniforms.Ref.isBillboard          = !data.circlesAround;
            AddDisposable(material.MainTexture.Texture = textureLoader.LoadTexture(
                              IEffectPartRenderer.TexturePath, data.texName));
            material.Sampler.Value = SamplerAddressMode.Clamp.AsDescription(SamplerFilter.MinLinear_MagLinear_MipLinear);
            AddDisposable(material);

            planes        = new RandomPlane[(int)(data.planeLife * data.spawnRate / 1000)];
            quadRange     = quadMeshBuffer.Reserve(planes.Length);
            tileTexCoords = EffectPartUtility.GetTileUV(data.tileW, data.tileH, data.tileId, data.tileCount);

            Reset();
        }
Пример #3
0
        private void HandlePart(RandomPlanes data, RandomPlanesRenderer ren)
        {
            InputText("Name", ref data.name, 128);
            NewLine();

            Text("Timing:");
            InputInt("Phase1", ref data.phase1);
            InputInt("Phase2", ref data.phase2);
            InputInt("Extra phase", ref data.extraPhase);
            InputFloat("MinProgress", ref data.minProgress);
            Checkbox("Ignore Phases", ref data.ignorePhases);
            NewLine();

            Text("Shape/Movement:");
            InputFloat("Width", ref data.width);
            InputFloat("Height", ref data.height);
            DragFloatRange2("Scale Speed Range", ref data.minScaleSpeed, ref data.maxScaleSpeed, 1f, 0f);
            InputFloat("Scale Speed Mult.", ref data.scaleSpeedMult);
            InputFloat("Target Size", ref data.targetSize);
            InputFloat2("Offset", ref data.minPosX, ref data.yOffset);
            InputFloat2("Pos Range", ref data.amplPosX, ref data.amplPosY);
            InputFloat("Rotation Speed Mult.", ref data.rotationSpeedMult);
            InputFloat("Tex Shift", ref data.texShift);
            Checkbox("Circles Around", ref data.circlesAround);
            NewLine();

            Text("Material:");
            LabelText("Texture", data.texName);
            InputInt("Tile Id", ref data.tileId);
            InputInt("Tile Count", ref data.tileCount);
            InputInt("Tile Duration", ref data.tileDuration);
            InputInt("Tile W", ref data.tileW);
            InputInt("Tile H", ref data.tileH);
            ColorEdit4("Color", ref data.color);
            EnumCombo("RenderMode", ref data.renderMode);
        }