Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 31: Creating New Node Types

../ch31/31fig07.gif
Figure 31.7

A donut shape built using the Donut geometry node and the LightOak appearance node.

31fig07.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
EXTERNPROTO Donut [
    field    SFFloat crossSectionRadius
    field    SFFloat spineRadius
    field    SFInt32 crossSectionResolution
    field    SFInt32 spineResolution
    eventIn  SFFloat set_crossSectionRadius
    eventIn  SFFloat set_spineRadius
    eventOut MFVec2f crossSection_changed
    eventOut MFVec3f spine_changed
] "donutpro.wrl#Donut"

EXTERNPROTO LightOak [
    exposedField SFNode textureTransform
] "applib.wrl#LightOak"

Shape {
    appearance LightOak {
        textureTransform TextureTransform {
            translation 0.5 0.0
        }
    }
    geometry Donut {
        crossSectionRadius 1.0
        spineRadius        2.0
    }
}