home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "15_4 Customize"
- ClientHeight = 6915
- ClientLeft = 1140
- ClientTop = 1425
- ClientWidth = 6690
- Height = 7290
- Left = 1080
- LinkTopic = "Form1"
- ScaleHeight = 6915
- ScaleWidth = 6690
- Top = 1110
- Width = 6810
- Begin VB.Label Label1
- Caption = $"15_4Customize.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 = 2535
- Left = 240
- TabIndex = 1
- Top = 240
- Width = 6255
- End
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 3975
- Left = 120
- TabIndex = 0
- Top = 2880
- Width = 6375
- _Version = 131072
- _ExtentX = 11245
- _ExtentY = 7011
- _StockProps = 0
- decorationOn = 0 'False
- viewingOn = 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 3 translate1Draggers and place them in space.
- Dim xDragSep As SoSeparator
- Set xDragSep = New SoSeparator
- Dim yDragSep As SoSeparator
- Set yDragSep = New SoSeparator
- Dim zDragSep As SoSeparator
- Set zDragSep = New SoSeparator
- Call root.addChild(xDragSep)
- Call root.addChild(yDragSep)
- Call root.addChild(zDragSep)
- 'Separators will each hold a different transform
- Dim xDragXf As SoTransform
- Set xDragXf = New SoTransform
- Dim yDragXf As SoTransform
- Set yDragXf = New SoTransform
- Dim zDragXf As SoTransform
- Set zDragXf = New SoTransform
- Call xDragXf.setFieldDataString("translation 0 -4 8")
- Call yDragXf.setFieldDataString("translation -8 0 8 rotation 0 0 1 1.57")
- Call zDragXf.setFieldDataString("translation -8 -4 0 rotation 0 1 0 -1.57")
- Call xDragSep.addChild(xDragXf)
- Call yDragSep.addChild(yDragXf)
- Call zDragSep.addChild(zDragXf)
- 'Add the draggers under the separators, after transforms
- Dim xDragger As SoTranslate1Dragger
- Set xDragger = New SoTranslate1Dragger
- Dim yDragger As SoTranslate1Dragger
- Set yDragger = New SoTranslate1Dragger
- Dim zDragger As SoTranslate1Dragger
- Set zDragger = New SoTranslate1Dragger
- Call xDragSep.addChild(xDragger)
- Call yDragSep.addChild(yDragger)
- Call zDragSep.addChild(zDragger)
- 'Create myTranslator and myTranslatorActive.
- 'These are custom geometry for the draggers.
- Dim myTranslator As SoSeparator
- Set myTranslator = New SoSeparator
- Dim myTranslatorActive As SoSeparator
- Set myTranslatorActive = New SoSeparator
- 'Materials for the dragger in regular and active states
- Dim myMtl As SoMaterial
- Set myMtl = New SoMaterial
- Dim myActiveMtl As SoMaterial
- Set myActiveMtl = New SoMaterial
- Call myMtl.diffuseColor.setValue(1, 1, 1)
- Call myActiveMtl.diffuseColor.setValue(1, 1, 0)
- Call myTranslator.addChild(myMtl)
- Call myTranslatorActive.addChild(myActiveMtl)
- 'Same shape for both versions.
- Dim myCube As SoCube
- Set myCube = New SoCube
- Call myCube.setFieldDataString("width 3 height .4 depth .4")
- Call myTranslator.addChild(myCube)
- Call myTranslatorActive.addChild(myCube)
- ' Now, customize the draggers with the pieces we created.
- Call xDragger.setPart(utlSbName("translator"), myTranslator)
- Call xDragger.setPart(utlSbName("translatorActive"), myTranslatorActive)
- Call yDragger.setPart(utlSbName("translator"), myTranslator)
- Call yDragger.setPart(utlSbName("translatorActive"), myTranslatorActive)
- Call zDragger.setPart(utlSbName("translator"), myTranslator)
- Call zDragger.setPart(utlSbName("translatorActive"), myTranslatorActive)
- 'Create shape kit for the 3D text
- 'The text says 'Slide Cubes To Move Me'
- Dim textKit As SoShapeKit
- Set textKit = New SoShapeKit
- Call root.addChild(textKit)
- Dim myText3 As SoText3
- Set myText3 = New SoText3
- Call textKit.setPart(utlSbName("shape"), myText3)
- Call myText3.justification.setValue(SoText3_CENTER)
- Call myText3.Str.set1Value(0, "Slide Cubes")
- Call myText3.Str.set1Value(1, "To")
- Call myText3.Str.set1Value(2, "Move Me")
- Call textKit.setParam("font { size 2}")
- Call textKit.setParam("material { diffuseColor 1 1 0}")
- 'Create shape kit for surrounding box.
- 'It's an unpickable cube, sized as (16,8,16)
- Dim boxKit As SoShapeKit
- Set boxKit = New SoShapeKit
- Call root.addChild(boxKit)
- Dim cube As SoCube
- Set cube = New SoCube
- Call boxKit.setPart(utlSbName("shape"), cube)
- Call boxKit.setParam("drawStyle { style LINES }")
- Call boxKit.setParam("pickStyle { style UNPICKABLE }")
- Call boxKit.setParam("material { emissiveColor 1 0 1 }")
- Call boxKit.setParam("shape { width 16 height 8 depth 16 }")
- 'Create the calculator to make a translation
- 'for the text. The x component of a translate1Dragger's
- 'translation field shows how far it moved in that
- 'direction. So our text's translation is:
- '(xDragTranslate[0],yDragTranslate[0],zDragTranslate[0])
- Static myCalc As SoCalculator
- Set myCalc = New SoCalculator
- Call myCalc.AU.connectFrom(xDragger.translation)
- Call myCalc.BU.connectFrom(yDragger.translation)
- Call myCalc.CU.connectFrom(zDragger.translation)
- Call myCalc.expression.setValue("oA = vec3f(A[0],B[0],C[0])")
- 'Connect the the translation in textKit from myCalc
- Dim textXf As SoTransform
-
- Set textXf = textKit.getPart(utlSbName("transform"), True)
- Call textXf.translation.connectFromEngine(myCalc.oAU)
- Call V3Space1.setSceneRoot(root)
- Call V3Space1.viewAll
- End Sub
-