Help with 3D
Bruce ONeel
beoneel at mindspring.com
Wed Sep 13 08:55:16 UTC 2000
Hi,
I have been playing around with the 3d bits of squeak recently and I
am obviously missing something critical in the following bits of code
when I run it in a workspace.
Could someone point out what is wrong? When I execute it I end up
with a nice B3DSceneExplorerMorph with both a cone and a sphere,
but the cone and sphere are both darkish gray on slightly
darker gray and I don't get what I'm doing wrong. There has
been too much brain fade on 3D since I last worked with it.
Thanks ever so much for any help.
cheers
bruce
p.s. With luck this will become a MacTech article if I can get what I'm
working on to work:-)
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 at 0@-1.5.
scene _ B3DScene new.
scene defaultCamera: camera.
"the headLight code is from B3DSceneExplorerMorph. Is it important?"
headLight := B3DSpotLight new.
headLight position: 0 at -1@0.
headLight target: 0 at 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.
More information about the Squeak-dev
mailing list
|