<
ProtoDeclare name='
ExtrusionCrossSection'
appinfo='
Shape prototype for Extrusion node that also draws spine line plus oriented scaled cross sections at each spine point'
documentation='
http://www.web3d.org/x3d/content/examples/Basic/course/ExtrusionCrossSectionPrototype.x3d '>
<
ProtoInterface>
<!-- run-time eventIn Extrusion-modification interfaces for VRML97 compatibility -->
<
field name='
name'
type='
SFString'
accessType='
initializeOnly'
appinfo='
Extrusion name'/>
<
field name='
crossSection'
type='
MFVec2f'
value='
1 1 1 -1 -1 -1 -1 1 1 1'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
spine'
type='
MFVec3f'
value='
0 0 0 0 1 0'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
scale'
type='
MFVec2f'
value='
1 1'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
orientation'
type='
MFRotation'
value='
0 0 1 0'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
beginCap'
type='
SFBool'
value='
false'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
endCap'
type='
SFBool'
value='
false'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
ccw'
type='
SFBool'
value='
true'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
convex'
type='
SFBool'
value='
true'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
creaseAngle'
type='
SFFloat'
value='
0'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
solid'
type='
SFBool'
value='
true'
accessType='
initializeOnly'
appinfo='
Extrusion field'/>
<
field name='
spineColor'
type='
SFColor'
value='
0 0.9 0.8'
accessType='
inputOutput'
appinfo='
emissiveColor of spine'/>
<
field name='
crossSectionColor'
type='
SFColor'
value='
0.2 0.8 0.3'
accessType='
inputOutput'
appinfo='
diffuseColor of crossSection'/>
<
field name='
crossSectionTransparency'
type='
SFFloat'
value='
0.2'
accessType='
inputOutput'
appinfo='
transparency of crossSection'/>
<
field name='
extrusionColor'
type='
SFColor'
value='
0.3 0.3 0.3'
accessType='
inputOutput'
appinfo='
diffuseColor of extrusion hull'/>
<
field name='
extrusionTransparency'
type='
SFFloat'
value='
0.7'
accessType='
inputOutput'
appinfo='
transparency of extrusion hull'/>
<
field name='
extrusionImageTexture'
type='
SFNode'
accessType='
initializeOnly'
appinfo='
Image to apply to Extrusion'>
<!-- initialization node (if any) goes here -->
</
field>
<
field name='
extrusionTextureTransform'
type='
SFNode'
accessType='
initializeOnly'
appinfo='
TextureTransform coordinates of image applied to Extrusion'>
<!-- initialization node (if any) goes here -->
</
field>
<
field name='
set_crossSection'
type='
MFVec2f'
accessType='
inputOnly'
appinfo='
Extrusion field'/>
<
field name='
set_spine'
type='
MFVec3f'
accessType='
inputOnly'
appinfo='
Extrusion field'/>
<
field name='
set_scale'
type='
MFVec2f'
accessType='
inputOnly'
appinfo='
Extrusion field'/>
<
field name='
set_orientation'
type='
MFRotation'
accessType='
inputOnly'
appinfo='
Extrusion field'/>
<
field name='
traceEnabled'
type='
SFBool'
value='
false'
accessType='
initializeOnly'
appinfo='
Whether to provide initialization trace statements showing node construction'/>
</
ProtoInterface>
<
ProtoBody>
<
Group>
<
Shape DEF='
Spine'>
<!--
SpineLine ROUTE:
[
from CrossSectionScript.spineIndex to set_coordIndex
]
-->
<
IndexedLineSet DEF='
SpineLine'
colorPerVertex='
false'>
<
Coordinate DEF='
SpineCoordinates'>
<
IS>
<
connect nodeField='
point'
protoField='
spine'/>
<
connect nodeField='
point'
protoField='
set_spine'/>
</
IS>
</
Coordinate>
</
IndexedLineSet>
<
Appearance>
<
Material DEF='
SpineMaterial'>
<
IS>
<
connect nodeField='
emissiveColor'
protoField='
spineColor'/>
</
IS>
</
Material>
</
Appearance>
</
Shape>
<
Shape DEF='
InternalCrossSections'>
<!-- use most conservative polygon settings: convex='false' solid='false' -->
<!--
CrossSectionFaces ROUTE:
[
from CrossSectionScript.facesIndex to set_coordIndex
]
-->
<
IndexedFaceSet DEF='
CrossSectionFaces'
convex='
false'
solid='
false'>
</
IndexedFaceSet>
<
Appearance>
<
Material DEF='
CrossSectionMaterial'>
</
Material>
</
Appearance>
</
Shape>
<
Shape DEF='
ExternalExtrusion'>
<!-- use most conservative polygon settings: convex='false' solid='false' -->
<
Extrusion DEF='
EnclosingExtrusion'
convex='
false'
solid='
false'>
<
IS>
<
connect nodeField='
crossSection'
protoField='
crossSection'/>
<
connect nodeField='
spine'
protoField='
spine'/>
<
connect nodeField='
scale'
protoField='
scale'/>
<
connect nodeField='
orientation'
protoField='
orientation'/>
<
connect nodeField='
set_crossSection'
protoField='
set_crossSection'/>
<
connect nodeField='
set_spine'
protoField='
set_spine'/>
<
connect nodeField='
set_scale'
protoField='
set_scale'/>
<
connect nodeField='
set_orientation'
protoField='
set_orientation'/>
<
connect nodeField='
beginCap'
protoField='
beginCap'/>
<
connect nodeField='
endCap'
protoField='
endCap'/>
<
connect nodeField='
ccw'
protoField='
ccw'/>
<
connect nodeField='
convex'
protoField='
convex'/>
<
connect nodeField='
creaseAngle'
protoField='
creaseAngle'/>
<
connect nodeField='
solid'
protoField='
solid'/>
</
IS>
</
Extrusion>
<
Appearance DEF='
ExtrusionAppearance'>
<
IS>
</
IS>
<
Material DEF='
ExtrusionMaterial'>
</
Material>
</
Appearance>
</
Shape>
</
Group>
<!-- TODO hardwired local Script path to workaround BS Contact bug -->
<!--
CrossSectionScript ROUTEs:
[
from spineIndex to SpineLine.set_coordIndex
]
[
from facesIndex to CrossSectionFaces.set_coordIndex
]
[
from facePoints to CrossSectionFacesCoordinates.point
]
-->
<
Script DEF='
CrossSectionScript'
url='
"
ExtrusionCrossSectionPrototype.js"
"
file:///C:/www.web3d.org/x3d/content/examples/Basic/course/ExtrusionCrossSectionPrototype.js"
"
http://www.web3d.org/x3d/content/examples/Basic/course/ExtrusionCrossSectionPrototype.js"
'>
<
field name='
name'
type='
SFString'
accessType='
initializeOnly'/>
<
field name='
crossSection'
type='
MFVec2f'
accessType='
initializeOnly'/>
<
field name='
spine'
type='
MFVec3f'
accessType='
initializeOnly'/>
<
field name='
scale'
type='
MFVec2f'
accessType='
initializeOnly'/>
<
field name='
orientation'
type='
MFRotation'
accessType='
initializeOnly'/>
<
field name='
spineColor'
type='
SFColor'
accessType='
inputOutput'/>
<
field name='
crossSectionColor'
type='
SFColor'
accessType='
inputOutput'/>
<
field name='
crossSectionTransparency'
type='
SFFloat'
accessType='
inputOutput'/>
<
field name='
extrusionColor'
type='
SFColor'
accessType='
inputOutput'/>
<
field name='
extrusionTransparency'
type='
SFFloat'
accessType='
inputOutput'/>
<
field name='
set_crossSection'
type='
MFVec2f'
accessType='
inputOnly'/>
<
field name='
set_spine'
type='
MFVec3f'
accessType='
inputOnly'/>
<
field name='
set_scale'
type='
MFVec2f'
accessType='
inputOnly'/>
<
field name='
set_orientation'
type='
MFRotation'
accessType='
inputOnly'/>
<
field name='
spineIndex'
type='
MFInt32'
accessType='
outputOnly'/>
<
field name='
facesIndex'
type='
MFInt32'
accessType='
outputOnly'/>
<
field name='
facePoints'
type='
MFVec3f'
accessType='
outputOnly'/>
<
field name='
traceEnabled'
type='
SFBool'
accessType='
initializeOnly'/>
<!-- local variables -->
<
field name='
computedFacesIndex'
type='
MFInt32'
accessType='
initializeOnly'/>
<
field name='
computedFacePoints'
type='
MFVec3f'
accessType='
initializeOnly'/>
<
IS>
<
connect nodeField='
name'
protoField='
name'/>
<
connect nodeField='
crossSection'
protoField='
crossSection'/>
<
connect nodeField='
spine'
protoField='
spine'/>
<
connect nodeField='
scale'
protoField='
scale'/>
<
connect nodeField='
spineColor'
protoField='
spineColor'/>
<
connect nodeField='
crossSectionColor'
protoField='
crossSectionColor'/>
<
connect nodeField='
crossSectionTransparency'
protoField='
crossSectionTransparency'/>
<
connect nodeField='
extrusionColor'
protoField='
extrusionColor'/>
<
connect nodeField='
extrusionTransparency'
protoField='
extrusionTransparency'/>
<
connect nodeField='
orientation'
protoField='
orientation'/>
<
connect nodeField='
set_crossSection'
protoField='
set_crossSection'/>
<
connect nodeField='
set_spine'
protoField='
set_spine'/>
<
connect nodeField='
set_scale'
protoField='
set_scale'/>
<
connect nodeField='
set_orientation'
protoField='
set_orientation'/>
<
connect nodeField='
traceEnabled'
protoField='
traceEnabled'/>
</
IS>
</
Script>
<
ROUTE fromNode='
CrossSectionScript'
fromField='
spineIndex'
toNode='
SpineLine'
toField='
set_coordIndex'/>
<
ROUTE fromNode='
CrossSectionScript'
fromField='
facesIndex'
toNode='
CrossSectionFaces'
toField='
set_coordIndex'/>
<
ROUTE fromNode='
CrossSectionScript'
fromField='
facePoints'
toNode='
CrossSectionFacesCoordinates'
toField='
point'/>
</
ProtoBody>
</
ProtoDeclare>
<!-- ==================== -->
<!-- Example instance adapted from Figure15.12Torus.x3d -->
<!-- http://www.web3d.org/x3d/content/examples/Basic/Vrml2.0Sourcebook/Chapter15-Extrusion/Figure15.12Torus.x3d -->
<!-- Redirection text in case a user examines this PROTO file via a 3D browser: -->
<
Group>
<
Transform translation='
0 1.5 0'>
<
Shape>
<
Appearance>
<Material diffuseColor='0 1 1' emissiveColor='0 1 1'/>
</
Appearance>
<
Text string='
"ExtrusionCrossSectionPrototype" "is a Prototype definition scene" "" "Example scenes using this node:"'
solid='
false'>
<FontStyle justify='"MIDDLE" "MIDDLE"' size='0.9'/>
</
Text>
</
Shape>
</
Transform>
<
Transform translation='
-2.5 -2 0'>
</
Transform>
<
Transform translation='
2.5 -2 0'>
</
Transform>
</
Group>