home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "04_01 Camera"
- ClientHeight = 5910
- ClientLeft = 945
- ClientTop = 1740
- ClientWidth = 6480
- Height = 6285
- Left = 885
- LinkTopic = "Form1"
- ScaleHeight = 5910
- ScaleWidth = 6480
- Top = 1425
- Width = 6600
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 5895
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 6495
- _Version = 131072
- _ExtentX = 11456
- _ExtentY = 10398
- _StockProps = 0
- decorationOn = 0 'False
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Form_Initialize()
- Dim root As SoSeparator
- Set root = New SoSeparator
- 'Create a blinker node and put it in the scene. A blinker
- ' switches between its children at timed intervals.
- Dim myBlinker As SoBlinker
- Set myBlinker = New SoBlinker
- myBlinker.On.setValue (False)
- Call root.addChild(myBlinker)
- 'Create two cameras. Their positions will be set later.
- Dim perspViewAll As SoPerspectiveCamera
- Set perspViewAll = New SoPerspectiveCamera 'V3Space1.createPerspectiveCamera("perspViewAll")
- Dim perspOffCenter As SoOrthographicCamera
- Set perspOffCenter = New SoOrthographicCamera 'V3Space1.createPerspectiveCamera("perspOffCenter")
- 'Read the object from a file and add to the scene
- Dim myInput As SoInput
- Set myInput = New SoInput
- Dim benchRoot As SoGroup
- Set benchRoot = myInput.readAllUrl(V3Space1.getRegistryDataPath() + "\examples\data\parkbench.iv", V3Space1.GetIDispatch())
- Dim myMaterial As SoMaterial
- Set myMaterial = New SoMaterial
- Call myMaterial.diffuseColor.setValue(1#, 1#, 0#)
- Call root.addChild(myMaterial)
- Call root.addChild(benchRoot)
- Call V3Space1.setSceneRoot(root)
- 'Current camera in the control is perspOffCenter
- Call V3Space1.setCurrentCamera(perspOffCenter)
- Call V3Space1.viewAll
- Dim x As Single
- Dim y As Single
- Dim z As Single
- Call perspOffCenter.position.getValue(x, y, z)
- Call perspOffCenter.position.setValue(x + x / 2, y + y / 2, z + z / 4)
- 'change cameras in the control
- Call V3Space1.setCurrentCamera(perspViewAll)
- Call V3Space1.viewAll
- Call myBlinker.addChild(perspViewAll)
- Call myBlinker.addChild(perspOffCenter)
- myBlinker.On.setValue (True)
- Set root = Nothing
- Set myBlinker = Nothing
- Set perspViewAll = Nothing
- Set perspOffCenter = Nothing
- Set myInput = Nothing
- Set benchRoot = Nothing
- Set myMaterial = Nothing
- End Sub
-