
At this lesson you will do an exercice loading a 3D object from our DMU web server (www.dmu.com) to a space created at your machine. At the next you will learn how to create this type of "webobject". Croquet can load, from the web, not only 3D models (our funny equivalent to wallpapers) but, this is really what matters, interactive 2D Squeak projects, sometimes multiplayer, to be placed inside 3D windows - complete commercial, admistractive, scientific applications - we will see this soon.
The browser reads and shows pages that are .HTML files, having sometimes other files added (.JPG files, by example).
Croquet reads and shows 3D webobjects that are .TEA files, having sometimes other files added (.JPG files, by example).
Like ever, our exercice begins with the creation of a new Class: FromWeb and here, only one "make function". Its code:
makeFromWeb1: sp | tframe url | url := 'http://www.dmu.com/TeaLand/spaces/legoicHal.tea'. tframe := self loadURL: url. tframe ifNil:[ tframe translationX: 0 y: -3 z: 0. tframe rotationAroundY: 180. tframe boundsDepth: 3. tframe initBounds. ]. sp addChild: tframe.
CODE COMMENTS
initializeDefaultSpace | space | "Create a new space" space := TSpace new. "Make a light" self makeLight: space. "Make a floor" self makeFloor: space fileName:'lawn.BMP'. self makeFromWeb1: space. ^space.
CODE COMMENTS
And also the usual "script for Workspace":
sW:= FromWeb new. win2D:= SystemWindow new. lf:= LayoutFrame new. lf leftFraction:0. lf rightFraction:1. lf topFraction:0. lf bottomFraction:1. win2D setLabel: 'OBJECT FROM WEB'. win2D addMorph: sW fullFrame:lf. win2D openInWorldExtent: 500@250. sW requestInitialSpace.
CODE COMMENTS
When we "doit-ize", we will see the space and the webobject inside! WOW!
Pay attention and you can see a message on the load of each of the 2 files here: the legoicHal.TEA and the theFace000.JPG
Mama mia! It's a new "legoic"! Lets go near:
This legoic is our tribute to Halloween (a traditional celebration at USA and some other countries this week - not in my country):
Back to the serious part of the lesson, we like to say that, like the usual web browsers, Croquet has a cache for the webobjects downloaded. If you request again the same webobject, Croquet will "look" first at the cache and, if doesn't exist there, it will go to the WWW.
After execute the exercice you can look to the structure of this cache at YOUR machine:
At the 2nd part of the lesson we will teach how you can create YOUR webobjects and put then available in the web.
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
