多年前本人开始从事三维动画方面的学习,后学习了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;
?>
由于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;
?>
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“利用PHP动态生成VRML网页”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。