Quicktime VR panorama movies in revlets
BNig
niggemann at uni-wh.de
Fri Dec 4 07:49:20 EST 2009
Currently it is not possible to display panorama movies (VR) in revlets.
(Report #8294 in QCC by Jacqueline) Over on the Runrev forum Dixie found an
approach that I expanded on
(http://forums.runrev.com/phpBB2/viewtopic.php?f=9&t=4479) and it turns out
it is a quite satisfactory solution, not as slick as native QTVR, especially
not cursors, but OK.
Jacque suggested I post the code that you put into the script of a player
and it should work for QTVR in revlets. An example can be seen here:
http://berndniggemann.on-rev.com/qtvr/
as usual watch for linebreaks
---------------------------------------------
local moviePan,movieRotateH,movieRotateStartLocH
local movieTilt,movieRotateV,movieRotateStartLocV
local movieZoom, tTiltConstraintsLow, tTiltConstraintsHigh,
tZoomConstraintsLow, tZoomConstraintsHigh
local tConstraintsOfMovie, zoomLength
on mouseDown
set the qtidlerate to 5
put 0 into movieRotateH
put the clickLoc into tClick
put the pan of me into moviePan
put item 1 of tClick into movieRotateStartLocH
put 0 into movieRotateV
put the tilt of me into movieTilt
put item 2 of tClick into movieRotateStartLocV
if tConstraintsOfMovie is "" then -- has not yet been initialized/first
time
initializeTheMovie
end if
updateMovie
end mouseDown
on mouseWithin
if the controlkey is down or the shiftkey is down then
if tConstraintsOfMovie is "" then initializeTheMovie -- only if not
initialized
-- increases the responsiveness
set the idlerate to 10
-- lock screen because we do screen updates
lock screen
if the controlkey is down then
put (movieZoom + 0.2) into movieZoom
if movieZoom >= tZoomConstraintsLow then put tZoomConstraintsLow
into movieZoom
set the zoom of me to movieZoom
end if
if the shiftKey is down then
put (movieZoom - 0.2) into movieZoom
if movieZoom <= tZoomConstraintsHigh then put tZoomConstraintsHigh
into movieZoom
set the zoom of me to movieZoom
end if
unlock screen
else
-- set idlerate back up to reduce burden on cpu or set it here to be
30
-- idlerate is the time in milliseconds between e.g. mouseWithin
messages beeing sent
set the idlerate to 30
end if
end mouseWithin
on mouseMove newMouseH,newMouseV
put ((movieRotateStartLocH - newMouseH) * .01) into movieRotateH
put ((movieRotateStartLocV - newMouseV) * .01) into movieRotateV
end mouseMove
on updateMovie
if the mouse is up then
repeat for each line cancelMessage in the pendingMessages
if item 3 of cancelMessage is "updateMovie" then
cancel (item 1 of cancelMessage)
end if
end repeat
put 0 into movieRotateH
set the qtidlerate to 50
exit updateMovie
end if
-- lock screen cause we do 2 screen updates
lock screen
add movieRotateH to moviePan
set the pan of me to moviePan
add movieRotateV to movieTilt
-- adjusts the max tilt to the zoomlevel, when zoomed out max tilt is low
or zero
-- when zoomed in tilt is highest at the zoomconstraints
-- this avoids that the user has to wait until movieTilt comes down
put 1- ((movieZoom - tZoomConstraintsHigh)/zoomLength) into zoomFactor
put tTiltConstraintsHigh * (zoomFactor +.07) into MaxTilt
put 0 - MaxTilt into MinTilt
if movieTilt < MinTilt then put MinTilt into movieTilt
if movieTilt > MaxTilt then put MaxTilt into movieTilt
set the tilt of me to movieTilt
unlock screen
-- put "tilt " & movieTilt && "zoom " & movieZoom && "pan " & moviePan
-- just to not pile up messages
if "updateMovie" is not in the pendingMessages then send updateMovie to
me in 10 millisecs
end upDateMovie
-- to catch mighty mouse scrollball and Mac touchpad
on rawKeyDown theKey
if not (the mouseloc is within the rect of me) then pass rawKeyDown
--if theKey is not among the words of "65311 65310 65309 65308" then pass
rawKeyDown
if tConstraintsOfMovie = "" then -- was not inititalized by mouseDown
initializeTheMovie
end if
switch theKey
case "65311" -- left touchpad/scrollball
subtract 1 from moviePan
set the pan of me to moviePan
break
case "65310" -- right left touchpad/scrollball
add 1 to moviePan
set the pan of me to moviePan
break
case "65309" -- forward touchpad/scrollball
case "65362" -- up arrow
put (movieZoom - 0.4) into movieZoom
if movieZoom <= tZoomConstraintsHigh then put tZoomConstraintsHigh
into movieZoom
set the zoom of me to movieZoom
break
case "65308" -- backward touchpad/scrollball
put (movieZoom + 0.4) into movieZoom
if movieZoom >= tZoomConstraintsLow then put tZoomConstraintsLow
into movieZoom
set the zoom of me to movieZoom
break
end switch
end rawKeyDown
on mouseUp
-- this handler refocuses on the player
-- since mouseWithin is lost if during mouse movements with the mouse
down
-- the cursor leaves the player rect and comes back.
-- this restores mouseWithin messages so the shift/ctrl keys work
put 0 into movieRotateH -- to reset in case a "updateMovie" is still
pending
put 0 into movieRotateV -- to reset in case a "updateMovie" is still
pending
put the mouseloc into aLoc
lock screen
click at 1,1
set the screenmouseLoc to globalloc (aLoc)
unlock screen
end mouseUp
private command initializeTheMovie
put the constraints of me into tConstraintsOfMovie
put (item 1 of line 2 of tConstraintsOfMovie) into tTiltConstraintsLow
put (item 2 of line 2 of tConstraintsOfMovie) into tTiltConstraintsHigh
put (item 1 of line 3 of tConstraintsOfMovie) into tZoomConstraintsHigh
put (item 2 of line 3 of tConstraintsOfMovie) into tZoomConstraintsLow
put the zoom of me into movieZoom
put the tilt of me into movieTilt
put the pan of me into moviePan
put tZoomConstraintsLow - tZoomConstraintsHigh into zoomLength
end initializeTheMovie
---------------------------
regards
Bernd Niggemann
--
View this message in context: http://n4.nabble.com/Quicktime-VR-panorama-movies-in-revlets-tp948484p948484.html
Sent from the Revolution - User mailing list archive at Nabble.com.
More information about the use-livecode
mailing list