BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.SCN0LightNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.SCN0LightNode:
BrawlLib.SSBB.ResourceNodes.SCN0EntryNode BrawlLib.SSBB.IBoolArraySource BrawlLib.Imaging.IColorSource BrawlLib.Wii.Animations.IKeyframeSource BrawlLib.SSBB.ResourceNodes.ResourceNode

Public Types

enum  FixedFlags : ushort
 

Public Member Functions

List< RGBAPixelGetColors (int i)
 
void SetColors (int i, List< RGBAPixel > value)
 
void MakeSolid (ARGBPixel color, int id)
 
void MakeList (int id)
 
override bool OnInitialize ()
 
override int OnCalculateSize (bool force)
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
bool HasPrimary (int id)
 
ARGBPixel GetPrimaryColor (int id)
 
void SetPrimaryColor (int id, ARGBPixel color)
 
string PrimaryColorName (int id)
 
int ColorCount (int id)
 
ARGBPixel GetColor (int index, int id)
 
void SetColor (int index, int id, ARGBPixel color)
 
bool GetColorConstant (int id)
 
void SetColorConstant (int id, bool constant)
 
bool GetEntry (int index)
 
void SetEntry (int index, bool value)
 
void MakeConstant (bool value)
 
void MakeAnimated ()
 
GLSLLightFrame GetGLSLAnimFrame (float index)
 
bool GetEnabled (float frame)
 
LightAnimationFrame GetAnimFrame (float index)
 
float GetFrameValue (LightKeyframeMode keyFrameMode, float index)
 
KeyframeEntry GetKeyframe (LightKeyframeMode keyFrameMode, int index)
 
void RemoveKeyframe (LightKeyframeMode keyFrameMode, int index)
 
void SetKeyframe (LightKeyframeMode keyFrameMode, int index, float value)
 
Vector3 GetStart (float frame)
 
Vector3 GetEnd (float frame)
 
Vector3 GetLightSpotCoefs (float frame)
 
Vector3 GetLightDistCoefs (float frame)
 
Vector3 GetSpecDistCoefs (float frame)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
override bool OnInitialize ()
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
IColorSource FindColorMatch (bool constant, int frameCount, int id)
 
int WriteColors (ref int flags, int bit, RGBAPixel solidColor, List< RGBAPixel > colors, bool constant, int frameCount, VoidPtr valueAddr, ref VoidPtr thisMatchAddr, VoidPtr thatMatchAddr, RGBAPixel *dataAddr)
 
void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, int flags, int fixedBit)
 Reads keyframes from an address and sets them in the keyframe array provided. More...
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void OnRenamed ()
 
List< ResourceNodeGetChildrenRecursive ()
 Used primarily to get bone lists. Kept for all resource nodes for utility. More...
 
virtual void SignalPropertyChange ()
 
virtual void Dispose ()
 
void SelectChildAtIndex (int index)
 
void UpdateProperties ()
 
void UpdateCurrentControl ()
 
virtual bool MoveUp ()
 
virtual bool MoveDown ()
 
virtual void OnMoved ()
 
virtual void DoMoveDown ()
 
virtual void DoMoveDown (bool select)
 
virtual void DoMoveUp ()
 
virtual void DoMoveUp (bool select)
 
virtual bool AddUp ()
 
virtual bool AddDown ()
 
virtual bool ToParent ()
 
void Populate (int levels=-1)
 
virtual void OnPopulate ()
 
void Initialize (ResourceNode parent, FileMap source)
 
void Initialize (ResourceNode parent, VoidPtr address, int length)
 
void Initialize (ResourceNode parent, DataSource origSource)
 
virtual void Initialize (ResourceNode parent, DataSource origSource, DataSource uncompSource)
 
virtual bool OnInitialize ()
 
virtual void Restore ()
 
virtual void Remove ()
 
virtual void RemoveChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child)
 
virtual void AddChild (ResourceNode child, bool change)
 
virtual void InsertChild (ResourceNode child, int index)
 
virtual void InsertChild (ResourceNode child, bool change, int index)
 
void SetSizeInternal (int size)
 
virtual void Replace (string fileName)
 
virtual void Replace (ResourceNode node)
 
virtual void Replace (string fileName, FileMapProtect prot, FileOptions options)
 
virtual void ReplaceRaw (VoidPtr address, int length)
 
virtual void ReplaceRaw (FileMap map)
 
virtual void Export (string outPath)
 
void Export (FileStream outStream)
 
virtual void ExportUncompressed (string outPath)
 
void ExportUncompressed (FileStream outStream)
 
virtual void Rebuild ()
 
virtual void Rebuild (bool force)
 
virtual void Rebuild (VoidPtr address, int length, bool force)
 
virtual void OnRebuild (VoidPtr address, int length, bool force)
 
virtual int CalculateSize (bool force)
 
virtual int OnCalculateSize (bool force)
 
void Merge ()
 
void Merge (bool forceBuild)
 
ResourceNode FindChildByType (string path, bool searchChildren, params ResourceType[] types)
 
ResourceNode FindChildByType (string path, bool searchChildren, StringComparison compare, params ResourceType[] types)
 
ResourceNode FindChild (string path)
 
ResourceNode FindChild (string path, bool searchChildren)
 
ResourceNode FindChild (string path, StringComparison compare)
 
ResourceNode FindChild (string path, bool searchChildren, StringComparison compare)
 
ResourceNode[] FindChildrenByClassType (string path, Type type)
 
ResourceNode[] FindChildrenByType (string path, ResourceType type)
 
ResourceNode[] FindChildrenByTypeInGroup (string path, ResourceType type, byte group)
 
ResourceNode[] FindChildrenByName (string name)
 
unsafe string FindName (string name)
 
ResourceNode FindEmbeddedIndex (int index)
 
virtual unsafe byte[] MD5 ()
 Find the MD5 checksum of this node's data. If this node doesn't have any data (BRESGroupNode, for example), this method will return null. More...
 
string MD5Str ()
 Get the result of the MD5() function as a string of hexadecimal digits. If MD5() returns null, this method will return an empty string. More...
 
ResourceNode PrevSibling ()
 
ResourceNode NextSibling ()
 
override string ToString ()
 
virtual void SortChildren ()
 
void SetEntry (int index, bool value)
 
bool GetEntry (int index)
 
void MakeAnimated ()
 
void MakeConstant (bool value)
 
bool HasPrimary (int id)
 
