=== Top of the Swiki === Attachments ===

Balloon3D

Example one

rend _ B3DRenderEngine defaultForPlatformOn: Display.
rend viewport: (Rectangle origin: 10@10 extent: 200@200).
rend clearViewport: Color black.
cam _ B3DCamera new.
cam initialize.
cam position: 0@0@2.
rend clearDepthBuffer.
rend loadIdentity.
cam renderOn: rend.
"tex _ Form fromUser.
rend texture: tex."
rend trackEmissionColor: true.
rend normal: 0@0@1.
rend color: Color white.
rend drawPolygonAfter: [
rend
"texCoords: -1@-1;"
vertex: -1@-1@0;
"texCoords:1@-1;"
vertex: 1@-1@0;
"texCoords: 1@1;"
vertex: 1@1@0;
"texCoords: -1@1;"
vertex: -1@1@0.
].
rend flush.






Example 2


se := B3DSceneExplorerMorph new openInWorld.

so := B3DSceneObject named: 'cone'.
cone := B3DIndexedMesh vrml97Cone.

"Do I need to create colors for the vertices?"
colors := B3DColor4Array new: (cone vertices size ).
1 to: (colors size) do:[:i| colors at: i put: (B3DColor4 r: 1 g: 0 b: 0
a: 0.5)].
so geometry: ((B3DIndexedMesh vrml97Cone) vertexColors: colors).

"Camera seems critical"
camera _ B3DCamera new.
camera position: 0@0@-1.5.

scene _ B3DScene new.
scene defaultCamera: camera.

"the headLight code is from B3DSceneExplorerMorph. Is it important?"
headLight := B3DSpotLight new.
headLight position: 0@-1@0.
headLight target: 0@0@0.
headLight lightColor: (B3DMaterialColor color: (Color blue)).
headLight attenuation: (B3DLightAttenuation constant: 1.0 linear: 0.0
squared: 0.0).
headLight minAngle: 5.
headLight maxAngle: 6.
scene lights add: headLight.

"This seems to work, except it's dark gray"
scene objects add: so.

"Now do the sphere, dark gray also"
so1 := B3DSceneObject named: 'Sphere'.
so1 geometry: (B3DIndexedMesh vrml97Sphere).
scene objects add: so1.

"Is this necessary? It's from B3DSceneExplorerMorph"
scene objects do: [ :object |
object material: nil].

"Now change the displayed B3DSceneExplorerMorph, but,
the cone and sphere are both dark gray"
se scene: scene.