Exemplo n.º 1
0
        public override int OnCalculateSize(bool force)
        {
            match1    = null;
            match2    = null;
            _lightLen = 0;
            _keyLen   = 0;
            _visLen   = 0;
            if (_name != "<null>")
            {
                if (!SetConstant)
                {
                    _visLen += _entryCount.Align(32) / 8;
                }
                if (!_constants[0])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                        {
                            break;
                        }

                        if (!n._constants[0])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(0)[i] != GetColors(0)[i])
                                {
                                    break;
                                }
                                if (i == FrameCount)
                                {
                                    match1 = n;
                                }
                            }
                        }

                        if (match1 != null)
                        {
                            break;
                        }
                    }
                    if (match1 == null)
                    {
                        _lightLen += 4 * (FrameCount + 1);
                    }
                }
                if (!_constants[1])
                {
                    foreach (SCN0LightNode n in Parent.Children)
                    {
                        if (n == this)
                        {
                            break;
                        }

                        if (!n._constants[1])
                        {
                            for (int i = 0; i < FrameCount + 1; i++)
                            {
                                if (n.GetColors(1)[i] != GetColors(1)[i])
                                {
                                    break;
                                }
                                if (i == FrameCount)
                                {
                                    match2 = n;
                                }
                            }
                        }

                        if (match2 != null)
                        {
                            break;
                        }
                    }
                    if (match2 == null)
                    {
                        _lightLen += 4 * (FrameCount + 1);
                    }
                }
                for (int i = 0; i < 10; i++)
                {
                    if (GetKeys(i)._keyCount > 1)
                    {
                        _keyLen += 8 + GetKeys(i)._keyCount * 12;
                    }
                }

                if (UsageFlags.HasFlag(UsageFlags.SpecularEnabled))
                {
                    ((SCN0Node)Parent.Parent)._specLights++;
                }
            }

            return(SCN0Light.Size);
        }
Exemplo n.º 2
0
 public bool GetEnabled(float frame)
 {
     return(!VisibilityEnabled ? false :
            ConstantVisibility?UsageFlags.HasFlag(UsageFlags.Enabled) :
                GetEntry((int)frame));
 }