BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Properties | List of all members
BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode Class Reference
Inheritance diagram for BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode:
BrawlLib.SSBB.ResourceNodes.MDL0EntryNode BrawlLib.Imaging.IImageSource BrawlLib.SSBB.ResourceNodes.ResourceNode

Public Member Functions

 MDL0MaterialRefNode ()
 
bool CheckIfMetal ()
 
override bool OnInitialize ()
 
override void OnRebuild (VoidPtr address, int length, bool force)
 
void SetEffectMatrix (SCN0Node node, ModelPanelViewport v, float frame)
 
Matrix GetTransform (bool useEffectMtx)
 
void Default ()
 
override void Remove ()
 
override bool MoveUp ()
 
override bool MoveDown ()
 
override void Replace (string fileName)
 
override void Export (string outPath)
 
Bitmap GetImage (int index)
 
- Public Member Functions inherited from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode
override void SignalPropertyChange ()
 
- 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 ()
 
Bitmap GetImage (int index)
 

Public Attributes

TexMtxEffect _texMatrixEffect
 
XFDualTex _dualTexFlags
 
XFTexMtxInfo _texMtxFlags
 
TextureFrameState _frameState
 
TextureFrameState _bindState
 
Dictionary< string, MDL0TextureNodePAT0Textures = new Dictionary<string, MDL0TextureNode>()
 
string PAT0Texture
 
string PAT0Palette
 
- Public Attributes inherited from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode
int _entryIndex
 
- 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
 

Properties

override ResourceType ResourceFileType [get]
 
override bool AllowDuplicateNames [get]
 
MDL0MaterialNode Material [get]
 
override string Name [get, set]
 
bool HasTextureMatrix [get, set]
 
Vector2 Scale [get, set]
 
float Rotation [get, set]
 
Vector2 Translation [get, set]
 
sbyte SCN0RefCamera [get, set]
 
sbyte SCN0RefLight [get, set]
 
MappingMethod MapMode [get, set]
 
bool IdentityMatrix [get, set]
 
Matrix34 EffectMatrix [get, set]
 
TexProjection Projection [get, set]
 
TexInputForm InputForm [get, set]
 
TexTexgenType Type [get, set]
 
TexSourceRow Coordinates [get, set]
 
int EmbossSource [get, set]
 
int EmbossLight [get, set]
 
bool Normalize [get, set]
 
MatWrapMode UWrapMode [get, set]
 
MatWrapMode VWrapMode [get, set]
 
MatTextureMinFilter MinFilter [get, set]
 
MatTextureMagFilter MagFilter [get, set]
 
float LODBias [get, set]
 
MatAnisotropy MaxAnisotropy [get, set]
 
bool ClampBias [get, set]
 
bool TexelInterpolate [get, set]
 
MDL0TextureNode TextureNode [get, set]
 
string Texture [get, set]
 
MDL0TextureNode PaletteNode [get, set]
 
string Palette [get, set]
 
int TextureCoordId [get]
 
int ImageCount [get]
 
- Properties inherited from BrawlLib.SSBB.ResourceNodes.MDL0EntryNode
MDL0Node Model [get]
 
BRRESNode BRESNode [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.Imaging.IImageSource
int ImageCount [get]
 

Additional Inherited Members

- 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)
 
- 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
 

Constructor & Destructor Documentation

◆ MDL0MaterialRefNode()

BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MDL0MaterialRefNode ( )
inline
31 {
32 _uWrap = (int) MatWrapMode.Repeat;
33 _vWrap = (int) MatWrapMode.Repeat;
36 _minFltr = 1;
37 _magFltr = 1;
38 }
TextureFrameState _bindState
Definition: MDL0MaterialRefNode.cs:756
TexMtxEffect _texMatrixEffect
Definition: MDL0MaterialRefNode.cs:52
MatWrapMode
Definition: MDL0MaterialRefNode.cs:1001
Definition: FrameState.cs:105
static readonly TextureFrameState Neutral
Definition: FrameState.cs:244
Definition: MDL0.cs:995
static readonly TexMtxEffect Default
Definition: MDL0.cs:1024

Member Function Documentation

