Пример #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 BeamStarRenderer(ITagContainer diContainer, DeviceBufferRange locationRange, BeamStar 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 = false;
            material.MainTexture.Texture      = textureLoader.LoadTexture(
                IEffectPartRenderer.TexturePath, data.texName);
            material.Sampler.Value = IEffectPartRenderer.SamplerDescription;
            AddDisposable(material);

            quadRange = quadMeshBuffer.Reserve(data.complexity.GetPlaneCount() * 2);

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

            Text("Timing:");
            InputInt("Phase 1", ref data.phase1);
            InputInt("Phase 2", ref data.phase2);

            Text("Shape/Movement:");
            EnumCombo("Complexity", ref data.complexity);
            EnumCombo("Mode", ref data.mode);
            InputFloat("Width", ref data.width);
            InputFloat("Scale Speed", ref data.scaleSpeedXY);
            InputFloat("Rotation Speed", ref data.rotationSpeed);

            Text("Material:");
            EnumCombo("Render Mode", ref data.renderMode);
            LabelText("Texture", data.texName);
            ColorEdit4("Color", ref data.color);
            InputFloat("V-Coord Shift", ref data.texShiftVStart);
            DragFloatRange2("End V-Coord", ref data.startTexVEnd, ref data.endTexVEnd);
        }