I have been engaged in 3D animation many years ago. After learning PHP, I found that I can use PHP to dynamically generate the OpenGL document, which is a bit similar to the Generator to dynamically generate Flash.
Due to the wide and profound knowledge of VRML, here is only a simple example. You can also store various types of VRML nodes into the database. Such a web page of virtual reality will ......, Great!
The following is the source program. Note: on the server, PHP is required to process wrl-Format documents. Otherwise, there will be no virtual reality. Source program directly saved into wrl files, in the browser to install plug-ins, you can go to my another home page download: http://go.163.com /~ Sjtucaocao/
<? Php header ("Content-type: application/x-vrml"); $ txt = "# fig
DEF leftBox Transform
{
Translation-5 0 0
Children
[
Shape
{
Appearance Appearance
{
Material Material
{
DiffuseColor 1 0 0
}
}
Geometry Box {}
}
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
{
DiffuseColor 0 0 1
}
}
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;
?>