◆ CheckIfMetal()

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.CheckIfMetal ( )
inline
585 {
586 if (Material != null && Material.CheckIfMetal())
587 {
588 return true;
589 }
590
591 return false;
592 }
bool CheckIfMetal()
Definition: MDL0MaterialNode.cs:1486
MDL0MaterialNode Material
Definition: MDL0MaterialRefNode.cs:28

◆ Default()

void BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Default ( )
inline
871 {
872 Name = "NewRef";
873 _minFltr = 1;
874 _magFltr = 1;
875 UWrapMode = MatWrapMode.Repeat;
876 VWrapMode = MatWrapMode.Repeat;
877
879 _texMatrixEffect.TextureMatrix = Matrix34.Identity;
880 _texMatrixEffect.SCNCamera = -1;
881 _texMatrixEffect.SCNLight = -1;
882 _texMatrixEffect.MapMode = MappingMethod.TexCoord;
883
885 {
887 InputForm = TexInputForm.AB11,
888 TexGenType = TexTexgenType.Regular,
889 SourceRow = TexSourceRow.TexCoord0,
890 EmbossSource = 5,
891 EmbossLight = 0
892 };
893
894 _texture = Model.FindOrCreateTexture(_name);
895 _texture._references.Add(this);
896 }
MDL0Node Model
Definition: MDL0GroupNode.cs:28
int EmbossSource
Definition: MDL0MaterialRefNode.cs:303
XFTexMtxInfo _texMtxFlags
Definition: MDL0MaterialRefNode.cs:54
override string Name
Definition: MDL0MaterialRefNode.cs:41
TexInputForm InputForm
Definition: MDL0MaterialRefNode.cs:260
MatWrapMode VWrapMode
Definition: MDL0MaterialRefNode.cs:360
MatWrapMode UWrapMode
Definition: MDL0MaterialRefNode.cs:345
int EmbossLight
Definition: MDL0MaterialRefNode.cs:317
TexProjection Projection
Definition: MDL0MaterialRefNode.cs:246
MDL0TextureNode FindOrCreateTexture(string name)
Definition: MDL0Node.cs:706
List< MDL0MaterialRefNode > _references
Definition: MDL0TextureNode.cs:117
string _name
Definition: ResourceNode.cs:139
MappingMethod
Definition: MDL0MaterialRefNode.cs:1024
TexInputForm
Definition: Enum.cs:560
TexSourceRow
Definition: Enum.cs:574
TexProjection
Definition: Enum.cs:554
TexTexgenType
Definition: Enum.cs:566
Definition: Matrix34.cs:15
static readonly Matrix34 Identity
Definition: Matrix34.cs:16

◆ Export()

override void BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Export ( string  outPath)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

966 {
967 StringTable table = new StringTable();
968 GetStrings(table);
969 int dataLen = OnCalculateSize(true);
970 int totalLen = dataLen + table.GetTotalSize();
971
972 using (FileStream stream = new FileStream(outPath, FileMode.OpenOrCreate, FileAccess.ReadWrite,
973 FileShare.None, 8, FileOptions.RandomAccess))
974 {
975 stream.SetLength(totalLen);
976 using (FileMap map = FileMap.FromStream(stream))
977 {
978 Rebuild(map.Address, dataLen, false);
979 table.WriteTable(map.Address + dataLen);
980 PostProcess(map.Address, map.Address, table);
981 }
982 }
983 }
Definition: FileMap.cs:10
static FileMap FromStream(FileStream stream)
Definition: FileMap.cs:117
VoidPtr Address
Definition: FileMap.cs:16
virtual void Rebuild()
Definition: ResourceNode.cs:987
virtual int OnCalculateSize(bool force)
Definition: ResourceNode.cs:1179

◆ GetImage()

Bitmap BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.GetImage ( int  index)
inline

Implements BrawlLib.Imaging.IImageSource.

988 {
989 return _texture.GetImage(index);
990 }
Bitmap GetImage(int index)
Definition: MDL0TextureNode.cs:448

◆ GetTransform()

Matrix BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.GetTransform ( bool  useEffectMtx)
inline
861 {
862 if (!useEffectMtx || _effectMatrix == Matrix.Identity)
863 {
864 return _frameState._transform;
865 }
866
867 return _frameState._transform * _effectMatrix;
868 }
TextureFrameState _frameState
Definition: MDL0MaterialRefNode.cs:756
Definition: Matrix.cs:14
static readonly Matrix Identity
Definition: Matrix.cs:15
Matrix _transform
Definition: FrameState.cs:111

