Beispiel #1
0
 public EffectNode(NodeContext nodeContext, EffectNodeDescription description) : base(nodeContext, description)
 {
     graphicsDevice = description.Factory.DeviceManager.GraphicsDevice;
     instance       = new DynamicEffectInstance(description.Name);
     instance.Initialize(description.Factory.ServiceRegistry);
     instance.UpdateEffect(graphicsDevice);
     parameters     = instance.Parameters;
     Inputs         = description.CreateNodeInputs(this, parameters);
     Outputs        = description.CreateNodeOutputs(this, parameters);
     perFrameParams = parameters.GetWellKnownParameters(WellKnownParameters.PerFrameMap).ToArray();
     perViewParams  = parameters.GetWellKnownParameters(WellKnownParameters.PerViewMap).ToArray();
     perDrawParams  = parameters.GetWellKnownParameters(WellKnownParameters.PerDrawMap).ToArray();
     if (perDrawParams.Length > 0)
     {
         worldPin = Inputs.OfType <ConvertedValueParameterPin <Matrix, SharpDX.Matrix> >().FirstOrDefault(p => p.Key == TransformationKeys.World);
     }
     if (Inputs.Length > 0)
     {
         customParameterSetterPin = Inputs[Inputs.Length - 1] as Pin <Action <ParameterCollection, RenderView, RenderDrawContext> >;
     }
 }
Beispiel #2
0
        void UpdateNodeDescriptions()
        {
            var descriptions = nodeDescriptions.ToArray();

            for (int i = 0; i < descriptions.Length; i++)
            {
                var description = descriptions[i] as EffectNodeDescription;
                if (description == null || !description.IsInUse)
                {
                    continue;
                }

                var updatedDescription = new EffectNodeDescription(this, description.Name);
                if (!updatedDescription.Inputs.SequenceEqual(description.Inputs, PinComparer.Instance) ||
                    !updatedDescription.Outputs.SequenceEqual(description.Outputs, PinComparer.Instance))
                {
                    // Signature change, force a new compilation
                    nodeDescriptions[i] = updatedDescription;
                }
            }
        }
Beispiel #3
0
 public EffectNodeBase(NodeContext nodeContext, EffectNodeDescription description) : base(nodeContext)
 {
     this.description = description;
 }