<
head>
</
head>
<!--
-->
<
Scene>
<!-- Protype definition for external use -->
<
ProtoDeclare name='
RefractiveMaterial'>
<
ProtoInterface>
<
field name='
ambientIntensity'
type='
SFFloat'
value='
0'
accessType='
inputOutput'/>
<
field name='
diffuseColor'
type='
SFColor'
value='
0.5 0.5 0.5'
accessType='
inputOutput'/>
<
field name='
specularColor'
type='
SFColor'
value='
0 0 0'
accessType='
inputOutput'/>
<
field name='
emissiveColor'
type='
SFColor'
value='
0 0 0'
accessType='
inputOutput'/>
<
field name='
shininess'
type='
SFFloat'
value='
0'
accessType='
inputOutput'/>
<
field name='
transparency'
type='
SFFloat'
value='
0'
accessType='
inputOutput'/>
<
field name='
indexOfRefraction'
type='
SFFloat'
value='
0.1'
accessType='
inputOutput'/>
</
ProtoInterface>
<
ProtoBody>
<!--
RefractiveMaterialNode ROUTE:
[
from RefractionScript.transparency_changed to transparency
]
-->
<
Material DEF='
RefractiveMaterialNode'>
<
IS>
<
connect nodeField='
ambientIntensity'
protoField='
ambientIntensity'/>
<
connect nodeField='
diffuseColor'
protoField='
diffuseColor'/>
<
connect nodeField='
specularColor'
protoField='
specularColor'/>
<
connect nodeField='
emissiveColor'
protoField='
emissiveColor'/>
<
connect nodeField='
shininess'
protoField='
shininess'/>
<
connect nodeField='
transparency'
protoField='
transparency'/>
</
IS>
</
Material>
<!-- after first node in ProtoDeclare, remainder of nodes do not render -->
<!--
RefractionScript ROUTE:
[
from transparency_changed to RefractiveMaterialNode.transparency
]
-->
<
Script DEF='
RefractionScript'>
<
field name='
transparencyInitial'
type='
SFFloat'
accessType='
inputOutput'/>
<
field name='
indexOfRefraction'
type='
SFFloat'
accessType='
inputOutput'/>
<
field name='
transparency_changed'
type='
SFFloat'
accessType='
outputOnly'/>
<
IS>
</
IS>
<![CDATA[
ecmascript:
function initialize()
{
// arbitary example modification of usual node properties
var newTransparency = 1.0 - ((1.0 - transparencyInitial) * indexOfRefraction);
Browser.print ('indexOfRefraction=' + indexOfRefraction +
', transparencyInitial=' + transparencyInitial +
', transparency_changed=' + newTransparency);
transparency_changed = newTransparency;
}
]]>
</
Scene>
</