Esempio n. 1
0
        public void LoadMaterial(Revolution.Material material, PaneEditor paneEditor)
        {
            ParentEditor   = paneEditor;
            ActiveMaterial = material;

            if (material.TevSwapModeTable != null)
            {
                var swapModes = material.TevSwapModeTable.SwapModes;
                //Note these are always 4 in length for RGBA
                for (int i = 0; i < swapModes?.Length; i++)
                {
                    SwapControls[i].LoadSwapMode(swapModes[i]);
                }
            }
        }
Esempio n. 2
0
        public void LoadMaterial(Revolution.Material material, PaneEditor paneEditor)
        {
            loaded         = false;
            ActiveMaterial = material;
            ParentEditor   = paneEditor;

            chkAlphaDefaults.Checked      = !material.EnableAlphaCompare;
            chkColorBlendDefaults.Checked = !material.EnableBlend;

            SetupDefaults();
            ReloadBlendValues(material);

            alphaValue1UD.Maximum = 255;
            alphaValue2UD.Maximum = 255;
            alphaValue1UD.Minimum = 0;
            alphaValue2UD.Minimum = 0;
            alphaValue1UD.Value   = 255;
            alphaValue2UD.Value   = 255;

            loaded = true;
        }
Esempio n. 3
0
        public static void SetMaterials(BxlytShader shader, Revolution.Material material, BasePane pane, Dictionary <string, STGenericTexture> textures)
        {
            var paneRotate = pane.Rotate;

            if (pane.animController.PaneSRT?.Count > 0)
            {
                foreach (var animItem in pane.animController.PaneSRT)
                {
                    switch (animItem.Key)
                    {
                    case LPATarget.RotateX:
                        paneRotate.X = animItem.Value; break;

                    case LPATarget.RotateY:
                        paneRotate.Y = animItem.Value; break;

                    case LPATarget.RotateZ:
                        paneRotate.Z = animItem.Value; break;
                    }
                }
            }

            Matrix4 rotationX      = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(paneRotate.X));
            Matrix4 rotationY      = Matrix4.CreateRotationY(MathHelper.DegreesToRadians(paneRotate.Y));
            Matrix4 rotationZ      = Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(paneRotate.Z));
            var     rotationMatrix = rotationX * rotationY * rotationZ;

            shader.SetMatrix("rotationMatrix", ref rotationMatrix);

            var WhiteColor = material.WhiteColor;
            var BlackColor = material.BlackColor;

            foreach (var animItem in material.animController.MaterialColors)
            {
                switch (animItem.Key)
                {
                case LMCTarget.WhiteColorRed:
                    WhiteColor.R = (byte)animItem.Value; break;

                case LMCTarget.WhiteColorGreen:
                    WhiteColor.G = (byte)animItem.Value; break;

                case LMCTarget.WhiteColorBlue:
                    WhiteColor.B = (byte)animItem.Value; break;

                case LMCTarget.WhiteColorAlpha:
                    WhiteColor.A = (byte)animItem.Value; break;

                case LMCTarget.BlackColorRed:
                    BlackColor.R = (byte)animItem.Value; break;

                case LMCTarget.BlackColorGreen:
                    BlackColor.G = (byte)animItem.Value; break;

                case LMCTarget.BlackColorBlue:
                    BlackColor.B = (byte)animItem.Value; break;

                case LMCTarget.BlackColorAlpha:
                    BlackColor.A = (byte)animItem.Value; break;
                }
            }

            shader.SetColor("whiteColor", Color.FromArgb(255, WhiteColor.R, WhiteColor.G, WhiteColor.B));
            shader.SetColor("blackColor", BlackColor.Color);
            shader.SetInt("debugShading", (int)Runtime.LayoutEditor.Shading);
            shader.SetInt("numTextureMaps", material.TextureMaps.Length);
            shader.SetVec2("uvScale0", new Vector2(1, 1));
            shader.SetFloat("uvRotate0", 0);
            shader.SetVec2("uvTranslate0", new Vector2(0, 0));
            shader.SetInt("flipTexture", 0);
            shader.SetInt("numTevStages", 0);
            shader.SetBool("AlphaInterpolation", material.AlphaInterpolation);
            shader.SetVec4("IndirectMat0", new Vector4(1, 1, 0, 0));
            shader.SetVec4("IndirectMat1", new Vector4(1, 1, 0, 0));
            shader.SetInt("tevTexMode", 0);
            shader.SetInt($"texCoords0GenType", 0);
            shader.SetInt($"texCoords0Source", 0);
        }