◆ MoveDown()

override bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MoveDown ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

934 {
935 if (Parent == null)
936 {
937 return false;
938 }
939
940 if (CheckIfMetal())
941 {
942 return false;
943 }
944
945 int index = Index + 1;
946 if (index >= Parent.Children.Count)
947 {
948 return false;
949 }
950
951 Parent.Children.Remove(this);
952 Parent.Children.Insert(index, this);
953 Parent._changed = true;
954
955 return true;
956 }
bool CheckIfMetal()
Definition: MDL0MaterialRefNode.cs:584
ResourceNode Parent
Definition: ResourceNode.cs:245
int Index
Definition: ResourceNode.cs:301
List< ResourceNode > Children
Definition: ResourceNode.cs:262

◆ MoveUp()

override bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MoveUp ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

909 {
910 if (Parent == null)
911 {
912 return false;
913 }
914
915 if (CheckIfMetal())
916 {
917 return false;
918 }
919
920 int index = Index - 1;
921 if (index < 0)
922 {
923 return false;
924 }
925
926 Parent.Children.Remove(this);
927 Parent.Children.Insert(index, this);
928 Parent._changed = true;
929
930 return true;
931 }

◆ OnInitialize()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

595 {
596 MDL0TextureRef* header = Header;
597
598 _uWrap = header->_uWrap;
599 _vWrap = header->_vWrap;
600 _minFltr = header->_minFltr;
601 _magFltr = header->_magFltr;
602 _lodBias = header->_lodBias;
603 _maxAniso = header->_maxAniso;
604 _clampBias = header->_clampBias == 1;
605 _texelInterp = header->_texelInterp == 1;
606
607 if (header->_texOffset != 0)
608 {
610 {
611 Name = null;
612 }
613 else
614 {
615 if (_replaced)
616 {
617 Name = header->TextureName;
618 }
619 else
620 {
621 _name = header->TextureName;
622 }
623
624 _texture = Model.FindOrCreateTexture(_name);
625 _texture._references.Add(this);
626 }
627 }
628
629 if (header->_pltOffset != 0)
630 {
632 {
633 _palette = null;
634 }
635 else
636 {
637 string name = header->PaletteName;
638 _palette = Model.FindOrCreatePalette(name);
639 _palette._references.Add(this);
640 }
641 }
642
643 int len = Material.XFCmds.Count;
644 if (len != 0 && Index * 2 + 1 < len)
645 {
646 _texMtxFlags = new XFTexMtxInfo(Material.XFCmds[Index * 2]._values[0]);
647 _dualTexFlags = new XFDualTex(Material.XFCmds[Index * 2 + 1]._values[0]);
648 }
649
650 //if (PaletteNode == null && TextureNode != null)
651 //{
652 // if (TextureNode.Source == null)
653 // TextureNode.GetSource();
654
655 // if (TextureNode.Source is TEX0Node && ((TEX0Node)TextureNode.Source).HasPalette)
656 // {
657 // Model._errors.Add("A palette was not set to texture reference " + Index + " in material " + Parent.Index + " (" + Parent.Name + ").");
658 // PaletteNode = Model.FindOrCreatePalette(TextureNode.Name);
659
660 // SignalPropertyChange();
661 // }
662 //}
663
664 MDL0TexSRTData* TexSettings = Material.Header->TexMatrices(Material._initVersion);
665
666 _texMatrixEffect = TexSettings->GetTexMatrices(Index);
667 _bindState = TexSettings->GetTexSRT(Index);
668 _bindState.MatrixMode = Material.TextureMatrixMode;
669
670 return false;
671 }
List< XFData > XFCmds
Definition: MDL0MaterialNode.cs:88
TexMatrixMode TextureMatrixMode
Definition: MDL0MaterialNode.cs:1113
XFDualTex _dualTexFlags
Definition: MDL0MaterialRefNode.cs:53
MDL0TextureNode FindOrCreatePalette(string name)
Definition: MDL0Node.cs:729
bool _replaced
Definition: ResourceNode.cs:827
DataSource WorkingUncompressed
Definition: ResourceNode.cs:183
int Length
Definition: ResourceNode.cs:32
MDL0TexSRTData * TexMatrices(int version)
Definition: MDL0.cs:1261
Definition: MDL0.cs:1046
TextureSRT GetTexSRT(int Index)
Definition: MDL0.cs:1100
TexMtxEffect GetTexMatrices(int Index)
Definition: MDL0.cs:1110
Definition: MDL0.cs:1758
byte _texelInterp
Definition: MDL0.cs:1774
bint _pltOffset
Definition: MDL0.cs:1762
bint _vWrap
Definition: MDL0.cs:1768
bint _uWrap
Definition: MDL0.cs:1767
bint _minFltr
Definition: MDL0.cs:1769
byte _clampBias
Definition: MDL0.cs:1773
bint _maxAniso
Definition: MDL0.cs:1772
bfloat _lodBias
Definition: MDL0.cs:1771
bint _magFltr
Definition: MDL0.cs:1770
bint _texOffset
Definition: MDL0.cs:1761
string TextureName
Definition: MDL0.cs:1788
string PaletteName
Definition: MDL0.cs:1796
Definition: XF.cs:199

