用PHP动态生成虚拟现实VRML网页

连年前我起头从事三个维度动画方面包车型大巴上学,后学习了PHP,开采能够经过PHP动态生成VRML文档,有一点点相同于Generator动态生成Flash的法门。
由于VRML绵绵不绝,这里只介绍一个简约的例子,还是能将各类VRML结点存入数据库中,那样的捏造现实网页将……,爽!
上边是源程序。注意:在服务器上,要将让PHP管理wrl格式的文书档案,不然后果将是不曾其余虚构现实。本源程序间接存成wrl文件,在浏览器中要安装插件,可以到本人的另三个主页上去下载:

<?php header(“Content-type: application/x-vrml”);$txt=”#VRML V2.0
utf8

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;
?>

  

发表评论

电子邮件地址不会被公开。 必填项已用*标注