home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "12_2 Node Sensor"
- ClientHeight = 6795
- ClientLeft = 1140
- ClientTop = 1425
- ClientWidth = 6390
- Height = 7170
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 6795
- ScaleWidth = 6390
- Top = 1110
- Width = 6510
- Begin VB.TextBox fieldName
- Enabled = 0 'False
- Height = 375
- Left = 4560
- TabIndex = 5
- Top = 5760
- Width = 1815
- End
- Begin VB.TextBox nodeName
- Enabled = 0 'False
- Height = 375
- Left = 4560
- TabIndex = 1
- Top = 5280
- Width = 1815
- End
- Begin VB.Label Label8
- Caption = "Changes Detected"
- Height = 255
- Left = 3480
- TabIndex = 13
- Top = 4680
- Width = 1455
- End
- Begin VB.Label Label7
- Caption = "Adjust the sliders to trigger the Node Sensor"
- Height = 375
- Left = 120
- TabIndex = 12
- Top = 4680
- Width = 3015
- End
- Begin VB.Label Label6
- Caption = "Cube Width"
- Height = 255
- Left = 120
- TabIndex = 11
- Top = 6240
- Width = 1095
- End
- Begin VB.Label Label5
- Caption = "Cube Height"
- Height = 255
- Left = 120
- TabIndex = 10
- Top = 5760
- Width = 1215
- End
- Begin VB.Label Label4
- Caption = "Sphere Radius"
- Height = 375
- Left = 120
- TabIndex = 9
- Top = 5280
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "Field Name"
- Height = 255
- Left = 3480
- TabIndex = 8
- Top = 5760
- Width = 855
- End
- Begin VB.Label Label2
- Caption = "Node Name"
- Height = 255
- Left = 3480
- TabIndex = 7
- Top = 5280
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "This example demonstrates the use of a SoNodeSensor to detect changes to nodes in the scene graph."
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 735
- Left = 120
- TabIndex = 6
- Top = 0
- Width = 6135
- End
- Begin ComctlLib.Slider boxHeight
- Height = 375
- Left = 1440
- TabIndex = 4
- Top = 5760
- Width = 1455
- _Version = 65536
- _ExtentX = 2566
- _ExtentY = 661
- _StockProps = 64
- LargeChange = 1
- Max = 3
- End
- Begin ComctlLib.Slider boxWidth
- Height = 375
- Left = 1440
- TabIndex = 3
- Top = 6240
- Width = 1455
- _Version = 65536
- _ExtentX = 2566
- _ExtentY = 661
- _StockProps = 64
- LargeChange = 1
- Max = 3
- End
- Begin ComctlLib.Slider sphere
- Height = 390
- Left = 1440
- TabIndex = 2
- Top = 5280
- Width = 1455
- _Version = 65536
- _ExtentX = 2566
- _ExtentY = 688
- _StockProps = 64
- LargeChange = 1
- Max = 3
- End
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 3735
- Left = 0
- TabIndex = 0
- Top = 840
- Width = 6375
- _Version = 131072
- _ExtentX = 11245
- _ExtentY = 6588
- _StockProps = 0
- decorationOn = 0 'False
- viewingOn = 0 'False
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim myCube As SoCube
- Dim mySphere As SoSphere
- Private Sub boxHeight_Change()
- Call myCube.Height.setValue(boxHeight.Value)
- End Sub
- Private Sub boxWidth_Change()
- Call myCube.Width.setValue(boxWidth.Value)
- End Sub
- Private Sub Form_Initialize()
- Dim root As SoSeparator
- Set root = New SoSeparator
- Call root.setName("Root")
- Set myCube = New SoCube
- Call root.addChild(myCube)
- Call myCube.setName("Cube")
- Dim tran As SoTranslation
- Set tran = New SoTranslation
- Call tran.translation.setValue(3, 0, 0)
- Call root.addChild(tran)
- Set mySphere = New SoSphere
- Call root.addChild(mySphere)
- Call mySphere.setName("Sphere")
- Call V3Space1.setSceneRoot(root)
- Call V3Space1.viewAll
- Static sensorCB As SoSensorCB
- Set sensorCB = New SoSensorCB
- sensorCB.sensorType = 6 'nodeSensor
- Dim mySensor As SoNodeSensor
- Set mySensor = New SoNodeSensor
- Call mySensor.setPriority(0)
- Dim idisp As Object
- Set idisp = V3Space1.GetIDispatch
- Call mySensor.setFunction(idisp, sensorCB)
- Call mySensor.attach(root)
- sphere.Value = mySphere.radius.getValue
- boxWidth.Value = myCube.Width.getValue
- boxHeight.Value = myCube.Height.getValue
- End Sub
- Private Sub Slider1_Change()
- Call mySphere.radius.setValue
- End Sub
- Private Sub Slider1_Click()
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Set myCube = Nothing
- Set mySphere = Nothing
- End Sub
- Private Sub sphere_Change()
- Call mySphere.radius.setValue(sphere.Value)
- End Sub
- Private Sub V3Space1_NodeSensor(ByVal sensorCB As Object, ByVal sensor As Object)
- 'We know the sensor is really a data sensor:
- Dim changedNode As Object
- Set changedNode = sensor.getTriggerNode()
- Dim changedField As Object
- Set changedField = sensor.getTriggerField()
- If changedNode Is Nothing Then
- GoTo cleanup
- End If
- nodeName.Text = changedNode.getName()
- If changedField Is Nothing Then
- GoTo cleanup
- End If
- Dim fn As SbName
- Call changedNode.getFieldName(changedField, fn)
- If fn Is Nothing Then
- GoTo cleanup
- End If
- fieldName.Text = fn.getString()
- 'if (changedField != NULL) {
- ' SbName fieldName;
- ' changedNode->getFieldName(changedField, fieldName);
- ' printf(" (field %s)\n", fieldName.getString());
- '} else {
- ' printf(" (no fields changed)\n");
- '}
- cleanup:
- Set changedNode = Nothing
- Set changedField = Nothing
- Set sensorCB = Nothing
- Set sensor = Nothing
- End Sub
-