◆ OnRebuild()

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

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

683 {
684 MDL0TextureRef* header = (MDL0TextureRef*) address;
685 header->_texPtr = 0;
686 header->_pltPtr = 0;
687 header->_index1 = Index;
688 header->_index2 = Index;
689 header->_uWrap = _uWrap;
690 header->_vWrap = _vWrap;
691 header->_minFltr = _minFltr;
692 header->_magFltr = _magFltr;
693 header->_lodBias = _lodBias;
694 header->_maxAniso = _maxAniso;
695 header->_clampBias = (byte) (_clampBias ? 1 : 0);
696 header->_texelInterp = (byte) (_texelInterp ? 1 : 0);
697 header->_pad = 0;
698 }
bint _texPtr
Definition: MDL0.cs:1763
bint _index1
Definition: MDL0.cs:1765
bshort _pad
Definition: MDL0.cs:1775
bint _index2
Definition: MDL0.cs:1766
bint _pltPtr
Definition: MDL0.cs:1764

◆ Remove()

override void BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Remove ( )
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

899 {
900 if (_parent != null && !CheckIfMetal())
901 {
902 TextureNode = null;
903 PaletteNode = null;
904 base.Remove();
905 }
906 }
MDL0TextureNode TextureNode
Definition: MDL0MaterialRefNode.cs:468
MDL0TextureNode PaletteNode
Definition: MDL0MaterialRefNode.cs:530
virtual void Remove()
Definition: ResourceNode.cs:741
ResourceNode _parent
Definition: ResourceNode.cs:142

◆ Replace()

override void BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Replace ( string  fileName)
inlinevirtual

Reimplemented from BrawlLib.SSBB.ResourceNodes.ResourceNode.

959 {
960 base.Replace(fileName);
961
963 }
void CheckTextures()
Definition: MDL0Node.cs:414

◆ SetEffectMatrix()

void BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.SetEffectMatrix ( SCN0Node  node,
ModelPanelViewport  v,
float  frame 
)
inline
830 {
831 if (MapMode != MappingMethod.TexCoord)
832 {
833 switch (MapMode)
834 {
835 case MappingMethod.Projection:
836 _effectMatrix = Matrix34.ProjectionMapping(SCN0RefCamera, node, v, frame);
837 break;
838 case MappingMethod.EnvSpec:
839 _effectMatrix = Matrix34.EnvSpecMap(SCN0RefCamera, SCN0RefLight, node, v, frame);
840 break;
841 case MappingMethod.EnvLight:
842 _effectMatrix = Matrix34.EnvLightMap(SCN0RefLight, node, v, frame);
843 break;
844 case MappingMethod.EnvCamera:
845 _effectMatrix = Matrix34.EnvCamMap(SCN0RefCamera, node, v, frame);
846 break;
847 default:
848 _effectMatrix = Matrix.Identity;
849 break;
850 }
851 }
852 else
853 {
854 _effectMatrix = Matrix.Identity;
855 }
856 }
MappingMethod MapMode
Definition: MDL0MaterialRefNode.cs:202
sbyte SCN0RefLight
Definition: MDL0MaterialRefNode.cs:188
sbyte SCN0RefCamera
Definition: MDL0MaterialRefNode.cs:174
static Matrix EnvCamMap(int refCam, SCN0Node node, ModelPanelViewport v, float frame)
Definition: Matrix34.cs:747
static Matrix EnvSpecMap(int refCam, int refLight, SCN0Node node, ModelPanelViewport v, float frame)
This function returns a texture matrix that will aim the texture to the midpoint between the active c...
Definition: Matrix34.cs:882
static Matrix EnvLightMap(int refLight, SCN0Node node, ModelPanelViewport v, float frame)
Definition: Matrix34.cs:760
static Matrix ProjectionMapping(int ref_camera, SCN0Node node, ModelPanelViewport v, float frame)
Definition: Matrix34.cs:825