ARGBPixel GetPrimaryColor (int id)
 
void SetPrimaryColor (int id, ARGBPixel color)
 
string PrimaryColorName (int id)
 
int ColorCount (int id)
 
ARGBPixel GetColor (int index, int id)
 
void SetColor (int index, int id, ARGBPixel color)
 
bool GetColorConstant (int id)
 
void SetColorConstant (int id, bool constant)
 

Static Public Member Functions

static Vector3 GetLightSpotCoefs (float cutoff, SpotFn spotFunc)
 
static Vector3 GetSpecShineDistCoefs (float shininess)
 
static Vector3 GetLightDistCoefs (float distance, float brightness, DistAttnFn distFunc)
 
- Static Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
static void DecodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 Reads keyframes at an address, starting with the keyframe array header. More...
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset, ref int flags, int fixedBit)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset)
 
static int EncodeKeyframes (KeyframeArray kf, VoidPtr dataAddr)
 
- Static Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
static ResourceNode[] FindAllSubNodes (ResourceNode root)
 
static ResourceNode FindNode (ResourceNode root, string path, bool searchChildren, StringComparison compare)
 

Public Attributes

int[] _numEntries = new int[] {0, 0}
 
RGBAPixel[] _solidColors = new RGBAPixel[2]
 
bool[] _constants = new bool[] {true, true}
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
int[] _dataLengths = {0, 0, 0}
 
VoidPtr[] _dataAddrs = new VoidPtr[3]
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
Form _mainForm
 
string _name
 
string _origPath
 
ResourceNode _parent
 
List< ResourceNode_children = new List<ResourceNode>()
 
int _calcSize
 
EventHandler UpdateControl
 
MoveEventHandler MovedDown
 
ResourceEventHandler Renamed
 
ResourceEventHandler PropertyChanged
 
ResourceEventHandler Replaced
 
ResourceEventHandler Restored
 
ResourceChildEventHandler ChildRemoved
 
bool _isPopulating
 
bool _replaced
 

Static Public Attributes

static bool _generateTangents = true
 

Properties

override ResourceType ResourceFileType [get]
 
UserDataCollection UserEntries [get, set]
 
int NonSpecularLightID [get]
 
LightType LightType [get, set]
 
bool ColorEnabled [get, set]
 
bool AlphaEnabled [get, set]
 
bool SpecularEnabled [get, set]
 
DistAttnFn DistanceFunction [get, set]
 
SpotFn SpotFunction [get, set]
 
bool ConstantColor [get, set]
 
bool ConstantSpecular [get, set]
 
bool Constant [get, set]
 
bool Enabled [get, set]
 
UsageFlags UsageFlags [get, set]
 
bool ConstantVisibility [get, set]
 
bool VisibilityEnabled [get, set]
 
int FrameCount [get]
 
int TypeCount [get]
 
int EntryCount [get, set]
 
KeyframeArray StartX [get]
 
KeyframeArray StartY [get]
 
KeyframeArray StartZ [get]
 
KeyframeArray EndX [get]
 
KeyframeArray EndY [get]
 
KeyframeArray EndZ [get]
 
KeyframeArray RefDist [get]
 
KeyframeArray RefBright [get]
 
KeyframeArray SpotCut [get]
 
KeyframeArray SpecShininess [get]
 
KeyframeCollection Keyframes [get]
 
