Example #1
0
        protected override void OnUpdate(DX11RenderContext context)
        {
            //Grab a temp target if enabled

            TexInfo ti = this.rtm.GetRenderTarget(context);

            if (ti.w != this.width || ti.h != this.height || !this.targets.ContainsKey(context) || this.invalidate ||
                ti.format != this.format)
            {
                this.invalidate = false;
                this.width      = ti.w;
                this.height     = ti.h;
                this.format     = ti.format;

                this.depthmanager.NeedReset = true;

                if (targets.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targets[context]);
                }

                if (targetresolve.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targetresolve[context]);
                }

                int aacount   = Convert.ToInt32(this.FInAASamplesPerPixel[0].Name);
                int aaquality = 0;

                if (aacount > 1)
                {
                    List <SampleDescription> sds = context.GetMultisampleFormatInfo(ti.format);
                    int maxlevels = sds[sds.Count - 1].Count;

                    if (aacount > maxlevels)
                    {
                        FHost.Log(TLogType.Warning, "Multisample count too high for this format, reverted to: " + maxlevels);
                        aacount = maxlevels;
                    }

                    DX11RenderTarget2D temptarget        = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount, aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;
                    DX11RenderTarget2D temptargetresolve = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(1, 0), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;

                    targets[context]       = temptarget;
                    targetresolve[context] = temptargetresolve;

                    this.FOutBuffers[0][context]   = temptargetresolve;
                    this.FOutAABuffers[0][context] = temptarget;
                }
                else
                {
                    //Bind both texture as same output
                    DX11RenderTarget2D temptarget = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount, aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0]).Element;
                    targets[context] = temptarget;

                    this.FOutBuffers[0][context]   = temptarget;
                    this.FOutAABuffers[0][context] = temptarget;
                }
            }
        }
Example #2
0
        protected override void CreatePins()
        {
            base.CreatePins();

            FHost.CreateValueOutput(Name, 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FValueOut);
            FValueOut.Order = Order;
            FValueOut.SetSubType(double.MinValue, double.MaxValue, 0.0001D, 0, false, false, false);
        }
Example #3
0
        protected override void CreatePins()
        {
            base.CreatePins();

            FHost.CreateStringOutput(Name, TSliceMode.Dynamic, TPinVisibility.True, out FStringOut);
            FStringOut.SetSubType("default", false);
            FStringOut.Order = Order;
        }
Example #4
0
        protected override void CreatePins()
        {
            base.CreatePins();

            FHost.CreateColorOutput(Name, TSliceMode.Dynamic, TPinVisibility.True, out FColorOut);
            FColorOut.SetSubType(VColor.Black, true);
            FColorOut.Order      = Order;
            FColorOut.SliceCount = 0;
        }
Example #5
0
        public override void DestroyPins()
        {
            FHost.DeletePin(FKeyTime);
            FHost.DeletePin(FKeyColor);
            FKeyTime  = null;
            FKeyColor = null;

            FKeyFrames.Clear();
        }
Example #6
0
        protected override void CreatePins()
        {
            FHost.CreateValueConfig(FPin.Name + "-Time" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyTime);
            FKeyTime.SliceCount = 0;
            FKeyTime.SetSubType(Double.MinValue, Double.MaxValue, 0.001D, 0, false, false, false);

            FHost.CreateColorConfig(FPin.Name + "-Color" + FSliceIndex.ToString(), TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyColor);
            FKeyColor.SliceCount = 0;
            FKeyColor.SetSubType(VColor.Black, true);
        }
Example #7
0
        public override void DestroyPins()
        {
            // DELETE ALL PINS
            ///////////////////////

            FHost.DeletePin(FValueOut);
            FValueOut = null;

            base.DestroyPins();
        }
Example #8
0
        public override void DestroyPins()
        {
            // DELETE ALL PINS
            ///////////////////////
            //FHost.DeletePin(FArm);

            FHost.DeletePin(FColorOut);
            FColorOut = null;

            base.DestroyPins();
        }
Example #9
0
        public override void DestroyPins()
        {
            FHost.DeletePin(FKeyTime);
            FHost.DeletePin(FKeyFlagY);
            FHost.DeletePin(FKeyValue);
            FKeyTime  = null;
            FKeyValue = null;
            FKeyFlagY = null;

            FKeyFrames.Clear();
        }