Member Data Documentation

◆ _bindState

TextureFrameState BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode._bindState

◆ _dualTexFlags

XFDualTex BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode._dualTexFlags

◆ _frameState

TextureFrameState BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode._frameState

◆ _texMatrixEffect

TexMtxEffect BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode._texMatrixEffect

◆ _texMtxFlags

XFTexMtxInfo BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode._texMtxFlags

◆ PAT0Palette

string BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.PAT0Palette

◆ PAT0Texture

string BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.PAT0Texture

◆ PAT0Textures

Dictionary<string, MDL0TextureNode> BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.PAT0Textures = new Dictionary<string, MDL0TextureNode>()

Property Documentation

◆ AllowDuplicateNames

override bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.AllowDuplicateNames
get

◆ ClampBias

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.ClampBias
getset
434 {
435 get => _clampBias;
436 set
437 {
438 if (!CheckIfMetal())
439 {
440 _clampBias = value;
442 }
443 }
444 }
override void SignalPropertyChange()
Definition: MDL0GroupNode.cs:66

◆ Coordinates

TexSourceRow BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Coordinates
getset
288 {
289 get => _texMtxFlags.SourceRow;
290 set
291 {
292 if (!CheckIfMetal())
293 {
294 _texMtxFlags.SourceRow = value;
297 }
298 }
299 }
void UpdateCurrentControl()
Definition: ResourceNode.cs:482
TexSourceRow SourceRow
Definition: XF.cs:151

◆ EffectMatrix

Matrix34 BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.EffectMatrix
getset
232 {
234 set
235 {
236 if (!CheckIfMetal())
237 {
238 _texMatrixEffect.TextureMatrix = value;
240 }
241 }
242 }
Matrix34 TextureMatrix
Definition: MDL0.cs:1015

◆ EmbossLight

int BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.EmbossLight
getset
317 {
319 set
320 {
321 if (!CheckIfMetal())
322 {
323 _texMtxFlags.EmbossLight = value;
325 }
326 }
327 }
int EmbossLight
Definition: XF.cs:163

◆ EmbossSource

int BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.EmbossSource
getset
303 {
305 set
306 {
307 if (!CheckIfMetal())
308 {
309 _texMtxFlags.EmbossSource = value;
311 }
312 }
313 }
int EmbossSource
Definition: XF.cs:157

◆ HasTextureMatrix

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.HasTextureMatrix
getset
71 {
72 get
73 {
74 bool allsinglebinds = true;
75 if (Material.Objects != null)
76 {
77 foreach (MDL0ObjectNode n in Material.Objects)
78 {
79 if (n.Weighted)
80 {
81 allsinglebinds = false;
82 if (!n._manager.HasTextureMatrix[Index])
83 {
84 return false;
85 }
86 }
87 }
88 }
89 else
90 {
91 return false;
92 }
93
94 if (allsinglebinds)
95 {
96 return false;
97 }
98
99 return true;
100 }
101 set
102 {
103 if (Material.Objects != null)
104 {
105 foreach (MDL0ObjectNode n in Material.Objects)
106 {
107 if (n.Weighted)
108 {
109 n._manager.HasTextureMatrix[Index] = value;
110 n._forceRebuild = true;
111 n.SignalPropertyChange();
112
113 if (n._vertexNode.Format != WiiVertexComponentType.Float)
114 {
115 n._vertexNode.ForceRebuild = n._vertexNode.ForceFloat = value;
116 }
117 }
118 }
119
121 }
122 }
123 }
MDL0ObjectNode[] Objects
Definition: MDL0MaterialNode.cs:103
WiiVertexComponentType
Definition: Enum.cs:4

