summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-09-12 22:14:20 +0000
committerKarl Berry <karl@freefriends.org>2012-09-12 22:14:20 +0000
commit775b0205d5a6a908604168ebeb3c22442e84303f (patch)
tree5c7818393bf03ecf13f839717df3e147219c90d1 /Master
parent60134622cf5eb833e549dd5dfefb08a674b5a78c (diff)
media9 (12sep12)
git-svn-id: svn://tug.org/texlive/trunk@27655 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/media9/ChangeLog5
-rw-r--r--Master/texmf-dist/doc/latex/media9/files/epix.prcbin63020 -> 56774 bytes
-rw-r--r--Master/texmf-dist/doc/latex/media9/media9.pdfbin1589635 -> 1583908 bytes
-rw-r--r--Master/texmf-dist/doc/latex/media9/media9.tex18
-rw-r--r--Master/texmf-dist/tex/latex/media9/javascript/3Dmenu.js42
-rw-r--r--Master/texmf-dist/tex/latex/media9/javascript/asylabels.js91
-rw-r--r--Master/texmf-dist/tex/latex/media9/media9.sty14
7 files changed, 72 insertions, 98 deletions
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
--- a/Master/texmf-dist/doc/latex/media9/files/epix.prc
+++ b/Master/texmf-dist/doc/latex/media9/files/epix.prc
Binary files 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
--- a/Master/texmf-dist/doc/latex/media9/media9.pdf
+++ b/Master/texmf-dist/doc/latex/media9/media9.pdf
Binary files 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=<views file>
\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<</D(3dscripts)/S/GoTo>>}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<scene.nodes.count; i++){
+ if(
+ scene.nodes.getByIndex(i).name == '$$$$$$' ||
+ scene.nodes.getByIndex(i).name == 'Clipping Plane'
+ ) {
+ clip=scene.nodes.getByIndex(i);
}
}
if(clip){
@@ -642,21 +640,17 @@ runtime.addEventHandler(selectionEventHandler);
cameraEventHandler=new CameraEventHandler();
cameraEventHandler.onEvent=function(e){
- //store current transformation matrices of all mesh nodes in the scene
- var curtrans=getCurTrans();
- //detect existing clipping plane (cross section)
- var ndcnt=scene.nodes.count;
- var clip=scene.createClippingPlane();
- if(ndcnt!=scene.nodes.count){
- clip.remove();
- runtime.removeCustomMenuItem("csection");
- runtime.addCustomMenuItem("csection", "Cross Section", "checked", 0);
- } else {
- runtime.removeCustomMenuItem("csection");
- runtime.addCustomMenuItem("csection", "Cross Section", "checked", 1);
+ runtime.removeCustomMenuItem("csection");
+ runtime.addCustomMenuItem("csection", "Cross Section", "checked", 0);
+ for(i=0; i<scene.nodes.count; i++){
+ if(
+ scene.nodes.getByIndex(i).name == '$$$$$$' ||
+ scene.nodes.getByIndex(i).name == 'Clipping Plane'
+ ) {
+ runtime.removeCustomMenuItem("csection");
+ runtime.addCustomMenuItem("csection", "Cross Section", "checked", 1);
+ }
}
- //restore previous position of mesh nodes
- restoreTrans(curtrans);
}
runtime.addEventHandler(cameraEventHandler);
diff --git a/Master/texmf-dist/tex/latex/media9/javascript/asylabels.js b/Master/texmf-dist/tex/latex/media9/javascript/asylabels.js
index a2455d7470c..505674a7438 100644
--- a/Master/texmf-dist/tex/latex/media9/javascript/asylabels.js
+++ b/Master/texmf-dist/tex/latex/media9/javascript/asylabels.js
@@ -1,19 +1,18 @@
////////////////////////////////////////////////////////////////////////////////
//
-// (C) 2012, Alexander Grahn
+// (C) 2012, Michail Vidiassov, John C. Bowman, Alexander Grahn
//
// asylabels.js
//
-// version 20120301
+// version 20120912
//
////////////////////////////////////////////////////////////////////////////////
//
// 3D JavaScript to be used with media9.sty (option `add3Djscript') for
// Asymptote generated PRC files
//
-// adds billboard behaviour to text labels in Asymptote PRC files for improved
-// visibility, they always face the camera while dragging the 3d object with the
-// mouse.
+// adds billboard behaviour to text labels in Asymptote PRC files so that
+// they always face the camera under 3D rotation.
//
//
// This work may be distributed and/or modified under the
@@ -30,75 +29,57 @@
//
////////////////////////////////////////////////////////////////////////////////
-//recursive function which computes the lower left BBox corner of a text
-//label; it marches through all sibling mesh nodes the label is composed of;
-//the returned Vector3 object will become the pivot point of the label
-function nextCenter(msh){
- //compute local-to-world transf. matrix of current mesh node
- var trans=new Matrix4x4(msh.transform);
- var parent=msh.parent;
- while(parent.transform){
- trans.multiplyInPlace(parent.transform);
- parent=parent.parent;
- }
-
- //min BBox corner of current mesh node
- var min=new Vector3();
- min.set(msh.computeBoundingBox().min);
- min.set(trans.transformPosition(min));
+var bbnodes=new Array(); // billboard meshes
+var bbtrans=new Array(); // billboard transforms
- //get min BBox corner
- if(msh.nextSibling){
- var nextmin=nextCenter(msh.nextSibling);
- return(min.length < nextmin.length ? min : nextmin);
- }else{
- return(min);
- }
-}
+function fulltransform(mesh)
+{
+ var t=new Matrix4x4(mesh.transform);
+ if(mesh.parent.name != "") {
+ var parentTransform=fulltransform(mesh.parent);
+ t.multiplyInPlace(parentTransform);
+ return t;
+ } else
+ return t;
+}
-//find all text labels in the scene and determine pivoting points
-var zero=new Vector3(0,0,0);
+// find all text labels in the scene and determine pivoting points
var nodes=scene.nodes;
-var center=new Array();
-var index=new Array();
-for(var i=0; i<nodes.count; i++){
+var nodescount=nodes.count;
+var third=1.0/3.0;
+for(var i=0; i < nodescount; i++) {
var node=nodes.getByIndex(i);
var name=node.name;
var end=name.lastIndexOf(".")-1;
- if(end > 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<index.length; i++){
- var node=nodes.getByIndex(index[i]);
- var R=Matrix4x4();
- R.setView(zero,direction,up);
- var c=center[i];
- var T=node.transform;
- T.setIdentity();
- T.translateInPlace(c.scale(-1));
- T.multiplyInPlace(R);
- T.translateInPlace(c);
- }
+ var T=new Matrix4x4();
+ T.setView(zero,camera.position.subtract(camera.targetPosition),
+ camera.up.subtract(camera.position));
+ for(var j=0; j < bbcount; j++)
+ bbnodes[j].transform.set(T.multiply(bbtrans[j]));
runtime.refresh();
}
runtime.addEventHandler(billboardHandler);
diff --git a/Master/texmf-dist/tex/latex/media9/media9.sty b/Master/texmf-dist/tex/latex/media9/media9.sty
index 3bb5afa0dee..bc8e144e7f6 100644
--- a/Master/texmf-dist/tex/latex/media9/media9.sty
+++ b/Master/texmf-dist/tex/latex/media9/media9.sty
@@ -39,8 +39,8 @@
\RequirePackage{l3keys2e}
\RequirePackage{ifpdf}
-\def\g@mix@date@tl{2012/09/07}
-\def\g@mix@version@tl{0.12}
+\def\g@mix@date@tl{2012/09/12}
+\def\g@mix@version@tl{0.13}
\def\g@mix@liiikerneldate{2012/07/16}
\def\g@mix@liiipkgdate{2012/07/16}
@@ -505,14 +505,13 @@
}
}
\bool_if:NT\g_mix_pkgbigfiles_bool{
- \special{!~(./\jobname.m9)~run~}
+ \special{!~1~dict~begin~(./\jobname.m9)~run~end}
%open auxiliary file \jobname.m9 for writing hex encoded streams
%of media files. This file is read and executed during ps2pdf
%conversion.
\iow_new:N\g_mix_mstreams_stream
\iow_open:Nn\g_mix_mstreams_stream{\jobname.m9}
\iow_now:Nn\g_mix_mstreams_stream{
- 1~dict~begin
/o{mark/_objdef}bind~def/O{/type/stream/OBJ~pdfmark}bind~def
/m~systemdict/mark~get~def
/P{/ASCIIHexDecode~filter/PUT~pdfmark}bind~def
@@ -521,13 +520,6 @@
}
}
- \bool_if:NT\g_mix_pkgbigfiles_bool{
- \AtEndDocument{
- \iow_now:Nn\g_mix_mstreams_stream{end}
- \iow_close:N\g_mix_mstreams_stream
- }
- }
-
\cs_new:Nn\mix_pdfobj:nnn{
% #1:objref; if empty, a new object number will be reserved
% #2:type of object (dict|array|stream|fstream)