home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Windows 95.com 1996 September
/
WIN95_09962.iso
/
vrml
/
cp2b2x.exe
/
DATA.Z
/
sphere.tcl
< prev
next >
Wrap
Text File
|
1996-06-26
|
1KB
|
54 lines
# Initialize
set bColor 0
proc vs_H_InitMove { obj event userdata } {
vsNewVariable $obj flg 0 ;# move direction
vsNewVariable $obj count 0 ;# counter
}
# move
proc vs_H_PeriodicMove { obj event userdata } {
global vsCSLocal vsRelative vsSuccess vsCSWorld vsAbsolute
global vsContinue vsStop
set local_count [ vsGetVariable $obj count ]
set local_flg [ vsGetVariable $obj flg ]
if { $local_flg } {
set ret [ vsTranslate $obj 0.0 0.8 0.0 $vsCSWorld $vsRelative ]
} else {
set ret [ vsTranslate $obj 0.0 -0.8 0.0 $vsCSWorld $vsRelative ]
}
if { $ret != $vsSuccess } {
vsWarning "vsTranslate failed"
}
# increment count
set local_count [ expr $local_count + 1 ]
if { $local_count >= 40 } {
set local_flg [ expr ~$local_flg ]
set local_count 0
}
# store variables
vsSetVariable $obj count $local_count
vsSetVariable $obj flg $local_flg
return $vsContinue
}
proc myClickColor { obj event userData } {
global bColor
global vsDiffuse
if {$bColor == 0} {
set bColor 1
vsSetObjAllMaterial $obj $vsDiffuse 1 0 0
} elseif {$bColor == 1} {
set bColor 0
vsSetObjAllMaterial $obj $vsDiffuse 0 0.8 0.8
}
}