◆ IdentityMatrix

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.IdentityMatrix
getset
217 {
219 set
220 {
221 if (CheckIfMetal())
222 return;
223 _texMatrixEffect.IdentityMatrix = value;
226 }
227 }
bool IdentityMatrix
Definition: MDL0.cs:1009

◆ ImageCount

int BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.ImageCount
get

◆ InputForm

TexInputForm BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.InputForm
getset
260 {
261 get => _texMtxFlags.InputForm;
262 set
263 {
264 if (!CheckIfMetal())
265 {
266 _texMtxFlags.InputForm = value;
268 }
269 }
270 }
TexInputForm InputForm
Definition: XF.cs:139

◆ LODBias

float BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.LODBias
getset
405 {
406 get => _lodBias;
407 set
408 {
409 if (!CheckIfMetal())
410 {
411 _lodBias = value;
414 }
415 }
416 }

◆ MagFilter

MatTextureMagFilter BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MagFilter
getset
390 {
391 get => (MatTextureMagFilter) _magFltr;
392 set
393 {
394 if (!CheckIfMetal())
395 {
396 _magFltr = (int) value;
399 }
400 }
401 }
MatTextureMagFilter
Definition: MDL0MaterialRefNode.cs:1018

◆ MapMode

MappingMethod BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MapMode
getset
202 {
204 set
205 {
206 if (!CheckIfMetal())
207 {
208 _texMatrixEffect.MapMode = value;
211 }
212 }
213 }
MappingMethod MapMode
Definition: MDL0.cs:1003

◆ Material

MDL0MaterialNode BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Material
get

◆ MaxAnisotropy

MatAnisotropy BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MaxAnisotropy
getset
420 {
421 get => (MatAnisotropy) _maxAniso;
422 set
423 {
424 if (!CheckIfMetal())
425 {
426 _maxAniso = (int) value;
428 }
429 }
430 }
MatAnisotropy
Definition: MDL0MaterialRefNode.cs:994

◆ MinFilter

MatTextureMinFilter BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.MinFilter
getset
375 {
376 get => (MatTextureMinFilter) _minFltr;
377 set
378 {
379 if (!CheckIfMetal())
380 {
381 _minFltr = (int) value;
384 }
385 }
386 }
MatTextureMinFilter
Definition: MDL0MaterialRefNode.cs:1008

◆ Name

override string BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Name
getset
41 {
42 get => _texture != null ? _texture.Name : base.Name;
43 set
44 {
45 Texture = value;
46 base.Name = value;
47 }
48 }
string Texture
Definition: MDL0MaterialRefNode.cs:512
virtual string Name
Definition: ResourceNode.cs:223

◆ Normalize

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Normalize
getset
331 {
332 get => _dualTexFlags._normalEnable != 0;
333 set
334 {
335 if (!CheckIfMetal())
336 {
337 _dualTexFlags._normalEnable = (byte) (value ? 1 : 0);
339 }
340 }
341 }

◆ Palette

string BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Palette
getset
558 {
559 get => _palette == null ? null : _palette.Name;
560 set
561 {
562 PaletteNode = string.IsNullOrEmpty(value) ? null : Model.FindOrCreatePalette(value);
565 }
566 }

◆ PaletteNode

MDL0TextureNode BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.PaletteNode
getset
530 {
531 get => _palette;
532 set
533 {
534 if (_palette == value)
535 {
536 return;
537 }
538
539 if (_palette != null)
540 {
541 _palette._references.Remove(this);
542 if (_palette._references.Count == 0)
543 {
544 _palette.Remove();
545 }
546 }
547
548 if ((_palette = value) != null)
549 {
550 _palette._references.Add(this);
551 }
552 }
553 }

◆ Projection

TexProjection BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Projection
getset
246 {
248 set
249 {
250 if (!CheckIfMetal())
251 {
252 _texMtxFlags.Projection = value;
254 }
255 }
256 }
TexProjection Projection
Definition: XF.cs:133

◆ ResourceFileType

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

