示例#1
0
            public void Read(FileData d)
            {
                if (hasFlag(flags, OMOFlags.hasPos))
                {
                    if (hasFlag(flags, OMOFlags.PosConst))
                    {
                        posType = OMOFlags.PosConst;
                        pos_min = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                    }

                    if (hasFlag(flags, OMOFlags.PosInter))
                    {
                        posType = OMOFlags.PosInter;
                        pos_min = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                        pos_max = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                    }
                }
                if (hasFlag(flags, OMOFlags.hasRot))
                {
                    if (hasFlag(flags, OMOFlags.RotConst))
                    {
                        rotType = OMOFlags.RotConst;
                        rot_min = calcW(new Vector4(d.readFloat(), d.readFloat(), d.readFloat(), 0));
                    }
                    if (hasFlag(flags, OMOFlags.RotFConst))
                    {
                        rotType = OMOFlags.RotFConst;
                        rot_min = new Vector4(d.readFloat(), d.readFloat(), d.readFloat(), d.readFloat());
                    }
                    if (hasFlag(flags, OMOFlags.RotInter))
                    {
                        rotType = OMOFlags.RotInter;
                        rot_min = new Vector4(d.readFloat(), d.readFloat(), d.readFloat(), 0);
                        rot_max = new Vector4(d.readFloat(), d.readFloat(), d.readFloat(), 0);
                    }
                    if (hasFlag(flags, OMOFlags.RotFrame))
                    {
                        rotType = OMOFlags.RotFrame;
                    }
                }
                if (hasFlag(flags, OMOFlags.hasSca))
                {
                    if (hasFlag(flags, OMOFlags.ScaConst) || hasFlag(flags, OMOFlags.ScaConst2))
                    {
                        scaType = OMOFlags.ScaConst;
                        if (hasFlag(flags, OMOFlags.ScaConst2))
                        {
                            scaType = OMOFlags.ScaConst2;
                        }
                        sca_min = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                    }

                    if (hasFlag(flags, OMOFlags.ScaInter))
                    {
                        scaType = OMOFlags.ScaInter;
                        sca_min = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                        sca_max = new Vector3(d.readFloat(), d.readFloat(), d.readFloat());
                    }
                }
            }
示例#2
0
        public static bool hasFlag(int flag, OMOFlags f)
        {
            if (f == OMOFlags.hasPos || f == OMOFlags.hasRot || f == OMOFlags.hasSca)
            {
                return(((flag & 0xFF000000) & (int)f) == (int)f);
            }

            if (f == OMOFlags.PosConst || f == OMOFlags.PosInter)
            {
                return(((flag & 0x00FF0000) & (int)f) == (int)f);
            }

            if (f == OMOFlags.RotInter || f == OMOFlags.RotFrame ||
                f == OMOFlags.RotFConst || f == OMOFlags.RotConst)
            {
                return(((flag & 0x0000F000)) == (int)f);
            }

            if (f == OMOFlags.ScaConst || f == OMOFlags.ScaConst2)
            {
                return(((flag & 0x00000F00)) == (int)f);
            }

            return((flag & 0x000000F0) == (int)f);
        }