Home Log In or Register Forums

Javascript & VRML

Home > Forums > It And Computing > 'Javascript & VRML'
'Javascript & VRML'
Page: [1] [2]
richard's user image
richard
03.11.2003 - 11:27
forum administrator
Continuing on from this discussion...

Arar:
Went to see my old school last night, got to speak to my old housemaster. They might want me to do some visualisation stuff for their website, do a 3D walkthrough of the school etc. Now, I'm wondering, what the best format for that would be for the web... VRML? A java plug-in? Choices choices... then there is the digitisation of the school architectural plans themselves, generation and storage of textures...
Its been a week, I'm back in england, and no more computer again! Did have time to make some cool (if somehow extremely bloated) animated gifs to use as buttons on my website.
What I would really like now is some javascript which would pre-load the animations (or postload? just so that it doesn't interfere with the general loading of the page)and make it so that they would swap the animations in with the mouseover event is fired.


In answer to the VRML question, Java applet would be quiet nice to do, since you've already done GL4Java before, but the only thing would be compatibility. Even though Java is supposed to be able to run on any web-browser, the reality of the situation is that it doesn't. At least not perfectly. As one person described it: Write Once, Debug Everywhere. (as opposed to the Write Once, Run Anywhere mantra). But then maybe I'm just being cynical and after all, it would be easier 4 u
richard's user image
richard
03.11.2003 - 11:36
forum administrator
... rather than learning VRML!!!

As for Javascript, pre-loading of images is easy. I used to have a snippet of code to do it, but damned if I can find it. I think it looks something like this:

function loadImages()
{
myImage = new Image();
myImage.src = "seaotter.gif"
myImage.src = "whale.gif"
myImage.src = "penguin.gif"
myImage.src = "manatee.gif"
}


and call that either at the beginning of the page or the end, or whenever you want to load the images.

As for switching on mouse overs:

<img src="whale.gif" onMouseOver="switch(this, 'buttonon.gif');" onMouseOut="switch(this, 'buttonoff.gif');">


with the accompanying javascript:

function switch(button, mode)
{
button.src = mode;
}


Enjoy!
arar's user image
arar
03.11.2003 - 11:57
Cheers matey!!! What did u think of the animated buttons anyhow? (Don't ask me where and when I had to dress up as a gold oscar =P ) javascript is much appreciated, as for learning VRML, 3DSMax v3.0 (the one we have been, ahem, learning in a student way) can export any model into VRML which means I can simply provide a link to a VRML plugin and have them download the model directly. The only problem of course is getting the model into 3DSMax into the first place - of course I need to do that anyhow if I want to export it in a standard format such as ASE...
Bored on our lunchbreak are we? =)
richard's user image
richard
03.11.2003 - 12:04
forum administrator
Lunchbreak?? If you drop that part, then yes.

Didn't you create something a while ago where you could click around a picture and it would map out the coordinates? Do that with the floorplan of the school, then extrude. That's for starters, then it would get interesting by cutting out windows, etc. etc...
arar's user image
arar
03.11.2003 - 12:20
Indeed sir. Image loaded in, then treated as a texture, ie
Image has W x H
Maps to 1 x 1
Therefore a function, given (x,y) should produce a color.
This will give a smooth transition of a single image onto an image of any size.

Therefore, to work with an image, decide how big you want it in the window SW x SH.
Decide the viewport CX, CY (corner of viewport) and VW, VH (width and height of viewport)
Create an image of size SW x SH, and produce the image by looping through each pixel, calculating VX and VY of each pixel, and feed into function to get picture.

Voila! Perfectly scalable viewport. Now, when you click, You get MouseX, MouseY, convert into MouseVX, MouseVY, and store values as points. Later, connect points into lines/polygons, or possibly curves if you want to autogenerate surface vectors etc for smooth surfaces. Could use b-splines for curves, however am not too up on b-spline patches, only know Beziers patches as far as full 3D curves go. They work just as well, but are less intuitive.
nelson's user image
nelson
03.11.2003 - 14:26
forum administrator
You might want to reconsider the 3D viewing thingy. If it's a requirement, fair enough, but most people find 360-degree panoramic pictures much, much more interesting and easy to interact with.

3D viewing is good for buildings that do not yet exist and stuff like technical schematics. A "tour of our facilities" is better served by something like this.
richard's user image
richard
03.11.2003 - 14:29
forum administrator
Yeah, I actually agree on this one. I believe even Hull demoed a similar one of their campus?
arar's user image
arar
03.11.2003 - 14:30
Very nice indeed =) I'm gonna be living near cribbs causeway in Bristol, which is one of the featured images. Having a 3D model is good for other things as well - I can't tell how long that applet took to load because I'm on the library computers again and its pretty much instant...
Still, at least there will never be any compatibility issues!
nelson's user image
nelson
03.11.2003 - 15:17
forum administrator
Shit, too close.
arar's user image
arar
03.11.2003 - 15:22
I'm sure we won't bump into each other too much.
Page: [1] [2]

You must log in to post messages on this board. If you don't have a username and password, you can register quickly to get them!

contact us © 2003, 2004 BurningHorizons.net