用PHP動(dòng)態(tài)生成虛擬現(xiàn)實(shí)VRML頁(yè)面
發(fā)表時(shí)間:2024-02-11 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]由于VRML博大精深,這里只介紹一個(gè)簡(jiǎn)單的例子,還可以將各種VRML結(jié)點(diǎn)存入數(shù)據(jù)庫(kù)中,下面是源程序。注意:在服務(wù)器上,要將讓PHP處理wrl格式的文檔,否則后果將是沒有任何虛擬現(xiàn)實(shí)。<?php header("Content-type: application/x-vrml&quo...
由于VRML博大精深,這里只介紹一個(gè)簡(jiǎn)單的例子,還可以將各種VRML結(jié)點(diǎn)存入數(shù)據(jù)庫(kù)中,下面是源程序。注意:在服務(wù)器上,要將讓PHP處理wrl格式的文檔,否則后果將是沒有任何虛擬現(xiàn)實(shí)。
<?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;
?>