📄 mflong.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "MFLong"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit
'*************************************************************************
'FUNCTION: 'this class is used to hold material indexes,
'which is a simple array.
'AUTHOR: edx - edx@hk.super.net, Oct 98 - all rights reserved
'HISTORY: -
'NOTES: - The indexes refer to materials in the CMaterials collection
'*************************************************************************
Public FieldID As FieldNameIDConstants
Public ID&
Public ChunkID%
Public Parent As CNode
Dim m_Count&
Dim m_Values&()
Public TreeNode As Node
Private Sub Class_Initialize()
'
End Sub
Private Sub Class_Terminate()
'
End Sub
'----------------------------------------------------------------------------
'you must set the count before adding values to this class.
'----------------------------------------------------------------------------
Public Property Get Count&()
Count = m_Count
End Property
Public Property Let Count(ByVal NewValue&)
If NewValue > 0 Then
ReDim m_Values(0 To NewValue - 1)
m_Count = NewValue
Else
ReDim m_Values(0 To 0)
m_Count = 0
End If
End Property
'----------------------------------------------------------------------------
'set a material
'----------------------------------------------------------------------------
Public Property Let Value(Index&, NewValue&)
If Index > m_Count Then
Debug.Assert 0
ReDim Preserve m_Values(0 To Index)
m_Count = Index + 1
End If
m_Values(Index) = NewValue
End Property
Public Property Get Value&(Index&)
Value = m_Values(Index)
End Property
'----------------------------------------------------------------------------
'add this object to the treeview
'----------------------------------------------------------------------------
Public Sub FillTree()
Dim ParentNode As Node, i&, s$
s = ChunkName(ChunkID)
Set ParentNode = Parent.TreeNode
Set TreeNode = frmMain.TV1.Nodes.Add(ParentNode, tvwChild, , s, IMG_FIELD)
End Sub
'----------------------------------------------------------------------------
'return a ptr to the array, if drawing is to be done elsewhere
'----------------------------------------------------------------------------
Public Function DataPointer&()
Debug.Assert 0
DataPointer = VarPtr(m_Values(0))
End Function
'----------------------------------------------------------------------------
'returns the index of the next array element which is
'different from the element at Index
'used when drawing, as all the the triangles of a given
'material are drawn at once.
'----------------------------------------------------------------------------
Public Function GetNextMatIndex&(Index&)
Dim curValue&, i&
curValue = m_Values(Index)
i = Index
Do While i + 1 < m_Count - 1
i = i + 1
If m_Values(i) <> curValue Then
GetNextMatIndex = i
Exit Function
End If
Loop
GetNextMatIndex = m_Count
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -