コード例 #1
0
        private void GenerateKonstColorCommands(Material mat)
        {
            for (int i = 0; i < 4; i++)
            {
                if (mat.KonstColors[i] == null)
                {
                    continue;
                }
                Util.Color color = mat.KonstColors[i].Value;

                BPCommand tev_kolorl = new BPCommand()
                {
                    Register = BPRegister.TEV_REGISTERL_0 + i * 2
                };
                BPCommand tev_kolorh = new BPCommand()
                {
                    Register = BPRegister.TEV_REGISTERH_0 + i * 2
                };

                // Set flags to indicate that this is konst color.
                tev_kolorl.SetFlag(true, 23);
                tev_kolorh.SetFlag(true, 23);

                tev_kolorl.SetBits((byte)(color.R * 255), 0, 11);
                tev_kolorl.SetBits((byte)(color.A * 255), 12, 11);
                tev_kolorh.SetBits((byte)(color.B * 255), 0, 11);
                tev_kolorh.SetBits((byte)(color.G * 255), 12, 11);

                BPCommands.Add(tev_kolorl);
                BPCommands.Add(tev_kolorh);
            }
        }
コード例 #2
0
        private void GenerateAmbientColorChannelCommands(Material mat)
        {
            XFCommand ambientColorChannelCommand = new XFCommand(XFRegister.SETCHAN0_AMBCOLOR);

            for (int i = 0; i < 2; i++)
            {
                if (mat.AmbientColors[i] == null)
                {
                    continue;
                }
                Util.Color color = mat.AmbientColors[i].Value;

                XFCommandArgument ambientColorChanArg = new XFCommandArgument();

                ambientColorChanArg.SetBits((byte)(color.R * 255), 24, 8);
                ambientColorChanArg.SetBits((byte)(color.G * 255), 16, 8);
                ambientColorChanArg.SetBits((byte)(color.B * 255), 8, 8);
                ambientColorChanArg.SetBits((byte)(color.A * 255), 0, 8);

                ambientColorChannelCommand.Args.Add(ambientColorChanArg);
            }

            if (ambientColorChannelCommand.Args.Count > 0)
            {
                XFCommands.Add(ambientColorChannelCommand);
            }
        }
コード例 #3
0
        private void GenerateTevColorCommands(Material mat)
        {
            for (int i = 1; i < 4; i++)
            {
                int colorIndex = i - 1;
                if (mat.TevColors[colorIndex] == null)
                {
                    continue;
                }
                Util.Color color = mat.TevColors[colorIndex].Value;

                BPCommand tev_colorl = new BPCommand()
                {
                    Register = BPRegister.TEV_REGISTERL_0 + i * 2
                };
                BPCommand tev_colorh = new BPCommand()
                {
                    Register = BPRegister.TEV_REGISTERH_0 + i * 2
                };

                tev_colorl.SetBits((short)(color.R * 255), 0, 11);
                tev_colorl.SetBits((short)(color.A * 255), 12, 11);
                tev_colorh.SetBits((short)(color.B * 255), 0, 11);
                tev_colorh.SetBits((short)(color.G * 255), 12, 11);

                BPCommands.Add(tev_colorl);
                BPCommands.Add(tev_colorh);
            }
        }