Example #10
0
        public override void DestroyPins()
        {
            FHost.DeletePin(FStateTime);
            FHost.DeletePin(FStateName);
            FHost.DeletePin(FStateEvents);
            FStateTime   = null;
            FStateName   = null;
            FStateEvents = null;

            FKeyFrames.Clear();
        }
Example #11
0
 void SetMidiFile(string Filename)
 {
     if (System.IO.File.Exists(Filename))
     {
         FMidiScore = new TMidiScore();
         FMidiScore.OnNotesParsed += NotesParsed;
         FMidiScore.SetFilename(Filename);
         FilenameLabel.Text = System.IO.Path.GetFileName(Filename);
     }
     else
     {
         FHost.Log(TLogType.Warning, " \"" + Filename + "\" does not exist!");
     }
 }
Example #12
0
        protected override void CreatePins()
        {
            FHost.CreateValueConfig(FPin.Name + "-Time" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FStateTime);
            FStateTime.SliceCount = 0;
            FStateTime.SetSubType(Double.MinValue, Double.MaxValue, 0.001D, 0, false, false, false);

            FHost.CreateStringConfig(FPin.Name + "-Name" + FSliceIndex.ToString(), TSliceMode.Dynamic, TPinVisibility.Hidden, out FStateName);
            FStateName.SliceCount = 0;
            FStateName.SetSubType("default", false);

            FHost.CreateStringConfig(FPin.Name + "-Events" + FSliceIndex.ToString(), TSliceMode.Dynamic, TPinVisibility.Hidden, out FStateEvents);
            FStateEvents.SliceCount = 0;
            FStateEvents.SetSubType("default", false);
        }
Example #13
0
        public override void DestroyPins()
        {
            // DELETE ALL PINS
            ///////////////////////
            FHost.DeletePin(FCurrentStateOut);
            FCurrentStateOut = null;

            FHost.DeletePin(FStates);
            FStates = null;

            FHost.DeletePin(FStateTimes);
            FStateTimes = null;

            base.DestroyPins();
        }
Example #14
0
        protected override void CreatePins()
        {
            base.CreatePins();

            FHost.CreateStringOutput(Name, TSliceMode.Dynamic, TPinVisibility.True, out FCurrentStateOut);
            FCurrentStateOut.SetSubType("", false);
            FCurrentStateOut.Order = Order;

            FHost.CreateStringOutput(Name + "-State", TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FStates);
            FStates.SetSubType("", false);
            FStates.Order = Order;

            FHost.CreateValueOutput(Name + "-StateTime", 1, null, TSliceMode.Dynamic, TPinVisibility.OnlyInspector, out FStateTimes);
            FStateTimes.SetSubType(double.MinValue, double.MaxValue, 0.0001, 0, false, false, false);
            FStateTimes.Order = Order;
        }
Example #15
0
        //this method is called by vvvv when the node is created
        public override void SetPluginHost(IPluginHost Host)
        {
            base.SetPluginHost(Host);

            //create inputs:

            //value
            //correct subtype of value pin
            FValueIn.SetSubType(0, 1, 0.01, 0, false, false, false);

            //color

            FHost.CreateValueInput("Slider Speed", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FSliderSpeedIn);
            FSliderSpeedIn.SetSubType(0, double.MaxValue, 0.01, 0.25, false, false, false);

            FHost.CreateTransformOutput("Slider Transform", TSliceMode.Dynamic, TPinVisibility.True, out FPinOutSliderTransform);
        }
Example #16
0
        protected override void CreatePins()
        {
            FHost.CreateValueConfig(FPin.Name + "-Time" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyTime);
            FKeyTime.SliceCount = 0;
            FKeyTime.SetSubType(double.MinValue, double.MaxValue, 0.001D, 0, false, false, false);

            FHost.CreateValueConfig(FPin.Name + "-Value" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyValue);
            FKeyValue.SliceCount = 0;
            FKeyValue.SetSubType(double.MinValue, double.MaxValue, 0.001D, 0, false, false, false);

            FHost.CreateValueConfig(FPin.Name + "-InType" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyInType);
            FKeyInType.SliceCount = 0;
            FKeyInType.SetSubType(0, 5, 1, 0, false, false, true);

            FHost.CreateValueConfig(FPin.Name + "-OutType" + FSliceIndex.ToString(), 1, null, TSliceMode.Dynamic, TPinVisibility.Hidden, out FKeyOutType);
            FKeyOutType.SliceCount = 0;
            FKeyOutType.SetSubType(0, 5, 1, 0, false, false, true);
        }
