source: GTP/trunk/App/Demos/Geom/Shark3D/clod_head_demo_win32/src/res/client/actor/extra.s3d_perch @ 2236

Revision 2236, 4.1 KB checked in by gumbau, 17 years ago (diff)
Line 
1///////////////////////////////////////////////////////////////////////////////
2//
3//      ##  ######
4//       ######  ###
5//  ## ###############        Shark 3D Engine (www.shark3d.com)
6//   ########## # # #
7//    ########                Copyright (c) 1996-2006 Spinor GmbH.
8//   ######### # # #          All rights reserved.
9//  ##   ##########
10//      ##
11//
12///////////////////////////////////////////////////////////////////////////////
13
14var actor m_motionDeleg;
15var actor m_universePlayer;
16var int m_lightMode;
17var int m_god;
18var float m_firstX, m_firstY, m_firstZ;
19var float m_secondX, m_secondY, m_secondZ;
20
21func public void initActor()
22    m_motionDeleg = findActor("motion_deleg");
23    m_universePlayer = findActor("universeplayer");
24    m_god = 0;
25    m_lightMode = 1;
26    m_firstX = 0.0;
27    m_firstY = 0.0;
28    m_firstZ = 0.0;
29    m_secondX = 0.0;
30    m_secondY = 0.0;
31    m_secondZ = 0.0;
32end
33
34func public void finishActor()
35end
36
37func public void off()
38    if m_lightMode then
39        m_lightMode = 0;
40        m_universePlayer ^ set_light_transl(
41                0.0, 0.0, 0.0 );
42    end
43end
44
45func public void on()
46    if !m_lightMode then
47        m_lightMode = 1;
48        m_firstX = 0.0;
49        m_firstY = 0.0;
50        m_firstZ = 0.0;
51        m_secondX = 0.0;
52        m_secondY = 0.0;
53        m_secondZ = 0.0;
54    end
55end
56
57func public void toggle()
58    if m_god then
59        if m_lightMode then
60            off();
61            m_motionDeleg ^ enable();
62        else
63            on();
64            m_motionDeleg ^ disable();
65        end
66    else
67        on();
68    end
69end
70
71func public void god()
72    if m_god then
73        m_god = 0;
74        on();
75        m_universePlayer ^ god_off();
76        m_motionDeleg ^ disable();
77    else
78        m_god = 1;
79        off();
80        m_universePlayer ^ god_on();
81        m_motionDeleg ^ enable();
82    end
83end
84
85func void updateLight()
86    var float x = m_firstX + m_secondX;
87    var float y = m_firstY + m_secondY;
88    var float z = m_firstZ + m_secondZ;
89    m_universePlayer ^ set_light_transl( x, y, z);   
90end
91
92func public void assign_vel_pos_x( float val )
93    if m_lightMode then
94        //m_firstZ = val;
95        updateLight();
96    end
97end
98
99func public void assign_vel_neg_x( float val )
100    if m_lightMode then
101        //m_firstZ = - val;
102        updateLight();
103    end
104end
105
106func public void assign_vel_pos_y( float val )
107    if m_lightMode then
108        m_firstZ = - val;
109        updateLight();
110    end
111end
112
113func public void assign_vel_neg_y( float val )
114    if m_lightMode then
115        m_firstZ = val;
116        updateLight();
117    end
118end
119
120func public void assign_vel_pos_z( float val )
121    if m_lightMode then
122        //m_firstY = val;
123        updateLight();
124    end
125end
126
127func public void assign_vel_neg_z( float val )
128    if m_lightMode then
129        //m_firstY = - val;
130        updateLight();
131    end
132end
133
134func public void assign_spin_pos_x( float val )
135    if m_lightMode then
136        m_secondY = val;
137        updateLight();
138    end
139end
140
141func public void assign_spin_neg_x( float val )
142    if m_lightMode then
143        m_secondY = - val;
144        updateLight();
145    end
146end
147
148func public void assign_spin_pos_y( float val )
149    if m_lightMode then
150        m_secondZ = val;
151        updateLight();
152    end
153end
154
155func public void assign_spin_neg_y( float val )
156    if m_lightMode then
157        m_secondZ = - val;
158        updateLight();
159    end
160end
161
162func public void assign_spin_pos_z( float val )
163    if m_lightMode then
164        m_secondX = val;
165        updateLight();
166    end
167end
168
169func public void assign_spin_neg_z( float val )
170    if m_lightMode then
171        m_secondX = - val;
172        updateLight();
173    end
174end
175
176func public void move_cursor_x( float val )
177    if m_lightMode then
178        m_firstX = m_firstX + val;
179        updateLight();
180    end
181end
182
183func public void move_cursor_y( float val )
184    if m_lightMode then
185        m_firstY = m_firstY - val;
186        updateLight();
187    end
188end
189
190///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.