KeyframeArray[] KeyArrays [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
override bool AllowNullNames [get]
 
SCN0Node Scene [get]
 
int NodeIndex [get]
 
int RealIndex [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
string FilePath [get]
 
string FileName [get]
 
string DirectoryName [get]
 
ResourceNode RootNode [get]
 
DataSource OriginalSource [get]
 
DataSource UncompressedSource [get]
 
DataSource WorkingSource [get]
 
DataSource WorkingUncompressed [get]
 
virtual bool HasChildren [get]
 
virtual ResourceType ResourceFileType [get]
 
string NodeType [get]
 
virtual string TreePathAbsolute [get]
 
virtual string TreePath [get]
 
virtual int Level [get]
 
virtual int MaxNameLength [get]
 
virtual bool AllowDuplicateNames [get]
 
virtual bool AllowNullNames [get]
 
virtual string Name [get, set]
 
ResourceNode Parent [get, set]
 
List< ResourceNodeChildren [get]
 
int Index [get]
 
int HexIndex [get]
 
bool IsCompressed [get]
 
bool HasChanged [get, set]
 
bool IsBranch [get]
 
bool HasMerged [get]
 
virtual bool AllowSaving [get, set]
 
virtual bool IsDirty [get, set]
 
virtual uint UncompressedSize [get]
 
virtual Type[] AllowedChildTypes [get]
 
virtual string Compression [get, set]
 
virtual bool RetainChildrenOnReplace [get]
 
virtual bool supportsCompression [get]
 
static MD5CryptoServiceProvider MD5Provider [get]
 
- Properties inherited from BrawlLib.SSBB.IBoolArraySource
bool Constant [get, set]
 
bool Enabled [get, set]
 
int EntryCount [get, set]
 
- Properties inherited from BrawlLib.Imaging.IColorSource
int TypeCount [get]
 
- Properties inherited from BrawlLib.Wii.Animations.IKeyframeSource
int FrameCount [get]
 
KeyframeArray[] KeyArrays [get]
 

Additional Inherited Members

- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode
void ReadColors (uint flags, uint bit, ref RGBAPixel solidColor, ref List< RGBAPixel > colors, int frameCount, VoidPtr address, ref bool constant, ref int numEntries)
 
void CalcKeyLen (KeyframeArray keyframes)
 
- Protected Member Functions inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
void ForceReplacedEvent ()
 
virtual void MergeInternal ()
 
- Events inherited from BrawlLib.SSBB.ResourceNodes.ResourceNode
SelectEventHandler SelectChild
 
EventHandler UpdateProps
 
MoveEventHandler MovedUp
 
ResourceEventHandler Disposing
 
ResourceChildEventHandler ChildAdded
 
ResourceChildInsertEventHandler ChildInserted
 

Member Enumeration Documentation

◆ FixedFlags

319 {
320 StartXConstant = 0x8,
321 StartYConstant = 0x10,
322 StartZConstant = 0x20,
323 ColorConstant = 0x40,
324 EnabledConstant = 0x80, //Refer to Enabled in UsageFlags if constant
325 EndXConstant = 0x100,
326 EndYConstant = 0x200,
327 EndZConstant = 0x400,
328 CutoffConstant = 0x800,
329 RefDistanceConstant = 0x1000,
330 RefBrightnessConstant = 0x2000,
331 SpecColorConstant = 0x4000,
332 ShininessConstant = 0x8000
333 }

Member Function Documentation

◆ ColorCount()

int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ColorCount ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

685 {
686 return _numEntries[id] == 0 ? 1 : _numEntries[id];
687 }
int[] _numEntries
Definition: SCN0LightNode.cs:30

◆ GetAnimFrame()

LightAnimationFrame BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetAnimFrame ( float  index)
inline
919 {
921 float* dPtr = (float*) &frame;
922 for (int x = 0; x < Keyframes.ArrayCount; x++)
923 {
925 *dPtr++ = a.GetFrameValue(index);
926 frame.SetBools(x, a.GetKeyframe((int) index) != null);
927 frame.Index = index;
928 }
929
930 frame.Enabled = GetEnabled(index);
931
932 if (ConstantColor)
933 {
934 frame.Color = _solidColors[0];
935 }
936 else if (_lightColor.Count > 0)
937 {
938 int colorIndex = ((int) Math.Truncate(index)).Clamp(0, _lightColor.Count - 1);
939 Vector4 color = _lightColor[colorIndex];
940 if (colorIndex + 1 < _lightColor.Count)
941 {
942 float frac = index - colorIndex;
943 Vector4 interp = _lightColor[colorIndex + 1];
944 color += (interp - color) * frac;
945 }
946
947 frame.Color = color;
948 }
949
950 if (SpecularEnabled)
951 {
953 {
954 frame.SpecularColor = _solidColors[1];
955 }
956 else if (_specColor.Count > 0)
957 {
958 int specIndex = ((int) Math.Truncate(index)).Clamp(0, _specColor.Count - 1);
959 Vector4 specColor = _specColor[specIndex];
960 if (specIndex + 1 < _specColor.Count)
961 {
962 float frac = index - specIndex;
963 Vector4 interp = _specColor[specIndex + 1];
964 specColor += (interp - specColor) * frac;
965 }
966
967 frame.SpecularColor = specColor;
968 }
969 }
970
971 return frame;
972 }
KeyframeCollection Keyframes
Definition: SCN0LightNode.cs:1162
bool SpecularEnabled
Definition: SCN0LightNode.cs:136
bool ConstantSpecular
Definition: SCN0LightNode.cs:200
bool ConstantColor
Definition: SCN0LightNode.cs:177
RGBAPixel[] _solidColors
Definition: SCN0LightNode.cs:31
bool GetEnabled(float frame)
Definition: SCN0LightNode.cs:911
Definition: KeyframeCollection.cs:380
float GetFrameValue(float index, bool returnOutValue=false)
Definition: KeyframeCollection.cs:491
KeyframeEntry GetKeyframe(int index)
Definition: KeyframeCollection.cs:475
int ArrayCount
Definition: KeyframeCollection.cs:179
Definition: Vector4.cs:12
Definition: AnimationFrame.cs:450
void SetBools(int index, bool val)
Definition: AnimationFrame.cs:480

◆ GetColor()

ARGBPixel BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetColor ( int  index,
int  id 
)
inline

Implements BrawlLib.Imaging.IColorSource.

690 {
691 return _numEntries[id] == 0 ? (ARGBPixel) _solidColors[id] : (ARGBPixel) GetColors(id)[index];
692 }
List< RGBAPixel > GetColors(int i)
Definition: SCN0LightNode.cs:339
Definition: PixelTypes.cs:16

◆ GetColorConstant()

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetColorConstant ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

709 {
710 switch (id)
711 {
712 case 0: return ConstantColor;
713 case 1: return ConstantSpecular;
714 }
715
716 return false;
717 }

◆ GetColors()

List< RGBAPixel > BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetColors ( int  i)
inline
340 {
341 switch (i)
342 {
343 case 0: return _lightColor;
344 case 1: return _specColor;
345 }
346
347 return null;
348 }

◆ GetEnabled()

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetEnabled ( float  frame)
inline
912 {
913 return !VisibilityEnabled ? false :
914 ConstantVisibility ? UsageFlags.HasFlag(UsageFlags.Enabled) :
915 GetEntry((int) frame);
916 }
bool VisibilityEnabled
Definition: SCN0LightNode.cs:288
bool ConstantVisibility
Definition: SCN0LightNode.cs:271
bool GetEntry(int index)
Definition: SCN0LightNode.cs:761
UsageFlags
Definition: SCN0.cs:349

◆ GetEnd()

Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetEnd ( float  frame)
inline
1025 {
1026 return new Vector3(
1027 EndX.GetFrameValue(frame),
1028 EndY.GetFrameValue(frame),
1029 EndZ.GetFrameValue(frame));
1030 }
KeyframeArray EndX
Definition: SCN0LightNode.cs:1150
KeyframeArray EndZ
Definition: SCN0LightNode.cs:1152
KeyframeArray EndY
Definition: SCN0LightNode.cs:1151
Definition: Vector3.cs:40

◆ GetEntry()

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetEntry ( int  index)
inline

Implements BrawlLib.SSBB.IBoolArraySource.

762 {
763 if (_data.Length == 0)
764 {
765 return Enabled;
766 }
767
768 int i = index >> 3;
769 int bit = 1 << (7 - (index & 0x7));
770 return (_data[i] & bit) != 0;
771 }
bool Enabled
Definition: SCN0LightNode.cs:245

◆ GetFrameValue()

float BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetFrameValue ( LightKeyframeMode  keyFrameMode,
float  index 
)
inline
975 {
976 return Keyframes[(int) keyFrameMode].GetFrameValue(index);
977 }
float GetFrameValue(LightKeyframeMode keyFrameMode, float index)
Definition: SCN0LightNode.cs:974

◆ GetGLSLAnimFrame()

GLSLLightFrame BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetGLSLAnimFrame ( float  index)
inline
819 {
820 bool enabled = GetEnabled(index);
821
822 //No point calculating anything if the light isn't used
823 if (!enabled)
824 {
825 return new GLSLLightFrame();
826 }
827
828 Vector4 color = new Vector4(0.0f),
829 specColor = new Vector4(0.0f);
830 Vector3
831 pos = GetStart(index),
832 aim = GetEnd(index),
833 diffAttnK = LightType != LightType.Directional
834 ? GetLightDistCoefs(index)
835 : new Vector3(1.0f, 0.0f, 0.0f),
836 diffAttnA = LightType == LightType.Spotlight ? GetLightSpotCoefs(index) : new Vector3(1.0f, 0.0f, 0.0f),
837 specAttnK = SpecularEnabled ? GetSpecDistCoefs(index) : new Vector3(1.0f, 0.0f, 0.0f);
838
839 //No point calculating colors if neither color nor alpha is used
841 {
842 if (ConstantColor)
843 {
844 color = _solidColors[0];
845 }
846 else
847 {
848 //Interpolate the color, in case the index isn't an integer
849
850 int colorIndex = (int) Math.Truncate(index);
851 color = _lightColor[colorIndex.Clamp(0, _lightColor.Count - 1)];
852 if (colorIndex + 1 < _lightColor.Count)
853 {
854 float frac = index - colorIndex;
855 Vector4 interp = _lightColor[colorIndex + 1];
856 color += (interp - color) * frac;
857 }
858 }
859
860 if (SpecularEnabled)
861 {
863 {
864 specColor = _solidColors[1];
865 }
866 else
867 {
868 //Interpolate the color, in case the index isn't an integer
869
870 int specIndex = (int) Math.Truncate(index);
871 specColor = _specColor[specIndex.Clamp(0, _specColor.Count - 1)];
872 if (specIndex + 1 < _specColor.Count)
873 {
874 float frac = index - specIndex;
875 Vector4 interp = _specColor[specIndex + 1];
876 specColor += (interp - specColor) * frac;
877 }
878 }
879 }
880
881 if (!ColorEnabled)
882 {
883 color._x = 0.0f;
884 color._y = 0.0f;
885 color._z = 0.0f;
886 specColor._x = 0.0f;
887 specColor._y = 0.0f;
888 specColor._z = 0.0f;
889 }
890
891 if (!AlphaEnabled)
892 {
893 color._w = 0.0f;
894 specColor._w = 0.0f;
895 }
896 }
897
898 return new GLSLLightFrame(
899 enabled,
900 LightType,
901 pos,
902 aim,
903 color,
904 diffAttnK,
905 diffAttnA,
907 specColor,
908 specAttnK);
909 }
bool ColorEnabled
Definition: SCN0LightNode.cs:98
Vector3 GetEnd(float frame)
Definition: SCN0LightNode.cs:1024
Vector3 GetSpecDistCoefs(float frame)
Definition: SCN0LightNode.cs:1098
Vector3 GetLightDistCoefs(float frame)
Definition: SCN0LightNode.cs:1093
Vector3 GetStart(float frame)
Definition: SCN0LightNode.cs:1016
Vector3 GetLightSpotCoefs(float frame)
Definition: SCN0LightNode.cs:1032
bool AlphaEnabled
Definition: SCN0LightNode.cs:117
LightType
Definition: SCN0.cs:358
Definition: AnimationFrame.cs:385

◆ GetKeyframe()

KeyframeEntry BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetKeyframe ( LightKeyframeMode  keyFrameMode,
int  index 
)
inline
980 {
981 return Keyframes[(int) keyFrameMode].GetKeyframe(index);
982 }
KeyframeEntry GetKeyframe(LightKeyframeMode keyFrameMode, int index)
Definition: SCN0LightNode.cs:979

◆ GetLightDistCoefs() [1/2]

static Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetLightDistCoefs ( float  distance,
float  brightness,
DistAttnFn  distFunc 
)
inlinestatic
1109 {
1110 //constant attn, linear attn, quadratic attn
1111 //k2x^2 + k1x + k0
1112 float k0, k1, k2;
1113
1114 if (distance < 0.0F || brightness <= 0.0F || brightness >= 1.0F)
1115 {
1116 distFunc = DistAttnFn.Off;
1117 }
1118
1119 switch (distFunc)
1120 {
1121 case DistAttnFn.Gentle:
1122 k0 = 1.0f;
1123 k1 = (1.0f - brightness) / (brightness * distance);
1124 k2 = 0.0f;
1125 break;
1126 case DistAttnFn.Medium:
1127 k0 = 1.0f;
1128 k1 = 0.5f * (1.0f - brightness) / (brightness * distance);
1129 k2 = 0.5f * (1.0f - brightness) / (brightness * distance * distance);
1130 break;
1131 case DistAttnFn.Steep:
1132 k0 = 1.0f;
1133 k1 = 0.0f;
1134 k2 = (1.0f - brightness) / (brightness * distance * distance);
1135 break;
1136 case DistAttnFn.Off:
1137 default:
1138 k0 = 1.0f;
1139 k1 = 0.0f;
1140 k2 = 0.0f;
1141 break;
1142 }
1143
1144 return new Vector3(k0, k1, k2);
1145 }
DistAttnFn
Definition: Enum.cs:602

◆ GetLightDistCoefs() [2/2]

Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetLightDistCoefs ( float  frame)
inline
1094 {
1096 }
KeyframeArray RefDist
Definition: SCN0LightNode.cs:1153
DistAttnFn DistanceFunction
Definition: SCN0LightNode.cs:155
KeyframeArray RefBright
Definition: SCN0LightNode.cs:1154

◆ GetLightSpotCoefs() [1/2]

static Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetLightSpotCoefs ( float  cutoff,
SpotFn  spotFunc 
)
inlinestatic
1038 {
1039 //a2x^2 + a1x + a0
1040 float a0, a1, a2, d, cr = (float) Math.Cos(cutoff * Maths._deg2radf);
1041
1042 if (cutoff <= 0.0f || cutoff > 90.0f)
1043 {
1044 spotFunc = SpotFn.Off;
1045 }
1046
1047 switch (spotFunc)
1048 {
1049 case SpotFn.Flat:
1050 a0 = -1000.0f * cr;
1051 a1 = 1000.0f;
1052 a2 = 0.0f;
1053 break;
1054 case SpotFn.Cos:
1055 a0 = -cr / (1.0f - cr);
1056 a1 = 1.0f / (1.0f - cr);
1057 a2 = 0.0f;
1058 break;
1059 case SpotFn.Cos2:
1060 a0 = 0.0f;
1061 a1 = -cr / (1.0f - cr);
1062 a2 = 1.0f / (1.0f - cr);
1063 break;
1064 case SpotFn.Sharp:
1065 d = (1.0f - cr) * (1.0f - cr);
1066 a0 = cr * (cr - 2.0f) / d;
1067 a1 = 2.0f / d;
1068 a2 = -1.0f / d;
1069 break;
1070 case SpotFn.Ring:
1071 d = (1.0f - cr) * (1.0f - cr);
1072 a0 = -4.0f * cr / d;
1073 a1 = 4.0f * (1.0f + cr) / d;
1074 a2 = -4.0f / d;
1075 break;
1076 case SpotFn.Ring2:
1077 d = (1.0f - cr) * (1.0f - cr);
1078 a0 = 1.0f - 2.0f * cr * cr / d;
1079 a1 = 4.0f * cr / d;
1080 a2 = -2.0f / d;
1081 break;
1082 case SpotFn.Off:
1083 default:
1084 a0 = 1.0f;
1085 a1 = 0.0f;
1086 a2 = 0.0f;
1087 break;
1088 }
1089
1090 return new Vector3(a0, a1, a2);
1091 }
SpotFn
Definition: Enum.cs:591

◆ GetLightSpotCoefs() [2/2]

Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetLightSpotCoefs ( float  frame)
inline
1033 {
1035 }
KeyframeArray SpotCut
Definition: SCN0LightNode.cs:1155
SpotFn SpotFunction
Definition: SCN0LightNode.cs:166

◆ GetPrimaryColor()

ARGBPixel BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetPrimaryColor ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

667 {
668 return new ARGBPixel();
669 }

◆ GetSpecDistCoefs()

Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetSpecDistCoefs ( float  frame)
inline
1099 {
1101 }
static Vector3 GetSpecShineDistCoefs(float shininess)
Definition: SCN0LightNode.cs:1103
KeyframeArray SpecShininess
Definition: SCN0LightNode.cs:1156

◆ GetSpecShineDistCoefs()

static Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetSpecShineDistCoefs ( float  shininess)
inlinestatic
1104 {
1105 return new Vector3(shininess / 2.0f, 0.0f, 1.0f - shininess / 2.0f);
1106 }

◆ GetStart()

Vector3 BrawlLib.SSBB.ResourceNodes.SCN0LightNode.GetStart ( float  frame)
inline
1017 {
1018 return new Vector3(
1019 StartX.GetFrameValue(frame),
1020 StartY.GetFrameValue(frame),
1021 StartZ.GetFrameValue(frame));
1022 }
KeyframeArray StartY
Definition: SCN0LightNode.cs:1148
KeyframeArray StartX
Definition: SCN0LightNode.cs:1147
KeyframeArray StartZ
Definition: SCN0LightNode.cs:1149

◆ HasPrimary()

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.HasPrimary ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

662 {
663 return false;
664 }

◆ MakeAnimated()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.MakeAnimated ( )
inline

Implements BrawlLib.SSBB.IBoolArraySource.

792 {
793 bool enabled = VisibilityEnabled;
794
795 ConstantVisibility = false;
796 VisibilityEnabled = false;
797
798 _entryCount = -1;
800
801 if (enabled)
802 {
803 for (int i = 0; i < _entryCount; i++)
804 {
805 SetEntry(i, true);
806 }
807 }
808
810 }
virtual void SignalPropertyChange()
Definition: ResourceNode.cs:313
void SetEntry(int index, bool value)
Definition: SCN0LightNode.cs:773
int FrameCount
Definition: SCN0LightNode.cs:405
int EntryCount
Definition: SCN0LightNode.cs:738

◆ MakeConstant()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.MakeConstant ( bool  value)
inline

Implements BrawlLib.SSBB.IBoolArraySource.

783 {
784 ConstantVisibility = true;
785 VisibilityEnabled = value;
786 _entryCount = 0;
787
789 }

◆ MakeList()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.MakeList ( int  id)
inline
372 {
373 _constants[id] = false;
374 int entries = Scene.FrameCount;
375 _numEntries[id] = GetColors(id).Count;
376 SetNumEntries(id, entries);
377 }
SCN0Node Scene
Definition: SCN0GroupNode.cs:242
bool[] _constants
Definition: SCN0LightNode.cs:37
override int FrameCount
Definition: SCN0Node.cs:72

◆ MakeSolid()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.MakeSolid ( ARGBPixel  color,
int  id 
)
inline
364 {
365 _numEntries[id] = 0;
366 _constants[id] = true;
367 _solidColors[id] = color;
369 }

◆ OnCalculateSize()

override int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.OnCalculateSize ( bool  force)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

507 {
508 _matches[0] = null;
509 _matches[1] = null;
510
511 for (int i = 0; i < 3; i++)
512 {
513 _dataLengths[i] = 0;
514 }
515
516 if (_name == "<null>")
517 {
518 return SCN0Light.Size;
519 }
520
521 for (int i = 0; i < Keyframes.ArrayCount; i++)
522 {
524 }
525
526 for (int i = 0; i < 2; i++)
527 {
528 if (i == 1 && !SpecularEnabled)
529 {
530 break;
531 }
532
533 _matches[i] = FindColorMatch(_constants[i], Scene.FrameCount, i) as SCN0LightNode;
534 if (_matches[i] == null && !_constants[i])
535 {
536 _dataLengths[1] += 4 * (FrameCount + 1);
537 }
538 }
539
541 {
542 _dataLengths[2] += _entryCount.Align(32) / 8;
543 }
544
545 //If this light uses specular lighting,
546 //increment SCN0 specular light count
547 if (SpecularEnabled && Scene != null)
548 {
550 }
551
552 return SCN0Light.Size;
553 }
string _name
Definition: ResourceNode.cs:139
int[] _dataLengths
Definition: SCN0GroupNode.cs:256
void CalcKeyLen(KeyframeArray keyframes)
Definition: SCN0GroupNode.cs:423
IColorSource FindColorMatch(bool constant, int frameCount, int id)
Definition: SCN0GroupNode.cs:314
int _specLights
Definition: SCN0Node.cs:31
Definition: SCN0.cs:367
const int Size
Definition: SCN0.cs:368

◆ OnInitialize()

override bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.OnInitialize ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.

433 {
434 //Read common header
435 base.OnInitialize();
436
437 //Initialize defaults
438 _numEntries = new int[] {0, 0};
439 _solidColors = new RGBAPixel[2];
440 _constants = new bool[] {true, true};
441
442 //Read header values
443 _nonSpecLightId = Data->_nonSpecLightId;
444 _fixedFlags = (FixedFlags) (ushort) Data->_fixedFlags;
445 _typeUsageFlags = (ushort) Data->_usageFlags;
446 _distFunc = Data->_distFunc;
447 _spotFunc = Data->_spotFunc;
448
449 //Read user data
450 (_userEntries = new UserDataCollection()).Read(Data->UserData, WorkingUncompressed);
451
452 //Don't bother reading data if the entry is null
453 if (Name == "<null>")
454 {
455 return false;
456 }
457
458 //Read light visibility array
459 if (!_fixedFlags.HasFlag(FixedFlags.EnabledConstant) && !_replaced)
460 {
461 _entryCount = Scene.FrameCount;
462 int numBytes = _entryCount.Align(32) / 8;
463
464 _data = new byte[numBytes];
465 Marshal.Copy((IntPtr) Data->VisBitEntries, _data, 0, numBytes);
466 }
467 else
468 {
469 _entryCount = 0;
470 _data = new byte[0];
471 }
472
473 //Read light color
475 (uint) _fixedFlags,
476 (uint) FixedFlags.ColorConstant,
477 ref _solidColors[0],
478 ref _lightColor,
480 Data->_lightColor.Address,
481 ref _constants[0],
482 ref _numEntries[0]);
483
484 if (!SpecularEnabled)
485 {
486 _constants[1] = (_fixedFlags & FixedFlags.SpecColorConstant) != 0;
487 return false;
488 }
489
490 //Read light specular color
492 (uint) _fixedFlags,
493 (uint) FixedFlags.SpecColorConstant,
494 ref _solidColors[1],
495 ref _specColor,
498 ref _constants[1],
499 ref _numEntries[1]);
500
501 return false;
502 }
bool _replaced
Definition: ResourceNode.cs:827
virtual string Name
Definition: ResourceNode.cs:223
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
void ReadColors(uint flags, uint bit, ref RGBAPixel solidColor, ref List< RGBAPixel > colors, int frameCount, VoidPtr address, ref bool constant, ref int numEntries)
Definition: SCN0GroupNode.cs:396
FixedFlags
Definition: SCN0LightNode.cs:319
Definition: PixelTypes.cs:327
VoidPtr Address
Definition: PixelTypes.cs:538
bint _spotFunc
Definition: SCN0.cs:389
bint _distFunc
Definition: SCN0.cs:384
VoidPtr UserData
Definition: SCN0.cs:414
RGBAPixel _lightColor
Definition: SCN0.cs:380
bint _nonSpecLightId
Definition: SCN0.cs:372
bushort _usageFlags
Definition: SCN0.cs:376
RGBAPixel _specularColor
Definition: SCN0.cs:393
bushort _fixedFlags
Definition: SCN0.cs:375
byte * VisBitEntries
Definition: SCN0.cs:407

