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

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 terrywang 的 blog

由于vrml博大精深,这里只介绍一个简单的例子,还可以将各种vrml结点存入数据库中,下面是源程序。注意:在服务器上,要将让php处理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;
?>

本文关键:用PHP动态生成虚拟现实VRML网页
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top