home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "14_2 Editors"
- ClientHeight = 6630
- ClientLeft = 1140
- ClientTop = 1425
- ClientWidth = 6750
- Height = 7005
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 6630
- ScaleWidth = 6750
- Top = 1110
- Width = 6870
- Begin VB.Label Label1
- Caption = $"14_2Editors.frx":0000
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 1695
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 6375
- End
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 4575
- Left = 120
- TabIndex = 0
- Top = 2040
- Width = 6495
- _Version = 131072
- _ExtentX = 11456
- _ExtentY = 8070
- _StockProps = 0
- decorationOn = 0 'False
- headlightOn = 0 'False
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim ltEditor As SoWinDirectionalLightEditor
- Dim mtlEditor As SoWinMaterialEditor
- Private Sub Form_Initialize()
- 'SCENE!
- Dim myScene As SoSceneKit
- Set myScene = New SoSceneKit
- 'LIGHTS! Add an SoLightKit to the "lightList." The
- 'SoLightKit creates an SoDirectionalLight by default.
- Static myLightKit As SoLightKit
- Set myLightKit = New SoLightKit
- Call myScene.setPart(utlSbName("lightList[0]"), myLightKit)
- 'CAMERA!! Add an SoCameraKit to the "cameraList." The
- 'SoCameraKit creates an SoPerspectiveCamera by default.
- Dim myCameraKit As SoCameraKit
- Set myCameraKit = New SoCameraKit
- Call myScene.setPart(utlSbName("cameraList[0]"), myCameraKit)
- Call myScene.setCameraNumber(0)
- 'Read an object from file.
- Dim fileContents As Object
- Set fileContents = utlReadFile(V3Space1.getRegistryDataPath() + "\examples\data\desk.iv", V3Space1.GetIDispatch())
- Set fileContents = utlStripGroup(fileContents)
- 'OBJECT!! Create an SoWrapperKit and set its contents to
- 'be what you read from file.
- Dim myDesk As SoWrapperKit
- Set myDesk = New SoWrapperKit
- Call myDesk.setPart(utlSbName("contents"), fileContents)
- Call myScene.setPart(utlSbName("childList[0]"), myDesk)
- 'Give the desk a good starting color
- Call myDesk.setParam("material { diffuseColor .8 .3 .1 }")
- 'MATERIAL EDITOR!! Attach it to myDesk's material node.
- 'Use the SO_GET_PART macro to get this part from myDesk.
- Set mtlEditor = New SoWinMaterialEditor
- Dim mtl As SoMaterial
- Set mtl = New SoMaterial
- Set mtl = myDesk.SoGetPart(myDesk, utlSbName("material"), mtl.getClassTypeId())
- 'mtlEditor->setTitle("Material of Desk");
- Call mtlEditor.Show
- Call mtlEditor.attach(mtl, 0)
- 'DIRECTIONAL LIGHT EDITOR!! Attach it to the
- 'SoDirectionalLight node within the SoLightKit we made.
- Set ltEditor = New SoWinDirectionalLightEditor
-
- Static ltPath As SoPath
- Set ltPath = myScene.createPathToPart(utlSbName("lightList[0].light"), True, Nothing)
- Call ltEditor.Show
- Call ltEditor.attach(ltPath)
- 'Set up Camera with ViewAll...
- '-- use the SO_GET_PART macro to get the camera node.
- '-- viewall is a method on the 'camera' part of
- 'the cameraKit, not on the cameraKit itself. So the part
- 'we ask for is not 'cameraList[0]' (which is of type
- 'SoPerspectiveCameraKit), but
- 'cameraList[0].camera' (which is of type
- ' SoPerspectiveCamera).
- Dim myCamera As SoPerspectiveCamera
- Set myCamera = New SoPerspectiveCamera
- Set myCamera = myScene.SoGetPart(myScene, utlSbName("cameraList[0].camera"), myCamera.getClassTypeId())
- Call myCamera.viewAll(myScene, V3Space1.getViewportRegion(), 1#)
- Call V3Space1.setSceneRoot(myScene)
- Call V3Space1.setCurrentCamera(myCamera)
- Call V3Space1.viewAll
- End Sub
- Private Sub Form_Terminate()
- Call ltEditor.Hide
- Call mtlEditor.Hide
- End Sub
-