From 87db3bff624ea61d6317321a423aa3093fa320b8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 18 Aug 2006 23:35:58 +0000 Subject: movei15 update (16aug06) git-svn-id: svn://tug.org/texlive/trunk@1980 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/movie15/dice.js | 144 +++++++++++++++--------- Master/texmf-dist/doc/latex/movie15/dice.vws | 14 +-- Master/texmf-dist/doc/latex/movie15/movie15.pdf | Bin 248565 -> 249626 bytes Master/texmf-dist/doc/latex/movie15/movie15.tex | 15 +-- Master/texmf-dist/tex/latex/movie15/movie15.sty | 39 +++++-- Master/texmf-dist/tpm/movie15.tpm | 8 +- 6 files changed, 140 insertions(+), 80 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/movie15/dice.js b/Master/texmf-dist/doc/latex/movie15/dice.js index 0b752c53b59..e5561194c32 100644 --- a/Master/texmf-dist/doc/latex/movie15/dice.js +++ b/Master/texmf-dist/doc/latex/movie15/dice.js @@ -1,56 +1,98 @@ +////////////////////////// +// add our own lights +////////////////////////// //first remove any scene lights -var lightIndex = scene.lights.count - 1; -for (; lightIndex >= 0; lightIndex--) -{ - scene.lights.removeByIndex(lightIndex); +for (var i = scene.lights.count - 1; i >= 0; i--) { + scene.lights.removeByIndex(i); } -////set background color -//changer = new RenderEventHandler(); -//changer.onEvent = function(event) -//{ -// event.canvas.background.setColor(new Color(1,1,1)); -//} -//runtime.addEventHandler(changer); - -//add our own lighting -lights = new Object(); -lights.init = function() -{ - //from left - l1 = scene.createLight(); - l1.color.set3(1,1,1); - l1.brightness = .4; - l1.direction.set3(1,0,0); //NB: direction, not source! - - //from right - l2 = scene.createLight(); - l2.color.set3(1,1,1); - l2.brightness = .4; - l2.direction.set3(-1,0,0); - - //from bottom - l3 = scene.createLight(); - l3.color.set3(1,1,1); - l3.brightness = .4; - l3.direction.set3(0,0,1); - - //from top - l4 = scene.createLight(); - l4.color.set3(1,1,1); - l4.brightness = .4; - l4.direction.set3(0,0,-1); - - //from front - l5 = scene.createLight(); - l5.color.set3(1,1,1); - l5.brightness = .4; - l5.direction.set3(0,1,0); - - //from back - l6 = scene.createLight(); - l6.color.set3(1,1,1); - l6.brightness = .4; - l6.direction.set3(0,-1,0); +lights = new Object(); +lights.init = function() { + //from left + l1 = scene.createLight(); + l1.color.set3(1,1,1); + l1.brightness = .4; + l1.direction.set3(1,0,0); //NB: direction, not source! + + //from right + l2 = scene.createLight(); + l2.color.set3(1,1,1); + l2.brightness = .4; + l2.direction.set3(-1,0,0); + + //from bottom + l3 = scene.createLight(); + l3.color.set3(1,1,1); + l3.brightness = .4; + l3.direction.set3(0,0,1); + + //from top + l4 = scene.createLight(); + l4.color.set3(1,1,1); + l4.brightness = .4; + l4.direction.set3(0,0,-1); + + //from front + l5 = scene.createLight(); + l5.color.set3(1,1,1); + l5.brightness = .4; + l5.direction.set3(0,1,0); + + //from back + l6 = scene.createLight(); + l6.color.set3(1,1,1); + l6.brightness = .4; + l6.direction.set3(0,-1,0); } + lights.init(); + +//////////////////////////////////////////////////////////////////////// +// get rid of Gimbal rotation; as a result the z-axis will always be up; +// this part of the script should work off the shelf with _any_ 3D model +//////////////////////////////////////////////////////////////////////// +var max_theta = 88; // maximum pitch (degrees from horizontal) of the camera +var sin_max_theta = Math.sin(max_theta * Math.PI/180); +var tan_max_theta = Math.tan(max_theta * Math.PI/180); + +mouseEventHandler = new MouseEventHandler(); +mouseEventHandler.onMouseMove = true; +mouseEventHandler.onEvent = function(event) { + if(event.currentTool == runtime.TOOL_NAME_ROTATE) { + var camera = scene.cameras.getByIndex(0); + var c2c = camera.position.subtract(camera.targetPosition); + var roo = c2c.length; + + try { + var sin_theta = c2c.z / roo; + if(sin_theta == 1) {//top view + c2c.z = roo * sin_max_theta; + c2c.y = -c2c.z / tan_max_theta; + c2c.x = 0 + } + else if(sin_theta == -1) {//bottom view + c2c.z = -roo * sin_max_theta; + c2c.y = c2c.z / tan_max_theta; + c2c.x = 0 + } + else if(sin_max_theta < sin_theta){//camera too high + c2c.z = Math.sqrt(c2c.x * c2c.x + c2c.y * c2c.y) * tan_max_theta; + c2c.normalize(); + c2c.scaleInPlace(roo); + } + else if(sin_theta < -sin_max_theta){//camera too low + c2c.z = -Math.sqrt(c2c.x * c2c.x + c2c.y * c2c.y) * tan_max_theta; + c2c.normalize(); + c2c.scaleInPlace(roo); + } + + //corrected camera position + camera.position.set(camera.targetPosition.add(c2c)); + } + catch(e) {} + + camera.roll=0; //z-axis always up + } +} + +runtime.addEventHandler(mouseEventHandler); diff --git a/Master/texmf-dist/doc/latex/movie15/dice.vws b/Master/texmf-dist/doc/latex/movie15/dice.vws index 96894f51dd4..06a7e496061 100644 --- a/Master/texmf-dist/doc/latex/movie15/dice.vws +++ b/Master/texmf-dist/doc/latex/movie15/dice.vws @@ -1,7 +1,7 @@ -[Front]{0 0 0}{0 -1 0}{28}{30} -[Back]{0 0 0}{0 1 0}{28}{30} -[Left]{0 0 0}{-1 0 0}{28}{30} -[Right]{0 0 0}{1 0 0}{28}{30} -[Top]{0 0 0}{0 0 1}{28}{30} -[Bottom]{0 0 0}{0 0 -1}{28}{30} -[Fish Eye at Centre]{0 0 0}{0 -1 0}{0.00001}{130} +[Front]{}{0 -1 0}{27}{}% using defaults coo=0 0 0 (arg #2) and aac=30 (arg #5) +[Back]{}{0 1 0}{27}{} +[Left]{}{-1 0 0}{27}{} +[Right]{}{1 0 0}{27}{} +[Top]{}{0 0 1}{27}{} +[Bottom]{}{0 0 -1}{27}{} +[Fish Eye at Centre]{}{0 -1 0}{}{130}% using defaults coo=0 0 0 (arg #2) and roo=0 (arg #4) diff --git a/Master/texmf-dist/doc/latex/movie15/movie15.pdf b/Master/texmf-dist/doc/latex/movie15/movie15.pdf index ab049fb499a..3b4afa9dacc 100644 Binary files a/Master/texmf-dist/doc/latex/movie15/movie15.pdf and b/Master/texmf-dist/doc/latex/movie15/movie15.pdf differ diff --git a/Master/texmf-dist/doc/latex/movie15/movie15.tex b/Master/texmf-dist/doc/latex/movie15/movie15.tex index 20b5c3ab5ff..b81e6e07f3b 100644 --- a/Master/texmf-dist/doc/latex/movie15/movie15.tex +++ b/Master/texmf-dist/doc/latex/movie15/movie15.tex @@ -255,7 +255,7 @@ are allowed. \end{verbatim} \verb++ (always positive!) specifies the radius of orbit $ROO$ of the virtual camera. See option `\verb+3Dc2c+' for the number format of \verb++. -Without the above options the immovable camera sits at the origin $(0,0,0)$ of the World, looking in the positive $Y$ direction, i. e. default settings of \verb+3Droo=0+, \verb+3Dcoo=0 0 0+ and \verb+3Dc2c=0 -1 0+ are assumed. (Note that $\overrightarrow{C2C}$ is the opposite of the view vector!) +Without the above options the virtual camera sits at the origin $(0,0,0)$ of the World, looking in the positive $Y$ direction, i. e. default settings of \verb+3Droo=0+, \verb+3Dcoo=0 0 0+ and \verb+3Dc2c=0 -1 0+ are assumed. (Note that $\overrightarrow{C2C}$ is the opposite of the view vector!) Thus, in order to get a `front view' of the 3D object it is sufficient to gradually increase the radius $ROO$ from \LaTeX{} run to \LaTeX{} run until the object or group of objects can be fully seen in the viewport. Since the object size in terms of world coordinate units may differ in orders of magnitude between U3D files, the optimal `\verb+3Droo+' setting might be found by experimenting with a series of geometrically increasing numbers, such as 1, 10, 100, 1000, 10000 etc. to get a rough approximation and by subsequent fine tuning using smaller changes. @@ -270,7 +270,7 @@ Instead of or in addition to the default view, further \emph{named views} can be \begin{verbatim} []{ }{ }{}{} \end{verbatim} -The \verb++ entry is optional. If \verb++ is not given, a default name consisting of `View' followed by the number of the current entry in the list is formed. For \verb++, \verb++, \verb++, \verb++, \verb++, \verb++, \verb++ and \verb++ the same rules as for the corresponding options `\verb+3Dcoo+', `\verb+3Dc2c+', `\verb+3Droo+' and `\verb+3Daac+' apply. Trailing spaces or comment signs (\%) are allowed. Reading of the file stops either at its end, at the first empty line encountered or at the first line containing nothing but spaces and/or a comment sign followed by arbitrary stuff. +The \verb++ entry is optional. If \verb++ is not given, a default name consisting of `View' followed by the number of the current entry in the list is formed. For \verb++, \verb++, \verb++, \verb++, \verb++, \verb++, \verb++ and \verb++ the same rules as for the corresponding options `\verb+3Dcoo+', `\verb+3Dc2c+', `\verb+3Droo+' and `\verb+3Daac+' apply. Empty braces, \verb+{}+, are possible and cause default values to be used. Trailing spaces or comment signs (\%) are allowed. Reading of the file stops either at its end, at the first empty line encountered or at the first line containing nothing but spaces and/or a comment sign followed by arbitrary stuff. \begin{verbatim} 3Dbg= @@ -438,7 +438,7 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \begin{minipage}{0.5\linewidth} \begin{center} \includemovie[poster, label=alien, text=(AlienSong.mpg), url, playerid=AAPL_QuickTime, repeat]{\linewidth}{.75\linewidth}{http://www.linux-video.net/Samples/Mpeg1/AlienSong.mpg}\\ - %\includemovie[poster, label=alien, text=(AlienSong.mpg), playerid=AAPL_QuickTime, repeat]{\linewidth}{.75\linewidth}{AlienSong.mpg}\\ +% \includemovie[poster, label=alien, text=(AlienSong.mpg), playerid=AAPL_QuickTime, repeat]{\linewidth}{.75\linewidth}{AlienSong.mpg}\\ \movieref[rate=0.5]{alien}{Slow}\hfill \movieref{alien}{Normal}\hfill \movieref[rate=2]{alien}{Fast}\hfill @@ -446,7 +446,7 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \end{center} \end{minipage} -\item\label{ex3d} Embedded U3D file. It is based on a VRML model by Peter Whitehouse \href{mailto:pwhitehouse@optusnet.com.au}{\tt }. Conversion to U3D has been made with DeepExploration\textsuperscript{\scriptsize\textregistered}\cite{dexp}. A file `{\tt dice.vws}' that provides additional views and a JavaScript `{\tt dice.js}' defining light sources have been associated with the 3D object. +\item\label{ex3d} Embedded U3D file. It is based on a VRML model by Peter Whitehouse \href{mailto:pwhitehouse@optusnet.com.au}{\tt }. Conversion to U3D has been made with DeepExploration\textsuperscript{\scriptsize\textregistered}\cite{dexp}. The file `{\tt dice.vws}' provides additional views to be selected from the 3D toolbar or by right click. The JavaScript `{\tt dice.js}' defines light sources and disables the annoying Gimbal rotation mode. \begin{minipage}{0.5\linewidth} {\tt% @@ -454,7 +454,7 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda \phantom{xx}poster,\\ \phantom{xx}label=dice,\\ \phantom{xx}text=(dice.u3d),\\ - \phantom{xx}3Droo=28,\\ + \phantom{xx}3Droo=27,\\ \phantom{xx}3Dc2c=1 -1 1,\\ \phantom{xx}3Dbg=1 1 1,\\ \phantom{xx}3Dviews=dice.vws,\\ @@ -478,11 +478,12 @@ The duration of the media segment to be played. The trailing `\verb+s+' is manda poster, label=dice, text=(dice.u3d), - 3Droo=28, + 3Droo=27, 3Dc2c=1 -1 1, 3Dbg=1 1 1, 3Dviews=dice.vws, - 3Djscript=dice.js]{\linewidth}{\linewidth}{dice.u3d} + 3Djscript=dice.js + ]{\linewidth}{\linewidth}{dice.u3d} \end{center} \movieref[3Dviewindex=N]{dice}{Click here} to cycle through the list of additional views. \movieref[3Dcalculate=60]{dice}{This link} calculates 3D option settings for a 60\textdegree{} aperture angle of the virtual camera. \end{minipage} diff --git a/Master/texmf-dist/tex/latex/movie15/movie15.sty b/Master/texmf-dist/tex/latex/movie15/movie15.sty index 694aa7a09fd..44702431632 100644 --- a/Master/texmf-dist/tex/latex/movie15/movie15.sty +++ b/Master/texmf-dist/tex/latex/movie15/movie15.sty @@ -9,7 +9,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{movie15}[2006/07/27] +\ProvidesPackage{movie15}[2006/08/15] \RequirePackage{keyval} \RequirePackage{ifthen} \RequirePackage{ifpdf} @@ -378,9 +378,11 @@ \@MXV@viewx\space\@MXV@viewy\space\@MXV@viewz}% \fi% %translation vector - \FPupn\@MXV@transx{#1 #7 abs \@MXV@viewx{} mul sub}% - \FPupn\@MXV@transy{#2 #7 abs \@MXV@viewy{} mul sub}% - \FPupn\@MXV@transz{#3 #7 abs \@MXV@viewz{} mul sub}% + \FPupn\@MXV@roo{#7 abs}% + \FPiflt\@MXV@roo{0.001}\FPupn\@MXV@roo{0.001}\fi% + \FPupn\@MXV@transx{#1 \@MXV@roo{} \@MXV@viewx{} mul sub}% + \FPupn\@MXV@transy{#2 \@MXV@roo{} \@MXV@viewy{} mul sub}% + \FPupn\@MXV@transz{#3 \@MXV@roo{} \@MXV@viewz{} mul sub}% %transformation matrix \xdef\@MXV@matrix{% \@MXV@matrix\space\@MXV@transx\space\@MXV@transy\space\@MXV@transz% @@ -390,10 +392,26 @@ %macro for parsing one line of 3D views file \newcommand{\@MXV@parseline}[5][]{% \xdef\@MXV@xname{#1}% name of the view (optional) - \xdef\@MXV@coo{#2}% - \xdef\@MXV@ctoc{#3}% - \xdef\@MXV@roo{#4}% - \xdef\@MXV@aac{#5}% + \ifthenelse{\equal{#2}{}}{% + \xdef\@MXV@coo{0 0 0}% + }{% + \xdef\@MXV@coo{#2}% + }% + \ifthenelse{\equal{#3}{}}{% + \xdef\@MXV@ctoc{0 -1 0}% + }{% + \xdef\@MXV@ctoc{#3}% + }% + \ifthenelse{\equal{#4}{}}{% + \xdef\@MXV@roo{0}% + }{% + \xdef\@MXV@roo{#4}% + }% + \ifthenelse{\equal{#5}{}}{% + \xdef\@MXV@aac{30}% + }{% + \xdef\@MXV@aac{#5}% + }% } %macro for generating an array of 3D views (varray) @@ -412,7 +430,6 @@ \IfFileExists{\@MXV@viewsfile}{% \edef\@MXV@endlinechar{\the\endlinechar}% \endlinechar=-1% suppress trailing space at input line end - \edef\@MXV@coo{}\edef\@MXV@ctoc{}\edef\@MXV@roo{}% \newread\@MXV@@viewsfile% \openin\@MXV@@viewsfile=\@MXV@viewsfile% \loop% @@ -2137,7 +2154,7 @@ )[\@MXV@getlabelvalue{@MXV@\@MXV@@label.3Doncurpage}-1]; annot3D["\@MXV@label"].activated=true; }catch(e){% - spc=String.fromCharCode(32); + var spc=String.fromCharCode(32); app.alert("3D" + spc + "annotation" + spc + "could" + spc + "not" + spc + "be" + spc + "activated!"); }% @@ -2271,7 +2288,7 @@ % %assemble result string var res = ''; - spc=String.fromCharCode(32); + var spc=String.fromCharCode(32); if(aac != 30){% res += util.printf('3Daac=\%s,' + spc, % (Math.abs(aac) < 1.001e-6 && Math.abs(aac) > 0 ? % diff --git a/Master/texmf-dist/tpm/movie15.tpm b/Master/texmf-dist/tpm/movie15.tpm index faf84318165..fcd920e01ab 100644 --- a/Master/texmf-dist/tpm/movie15.tpm +++ b/Master/texmf-dist/tpm/movie15.tpm @@ -3,7 +3,7 @@ movie15 Package - 2006/07/26 13:35:00 + 2006/08/15 07:56:00 2005/07/01 rahtz Multimedia inclusion package. @@ -15,13 +15,13 @@ played back synchronously. [description copied from TeX Catalogue] Alexander Grahn - 612929 + 654776 - + texmf-dist/tex/latex/movie15/movie15.sty texmf-dist/tpm/movie15.tpm - + texmf-dist/doc/latex/movie15/3dsystem.fig texmf-dist/doc/latex/movie15/3dsystem.pdf texmf-dist/doc/latex/movie15/3dsystem.tex -- cgit v1.2.3