From 775b0205d5a6a908604168ebeb3c22442e84303f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 12 Sep 2012 22:14:20 +0000 Subject: media9 (12sep12) git-svn-id: svn://tug.org/texlive/trunk@27655 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/media9/ChangeLog | 5 ++ Master/texmf-dist/doc/latex/media9/files/epix.prc | Bin 63020 -> 56774 bytes Master/texmf-dist/doc/latex/media9/media9.pdf | Bin 1589635 -> 1583908 bytes Master/texmf-dist/doc/latex/media9/media9.tex | 18 ++-- .../tex/latex/media9/javascript/3Dmenu.js | 42 ++++------ .../tex/latex/media9/javascript/asylabels.js | 91 ++++++++------------- Master/texmf-dist/tex/latex/media9/media9.sty | 14 +--- 7 files changed, 72 insertions(+), 98 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/media9/ChangeLog b/Master/texmf-dist/doc/latex/media9/ChangeLog index e0b3c3f92c4..a19252bd27d 100644 --- a/Master/texmf-dist/doc/latex/media9/ChangeLog +++ b/Master/texmf-dist/doc/latex/media9/ChangeLog @@ -1,3 +1,8 @@ +2012-09-12 + * v0.13 + * fix: cross section related bug in 3Dmenu.js + * fix: asylabels.js with improved label control (requires asymptote-2.17) + 2012-09-07 * v0.12 * new: command option `3Dpsob' and 3d views file entry `PSOB' added on diff --git a/Master/texmf-dist/doc/latex/media9/files/epix.prc b/Master/texmf-dist/doc/latex/media9/files/epix.prc index fa22b4ca5eb..3d8da38bfea 100644 Binary files a/Master/texmf-dist/doc/latex/media9/files/epix.prc and b/Master/texmf-dist/doc/latex/media9/files/epix.prc differ diff --git a/Master/texmf-dist/doc/latex/media9/media9.pdf b/Master/texmf-dist/doc/latex/media9/media9.pdf index 9005f612716..8255d8e7103 100644 Binary files a/Master/texmf-dist/doc/latex/media9/media9.pdf and b/Master/texmf-dist/doc/latex/media9/media9.pdf differ diff --git a/Master/texmf-dist/doc/latex/media9/media9.tex b/Master/texmf-dist/doc/latex/media9/media9.tex index 6c4e0fa6585..561327326cf 100644 --- a/Master/texmf-dist/doc/latex/media9/media9.tex +++ b/Master/texmf-dist/doc/latex/media9/media9.tex @@ -316,7 +316,9 @@ Sets the default render mode. The following values are honoured: `\verb+Solid+', \begin{verbatim} 3Dpartsattrs=restore | keep \end{verbatim} -When the user selects another view from the list of predefined views (see option `\verb+3Dviews+'), attributes of individual parts, such as opacity, visibility, render mode, translation in space, which all can be set from within the Reader or by means of a file of predefined views, are reset to their original states as defined in the embedded 3D file, before any new part settings are applied. This default behaviour can be overridden by `\verb+3Dpartsattrs=keep+'. This will preserve current part attributes when the user selects another predefined 3D view in the Reader. +When the user selects another view from the list of predefined views (see option `\verb+3Dviews+'), attributes of individual parts, such as opacity, visibility, render mode, +translation in space, +which all can be set from within the Reader or by means of a file of predefined views, are reset to their original states as defined in the embedded 3D file, before any new part settings are applied. This default behaviour can be overridden by `\verb+3Dpartsattrs=keep+'. This will preserve current part attributes when the user selects another predefined 3D view in the Reader. \begin{verbatim} 3Dviews= \end{verbatim} @@ -395,7 +397,7 @@ Things like animation, lighting, background of 3D objects etc. may also be scrip } runtime.addEventHandler(reh); \end{verbatim} -\hypertarget{3dscripts}{}For convenience, subdirectory `javascript' of the `media9' installation contains three 3D JavaScript files which may come in handy at times: `animation.js' enables embedded keyframe animation in 3D files; `3Dspintool.js' enables the Spin tool of the 3D plugin for easier rotating the 3D object with the mouse; `asylabels.js' adds `billboard behaviour' to text labels in Asymptote generated PRC files for improved visibility, they always face the camera while dragging the 3D object with the mouse. +\hypertarget{3dscripts}{}For convenience, subdirectory `javascript' of the `media9' installation contains three 3D JavaScript files which may come in handy at times: `animation.js' enables embedded keyframe animation in 3D files; `3Dspintool.js' enables the Spin tool of the 3D plugin for easier rotating the 3D object with the mouse; `asylabels.js' adds `billboard behaviour' to text labels in Asymptote ($\ge v2.17$) generated PRC files for improved visibility; text labels always face the camera while rotating the 3D object with the mouse. \begin{table}[bp]%[p]%[htbp] \centering @@ -721,23 +723,23 @@ Below, two examples of embedded 3D files are shown. The first one, Fig.~\ref{asy % 3Dcoo, 3Droo values found with `Generate Default View' from % context menu 3Dmenu, - 3Dcoo=-21.371112823486328 -19.702425003051758 -395.4008483886719, - 3Droo=472.3543474473915, - 3Dc2c=4 2 3 + 3Dc2c=4 2 3, + 3Dcoo=6.01792049407959 12.437679290771484 0.18967819213867188, + 3Droo=479.9268773794643, ]{}{epix.prc} \end{Verbatim} \vspace{1ex} \includemedia[ width=0.8\linewidth,height=0.8\linewidth, activate=pageopen, - add3Djscript=asylabels.js, %upright text labels + add3Djscript=asylabels.js, %upright text labels add3Djscript=3Dspintool.js, %let scene rotate about z-axis % 3Dcoo, 3Droo values found with `Generate Default View' from % context menu 3Dmenu, - 3Dcoo=-21.371112823486328 -19.702425003051758 -395.4008483886719, - 3Droo=472.3543474473915, 3Dc2c=4 2 3, + 3Dcoo=6.01792049407959 12.437679290771484 0.18967819213867188, + 3Droo=479.9268773794643, ]{}{epix.prc} \caption{Embedded PRC file produced with Asymptote, making use of convenience 3D JavaScripts `asylabels.js' and `3Dspintool.js' mentioned {\leavevmode\pdfstartlink attr{/Border[0 0 1]/C[0 0 1]/H/I}user{/Subtype/Link/A<>}above\pdfendlink}.}\label{asyex} diff --git a/Master/texmf-dist/tex/latex/media9/javascript/3Dmenu.js b/Master/texmf-dist/tex/latex/media9/javascript/3Dmenu.js index a987b5ed08c..20bf5a8a55a 100644 --- a/Master/texmf-dist/tex/latex/media9/javascript/3Dmenu.js +++ b/Master/texmf-dist/tex/latex/media9/javascript/3Dmenu.js @@ -4,7 +4,7 @@ // // 3Dmenu.js // -// version 20120813 +// version 20120912 // //////////////////////////////////////////////////////////////////////////////// // @@ -576,16 +576,14 @@ function get3Dview () { if(!defaultvals) res+=respart; } - //detect existing Clipping Plane (3DCrossSection) + //detect existing Clipping Plane (3D Cross Section) var clip=null; - try { - clip=scene.nodes.getByName("Clipping Plane"); - }catch(e){ - var ndcnt=scene.nodes.count; - clip=scene.createClippingPlane(); - if(ndcnt!=scene.nodes.count){ - clip.remove(); - clip=null; + for(i=0; i 0){ - if(name.charAt(end) == "\001"){ + if(end > 0) { + if(name.charAt(end) == "\001") { var start=name.lastIndexOf("-")+1; - if(end-start > 0) { - index.push(i); - center.push(nextCenter(node.firstChild)); + if(end > start) { node.name=name.substr(0,start-1); + var nodeMatrix=fulltransform(node.parent); + var c=nodeMatrix.translation; // position + var d=Math.pow(Math.abs(nodeMatrix.determinant),third); // scale + bbnodes.push(node); + bbtrans.push(Matrix4x4().scale(d,d,d).translate(c).multiply(nodeMatrix.inverse)); } } } } var camera=scene.cameras.getByIndex(0); +var zero=new Vector3(0,0,0); +var bbcount=bbnodes.length; -//event handler to maintain upright position of text labels +// event handler to maintain camera-facing text labels billboardHandler=new RenderEventHandler(); billboardHandler.onEvent=function(event) { - var position=camera.position; - var direction=position.subtract(camera.targetPosition); - var up=camera.up.subtract(position); - - for(var i=0; i