Esempio n. 1
0
        // ---- METHODS ------------------------------------------------------------------------------------------------

        void IResData.Load(ResFileLoader loader)
        {
            _flags         = loader.ReadUInt32();
            PolygonControl = new PolygonControl()
            {
                Value = loader.ReadUInt32()
            };
            DepthControl = new DepthControl()
            {
                Value = loader.ReadUInt32()
            };
            AlphaControl = new AlphaControl()
            {
                Value = loader.ReadUInt32()
            };
            AlphaRefValue = loader.ReadSingle();
            ColorControl  = new ColorControl()
            {
                Value = loader.ReadUInt32()
            };
            BlendTarget  = loader.ReadUInt32();
            BlendControl = new BlendControl()
            {
                Value = loader.ReadUInt32()
            };
            BlendColor = loader.ReadVector4F();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderState"/> class.
        /// </summary>
        public RenderState()
        {
            FlagsMode      = RenderStateFlagsMode.Opaque;
            FlagsBlendMode = RenderStateFlagsBlendMode.None;

            PolygonControl = new PolygonControl()
            {
                CullBack                  = false,
                CullFront                 = false,
                FrontFace                 = GX2FrontFaceMode.CounterClockwise,
                PolygonModeBack           = GX2PolygonMode.Triangle,
                PolygonModeFront          = GX2PolygonMode.Triangle,
                PolygonOffsetBackEnabled  = false,
                PolygonOffsetFrontEnabled = false,
                PolygonLineOffsetEnabled  = false,
                PolygonModeEnabled        = true,
            };

            AlphaControl = new AlphaControl()
            {
                AlphaFunc = GX2CompareFunction.GreaterOrEqual,
            };

            DepthControl = new DepthControl()
            {
                BackStencilEnabled = false,
                BackStencilFail    = GX2StencilFunction.Replace,
                BackStencilFunc    = GX2CompareFunction.Always,
                BackStencilZFail   = GX2StencilFunction.Replace,
                BackStencilZPass   = GX2StencilFunction.Replace,
                DepthFunc          = GX2CompareFunction.LessOrEqual,
                DepthTestEnabled   = true,
                DepthWriteEnabled  = true,
                FrontStencilFail   = GX2StencilFunction.Replace,
                FrontStencilFunc   = GX2CompareFunction.Always,
                FrontStencilZFail  = GX2StencilFunction.Replace,
                FrontStencilZPass  = GX2StencilFunction.Replace,
                StencilTestEnabled = false,
            };

            AlphaRefValue = 0.5F;


            BlendControl = new BlendControl()
            {
                AlphaCombine          = GX2BlendCombine.Add,
                AlphaDestinationBlend = GX2BlendFunction.Zero,
                AlphaSourceBlend      = GX2BlendFunction.Zero,
                ColorCombine          = GX2BlendCombine.Add,
                ColorDestinationBlend = GX2BlendFunction.OneMinusSourceAlpha,
                ColorSourceBlend      = GX2BlendFunction.SourceAlpha,
                SeparateAlphaBlend    = true,
            };

            BlendColor = new Vector4F(0, 0, 0, 0);
        }