[GOODIE] Texture-mapped spheres

Raab, Andreas Andreas.Raab at disney.com
Fri Feb 4 02:48:01 UTC 2000


Uh well,

> This changeset implements high-speed texture-mapped spheres.  
> While that might not seem very exciting, it's an interesting 
> hack that illustrates the strengths of Squeak's plugins. 
> It's also useful for those all-too-frequent times when 
> you need to rotate Mars - hopefully the distribution includes
> the appropriate texture maps.

That's certainly a challenge for a system that has a 3D engine ;-)
Let's see how small we can get - here's my attempt:

'From Squeak2.7 of 5 January 2000 [latest update: #1762] on 3 February 2000
at 6:34:43 pm'!
B3DMorph subclass: #B3DSphereMorph
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Balloon3D-Demo Morphs'!

!B3DSphereMorph methodsFor: 'initialize' stamp: 'ar 2/3/2000 18:34'!
initialize
	"Prevent super initialize"
	bounds _ 0 at 0 corner: 100 at 100.
	submorphs _ #().
	color _ nil.
	angle _ 0.
	"Create sphere"
	geometry _ B3DIndexedMesh vrml97Sphere copy.
	"Make us some light"
	geometry vertexColors: (B3DColor4Array new: geometry vertices size).
	geometry vertexColors += Color white.
	"Make us a camera"
	camera _ B3DCamera new.
	camera position: 0 at 0@1.5.
	camera nearDistance: 0.1.
	camera farDistance: 5.0.
	"Make us a texture"
	texture _ ImageImports at: 'MarsTexture'.
	texture _ texture asTexture.
! !


!B3DSphereMorph methodsFor: 'drawing' stamp: 'ar 2/3/2000 18:31'!
renderOn: aRenderer
	aRenderer trackEmissionColor: true.
	super renderOn: aRenderer.! !


Sorry, couldn't resist.

  Andreas





More information about the Squeak-dev mailing list