home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "03_02 Robot"
- ClientHeight = 5430
- ClientLeft = 915
- ClientTop = 1230
- ClientWidth = 6210
- Height = 5805
- Left = 855
- LinkTopic = "Form1"
- ScaleHeight = 5430
- ScaleWidth = 6210
- Top = 915
- Width = 6330
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 5412
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 6132
- _Version = 131072
- _ExtentX = 10816
- _ExtentY = 9546
- _StockProps = 0
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub Form_Initialize()
- Call V3Space1.deleteSceneGraph
- Dim robot As SoSeparator
- Set robot = makeRobot()
- Dim sceneRoot As SoSelection
- Set sceneRoot = V3Space1.getSceneRoot
- Call sceneRoot.addChild(robot)
- Call V3Space1.viewAll
- End Sub
- Public Function makeRobot()
- 'Robot with legs
- 'Construct parts for legs (thigh, calf and foot)
- Dim thigh As SoCube
- Set thigh = New SoCube
- Call thigh.Width.setValue(1.2)
- Call thigh.Height.setValue(2.2)
- Call thigh.depth.setValue(1.1)
- Dim calfTransform As SoTransform
- Set calfTransform = New SoTransform
- Call calfTransform.translation.setValue(0#, -2.25, 0#)
- Dim calf As SoCube
- Set calf = New SoCube
- Call calf.Width.setValue(1#)
- Call calf.Height.setValue(2.2)
- Call calf.depth.setValue(1)
- Dim footTransform As SoTransform
- Set footTransform = New SoTransform
- Call footTransform.translation.setValue(0#, -1.5, 0.5)
- Dim foot As SoCube
- Set foot = New SoCube
- Call foot.Width.setValue(0.8)
- Call foot.Height.setValue(0.8)
- Call foot.depth.setValue(2#)
- 'Put leg parts together
- Dim leg As SoGroup
- Set leg = New SoGroup
- Call leg.addChild(thigh)
- Call leg.addChild(calfTransform)
- Call leg.addChild(calf)
- Call leg.addChild(footTransform)
- Call leg.addChild(foot)
- Dim leftTransform As SoTransform
- Set leftTransform = New SoTransform
- Call leftTransform.translation.setValue(1#, -4.25, 0#)
- 'Left leg
- Dim leftLeg As SoSeparator
- Set leftLeg = New SoSeparator
- Call leftLeg.addChild(leftTransform)
- Call leftLeg.addChild(leg)
- Dim rightTransform As SoTransform
- Set rightTransform = New SoTransform
- Call rightTransform.translation.setValue(-1#, -4.25, 0#)
- 'Right leg
- Dim rightLeg As SoSeparator
- Set rightLeg = New SoSeparator
- Call rightLeg.addChild(rightTransform)
- Call rightLeg.addChild(leg)
- 'Parts for body
- Dim bodyTransform As SoTransform
- Set bodyTransform = New SoTransform
- Call bodyTransform.translation.setValue(0#, 3#, 0#)
- Dim bronze As SoMaterial
- Set bronze = New SoMaterial
- Call bronze.ambientColor.setValue(0.33, 0.22, 0.27)
- Call bronze.diffuseColor.setValue(0.78, 0.57, 0.11)
- Call bronze.specularColor.setValue(0.99, 0.94, 0.81)
- Call bronze.shininess.setValue(0.28)
- Dim bodyCylinder As SoCylinder
- Set bodyCylinder = New SoCylinder
- Call bodyCylinder.radius.setValue(2.5)
- Call bodyCylinder.Height.setValue(6#)
- 'Construct body out of parts
- Dim body As SoSeparator
- Set body = New SoSeparator
- Call body.addChild(bodyTransform)
- Call body.addChild(bronze)
- Call body.addChild(bodyCylinder)
- Call body.addChild(leftLeg)
- Call body.addChild(rightLeg)
- 'Head parts
- Dim headTransform As SoTransform
- Set headTransform = New SoTransform
- Call headTransform.translation.setValue(0#, 7.5, 0#)
- Call headTransform.scaleFactor.setValue(1.5, 1.5, 1.5)
- Dim silver As SoMaterial
- Set silver = New SoMaterial
- Call silver.ambientColor.setValue(0.2, 0.2, 0.2)
- Call silver.diffuseColor.setValue(0.6, 0.6, 0.6)
- Call silver.specularColor.setValue(0.5, 0.5, 0.5)
- Call silver.shininess.setValue(0.5)
- Dim headSphere As SoSphere
- Set headSphere = New SoSphere
- 'Construct head
- Dim head As SoSeparator
- Set head = New SoSeparator
- Call head.addChild(headTransform)
- Call head.addChild(silver)
- Call head.addChild(headSphere)
- 'Robot is just head and body
- Dim robot As SoSeparator
- Set robot = New SoSeparator
- Call robot.addChild(body)
- Call robot.addChild(head)
- Set makeRobot = robot
- 'Clean up
- Set thigh = Nothing
- Set calfTransform = Nothing
- Set calf = Nothing
- Set leftLeg = Nothing
- Set rightTransform = Nothing
- Set rightLeg = Nothing
- Set bodyTransform = Nothing
- Set bronze = Nothing
- Set bodyCylinder = Nothing
- Set footTransform = Nothing
- Set foot = Nothing
- Set leg = Nothing
- Set leftTransform = Nothing
- Set leftLeg = Nothing
- Set body = Nothing
- Set bodyTransform = Nothing
- Set bronze = Nothing
- Set headTransform = Nothing
- Set silver = Nothing
- Set headSphere = Nothing
- Set head = Nothing
- Set robot = Nothing
- End Function
-