◆ OnRebuild()

override void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.OnRebuild ( VoidPtr  address,
int  length,
bool  force 
)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.SCN0EntryNode.

558 {
559 //Build common header
560 base.OnRebuild(address, length, force);
561
562 //Reset addresses
563 _lightAddress = null;
564 _specularAddress = null;
565
566 //Don't write anything if this node is null
567 if (_name == "<null>")
568 {
569 return;
570 }
571
572 //Write header information
573 SCN0Light* header = (SCN0Light*) address;
575 header->_userDataOffset = 0;
576 header->_distFunc = _distFunc;
577 header->_spotFunc = _spotFunc;
578
579 int newFlags = 0;
580
581 //Encode keyframe data
582 for (int i = 0, index = 0; i < 14; i++)
583 {
584 if (!(i == 3 || i == 7 || i == 10 || i == 12))
585 {
587 Keyframes[index],
588 _dataAddrs[0],
589 header->_startPoint._x.Address + i * 4,
590 ref newFlags,
591 (int) _ordered[index++]);
592 }
593 }
594
596 ref newFlags,
597 (int) FixedFlags.ColorConstant,
598 _solidColors[0],
599 _lightColor,
600 _constants[0],
602 header->_lightColor.Address,
603 ref _lightAddress,
604 _matches[0] == null ? null : _matches[0]._lightAddress,
605 (RGBAPixel*) _dataAddrs[1]);
606
607 //Only bother writing if specular is enabled
608 if (SpecularEnabled)
609 {
611 ref newFlags,
612 (int) FixedFlags.SpecColorConstant,
613 _solidColors[1],
614 _specColor,
615 _constants[1],
617 header->_specularColor.Address,
618 ref _specularAddress,
619 _matches[1] == null ? null : _matches[1]._specularAddress,
620 (RGBAPixel*) _dataAddrs[1]);
621 }
622 else
623 {
624 //The value is set to 0
625 header->_specularColor = new RGBAPixel();
626
627 //The flag, while unused, seems to be set to the same state as the color constant flag
628 if (_constants[0])
629 {
630 newFlags |= (int) FixedFlags.SpecColorConstant;
631 }
632 else
633 {
634 newFlags &= (int) ~FixedFlags.SpecColorConstant;
635 }
636 }
637
638 if (!ConstantVisibility && _entryCount != 0)
639 {
640 header->_visOffset = (int) _dataAddrs[2] - (int) header->_visOffset.Address;
641 Marshal.Copy(_data, 0, _dataAddrs[2], _data.Length);
642 _dataAddrs[2] = _dataAddrs[2] + EntryCount.Align(32) / 8;
643 }
644 else
645 {
646 newFlags |= (int) FixedFlags.EnabledConstant;
647 }
648
649 //Set newly calculated flags
650 header->_fixedFlags = (ushort) (_fixedFlags = (FixedFlags) newFlags);
651 header->_usageFlags = _typeUsageFlags._data;
652 }
int WriteColors(ref int flags, int bit, RGBAPixel solidColor, List< RGBAPixel > colors, bool constant, int frameCount, VoidPtr valueAddr, ref VoidPtr thisMatchAddr, VoidPtr thatMatchAddr, RGBAPixel *dataAddr)
Definition: SCN0GroupNode.cs:353
static int EncodeKeyframes(KeyframeArray kf, VoidPtr dataAddr, VoidPtr offset, ref int flags, int fixedBit)
Definition: SCN0GroupNode.cs:465
VoidPtr[] _dataAddrs
Definition: SCN0GroupNode.cs:257
int NonSpecularLightID
Definition: SCN0LightNode.cs:59
bfloat _x
Definition: BigEndianTypes.cs:367
bushort _data
Definition: BinaryHandlers.cs:237
VoidPtr Address
Definition: BigEndianTypes.cs:128
VoidPtr Address
Definition: BigEndianTypes.cs:33
bint _userDataOffset
Definition: SCN0.cs:373
BVec3 _startPoint
Definition: SCN0.cs:379
bint _visOffset
Definition: SCN0.cs:378

