用PHP动态生成虚拟现实VRML网页 (转)[@more@]由于VRML博大精深,这里只介绍一个简单的例子,还可以将各种VRML结点存入
数据库中,下面是源
程序。注意:在
服务器上,要将让
PHP处理wrl格式的文档,否则后果将是没有任何虚拟现实。
DEF leftBox Tran
sfo
RM {
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;
?>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10790690/viewspace-951556/
,如需转载,请注明出处,否则将追究法律责任。