#VRML V2.0 utf8
# X3D-to-VRML-97 XSL translation autogenerated by X3dToVrml97.xslt
# https://www.web3d.org/x3d/content/X3dToVrml97.xslt
# Generated using XSLT processor: Saxonica
# [X3D] VRML V3.3 utf8
# PROFILE Immersive
# [X3D] version=3.3
# [X3D] noNamespaceSchemaLocation=https://www.web3d.org/specifications/x3d-3.3.xsd
# [head]
# META "title" "ExtrusionCrossSectionITSSPrototype.x3d"
# META "creator" "Don Brutzman and Sungmin Kwon"
# META "created" "23 October 2017"
# META "modified" "20 October 2019"
# META "description" "Shape prototype for Enclosing IndexedTriangleStripSet that also draws spine line plus oriented, scaled cross sections at each spine point."
# META "hint" "Utilize ExtrusionCrossSectionITSS ProtoInstance as if it is a Shape node (with containerField=\"children\") rather than an Extrusion node (with containerField=\"geometry\") under a Shape."
# META "reference" "VRML 97 Specification, 6.18 Extrusion"
# META "reference" "https://www.web3d.org/technicalinfo/specifications/vrml97/part1/nodesRef.html#Extrusion"
# META "Image" "VRML 97 Specification, Figure 6.6"
# META "Image" "https://www.web3d.org/technicalinfo/specifications/vrml97/Images/Extrusion.gif"
# META "reference" "http://realism.com/x3d/examples/Extrusion/_frame.html"
# META "reference" "http://www.cs.brown.edu/~gss/vrml/drawpoly.html"
# META "reference" "ExtrusionXj3dGoldberg1999.java"
# META "reference" "http://web3d.metrolink.com/cgi-bin/cvsweb.cgi/x3d/src/com/sun/j3d/loaders/vrml97/impl/Attic/Extrusion.java"
# META "identifier" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter06GeometryPointsLinesPolygons/ExtrusionCrossSectionPrototype.x3d"
### Warning: File name doesn't match for and
# META "generator" "X3D-Edit 3.3, https://savage.nps.edu/X3D-Edit"
# META "license" "../license.html"
EXTERNPROTO IndexedTriangleFanSet [
# [appinfo] IndexedTriangleFanSet represents a 3D shape composed of triangles that form a fan shape around the first vertex declared in each fan.
field SFBool ccw
field SFBool colorPerVertex
field SFBool normalPerVertex
field SFBool solid
field MFInt32 index
eventIn MFInt32 set_index
exposedField SFNode color # [appinfo] Color, ColorRGBA node only
exposedField SFNode coord # [appinfo] Coordinate node only
exposedField SFNode normal # [appinfo] Normal node only
exposedField SFNode texCoord # [appinfo] TextureCoordinate node only
exposedField SFNode metadata # [appinfo] Metadata node only
][
"RenderingComponentPrototypes.wrl#IndexedTriangleFanSet"
"https://www.web3d.org/x3d/content/examples/Basic/development/RenderingComponentPrototypes.wrl#IndexedTriangleFanSet"
"RenderingComponentPrototypes.x3d#IndexedTriangleFanSet"
"https://www.web3d.org/x3d/content/examples/Basic/development/RenderingComponentPrototypes.x3d#IndexedTriangleFanSet"
]
EXTERNPROTO IndexedTriangleStripSet [
# [appinfo] IndexedTriangleStripSet represents a 3D shape composed of strips of triangles.
field SFBool ccw
field SFBool colorPerVertex
field SFBool normalPerVertex
field SFBool solid
field MFInt32 index
eventIn MFInt32 set_index
exposedField SFNode color # [appinfo] Color, ColorRGBA node only
exposedField SFNode coord # [appinfo] Coordinate node only
exposedField SFNode normal # [appinfo] Normal node only
exposedField SFNode texCoord # [appinfo] TextureCoordinate node only
exposedField SFNode metadata # [appinfo] Metadata node only
][
"RenderingComponentPrototypes.wrl#IndexedTriangleStripSet"
"https://www.web3d.org/x3d/content/examples/Basic/development/RenderingComponentPrototypes.wrl#IndexedTriangleStripSet"
"RenderingComponentPrototypes.x3d#IndexedTriangleStripSet"
"https://www.web3d.org/x3d/content/examples/Basic/development/RenderingComponentPrototypes.x3d#IndexedTriangleStripSet"
]
# [Scene] ========== ========== ==========
NavigationInfo { type [ "EXAMINE" "ANY" ] } ### Default X3D NavigationInfo
WorldInfo {
title "ExtrusionCrossSectionITSSPrototype.x3d"
}
PROTO ExtrusionCrossSectionITSS [
# [appinfo] Shape prototype for Extrusion node that also draws spine line plus oriented scaled cross sections at each spine point
# documentation: https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter06GeometryPointsLinesPolygons/ExtrusionCrossSectionPrototype.x3d
field SFString name "" # [appinfo] Extrusion name
field MFVec2f crossSection [ 1 1 1 -1 -1 -1 -1 1 1 1 ] # [appinfo] Extrusion field
field MFVec3f spine [ 0 0 0 0 1 0 ] # [appinfo] Extrusion field
field MFVec2f scale [ 1 1 ] # [appinfo] Extrusion field
field MFRotation orientation [ 0 0 1 0 ] # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFBool beginCap FALSE # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFBool endCap FALSE # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFBool ccw TRUE # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFBool convex TRUE # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFFloat creaseAngle 0 # [appinfo] Extrusion field
### Warning: ProtoInterface is unreferenced in ProtoBody with no corresponding IS/connect/@protoField
field SFBool solid TRUE # [appinfo] Extrusion field
exposedField SFColor spineColor 0 0.9 0.8 # [appinfo] emissiveColor of spine
exposedField SFColor crossSectionColor 0.2 0.8 0.3 # [appinfo] diffuseColor of crossSection
exposedField SFFloat crossSectionTransparency 0.2 # [appinfo] transparency of crossSection
exposedField SFColor extrusionColor 0.3 0.3 0.3 # [appinfo] diffuseColor of extrusion hull
exposedField SFFloat extrusionTransparency 0.7 # [appinfo] transparency of extrusion hull
field SFNode extrusionImageTexture NULL # [appinfo] Image to apply to Extrusion
# initialization node (if any) goes here
field SFNode extrusionTextureTransform NULL # [appinfo] TextureTransform coordinates of image applied to Extrusion
# initialization node (if any) goes here
eventIn MFVec2f set_crossSection # [appinfo] Extrusion field
eventIn MFVec3f set_spine # [appinfo] Extrusion field
eventIn MFVec2f set_scale # [appinfo] Extrusion field
eventIn MFRotation set_orientation # [appinfo] Extrusion field
field SFBool traceEnabled FALSE # [appinfo] Whether to provide initialization trace statements showing node construction
] {
Group {
children [
DEF Spine Shape {
geometry DEF SpineLine IndexedLineSet {
colorPerVertex FALSE
coord DEF SpineCoordinates Coordinate {
point IS spine
### Error: duplicate IS/connect not allowed for @nodeField='point'
point IS set_spine
}
}
appearance Appearance {
material DEF SpineMaterial Material {
emissiveColor IS spineColor
}
}
}
DEF InternalCrossSections Shape {
geometry DEF CrossSectionFaces IndexedTriangleFanSet {
ccw TRUE
colorPerVertex TRUE
normalPerVertex TRUE
solid FALSE
coord DEF CrossSectionFacesCoordinates Coordinate {
}
}
appearance Appearance {
material DEF CrossSectionMaterial Material {
diffuseColor IS crossSectionColor
transparency IS crossSectionTransparency
}
}
}
DEF ExternalExtrusion2 Shape {
appearance DEF ExtrusionAppearance2 Appearance {
texture IS extrusionImageTexture
textureTransform IS extrusionTextureTransform
material DEF ExtrusionMaterial2 Material {
diffuseColor IS extrusionColor
transparency IS extrusionTransparency
}
}
geometry DEF EnclosingExtrusion2 IndexedTriangleStripSet {
ccw TRUE
colorPerVertex TRUE
index [ 0 1 2 ]
normalPerVertex TRUE
solid TRUE
coord DEF ExtrusionCoordinates2 Coordinate {
}
}
}
#
]
}
DEF CrossSectionScript Script {
field SFString name IS name
field MFVec2f crossSection IS crossSection
field MFVec3f spine IS spine
field MFVec2f scale IS scale
field MFRotation orientation IS orientation
### Warning: Script field 'spineColor' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors.
exposedField SFColor spineColor IS spineColor
### Warning: Script field 'crossSectionColor' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors.
exposedField SFColor crossSectionColor IS crossSectionColor
### Warning: Script field 'crossSectionTransparency' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors.
exposedField SFFloat crossSectionTransparency IS crossSectionTransparency
### Warning: Script field 'extrusionColor' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors.
exposedField SFColor extrusionColor IS extrusionColor
### Warning: Script field 'extrusionTransparency' has accessType 'inputOutput' (exposedField), which is only allowed in X3D Script node, not VRML97 Script node. Using exposedField anyway, may cause errors.
exposedField SFFloat extrusionTransparency IS extrusionTransparency
eventIn MFVec2f set_crossSection IS set_crossSection
eventIn MFVec3f set_spine IS set_spine
eventIn MFVec2f set_scale IS set_scale
eventIn MFRotation set_orientation IS set_orientation
eventOut MFInt32 spineIndex
eventOut MFInt32 facesIndex
eventOut MFVec3f facePoints
eventOut MFInt32 triStripIndex
field SFBool traceEnabled IS traceEnabled
# local variables
field MFInt32 computedFacesIndex [ ]
field MFVec3f computedFacePoints [ ]
field MFInt32 computedTriStripIndex [ ]
# local variables
url [ "ExtrusionCrossSectionITSSPrototype.js" "https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter06GeometryPointsLinesPolygons/ExtrusionCrossSectionITSSPrototype.js"
]
}
ROUTE CrossSectionScript.spineIndex TO SpineLine.set_coordIndex
ROUTE CrossSectionScript.facesIndex TO CrossSectionFaces.set_index
### Error: Mismatched type: ROUTE source CrossSectionScript.facesIndex has type MFInt32, but destination CrossSectionFaces.set_index has type IndexedTriangleFanSet.index.FieldTypeNotFound.
ROUTE CrossSectionScript.facePoints TO CrossSectionFacesCoordinates.point
ROUTE CrossSectionScript.triStripIndex TO EnclosingExtrusion2.set_index
### Error: Mismatched type: ROUTE source CrossSectionScript.triStripIndex has type MFInt32, but destination EnclosingExtrusion2.set_index has type IndexedTriangleStripSet.index.FieldTypeNotFound.
Group {
children [
# ======= ROUTE Trace ==============================================
DEF Trace_ROUTE_CrossSectionScript.triStripIndex_TO_EnclosingExtrusion2.set_index Script {
# Trace ROUTEd event values on X3D browser console
field SFTime reportInterval 1.0 # [appinfo] Sampling frequency in seconds (0 means all values)
eventIn MFInt32 traceValue
field SFTime timeStampPreviousReport -1
mustEvaluate TRUE
url [ "javascript: // ### X3D Browser.print() not supported by all VRML97 viewers, instead simply using print()
function traceValue (eventValue, timeStamp) {
// input eventValue received for trace field
if (timeStamp - timeStampPreviousReport >= reportInterval) {
printing ('Trace_ROUTE_CrossSectionScript.triStripIndex_TO_EnclosingExtrusion2.set_index type=MFInt32 value=' + eventValue.toString() + '\n');
timeStampPreviousReport = timeStamp;
}
}
function timeOfDay (someTime) {
hh = Math.floor (someTime /(60*60)) % 24;
mm = Math.floor (someTime / 60) % 60;
ss = Math.floor (someTime) % 60;
if (hh < 9) hour = '0' + hh;
else hour = hh;
if (mm < 9) minute = '0' + mm;
else minute = mm;
if (ss < 9) second = '0' + ss;
else second = ss;
return '(' + hour + ':' + minute + ':' + second + ' GMT)';
}
" ]
}
# ======= ROUTE Trace block complete =====================================================
]
ROUTE CrossSectionScript.triStripIndex TO Trace_ROUTE_CrossSectionScript.triStripIndex_TO_EnclosingExtrusion2.set_index.traceValue
}
ROUTE CrossSectionScript.facePoints TO ExtrusionCoordinates2.point
}
# ====================
# Example instance adapted from Figure15.12Torus.x3d
# https://www.web3d.org/x3d/content/examples/Basic/Vrml2Sourcebook/Chapter15-Extrusion/Figure15.12Torus.x3d
# Redirection text in case a user examines this PROTO file via a 3D browser:
Group {
children [
Transform {
translation 0 0.5 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0 1 1
emissiveColor 0 1 1
}
}
geometry Text {
string [ "ExtrusionCrossSectionITSS" "is a Prototype definition scene" ]
fontStyle FontStyle {
justify [ "MIDDLE" "MIDDLE" ]
size 0.7
}
}
}
]
}
]
}