?? cscene.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 = "CScene"
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 collection holds the top level nodes. Most
'nodes will ne contained in the Children collection of another
'CNode. A 3ds or obj mesh is a single object. Currently, this collection
'reflects the needs of the treeview display (it contains a 'file header', keyframe,
'and actual mesh data, because we are showing the 3ds file structure).
'For a true 'scene', each mesh would be a top-level node, and the collection
'would contain multiple objects.
'AUTHOR: edx - edx@hk.super.net, Oct 98 - all rights reserved
'HISTORY: -
'NOTES: Since the 3d viewer is dealing with simple meshes,
'transform values aren't currently used.
'*************************************************************************
Dim TV As TreeView
Dim m_Nodes As Collection
Private Sub Class_Initialize()
Set TV = frmMain.TV1
Set m_Nodes = New Collection
End Sub
Private Sub Class_Terminate()
Set m_Nodes = Nothing
End Sub
'----------------------------------------------------------------
Public Sub Clear()
Dim i&
TV.Nodes.Clear
For i = 1 To m_Nodes.Count
m_Nodes.Remove 1
Next
End Sub
'----------------------------------------------------------------
'tell each top level node to fill the tree
'----------------------------------------------------------------
Public Sub FillTree()
Dim n As CNode
For Each n In m_Nodes
n.FillTree
Next
TV.Nodes(1).Expanded = True
End Sub
'----------------------------------------------------------------
'convenience function.
'----------------------------------------------------------------
Public Function AddNode(ParentNode As CNode, ChunkID%, NodeID&, Optional Name$) As CNode
Dim s$, Node As CNode
Set Node = New CNode
If ChunkID = 0 Then Debug.Assert 0
Node.ChunkID = ChunkID
Node.NodeID = NodeID
Node.Name = Name
Set Node.Parent = ParentNode
'if it has a Parent, add it to the
'Parent's collection of children
If Not ParentNode Is Nothing Then
ParentNode.AddChild Node
Else
m_Nodes.Add Node
End If
Set AddNode = Node
End Function
'----------------------------------------------------------------
Public Sub Draw()
Dim n As CNode
For Each n In m_Nodes
n.Draw
Next
End Sub
'----------------------------------------------------------------
'since we are using display lists, must recompile when viewing
'parameters change (wireframe, textures)
'----------------------------------------------------------------
Public Sub Compile()
Dim n As CNode
For Each n In m_Nodes
n.Compile
Next
gCtl.Render
End Sub
'----------------------------------------------------------------
'returns the text value of a simple CField. Returns no value
'for CNodes, CMaterials, MFKey or any of the MF... classes
'this is to retrieve values when a node is selected in the Treeview
'----------------------------------------------------------------
Public Function GetTreeNodeValue$(TreeNode As Node)
Dim Node As CNode, i&, Field As Object
For i = 1 To m_Nodes.Count
Set Node = m_Nodes(i)
If Node.TreeNode Is Nothing Then Debug.Assert 0
If Node.TreeNode Is TreeNode Then
'no value
Exit Function
Else
Set Field = Node.FindFieldorNode(TreeNode)
If Not Field Is Nothing Then
Debug.Print TypeName(Field)
If TypeName(Field) = "CField" Then
GetTreeNodeValue = Field.Value
End If
Exit Function
End If
End If
Next
End Function
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -