public override bool OnInitialize() { base.OnInitialize(); _numEntries = new int[] { 0, 0 }; _solidColors = new RGBAPixel[2]; _constants = new bool[] { true, true }; _nonSpecLightId = Data->_nonSpecLightId; _part2Offset = Data->_part2Offset; _flags1 = Data->_fixedFlags; _flags2 = Data->_usageFlags; _enableOffset = Data->_visOffset; _distFunc = Data->_distFunc; _spotFunc = Data->_spotFunc; for (int x = 0; x < 10; x++) { SetKeys(x, new KeyframeArray(FrameCount + 1)); } FixedFlags flags = (FixedFlags)_flags1; if (Name == "<null>") { return(false); } if (!flags.HasFlag(FixedFlags.EnabledConstant)) { _entryCount = FrameCount + 1; int numBytes = _entryCount.Align(32) / 8; _data = new byte[numBytes]; Marshal.Copy((IntPtr)Data->visBitEntries, _data, 0, numBytes); } else { _entryCount = 0; _data = new byte[0]; } if (flags.HasFlag(FixedFlags.ColorConstant)) { _solidColors[0] = Data->_lightColor; } else { _constants[0] = false; _numEntries[0] = FrameCount + 1; RGBAPixel *addr = Data->lightColorEntries; for (int x = 0; x <= FrameCount; x++) { _lightColor.Add(*addr++); } } if (SpecularEnabled) { if (flags.HasFlag(FixedFlags.SpecColorConstant)) { _solidColors[1] = Data->_specularColor; } else { _constants[1] = false; _numEntries[1] = FrameCount + 1; RGBAPixel *addr = Data->specColorEntries; for (int x = 0; x <= FrameCount; x++) { _specColor.Add(*addr++); } } } bint *values = (bint *)&Data->_startPoint; int index = 0; for (int i = 0; i < 14; i++) { if (!(i == 3 || i == 7 || i == 10 || i == 12)) { DecodeFrames(GetKeys(index), &values[i], (int)_flags1, (int)_ordered[index++]); } } return(false); }
public override bool OnInitialize() { //Read common header base.OnInitialize(); //Initialize defaults _numEntries = new int[] { 0, 0 }; _solidColors = new RGBAPixel[2]; _constants = new bool[] { true, true }; //Read header values _nonSpecLightId = Data->_nonSpecLightId; _fixedFlags = (FixedFlags)(ushort)Data->_fixedFlags; _typeUsageFlags = (ushort)Data->_usageFlags; _distFunc = Data->_distFunc; _spotFunc = Data->_spotFunc; //Read user data (_userEntries = new UserDataCollection()).Read(Data->UserData); //Don't bother reading data if the entry is null if (Name == "<null>") { return(false); } //Read light visibility array if (!_fixedFlags.HasFlag(FixedFlags.EnabledConstant) && !_replaced) { _entryCount = Scene.FrameCount; int numBytes = _entryCount.Align(32) / 8; _data = new byte[numBytes]; Marshal.Copy((IntPtr)Data->VisBitEntries, _data, 0, numBytes); } else { _entryCount = 0; _data = new byte[0]; } //Read light color ReadColors( (uint)_fixedFlags, (uint)FixedFlags.ColorConstant, ref _solidColors[0], ref _lightColor, Scene.FrameCount, Data->_lightColor.Address, ref _constants[0], ref _numEntries[0]); if (!SpecularEnabled) { _constants[1] = (_fixedFlags & FixedFlags.SpecColorConstant) != 0; return(false); } //Read light specular color ReadColors( (uint)_fixedFlags, (uint)FixedFlags.SpecColorConstant, ref _solidColors[1], ref _specColor, Scene.FrameCount, Data->_specularColor.Address, ref _constants[1], ref _numEntries[1]); return(false); }