home *** CD-ROM | disk | FTP | other *** search
/ Using Visual Basic 5 (Platinum Edition) / vb5.iso / ACTIVEX / VIS3SPAC / DATA.9 / examples / vb / 15_2SliderBox / 15_2SliderBox.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-12-01  |  4.7 KB  |  122 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "15_2 SliderBox"
  4.    ClientHeight    =   5850
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1425
  7.    ClientWidth     =   6090
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   0
  11.       weight          =   700
  12.       size            =   12
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    Height          =   6225
  18.    Left            =   1080
  19.    LinkTopic       =   "Form1"
  20.    ScaleHeight     =   5850
  21.    ScaleWidth      =   6090
  22.    Top             =   1110
  23.    Width           =   6210
  24.    Begin VB.Label Label1 
  25.       Caption         =   $"15_2SliderBox.frx":0000
  26.       Height          =   1575
  27.       Left            =   120
  28.       TabIndex        =   1
  29.       Top             =   120
  30.       Width           =   5895
  31.    End
  32.    Begin TgsVisual3SpaceLibCtl.V3Space V3Space1 
  33.       Height          =   3855
  34.       Left            =   120
  35.       TabIndex        =   0
  36.       Top             =   1920
  37.       Width           =   5895
  38.       _Version        =   131072
  39.       _ExtentX        =   10398
  40.       _ExtentY        =   6800
  41.       _StockProps     =   0
  42.       decorationOn    =   0   'False
  43.       viewingOn       =   0   'False
  44.    End
  45. Attribute VB_Name = "Form1"
  46. Attribute VB_Creatable = False
  47. Attribute VB_Exposed = False
  48. Private Sub Form_Initialize()
  49.     Dim root As SoSeparator
  50.     Set root = New SoSeparator
  51.     'Create 3 translate1Draggers and place them in space.
  52.     Dim xDragSep, yDragSep, zDragSep As SoSeparator
  53.     Set xDragSep = New SoSeparator
  54.     Set yDragSep = New SoSeparator
  55.     Set zDragSep = New SoSeparator
  56.     Call root.addChild(xDragSep)
  57.     Call root.addChild(yDragSep)
  58.     Call root.addChild(zDragSep)
  59.     'Separators will each hold a different transform
  60.     Dim xDragXf, yDragXf, zDragXf As SoTransform
  61.     Set xDragXf = New SoTransform
  62.     Set yDragXf = New SoTransform
  63.     Set zDragXf = New SoTransform
  64.     Call xDragXf.setFieldDataString("translation  0 -4 8")
  65.     Call yDragXf.setFieldDataString("translation -8  0 8 rotation 0 0 1  1.57")
  66.     Call zDragXf.setFieldDataString("translation -8 -4 0 rotation 0 1 0 -1.57")
  67.     Call xDragSep.addChild(xDragXf)
  68.     Call yDragSep.addChild(yDragXf)
  69.     Call zDragSep.addChild(zDragXf)
  70.     'Add the draggers under the separators, after transforms
  71.     Dim xDragger, yDragger, zDragger As SoTranslate1Dragger
  72.     Set xDragger = New SoTranslate1Dragger
  73.     Set yDragger = New SoTranslate1Dragger
  74.     Set zDragger = New SoTranslate1Dragger
  75.     Call xDragSep.addChild(xDragger)
  76.     Call yDragSep.addChild(yDragger)
  77.     Call zDragSep.addChild(zDragger)
  78.     'Create shape kit for the 3D text
  79.     'The text says 'Slide Cubes To Move Me'
  80.     Dim textKit As SoShapeKit
  81.     Set textKit = New SoShapeKit
  82.     Call root.addChild(textKit)
  83.     Dim myText3 As SoText3
  84.     Set myText3 = New SoText3
  85.     Call textKit.setPart(utlSbName("shape"), myText3)
  86.     Call myText3.justification.setValue(SoText3_CENTER)
  87.     Call myText3.Str.set1Value(0, "Slide Arrows")
  88.     Call myText3.Str.set1Value(1, "To")
  89.     Call myText3.Str.set1Value(2, "Move Me")
  90.     Call textKit.setParam("font { size 2}")
  91.     Call textKit.setParam("material { diffuseColor 1 1 0}")
  92.     'Create shape kit for surrounding box.
  93.     'It's an unpickable cube, sized as (16,8,16)
  94.     Dim boxKit As SoShapeKit
  95.     Set boxKit = New SoShapeKit
  96.     Call root.addChild(boxKit)
  97.     Dim myCube As SoCube
  98.     Set myCube = New SoCube
  99.     Call boxKit.setPart(utlSbName("shape"), myCube)
  100.     Call boxKit.setParam("drawStyle { style LINES }")
  101.     Call boxKit.setParam("pickStyle { style UNPICKABLE }")
  102.     Call boxKit.setParam("material { emissiveColor 1 0 1 }")
  103.     Call boxKit.setParam("shape { width 16 height 8 depth 16 }")
  104.     'Create the calculator to make a translation
  105.     'for the text.  The x component of a translate1Dragger's
  106.     'translation field shows how far it moved in that
  107.     'direction. So our text's translation is:
  108.     '(xDragTranslate[0],yDragTranslate[0],zDragTranslate[0])
  109.     Static myCalc As SoCalculator
  110.     Set myCalc = New SoCalculator
  111.     Call myCalc.AU.connectFrom(xDragger.translation)
  112.     Call myCalc.BU.connectFrom(yDragger.translation)
  113.     Call myCalc.CU.connectFrom(zDragger.translation)
  114.     Call myCalc.expression.setValue("oA = vec3f(A[0],B[0],C[0])")
  115.     'Connect the the translation in textKit from myCalc
  116.     Dim textXf As SoTransform
  117.     Set textXf = textKit.getPart(utlSbName("transform"), True)
  118.     Call textXf.translation.connectFromEngine(myCalc.oAU)
  119.     Call V3Space1.setSceneRoot(root)
  120.     Call V3Space1.viewAll
  121. End Sub
  122.