利用PHP動態(tài)生成VRML網(wǎng)頁
更新時間:2006年10月09日 00:00:00 作者:
多年前本人開始從事三維動畫方面的學習,后學習了PHP,發(fā)現(xiàn)可以通過PHP動態(tài)生成VRML文檔,有點類似于Generator動態(tài)生成Flash的方式。
由于VRML博大精深,這里只介紹一個簡單的例子,還可以將各種VRML結點存入數(shù)據(jù)庫中,這樣的虛擬現(xiàn)實網(wǎng)頁將……,爽!
下面是源程序。注意:在服務器上,要將讓PHP處理wrl格式的文檔,否則后果將是沒有任何虛擬現(xiàn)實。本源程序直接存成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結點存入數(shù)據(jù)庫中,這樣的虛擬現(xiàn)實網(wǎng)頁將……,爽!
下面是源程序。注意:在服務器上,要將讓PHP處理wrl格式的文檔,否則后果將是沒有任何虛擬現(xiàn)實。本源程序直接存成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;
?>
相關文章
第4章 數(shù)據(jù)處理-php字符串的處理-鄭阿奇(續(xù))
第4章 數(shù)據(jù)處理-php字符串的處理-鄭阿奇(續(xù)) ,學習php的朋友可以參考下。2011-07-07將RTF格式的文件轉成HTML并在網(wǎng)頁中顯示的代碼
將RTF格式的文件轉成HTML并在網(wǎng)頁中顯示的代碼...2006-10-10PHP5.0正式發(fā)布 不完全兼容PHP4 新增多項功能
PHP5.0正式發(fā)布 不完全兼容PHP4 新增多項功能...2006-10-10PHP的mysqli_select_db()函數(shù)講解
今天小編就為大家分享一篇關于PHP的mysqli_select_db()函數(shù)講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-01-01