Example #17
0
        //this method is called by vvvv when the node is created
        public override void SetPluginHost(IPluginHost Host)
        {
            base.SetPluginHost(Host);

            //create inputs:

            //value
            //correct subtype of value pin
            FValueIn.SetSubType(0, 1, 0.01, 0, false, false, false);
            FInternalValueConfig.SetSubType(0, 1, 0.01, 0, false, false, false);

            //color
            FHost.CreateColorInput("Slider Color", TSliceMode.Dynamic, TPinVisibility.True, out FSliderColorIn);
            FSliderColorIn.SetSubType(new RGBAColor(1, 1, 1, 1), true);

            FHost.CreateValueInput("Slider Speed", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FSliderSpeedIn);
            FSliderSpeedIn.SetSubType(0, double.MaxValue, 0.01, 0.25, false, false, false);
        }
Example #18
0
        protected override void CreatePins()
        {
            base.CreatePins();

            FHost.CreateStringConfig(Name + "-Filename", TSliceMode.Single, TPinVisibility.True, out FFilenameIn);
            FFilenameIn.Order = Order;
            FFilenameIn.SetSubType("*.mid", true);

            FHost.CreateValueOutput(Name + "-Channel", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FChannelOut);
            FChannelOut.SliceCount = 128;
            FChannelOut.Order      = Order;
            FChannelOut.SetSubType(0, 15, 1, 0, false, false, true);

            FHost.CreateValueOutput(Name + "-Velocity", 1, null, TSliceMode.Dynamic, TPinVisibility.True, out FVelocityOut);
            FVelocityOut.SliceCount = 128;
            FVelocityOut.Order      = Order;
            FVelocityOut.SetSubType(0, 1, 1 / 128, 0, false, false, false);
        }
Example #19
0
        public override void DestroyPins()
        {
            // DELETE ALL PINS
            ///////////////////////
            ///

            FHost.DeletePin(FFilenameIn);
            FFilenameIn = null;

            FHost.DeletePin(FChannelOut);
            FChannelOut = null;

            FHost.DeletePin(FVelocityOut);
            FVelocityOut = null;

            //delete midiscore
            FMidiScore = null;

            base.DestroyPins();
        }
