⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mfvec3l.cls

📁 3ds文件浏览程序
💻 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 = "MFVec3L"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'*************************************************************************
'FUNCTION: holds an array of indices to vertices (or normals)
'AUTHOR: edx - edx@hk.super.net, Oct 98 - all rights reserved
'HISTORY: -
'NOTES: - this class is used to hold face indexes,
'which are in sets of 3. This is not the VRML
'class! This assumes triangles only.
'*************************************************************************
Public FieldID As FieldNameIDConstants
Public ID&
Public ChunkID%
Public Parent As CNode
Public TreeNode As Node
Dim m_Count&
Dim m_Values() As INDEX3L

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 the indices defining a triangle
'----------------------------------------------------------------------------
Public Sub SetValue(Index&, v&())
    If Index > m_Count Then
        Debug.Assert 0
        ReDim Preserve m_Values(0 To Index)
        m_Count = Index + 1
    End If
    m_Values(Index).p(0) = v(0)
    m_Values(Index).p(1) = v(1)
    m_Values(Index).p(2) = v(2)
End Sub

'----------------------------------------------------------------------------
'object files use base 1 for indices
'----------------------------------------------------------------------------
Public Sub SetValueOBJ(Index&, v&())
    If Index > m_Count Then
        Debug.Assert 0
        ReDim Preserve m_Values(0 To Index)
        m_Count = Index + 1
    End If
    m_Values(Index).p(0) = v(0) - 1
    m_Values(Index).p(1) = v(1) - 1
    m_Values(Index).p(2) = v(2) - 1
End Sub

'----------------------------------------------------------------------------
'returns the indices defining a triangle
'----------------------------------------------------------------------------
Public Sub GetValue(Index&, v&())
    v(0) = m_Values(Index).p(0)
    v(1) = m_Values(Index).p(1)
    v(2) = m_Values(Index).p(2)
End Sub

'----------------------------------------------------------------------------
'add this object to the treeview
'----------------------------------------------------------------------------
Public Sub FillTree()
    Set TreeNode = frmMain.TV1.Nodes.Add(Parent.TreeNode, tvwChild, , ChunkName(ChunkID), IMG_FIELD)
End Sub

Public Sub DrawElements(Index&, Range&)
    If Index + Range - 1 > m_Count - 1 Then
        Debug.Assert 0
        Range = m_Count - Index
    End If
    glDrawElements GL_TRIANGLES, Range * 3, GL_UNSIGNED_INT, m_Values(Index).p(0)
End Sub

'----------------------------------------------------------------------------
'return a ptr to the array, if drawing is to be done elsewhere
'----------------------------------------------------------------------------
Public Function DataPointer&()
    DataPointer = VarPtr(m_Values(0).p(0))
End Function

'----------------------------------------------------------------------------
'Reverse the polygon winding
'----------------------------------------------------------------------------
Public Sub ReverseWinding()
Dim i&, swap&
    Select Case FID_COORDINDEX
    Case FID_COORD, FID_NORMALINDEX
        For i = 0 To m_Count - 1
            swap = m_Values(i).p(0)
            m_Values(i).p(0) = m_Values(i).p(2)
            m_Values(i).p(2) = swap
        Next
    End Select
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -