当前位置: 移动技术网 > IT编程>开发语言>PHP > 用PHP动态生成虚拟现实VRML网页

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

2019年05月17日  | 移动技术网IT编程  | 我要评论
多年前本人开始从事三维动画方面的学习,后学习了php,发现可以通过php动态生成vrml文档,有点类似于generator动态生成flash的方式。
由于vrml博大精深,这里只介绍一个简单的例子,还可以将各种vrml结点存入数据库中,这样的虚拟现实网页将……,爽!
下面是源程序。注意:在服务器上,要将让php处理wrl格式的文档,否则后果将是没有任何虚拟现实。本源程序直接存成wrl文件,在浏览器中要安装插件,可以到我的另一个主页上去下载:http://go.163.com/~sjtucaocao/

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

  

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网