-----------------------------------------------------------------------
-- An example of Actor Prolog program. --
-- (c) 2012 IRE RAS Alexei A. Morozov --
-- --
-- This program draws an object and creates a clip plane to see --
-- the interior of the object. It also has a behavior to move --
-- the clip plane. --
-----------------------------------------------------------------------
import .. from "morozov/Java3D";
class 'Main' (specialized 'Canvas3D'):
[
goal:-!,
Bounds== 'BoundingSphere'({
center: p(0.0,0.0,0.0),
radius: 100.0
}),
Appearance== 'Appearance'({
material: 'Material'({
lightingEnable: 'yes'
}),
polygonAttributes: 'PolygonAttributes'({
cullFace: 'CULL_NONE'
})
}),
show([
'TransformGroup'({
transform3D: 'Transform3D'({
scale: 0.4
}),
branches: [
'AmbientLight'({
lightOn: 'yes',
color: color3(1.0,1.0,1.0),
influencingBounds: Bounds
}),
'DirectionalLight'({
color: color3(0.5,0.0,0.5),
direction: [-1.0,-1.0,1.0],
influencingBounds: Bounds
}),
'DirectionalLight'({
color: color3(0.7,0.7,0.0),
direction: [0.0,0.0,-1.0],
influencingBounds: Bounds
}),
'TransformGroup'({
transform3D: 'Transform3D'({
rotation: [0.0,1.0,0.0,45.0]
}),
branches: [
'Cylinder'({
radius: 0.5,
height: 2.2,
generateNormals: 'yes',
xdivisions: 100,
ydivisions: 1,
appearance: Appearance
}),
'Cylinder'({
radius: 0.3,
height: 2.5,
generateNormals: 'yes',
xdivisions: 100,
ydivisions: 1,
appearance: Appearance
}),
'Box'({
xdim: 0.8,
ydim: 0.8,
zdim: 0.8,
generateNormals: 'yes',
appearance: Appearance
}),
'TransformGroup'({
allowTransformWrite: 'yes',
allowTransformRead: 'yes',
branches: [
'MouseRotate'({
schedulingBounds: Bounds
}),
'MouseZoom'({
schedulingBounds: Bounds
}),
'MouseWheelZoom'({
schedulingBounds: Bounds
}),
'ModelClip'({
1: [0.0,1.0,1.0,0.0],
influencingBounds: Bounds
})
]
})
]
})
]
})
]).
]
|