1 header("Content-type: application/x-vrml"); $txt="#VRML V2.0 utf8
2
3DEF leftBox Transform
4{
5translation -5 0 0
6children
7[
8Shape
9{
10appearance Appearance
11{
12material Material
13{
14diffuseColor 1 0 0
15}
16}
17geometry Box{}
18}
19DEF SphereChild Shape
20{
21appearance Appearance
22{
23material Material
24{
25diffuseColor 1 0 1
26}
27}
28geometry Sphere
29{
30radius 1.2
31}
32}
33]
34}
35
36DEF rightBox Transform
37{
38translation 5 0 0
39children
40[
41Shape
42{
43appearance Appearance
44{
45material Material
46{
47diffuseColor 0 0 1
48}
49}
50geometry Box{}
51}
52]
53}
54
55DEF onoff Transform
56{
57translation 0 -1 0
58children
59[
60Shape
61{
62appearance Appearance
63{
64material Material
65{
66diffuseColor 0 1 0
67}
68}
69geometry Box{}
70}
71DEF TS TouchSensor{}
72]
73}
74
75DEF S Script
76{
77eventIn SFBool isActive
78eventOut MFNode child
79field MFNode testNode USE SphereChild
80url
81"javascript:
82function isActive(value)
83{
84if (value)
85{
86child=testNode;
87}
88}
89"
90}
91
92ROUTE TS.isActive TO S.isActive
93ROUTE S.child TO leftBox.removeChildren
94ROUTE S.child TO rightBox.addChildren";echo $txt;
用PHP动态生成虚拟现实VRML网页 (转 )
comments powered by Disqus