◆ PrimaryColorName()

string BrawlLib.SSBB.ResourceNodes.SCN0LightNode.PrimaryColorName ( int  id)
inline

Implements BrawlLib.Imaging.IColorSource.

677 {
678 return null;
679 }

◆ RemoveKeyframe()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.RemoveKeyframe ( LightKeyframeMode  keyFrameMode,
int  index 
)
inline
985 {
986 KeyframeEntry k = Keyframes[(int) keyFrameMode].Remove(index);
987 if (k != null && _generateTangents)
988 {
992 }
993 }
virtual void Remove()
Definition: ResourceNode.cs:741
static bool _generateTangents
Definition: SCN0LightNode.cs:816
Definition: KeyframeCollection.cs:193
KeyframeEntry _prev
Definition: KeyframeCollection.cs:195
float GenerateTangent()
Definition: KeyframeCollection.cs:322
KeyframeEntry _next
Definition: KeyframeCollection.cs:195

◆ SetColor()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetColor ( int  index,
int  id,
ARGBPixel  color 
)
inline

Implements BrawlLib.Imaging.IColorSource.

695 {
696 if (_numEntries[id] == 0)
697 {
698 _solidColors[id] = color;
699 }
700 else
701 {
702 GetColors(id)[index] = color;
703 }
704
706 }

