public LightingEffectBehavior AddLighting(int nID, LightEffectParam param)
 {
     //打开开关,并且有预制体的,并且不是主角的,我们才存起来
     if (!param.bIsHero)
     {
         //如果需要创建的数量比每帧需要创建的要多,一次性最多只能创建MaxCreateOnPreFrame
         if (WillCreateList.Count > MaxCreateOnPreFrame && CurrentCreateCount < MaxCreateOnPreFrame)
         {
             EffectCreateInfo info = GetInvaildInfo();
             info.nID          = nID;
             info.param        = param;
             info.hostInstance = this;
             WillCreateList.Enqueue(info);
             return(null);
         }
         else
         {
             CurrentCreateCount++;
             return(AddLightingImpl(nID, param));
         }
     }
     else
     {
         return(AddLightingImpl(nID, param));
     }
 }
    static EffectCreateInfo GetInvaildInfo()
    {
        EffectCreateInfo info = null;

        if (CreatedList.Count > 0)
        {
            info = CreatedList.Dequeue();
        }
        else
        {
            info = new EffectCreateInfo();
        }

        return(info);
    }
Пример #3
0
        public Triangle(GraphicsDevice graphicsDevice)
        {
            this.graphicsDevice = graphicsDevice;

            var createInfo = new EffectCreateInfo
            {
                PixelShaderPath        = "Content//TriangleShaders//pixelShader.hlsl",
                VertexShaderPath       = "Content//TriangleShaders//vertexShader.hlsl",
                VertexShaderEntryPoint = "VSMain",
                PixelShaderEntryPoint  = "PSMain"
            };


            effect = new LeaEffect(graphicsDevice, createInfo);

            SetUp();
        }
Пример #4
0
        private void CreateEffect()
        {
            var vertexShaderSource   = Resources.vertexShaderFont;
            var geometryShaderSource = Resources.geometryShaderFont;
            var pixelShaderSource    = Resources.pixelShaderFont;

            var createInfo = new EffectCreateInfo
            {
                VertexShaderBlob   = vertexShaderSource,
                GeometryShaderBlob = geometryShaderSource,
                PixelShaderBlob    = pixelShaderSource,

                VertexShaderEntryPoint   = "VSMain",
                GeometryShaderEntryPoint = "GSMain",
                PixelShaderEntryPoint    = "PSMain"
            };

            effect = new LeaEffect(graphicsDevice, createInfo);
        }
    public static void UpdateCreateList()
    {
        if (WillCreateList.Count <= 0)
        {
            return;
        }

        for (int i = 0; i < MaxCreateOnPreFrame; i++)
        {
            if (WillCreateList.Count <= 0)
            {
                break;
            }

            EffectCreateInfo info = WillCreateList.Dequeue();
            if (null != info)
            {
                info.hostInstance.AddLightingImpl(info.nID, info.param);
                CreatedList.Enqueue(info);
            }
        }
        CurrentCreateCount = 0;
    }