| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.3//EN" "https://www.web3d.org/specifications/x3d-3.3.dtd">
|
| 3 | <X3D profile='Immersive' version='3.3' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.3.xsd'> |
| 4 | <head> |
| 5 | <meta name='title' content=' Cut.x3d '/> |
| 6 | <meta name='description' content='Select and drag cross-section to see changes. Cutting plane parts: this file contains two prototype declarations used in creating a cutting plane. The example scene TexturePlane uses these for external prototype instances and creates a plane with one of a set of textures mapped to it. The texture choice is controlled by a fraction eventIn. SlidingPlane creates a texture plane that slides back and forth along the X axis, changing the texture based upon the X position.'/> |
| 7 | <meta name='creator' content='David R. Nadeau'/> |
| 8 | <meta name='translator' content='Don Brutzman'/> |
| 9 | <meta name='created' content='1 July 1998'/> |
| 10 | <meta name='translated' content='2 February 2014'/> |
| 11 | <meta name='modified' content='7 December 2024'/> |
| 12 | <meta name='reference' content=' CutPlane.x3d '/> |
| 13 | <meta name='reference' content=' TexturePlane.x3d '/> |
| 14 | <meta name='reference' content='originals/cut.wrl'/> |
| 15 | <meta name='reference' content='http://www.siggraph.org/s98'/> |
| 16 | <meta name='reference' content=' http://www.siggraph.org/s98/conference/courses/18.html '/> |
| 17 | <meta name='reference' content=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/slides/mt0497.htm '/> |
| 18 | <meta name='reference' content=' http://www.sdsc.edu/~moreland/courses/Siggraph98/vrml97/vrml97.htm '/> |
| 19 | <meta name='reference' content=' https://www.web3d.org/x3d/content/examples/X3dResources.html '/> |
| 20 | <meta name='identifier' content=' https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/Cut.x3d '/> |
| 21 | <meta name='generator' content=' Vrml97ToX3dNist, http://ovrt.nist.gov/v2_x3d.html '/> |
| 22 | <meta name='generator' content='X3D-Edit, https://www.web3d.org/x3d/tools/X3D-Edit'/> |
| 23 | <meta name='license' content='../license.html'/> |
| 24 | </head> |
| 25 | <Scene> |
| 26 | <WorldInfo info='"Copyright (c) 1997, David R. Nadeau"' title='Cutting Plane parts'/> |
| 27 | <ProtoDeclare name='TexturePlane'> |
| 28 | <ProtoInterface> |
| 29 | <field name='textures' type='MFNode' accessType='initializeOnly'> |
| 30 | <!-- initialized with ImageTexture nodes upon use --> |
| 31 | </field> |
| 32 | <field name='set_fraction' type='SFFloat' accessType='inputOnly'/> |
| 33 | </ProtoInterface> |
| 34 | <ProtoBody> |
| 35 | <Group> |
| 36 | <Shape> |
| 37 |
<!-- ROUTE information for App node:
[from Selector.texture_changed to set_texture
]
-->
<Appearance DEF='App'/> |
| 38 | <IndexedFaceSet solid='false' coordIndex='0 1 2 3' texCoordIndex='0 1 2 3'> |
| 39 | <TextureCoordinate point='0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0'/> |
| 40 | <Coordinate point='-1.0 -1.0 0.0 1.0 -1.0 0.0 1.0 1.0 0.0 -1.0 1.0 0.0'/> |
| 41 | </IndexedFaceSet> |
| 42 | </Shape> |
| 43 | <Shape> |
| 44 | <Appearance/> |
| 45 | <IndexedLineSet coordIndex='0 1 2 3 0'> |
| 46 | <Coordinate point='-1.0 -1.0 0.0 1.0 -1.0 0.0 1.0 1.0 0.0 -1.0 1.0 0.0'/> |
| 47 | </IndexedLineSet> |
| 48 | </Shape> |
| 49 | </Group> |
| 50 | <!-- ProtoBody child following first child will not be rendered, since the first child determines node type of this prototype. --> |
| 51 |
<!-- ROUTE information for Selector node:
[from texture_changed to App.set_texture
]
-->
<Script DEF='Selector' directOutput='true'> |
| 52 | <field name='textures' type='MFNode' accessType='initializeOnly'/> |
| 53 | <field name='texture_changed' type='SFNode' accessType='outputOnly'/> |
| 54 | <field name='set_fraction' type='SFFloat' accessType='inputOnly'/> |
| 55 | <IS> |
| 56 | <connect nodeField='textures' protoField='textures'/> |
| 57 | <connect nodeField='set_fraction' protoField='set_fraction'/> |
| 58 | </IS> |
<![CDATA[
ecmascript:
function initialize( ) {
texture_changed = textures[0];
Browser.println ('[Cut Selector] initialize(): textures.length=' + textures.length); // debug
}
function set_fraction( f, tm ) {
i = Math.floor(f * 10);
if ( i == 10 ) { i = 9; }
Browser.println ('[Cut Selector] set_fraction(): i=' + i); // debug
texture_changed = textures[i];
}
]]>
|
|
| 60 | </Script> |
| 61 | < ROUTE fromNode='Selector' fromField='texture_changed' toNode='App' toField='set_texture'/> |
| 62 | </ProtoBody> |
| 63 | </ProtoDeclare> |
| 64 | <ProtoDeclare name='SlidingPlane'> |
| 65 | <ProtoInterface> |
| 66 | <field name='textures' type='MFNode' accessType='initializeOnly'> |
| 67 | <!-- initialized with ImageTexture nodes upon use --> |
| 68 | </field> |
| 69 | <field name='minMaxX' type='SFVec2f' value='0.0 1.0' accessType='initializeOnly'/> |
| 70 | <field name='initialX' type='SFFloat' value='0.0' accessType='initializeOnly'/> |
| 71 | </ProtoInterface> |
| 72 | <ProtoBody> |
| 73 | <Transform rotation='0.0 1.0 0.0 1.571'> |
| 74 |
<!-- ROUTE information for Slider node:
[from Translator.minPosition_changed to set_minPosition
]
[from Translator.maxPosition_changed to set_maxPosition
]
[from Translator.offset_changed to set_offset
]
[from translation_changed to PlanePosition.set_translation
]
[from translation_changed to Translator.set_translation
]
-->
<PlaneSensor DEF='Slider' description='drag to see cross-section slices'/> |
| 75 |
<!-- ROUTE information for PlanePosition node:
[from Slider.translation_changed to set_translation
]
[from Translator.offset_changed to set_translation
]
-->
<Transform DEF='PlanePosition' rotation='0.0 1.0 0.0 -1.571'> |
| 76 |
<!-- ROUTE information for Plane node:
[from Translator.fraction_changed to set_fraction
]
-->
<ProtoInstance name='TexturePlane' DEF='Plane'> |
| 77 | <IS> |
| 78 | <connect nodeField='textures' protoField='textures'/> |
| 79 | </IS> |
| 80 | </ProtoInstance> |
| 81 | <Transform rotation='0.0 1.0 0.0 1.571' translation='1.05 -1.2 0.0'> |
| 82 | <Shape> |
| 83 | <Appearance/> |
| 84 |
<!-- ROUTE information for Label node:
[from Translator.label_changed to set_string
]
-->
<Text DEF='Label' string='""'> |
| 85 | <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.3' style='BOLD'/> |
| 86 | </Text> |
| 87 | </Shape> |
| 88 | </Transform> |
| 89 | </Transform> |
| 90 | </Transform> |
| 91 |
<!-- ROUTE information for Translator node:
[from Slider.translation_changed to set_translation
]
[from fraction_changed to Plane.set_fraction
]
[from label_changed to Label.set_string
]
[from minPosition_changed to Slider.set_minPosition
]
[from maxPosition_changed to Slider.set_maxPosition
]
[from offset_changed to Slider.set_offset
]
[from offset_changed to PlanePosition.set_translation
]
-->
<Script DEF='Translator'> |
| 92 | <field name='set_translation' type='SFVec3f' accessType='inputOnly'/> |
| 93 | <field name='minMaxX' type='SFVec2f' accessType='initializeOnly'/> |
| 94 | <field name='minPosition_changed' type='SFVec2f' accessType='outputOnly'/> |
| 95 | <field name='fraction_changed' type='SFFloat' accessType='outputOnly'/> |
| 96 | <field name='initialX' type='SFFloat' accessType='initializeOnly'/> |
| 97 | <field name='offset_changed' type='SFVec3f' accessType='outputOnly'/> |
| 98 | <field name='maxPosition_changed' type='SFVec2f' accessType='outputOnly'/> |
| 99 | <field name='label_changed' type='MFString' accessType='outputOnly'/> |
| 100 | <IS> |
| 101 | <connect nodeField='minMaxX' protoField='minMaxX'/> |
| 102 | <connect nodeField='initialX' protoField='initialX'/> |
| 103 | </IS> |
<![CDATA[
ecmascript:
function translate( x ) {
// compute the fraction using the given X position
f = (x-minMaxX[0]) / (minMaxX[1] - minMaxX[0]);
// send a fraction event
fraction_changed = f;
// send a new label string with 1 digit after decimal
label_changed[0] = Math.floor(f*10.0)/10.0;
}
function initialize( ) {
// set the plane sensor bounds
minPosition_changed[0] = minMaxX[0];
minPosition_changed[1] = 0.0;
maxPosition_changed[0] = minMaxX[1];
maxPosition_changed[1] = 0.0;
// set the plane sensor initial position
offset_changed[0] = initialX;
offset_changed[1] = 0.0;
offset_changed[2] = 0.0;
// compute the initial values
translate( initialX );
}
function set_translation( t, tm ) {
// compute the new values
translate( t[0] );
}
]]>
|
|
| 105 | </Script> |
| 106 | < ROUTE fromNode='Slider' fromField='translation_changed' toNode='PlanePosition' toField='set_translation'/> |
| 107 | < ROUTE fromNode='Slider' fromField='translation_changed' toNode='Translator' toField='set_translation'/> |
| 108 | < ROUTE fromNode='Translator' fromField='fraction_changed' toNode='Plane' toField='set_fraction'/> |
| 109 | < ROUTE fromNode='Translator' fromField='label_changed' toNode='Label' toField='set_string'/> |
| 110 | < ROUTE fromNode='Translator' fromField='minPosition_changed' toNode='Slider' toField='set_minPosition'/> |
| 111 | < ROUTE fromNode='Translator' fromField='maxPosition_changed' toNode='Slider' toField='set_maxPosition'/> |
| 112 | < ROUTE fromNode='Translator' fromField='offset_changed' toNode='Slider' toField='set_offset'/> |
| 113 | < ROUTE fromNode='Translator' fromField='offset_changed' toNode='PlanePosition' toField='set_translation'/> |
| 114 | </ProtoBody> |
| 115 | </ProtoDeclare> |
| 116 | <!-- Display scene instructions for viewing an example scene with a corresponding prototype instance --> |
| 117 | <Background skyColor='0 0.333333 0.66667'/> |
| 118 | <Transform translation='0 2.5 0'> |
| 119 | <Anchor description='select text to view parent scene' url=' "CutPlane.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/CutPlane.x3d" "CutPlane.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/CutPlane.wrl" '> |
| 120 | <Shape> |
| 121 | <Text string='"The Cut.x3d scene holds prototype" "declarations for model reuse." "" "Select this text to view example usage" "in CutPlane.x3d scene"'> |
| 122 | |
| 123 | </Text> |
| 124 | <Appearance> |
| 125 | <Material diffuseColor='1 0.9 0.4'/> |
| 126 | </Appearance> |
| 127 | </Shape> |
| 128 | <!-- Invisible box behind text makes selection easier --> |
| 129 | <Shape> |
| 130 | <Box size='12 5 0.1'/> |
| 131 | <Appearance> |
| 132 | <Material transparency='1'/> |
| 133 | </Appearance> |
| 134 | </Shape> |
| 135 | </Anchor> |
| 136 | </Transform> |
| 137 | <Transform translation='0 -2.5 0'> |
| 138 | <Anchor description='select text to view parent scene' url=' "TexturePlane.x3d" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/TexturePlane.x3d" "TexturePlane.wrl" "https://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Siggraph98Course/TexturePlane.wrl" '> |
| 139 | <Shape> |
| 140 | <Text string='"Otherwise select this text to" "view example usage in" "TexturePlane.x3d scene"'> |
| 141 | <FontStyle USE='TextFont'/> |
| 142 | </Text> |
| 143 | <Appearance> |
| 144 | <Material diffuseColor='1 0.9 0.4'/> |
| 145 | </Appearance> |
| 146 | </Shape> |
| 147 | <!-- Invisible box behind text makes selection easier --> |
| 148 | <Shape> |
| 149 | <Box size='12 5 0.1'/> |
| 150 | <Appearance> |
| 151 | <Material transparency='1'/> |
| 152 | </Appearance> |
| 153 | </Shape> |
| 154 | </Anchor> |
| 155 | </Transform> |
| 156 | </Scene> |
| 157 | </X3D> |
Event Graph ROUTE Table entries with 9 ROUTE connections total, showing X3D event-model relationships for this scene.
Each row shows an event cascade that may occur during a single timestamp interval between frame renderings, as part of the X3D execution model.
|
Selector
Script texture_changed SFNode |
App
Appearance set_texture SFNode |
|
Plane
ProtoInstance TexturePlane |
No direct ROUTE connection found for events to/from this node. This ProtoInstance contains SFNode/MFNode fieldValue declarations with direct access to other nodes, and thus has potential to produce run-time animation. |
| line 119
Anchor |
description='select text to view parent scene' User-interaction hint for this node. |
| line 138
Anchor |
description='select text to view parent scene' User-interaction hint for this node. |
<!--
Color-coding legend: X3D terminology
<X3dNode
DEF='idName' field='value'/>
matches XML terminology
<XmlElement
DEF='idName' attribute='value'/>
(Light-blue background: event-based behavior node or statement)
(Grey background inside box: inserted documentation)
(Magenta background: X3D Extensibility)
<ProtoInstance name='ProtoName'>
<field
name='fieldName'/> </ProtoInstance>
-->
<!--
For additional help information about X3D scenes, please see X3D Tooltips, X3D Resources, and X3D Scene Authoring Hints.
-->