read Library Method
Short Description: Download a model file from the server
Signature: x.read (url[,async][,onload])
Class: taccglOBJFile Class
Downloads an OBJ file containing a 3D model from the specified url.
The 3D model in general contains the definition of several 3D objects.
Placeholder for OBJ
<div id="placeholder" style="width:200px; height:200px; float:right; border:1px solid; padding:30px">
When downloaded transitions that display some or all of the 3D objects can
be created using taccglOBJFile.objs or taccglOBJFile.scene.
If async is set to false or is not present, then a synchronos request is done
and the method waits until the file has been downloaded completely.
This is an easy way of operation, which is why we recommend that for initial testing.
In production it has the problem that the page seems to hang, until the file
was downloaded and does not respond to any user interaction needing javaScript.
If async is set to true the download is started, however the method does not
wait, until the downlaod is finished. So you can not access the files data
until the download is finished. Using taccglOBJFile.ready
you can find out when this is the case, or you can use the onload parameter
to pass an taccglOBJFile.onload
callback to perform further action, when the file was downloaded. See taccglOBJFile.ready
and taccglOBJFile.onload for examples with async=true.
Examples
var to=taccgl.objFile(); to.read('/objtest/taccgldoc.obj',false); var a=taccgl.actor("placeholder",to.objs("Cone")).modFit(). rotateMiddle(0.7,0,0.7) .dur(3).start(); | RUN |
var to=taccgl.objFile().read('/objtest/taccgldoc.obj',false); var a=taccgl.actor("placeholder",to.objs("Sphere|Torus")).modFit(). to(0,1000,0).dur(3).start(); | RUN |
var to=taccgl.objFile().read('/objtest/taccgldoc.obj',false); var a=taccgl.actor("placeholder",to.scene()).modFit(). to(100,500,-2500). rotateMiddle(0.7,0,0.7).dur(3).start(); | RUN |
WebGL™ is a trademark of the Khronos Group Inc.
|