◆ Rotation

float BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Rotation
getset
143 {
144 get => _bindState.Rotate;
145 set
146 {
147 if (!CheckIfMetal())
148 {
149 _bindState.Rotate = value;
152 }
153 }
154 }
float Rotate
Definition: FrameState.cs:145

◆ Scale

Vector2 BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Scale
getset
128 {
129 get => _bindState.Scale;
130 set
131 {
132 if (!CheckIfMetal())
133 {
134 _bindState.Scale = value;
137 }
138 }
139 }
Vector2 Scale
Definition: FrameState.cs:155

◆ SCN0RefCamera

sbyte BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.SCN0RefCamera
getset
174 {
176 set
177 {
178 if (!CheckIfMetal())
179 {
180 _texMatrixEffect.SCNCamera = value;
182 }
183 }
184 }
sbyte SCNCamera
Definition: MDL0.cs:996

◆ SCN0RefLight

sbyte BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.SCN0RefLight
getset
188 {
190 set
191 {
192 if (!CheckIfMetal())
193 {
194 _texMatrixEffect.SCNLight = value;
196 }
197 }
198 }
sbyte SCNLight
Definition: MDL0.cs:997

◆ TexelInterpolate

bool BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.TexelInterpolate
getset
448 {
449 get => _texelInterp;
450 set
451 {
452 if (!CheckIfMetal())
453 {
454 _texelInterp = value;
456 }
457 }
458 }

◆ Texture

string BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Texture
getset
512 {
513 get => _texture == null ? null : _texture.Name;
514 set
515 {
516 TextureNode = string.IsNullOrEmpty(value) || Model == null ? null : Model.FindOrCreateTexture(value);
519 }
520 }

◆ TextureCoordId

int BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.TextureCoordId
get
572 {
573 get
574 {
575 if ((int) Coordinates >= (int) TexSourceRow.TexCoord0)
576 {
577 return (int) Coordinates - (int) TexSourceRow.TexCoord0;
578 }
579
580 return -1 - (int) Coordinates;
581 }
582 }
TexSourceRow Coordinates
Definition: MDL0MaterialRefNode.cs:288

◆ TextureNode

MDL0TextureNode BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.TextureNode
getset
468 {
469 get => _texture;
470 set
471 {
472 if (_texture == value)
473 {
474 return;
475 }
476
477 if (_texture != null)
478 {
479 _texture._references.Remove(this);
480 if (_texture._references.Count == 0)
481 {
482 _texture.Remove();
483 }
484 }
485
486 if ((_texture = value) != null)
487 {
488 _texture._references.Add(this);
489
490 Name = _texture.Name;
491
492 if (_texture.Source == null)
493 {
494 _texture.GetSource();
495 }
496
497 if (_texture.Source is TEX0Node && ((TEX0Node) _texture.Source).HasPalette)
498 {
500 }
501 else
502 {
503 PaletteNode = null;
504 }
505 }
506 }
507 }
object Source
Definition: MDL0TextureNode.cs:115
void GetSource()
Definition: MDL0TextureNode.cs:203

◆ Translation

Vector2 BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Translation
getset
159 {
160 get => _bindState.Translate;
161 set
162 {
163 if (!CheckIfMetal())
164 {
165 _bindState.Translate = value;
168 }
169 }
170 }
Vector2 Translate
Definition: FrameState.cs:135

◆ Type

TexTexgenType BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.Type
getset
274 {
276 set
277 {
278 if (!CheckIfMetal())
279 {
280 _texMtxFlags.TexGenType = value;
282 }
283 }
284 }
TexTexgenType TexGenType
Definition: XF.cs:145

◆ UWrapMode

MatWrapMode BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.UWrapMode
getset
345 {
346 get => (MatWrapMode) _uWrap;
347 set
348 {
349 if (!CheckIfMetal())
350 {
351 _uWrap = (int) value;
354 }
355 }
356 }

◆ VWrapMode

MatWrapMode BrawlLib.SSBB.ResourceNodes.MDL0MaterialRefNode.VWrapMode
getset
360 {
361 get => (MatWrapMode) _vWrap;
362 set
363 {
364 if (!CheckIfMetal())
365 {
366 _vWrap = (int) value;
369 }
370 }
371 }

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