Example #20
0
        public override void Configurate(IPluginConfig Input, bool FirstFrame)
        {
            //if Input = last ConfigInput created!
            if (Input == FStateEvents && FirstFrame)
            {
                FKeyFrames.Clear();

                string name, events;
                double time;

                for (int i = 0; i < FStateEvents.SliceCount; i++)
                {
                    FStateTime.GetValue(i, out time);
                    FStateName.GetString(i, out name);
                    FStateEvents.GetString(i, out events);
                    AddKeyFrame(name, time, events);
                }

                FKeyFrames.Sort(delegate(TLBaseKeyFrame k0, TLBaseKeyFrame k1) { return(k0.Time.CompareTo(k1.Time)); });
            }

            //make sure every state's events have according input-pins
            //remove all inputs that don't have an according event
            //go through all events and find a corresponding pin
            List <IValueFastIn> tmpList = new List <IValueFastIn>();
            IValueFastIn        tmpEventPin;

            foreach (TLStateKeyFrame skf in FKeyFrames)
            {
                foreach (TLEvent e in skf.Events)
                {
                    if (e.Name != "OnEnd")
                    {
                        IValueFastIn ep = FEventPins.Find(delegate(IValueFastIn p) { return(p.Name == e.Name); });

                        if (ep == null)
                        {
                            FHost.CreateValueFastInput(e.Name, 1, null, TSliceMode.Single, TPinVisibility.True, out tmpEventPin);
                            tmpEventPin.SetSubType(0, 1, 1, 0, false, false, false);
                            e.EventPin = tmpEventPin;
                            tmpList.Add(tmpEventPin);
                            FEventPins.Add(tmpEventPin);
                        }
                        else
                        {
                            e.EventPin = ep;
                            if (!tmpList.Contains(ep))
                            {
                                tmpList.Add(ep);
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < FEventPins.Count; i++)
            {
                if (!tmpList.Contains(FEventPins[i]))
                {
                    FHost.DeletePin(FEventPins[i]);
                }
            }

            FEventPins.Clear();
            FEventPins.AddRange(tmpList);
        }
Example #21
0
        protected override void OnUpdate(DX11RenderContext context)
        {
            bool resetta = true;

            try
            {
                var ptadesc = FOutTexArray[0][context].Description;
                resetta = FTADepth[0] != ptadesc.ArraySize ||
                          (int)FTASize[0].x != ptadesc.Width ||
                          (int)FTASize[0].y != ptadesc.Height ||
                          FTAFormat[0] != ptadesc.Format;
            }
            catch (Exception e) { }
            if (resetta)
            {
                try
                {
                    FOutTexArray[0].Dispose(context);
                }
                catch (Exception e) { }
                var tadesc = new Texture2DDescription
                {
                    ArraySize = FTADepth[0],
                    Width     = (int)FTASize[0].x,
                    Height    = (int)FTASize[0].y,
                    Format    = FTAFormat[0],
                    BindFlags = BindFlags.UnorderedAccess | BindFlags.ShaderResource,
                    //CpuAccessFlags = CpuAccessFlags.None,
                    MipLevels         = 1,
                    OptionFlags       = ResourceOptionFlags.None,
                    SampleDescription = new SampleDescription(1, 0),
                    //Usage = ResourceUsage.Default
                };
                FOutTexArray[0][context] = new DX11RWTextureArray2D(context, new Texture2D(context.Device, tadesc));

                foreach (var semantic in CustomSemantics)
                {
                    semantic.Dispose();
                }
                CustomSemantics.Clear();
                CustomSemantics.Add(new RWTexture2dArrayRenderSemantic("TEXTUREARRAY", false)
                {
                    Data = FOutTexArray[0][context]
                });
                CustomSemantics.Add(new Texture2dArrayRenderSemantic("TEXTUREARRAY_SRV", false)
                {
                    Data = FOutTexArray[0][context]
                });
            }

            TexInfo ti = this.rtm.GetRenderTarget(context);

            if (ti.w != this.width || ti.h != this.height || !this.targets.ContainsKey(context) || this.invalidate ||
                ti.format != this.format)
            {
                this.invalidate = false;
                this.width      = ti.w;
                this.height     = ti.h;
                this.format     = ti.format;

                this.depthmanager.NeedReset = true;

                if (targets.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targets[context]);
                }

                if (targetresolve.ContainsKey(context))
                {
                    context.ResourcePool.Unlock(targetresolve[context]);
                }

                int aacount   = Convert.ToInt32(this.FInAASamplesPerPixel[0].Name);
                int aaquality = 0;

                if (aacount > 1)
                {
                    List <SampleDescription> sds = context.GetMultisampleFormatInfo(ti.format);
                    int maxlevels = sds[sds.Count - 1].Count;

                    if (aacount > maxlevels)
                    {
                        FHost.Log(TLogType.Warning, "Multisample count too high for this format, reverted to: " + maxlevels);
                        aacount = maxlevels;
                    }

                    DX11RenderTarget2D temptarget        = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount, aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0], this.FInSharedTex[0]).Element;
                    DX11RenderTarget2D temptargetresolve = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(1, 0), this.FInDoMipMaps[0], this.FInMipLevel[0], this.FInSharedTex[0]).Element;

                    targets[context]       = temptarget;
                    targetresolve[context] = temptargetresolve;

                    this.FOutBuffers[0][context]   = temptargetresolve;
                    this.FOutAABuffers[0][context] = temptarget;
                }
                else
                {
                    //Bind both texture as same output
                    DX11RenderTarget2D temptarget = context.ResourcePool.LockRenderTarget(this.width, this.height, ti.format, new SampleDescription(aacount, aaquality), this.FInDoMipMaps[0], this.FInMipLevel[0], this.FInSharedTex[0]).Element;
                    targets[context] = temptarget;

                    this.FOutBuffers[0][context]   = temptarget;
                    this.FOutAABuffers[0][context] = temptarget;
                }
            }
        }