◆ SetColorConstant()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetColorConstant ( int  id,
bool  constant 
)
inline

Implements BrawlLib.Imaging.IColorSource.

720 {
721 switch (id)
722 {
723 case 0:
724 ConstantColor = constant;
725 break;
726 case 1:
727 ConstantSpecular = constant;
728 break;
729 }
730 }

◆ SetColors()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetColors ( int  i,
List< RGBAPixel value 
)
inline
351 {
352 switch (i)
353 {
354 case 0:
355 _lightColor = value;
356 break;
357 case 1:
358 _specColor = value;
359 break;
360 }
361 }

◆ SetEntry()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetEntry ( int  index,
bool  value 
)
inline

Implements BrawlLib.SSBB.IBoolArraySource.

774 {
775 int i = index >> 3;
776 int bit = 1 << (7 - (index & 0x7));
777 int mask = ~bit;
778 _data[i] = (byte) ((_data[i] & mask) | (value ? bit : 0));
780 }

◆ SetKeyframe()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetKeyframe ( LightKeyframeMode  keyFrameMode,
int  index,
float  value 
)
inline
996 {
997 KeyframeArray keys = Keyframes[(int) keyFrameMode];
998 bool exists = keys.GetKeyframe(index) != null;
999 KeyframeEntry k = keys.SetFrameValue(index, value);
1000
1001 if (!exists && !_generateTangents)
1002 {
1003 k.GenerateTangent();
1004 }
1005
1007 {
1008 k.GenerateTangent();
1011 }
1012
1014 }
KeyframeEntry SetFrameValue(int index, float value, bool parsing=false)
Definition: KeyframeCollection.cs:556

