多年前本人開始從事三維動畫的學習,後學習了PHP,發現可以透過PHP動態產生VRML文檔,有點類似Generator動態產生Flash的方式。
由於VRML博大精深,這裡只介紹一個簡單的例子,還可以將各種VRML結點存入資料庫中,這樣的虛擬實境網頁將會…,爽!
下面是原始程式。注意:在伺服器上,要讓PHP處理wrl格式的文檔,否則後果將是沒有任何虛擬實境。本原始程式直接存成wrl文件,在瀏覽器中要安裝插件,可以到我的另一個主頁上去下載:http://go.163.com/~sjtucaocao/
DEF leftBox Transform
{
translation -5 0 0
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 0
}
diffuseColor 1 0 0
}
}
} }
}
DEF SphereChild Shape
{
appearance Appearance
{
material Material
{
diffuseColor 1 0 1
{
diffuseColor 1 0 1
>geometry Sphere
{
radius 1.2
}
}
]
}
DEF rightBox Transform
{
children
[
Shape
{
appearance Appearance
{
material Material
{
diffuseColor 0 0 1
}
geometry Box{}
}
]
}
DEF onoff Transform
{
translation 0 -1 0
children
[
[ 🎜>{
appearance Appearance
{
material Material
{
diffuseColor 0 1 0
}
}
geometry>gometry> DEF TS TouchSensor{}
]
}
DEF S Script
{
eventIn SFBool isActive
eventOut MFNode child "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 $🎜>ROUTE S.child TO rightBox.addChildren";echo $🎜>>; 🎜>
http://www.bkjia.com/PHPjc/316801.html
www.bkjia.com
true