Home > Article > Backend Development > Use PHP to dynamically generate VRML web pages_PHP tutorial
I started studying 3D animation many years ago, and then I learned PHP and found that I could dynamically generate VRML documents through PHP, which is somewhat similar to how Generator dynamically generates Flash.
Due to the broad and profound nature of VRML, we only introduce a simple example here. Various VRML nodes can also be stored in the database. Such a virtual reality web page will be... cool!
The following is the source program. Note: On the server, you must let PHP process the wrl format document, otherwise the result will be no virtual reality. The source program is directly saved as a wrl file. To install the plug-in in the browser, you can download it from my other homepage: http://go.163.com/~sjtucaocao/
DEF leftBox Transform
{
translation -5 0 0
children
[
Shape
{
appearance Appearance
{
material Material {}
}
DEF SphereChild Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 1
}
}
geometry Sphere
{
radius 1.2
}
}
]
}
DEF rightBox Transform
{
translation 5 0 0
children
[
Shape
{
appearance Appearance
{
material Material >geometry Box{}
}
]
}
DEF onoff Transform
{
translation 0 -1 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 1 0
}
}
geometry Box{}
}
DEF TS TouchSensor{}
]
}
DEF S Script
{
eventIn SFBool isActive
eventOut MFNode child
field MFNode testNode USE SphereChild
url
"javascript:
function isActive(value)
{
if (value)
{
child=testNode;
}
}
"
}
ROUTE TS.isActive TO S.isActive
ROUTE S.child TO leftBox.removeChildren
ROUTE S.child TO rightBox.addChildren";echo $txt;
?> ;
http://www.bkjia.com/PHPjc/316178.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/316178.html
TechArticle