◆ SetPrimaryColor()

void BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SetPrimaryColor ( int  id,
ARGBPixel  color 
)
inline

Implements BrawlLib.Imaging.IColorSource.

672 {
673 }

Member Data Documentation

◆ _constants

bool [] BrawlLib.SSBB.ResourceNodes.SCN0LightNode._constants = new bool[] {true, true}

◆ _generateTangents

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode._generateTangents = true
static

◆ _numEntries

int [] BrawlLib.SSBB.ResourceNodes.SCN0LightNode._numEntries = new int[] {0, 0}

◆ _solidColors

RGBAPixel [] BrawlLib.SSBB.ResourceNodes.SCN0LightNode._solidColors = new RGBAPixel[2]

Property Documentation

◆ AlphaEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.AlphaEnabled
getset
117 {
118 get => UsageFlags.HasFlag(UsageFlags.AlphaEnabled);
119 set
120 {
121 if (value)
122 {
123 UsageFlags |= UsageFlags.AlphaEnabled;
124 }
125 else
126 {
127 UsageFlags &= ~UsageFlags.AlphaEnabled;
128 }
129
131 }
132 }

◆ ColorEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ColorEnabled
getset
98 {
99 get => UsageFlags.HasFlag(UsageFlags.ColorEnabled);
100 set
101 {
102 if (value)
103 {
104 UsageFlags |= UsageFlags.ColorEnabled;
105 }
106 else
107 {
108 UsageFlags &= ~UsageFlags.ColorEnabled;
109 }
110
112 }
113 }

◆ Constant

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.Constant
getset

Implements BrawlLib.SSBB.IBoolArraySource.

223 {
224 get => ConstantVisibility;
225 set
226 {
227 if (value != ConstantVisibility)
228 {
229 if (value)
230 {
231 MakeConstant(true);
232 }
233 else
234 {
235 MakeAnimated();
236 }
237
239 }
240 }
241 }
void UpdateCurrentControl()
Definition: ResourceNode.cs:482
void MakeAnimated()
Definition: SCN0LightNode.cs:791
void MakeConstant(bool value)
Definition: SCN0LightNode.cs:782

◆ ConstantColor

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ConstantColor
getset
177 {
178 get => _constants[0];
179 set
180 {
181 if (_constants[0] != value)
182 {
183 _constants[0] = value;
184 if (_constants[0])
185 {
186 MakeSolid(new ARGBPixel(), 0);
187 }
188 else
189 {
190 MakeList(0);
191 }
192
194 }
195 }
196 }
void MakeList(int id)
Definition: SCN0LightNode.cs:371
void MakeSolid(ARGBPixel color, int id)
Definition: SCN0LightNode.cs:363

◆ ConstantSpecular

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ConstantSpecular
getset
200 {
201 get => _constants[1];
202 set
203 {
204 if (_constants[1] != value)
205 {
206 _constants[1] = value;
207 if (_constants[1])
208 {
209 MakeSolid(new ARGBPixel(), 1);
210 }
211 else
212 {
213 MakeList(1);
214 }
215
217 }
218 }
219 }

◆ ConstantVisibility

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ConstantVisibility
getset
271 {
272 get => _fixedFlags.HasFlag(FixedFlags.EnabledConstant);
273 set
274 {
275 if (value)
276 {
277 _fixedFlags |= FixedFlags.EnabledConstant;
278 }
279 else
280 {
281 _fixedFlags &= ~FixedFlags.EnabledConstant;
282 }
283 }
284 }

◆ DistanceFunction

DistAttnFn BrawlLib.SSBB.ResourceNodes.SCN0LightNode.DistanceFunction
getset
155 {
156 get => (DistAttnFn) _distFunc;
157 set
158 {
159 _distFunc = (int) value;
161 }
162 }

◆ Enabled

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.Enabled
getset

Implements BrawlLib.SSBB.IBoolArraySource.

245 {
246 get => VisibilityEnabled;
247 set
248 {
249 VisibilityEnabled = value;
251 }
252 }

◆ EndX

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.EndX
get

◆ EndY

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.EndY
get

◆ EndZ

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.EndZ
get

◆ EntryCount

int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.EntryCount
getset

Implements BrawlLib.SSBB.IBoolArraySource.

738 {
739 get => _entryCount;
740 set
741 {
742 if (_entryCount == 0)
743 {
744 return;
745 }
746
747 _entryCount = value;
748 int len = value.Align(32) / 8;
749
750 if (_data.Length < len)
751 {
752 byte[] newArr = new byte[len];
753 Array.Copy(_data, newArr, _data.Length);
754 _data = newArr;
755 }
756
758 }
759 }

◆ FrameCount

int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.FrameCount
get

◆ KeyArrays

KeyframeArray [] BrawlLib.SSBB.ResourceNodes.SCN0LightNode.KeyArrays
get

◆ Keyframes

KeyframeCollection BrawlLib.SSBB.ResourceNodes.SCN0LightNode.Keyframes
get
1162 {
1163 get
1164 {
1165 if (_keyframes == null)
1166 {
1167 _keyframes =
1168 new KeyframeCollection(10, Scene == null ? 1 : Scene.FrameCount + (Scene.Loop ? 1 : 0));
1169 if (Data != null && _name != "<null>")
1170 {
1171 for (int i = 0, index = 0; i < 14; i++)
1172 {
1173 if (!(i == 3 || i == 7 || i == 10 || i == 12))
1174 {
1176 Keyframes[index],
1177 Data->_startPoint._x.Address + i * 4,
1178 (int) _fixedFlags,
1179 (int) _ordered[index++]);
1180 }
1181 }
1182 }
1183 }
1184
1185 return _keyframes;
1186 }
1187 }
void DecodeKeyframes(KeyframeArray kf, VoidPtr dataAddr, int flags, int fixedBit)
Reads keyframes from an address and sets them in the keyframe array provided.
Definition: SCN0GroupNode.cs:438
override bool Loop
Definition: SCN0Node.cs:79
Definition: KeyframeCollection.cs:17

◆ LightType

LightType BrawlLib.SSBB.ResourceNodes.SCN0LightNode.LightType
getset
87 {
88 get => (LightType) _typeUsageFlags[0, 2];
89 set
90 {
91 _typeUsageFlags[0, 2] = (ushort) value;
93 }
94 }
LightType LightType
Definition: SCN0LightNode.cs:87

◆ NonSpecularLightID

int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.NonSpecularLightID
get
59 {
60 get
61 {
62 if (!SpecularEnabled)
63 {
64 return 0;
65 }
66
67 int i = 0;
68 foreach (SCN0LightNode n in Parent.Children)
69 {
70 if (n.Index == Index)
71 {
72 return Parent.Children.Count + i;
73 }
74
75 if (n.SpecularEnabled && n.Index != Index)
76 {
77 i++;
78 }
79 }
80
81 return 0;
82 }
83 }
ResourceNode Parent
Definition: ResourceNode.cs:245
int Index
Definition: ResourceNode.cs:301
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ RefBright

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.RefBright
get

◆ RefDist

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.RefDist
get

◆ ResourceFileType

override ResourceType BrawlLib.SSBB.ResourceNodes.SCN0LightNode.ResourceFileType
get

◆ SpecShininess

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SpecShininess
get

◆ SpecularEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SpecularEnabled
getset
136 {
137 get => UsageFlags.HasFlag(UsageFlags.SpecularEnabled);
138 set
139 {
140 if (value)
141 {
142 UsageFlags |= UsageFlags.SpecularEnabled;
143 }
144 else
145 {
146 UsageFlags &= ~UsageFlags.SpecularEnabled;
147 }
148
150 }
151 }

◆ SpotCut

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SpotCut
get

◆ SpotFunction

SpotFn BrawlLib.SSBB.ResourceNodes.SCN0LightNode.SpotFunction
getset
166 {
167 get => (SpotFn) _spotFunc;
168 set
169 {
170 _spotFunc = (int) value;
172 }
173 }

◆ StartX

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.StartX
get

◆ StartY

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.StartY
get

◆ StartZ

KeyframeArray BrawlLib.SSBB.ResourceNodes.SCN0LightNode.StartZ
get

◆ TypeCount

int BrawlLib.SSBB.ResourceNodes.SCN0LightNode.TypeCount
get

◆ UsageFlags

UsageFlags BrawlLib.SSBB.ResourceNodes.SCN0LightNode.UsageFlags
getset
260 {
261 get => (UsageFlags) _typeUsageFlags[2, 4];
262 set
263 {
264 _typeUsageFlags[2, 4] = (ushort) value;
266 }
267 }
UsageFlags UsageFlags
Definition: SCN0LightNode.cs:260

◆ UserEntries

UserDataCollection BrawlLib.SSBB.ResourceNodes.SCN0LightNode.UserEntries
getset
46 {
47 get => _userEntries;
48 set
49 {
50 _userEntries = value;
52 }
53 }

◆ VisibilityEnabled

bool BrawlLib.SSBB.ResourceNodes.SCN0LightNode.VisibilityEnabled
getset
288 {
289 get => UsageFlags.HasFlag(UsageFlags.Enabled);
290 set
291 {
292 if (value)
293 {
294 UsageFlags |= UsageFlags.Enabled;
295 }
296 else
297 {
298 UsageFlags &= ~UsageFlags.Enabled;
299 }
300 }
301 }

The documentation for this class was generated from the following file: