1*bebae9c0SAndroid Build Coastguard Worker /*
2*bebae9c0SAndroid Build Coastguard Worker * Copyright (C) 2010 The Android Open Source Project
3*bebae9c0SAndroid Build Coastguard Worker *
4*bebae9c0SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*bebae9c0SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*bebae9c0SAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*bebae9c0SAndroid Build Coastguard Worker *
8*bebae9c0SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
9*bebae9c0SAndroid Build Coastguard Worker *
10*bebae9c0SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*bebae9c0SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*bebae9c0SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*bebae9c0SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*bebae9c0SAndroid Build Coastguard Worker * limitations under the License.
15*bebae9c0SAndroid Build Coastguard Worker */
16*bebae9c0SAndroid Build Coastguard Worker
17*bebae9c0SAndroid Build Coastguard Worker /* 3DLocation implementation */
18*bebae9c0SAndroid Build Coastguard Worker
19*bebae9c0SAndroid Build Coastguard Worker #include "sles_allinclusive.h"
20*bebae9c0SAndroid Build Coastguard Worker
21*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_SetLocationCartesian(SL3DLocationItf self,const SLVec3D * pLocation)22*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_SetLocationCartesian(SL3DLocationItf self, const SLVec3D *pLocation)
23*bebae9c0SAndroid Build Coastguard Worker {
24*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
25*bebae9c0SAndroid Build Coastguard Worker
26*bebae9c0SAndroid Build Coastguard Worker if (NULL == pLocation) {
27*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
28*bebae9c0SAndroid Build Coastguard Worker } else {
29*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
30*bebae9c0SAndroid Build Coastguard Worker SLVec3D locationCartesian = *pLocation;
31*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
32*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian = locationCartesian;
33*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
34*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
35*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
36*bebae9c0SAndroid Build Coastguard Worker }
37*bebae9c0SAndroid Build Coastguard Worker
38*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
39*bebae9c0SAndroid Build Coastguard Worker }
40*bebae9c0SAndroid Build Coastguard Worker
41*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_SetLocationSpherical(SL3DLocationItf self,SLmillidegree azimuth,SLmillidegree elevation,SLmillimeter distance)42*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_SetLocationSpherical(SL3DLocationItf self,
43*bebae9c0SAndroid Build Coastguard Worker SLmillidegree azimuth, SLmillidegree elevation, SLmillimeter distance)
44*bebae9c0SAndroid Build Coastguard Worker {
45*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
46*bebae9c0SAndroid Build Coastguard Worker
47*bebae9c0SAndroid Build Coastguard Worker if (!((-360000 <= azimuth) && (azimuth <= 360000) &&
48*bebae9c0SAndroid Build Coastguard Worker (-90000 <= elevation) && (elevation <= 90000) &&
49*bebae9c0SAndroid Build Coastguard Worker (0 <= distance) && (distance <= SL_MILLIMETER_MAX))) {
50*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
51*bebae9c0SAndroid Build Coastguard Worker } else {
52*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
53*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
54*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationSpherical.mAzimuth = azimuth;
55*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationSpherical.mElevation = elevation;
56*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationSpherical.mDistance = distance;
57*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_UNKNOWN_SPHERICAL_SET;
58*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
59*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
60*bebae9c0SAndroid Build Coastguard Worker }
61*bebae9c0SAndroid Build Coastguard Worker
62*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
63*bebae9c0SAndroid Build Coastguard Worker }
64*bebae9c0SAndroid Build Coastguard Worker
65*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_Move(SL3DLocationItf self,const SLVec3D * pMovement)66*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_Move(SL3DLocationItf self, const SLVec3D *pMovement)
67*bebae9c0SAndroid Build Coastguard Worker {
68*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
69*bebae9c0SAndroid Build Coastguard Worker
70*bebae9c0SAndroid Build Coastguard Worker if (NULL == pMovement) {
71*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
72*bebae9c0SAndroid Build Coastguard Worker } else {
73*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
74*bebae9c0SAndroid Build Coastguard Worker SLVec3D movementCartesian = *pMovement;
75*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
76*bebae9c0SAndroid Build Coastguard Worker for (;;) {
77*bebae9c0SAndroid Build Coastguard Worker enum CartesianSphericalActive locationActive = thiz->mLocationActive;
78*bebae9c0SAndroid Build Coastguard Worker switch (locationActive) {
79*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_COMPUTED_SPHERICAL_SET:
80*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_COMPUTED: // not in 1.0.1
81*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_REQUESTED: // not in 1.0.1
82*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_UNKNOWN:
83*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.x += movementCartesian.x;
84*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.y += movementCartesian.y;
85*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.z += movementCartesian.z;
86*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
87*bebae9c0SAndroid Build Coastguard Worker break;
88*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_UNKNOWN_SPHERICAL_SET:
89*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET;
90*bebae9c0SAndroid Build Coastguard Worker FALLTHROUGH_INTENDED;
91*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_REQUESTED_SPHERICAL_SET:
92*bebae9c0SAndroid Build Coastguard Worker // matched by cond_broadcast in case multiple requesters
93*bebae9c0SAndroid Build Coastguard Worker #if 0
94*bebae9c0SAndroid Build Coastguard Worker interface_cond_wait(thiz);
95*bebae9c0SAndroid Build Coastguard Worker #else
96*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET;
97*bebae9c0SAndroid Build Coastguard Worker #endif
98*bebae9c0SAndroid Build Coastguard Worker continue;
99*bebae9c0SAndroid Build Coastguard Worker default:
100*bebae9c0SAndroid Build Coastguard Worker assert(SL_BOOLEAN_FALSE);
101*bebae9c0SAndroid Build Coastguard Worker break;
102*bebae9c0SAndroid Build Coastguard Worker }
103*bebae9c0SAndroid Build Coastguard Worker break;
104*bebae9c0SAndroid Build Coastguard Worker }
105*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
106*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
107*bebae9c0SAndroid Build Coastguard Worker }
108*bebae9c0SAndroid Build Coastguard Worker
109*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
110*bebae9c0SAndroid Build Coastguard Worker }
111*bebae9c0SAndroid Build Coastguard Worker
112*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_GetLocationCartesian(SL3DLocationItf self,SLVec3D * pLocation)113*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_GetLocationCartesian(SL3DLocationItf self, SLVec3D *pLocation)
114*bebae9c0SAndroid Build Coastguard Worker {
115*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
116*bebae9c0SAndroid Build Coastguard Worker
117*bebae9c0SAndroid Build Coastguard Worker if (NULL == pLocation) {
118*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
119*bebae9c0SAndroid Build Coastguard Worker } else {
120*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
121*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
122*bebae9c0SAndroid Build Coastguard Worker for (;;) {
123*bebae9c0SAndroid Build Coastguard Worker enum CartesianSphericalActive locationActive = thiz->mLocationActive;
124*bebae9c0SAndroid Build Coastguard Worker switch (locationActive) {
125*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_COMPUTED_SPHERICAL_SET:
126*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_COMPUTED: // not in 1.0.1
127*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_REQUESTED: // not in 1.0.1
128*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_SET_SPHERICAL_UNKNOWN:
129*bebae9c0SAndroid Build Coastguard Worker {
130*bebae9c0SAndroid Build Coastguard Worker SLVec3D locationCartesian = thiz->mLocationCartesian;
131*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
132*bebae9c0SAndroid Build Coastguard Worker *pLocation = locationCartesian;
133*bebae9c0SAndroid Build Coastguard Worker }
134*bebae9c0SAndroid Build Coastguard Worker break;
135*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_UNKNOWN_SPHERICAL_SET:
136*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET;
137*bebae9c0SAndroid Build Coastguard Worker FALLTHROUGH_INTENDED;
138*bebae9c0SAndroid Build Coastguard Worker case CARTESIAN_REQUESTED_SPHERICAL_SET:
139*bebae9c0SAndroid Build Coastguard Worker // matched by cond_broadcast in case multiple requesters
140*bebae9c0SAndroid Build Coastguard Worker #if 0
141*bebae9c0SAndroid Build Coastguard Worker interface_cond_wait(thiz);
142*bebae9c0SAndroid Build Coastguard Worker #else
143*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET;
144*bebae9c0SAndroid Build Coastguard Worker #endif
145*bebae9c0SAndroid Build Coastguard Worker continue;
146*bebae9c0SAndroid Build Coastguard Worker default:
147*bebae9c0SAndroid Build Coastguard Worker assert(SL_BOOLEAN_FALSE);
148*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
149*bebae9c0SAndroid Build Coastguard Worker pLocation->x = 0;
150*bebae9c0SAndroid Build Coastguard Worker pLocation->y = 0;
151*bebae9c0SAndroid Build Coastguard Worker pLocation->z = 0;
152*bebae9c0SAndroid Build Coastguard Worker break;
153*bebae9c0SAndroid Build Coastguard Worker }
154*bebae9c0SAndroid Build Coastguard Worker break;
155*bebae9c0SAndroid Build Coastguard Worker }
156*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
157*bebae9c0SAndroid Build Coastguard Worker }
158*bebae9c0SAndroid Build Coastguard Worker
159*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
160*bebae9c0SAndroid Build Coastguard Worker }
161*bebae9c0SAndroid Build Coastguard Worker
162*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_SetOrientationVectors(SL3DLocationItf self,const SLVec3D * pFront,const SLVec3D * pAbove)163*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_SetOrientationVectors(SL3DLocationItf self,
164*bebae9c0SAndroid Build Coastguard Worker const SLVec3D *pFront, const SLVec3D *pAbove)
165*bebae9c0SAndroid Build Coastguard Worker {
166*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
167*bebae9c0SAndroid Build Coastguard Worker
168*bebae9c0SAndroid Build Coastguard Worker if (NULL == pFront || NULL == pAbove) {
169*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
170*bebae9c0SAndroid Build Coastguard Worker } else {
171*bebae9c0SAndroid Build Coastguard Worker SLVec3D front = *pFront;
172*bebae9c0SAndroid Build Coastguard Worker SLVec3D above = *pAbove;
173*bebae9c0SAndroid Build Coastguard Worker // NTH Check for vectors close to zero or close to parallel
174*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
175*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
176*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationVectors.mFront = front;
177*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationVectors.mAbove = above;
178*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationActive = ANGLES_UNKNOWN_VECTORS_SET;
179*bebae9c0SAndroid Build Coastguard Worker thiz->mRotatePending = SL_BOOLEAN_FALSE;
180*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
181*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
182*bebae9c0SAndroid Build Coastguard Worker }
183*bebae9c0SAndroid Build Coastguard Worker
184*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
185*bebae9c0SAndroid Build Coastguard Worker }
186*bebae9c0SAndroid Build Coastguard Worker
187*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_SetOrientationAngles(SL3DLocationItf self,SLmillidegree heading,SLmillidegree pitch,SLmillidegree roll)188*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_SetOrientationAngles(SL3DLocationItf self,
189*bebae9c0SAndroid Build Coastguard Worker SLmillidegree heading, SLmillidegree pitch, SLmillidegree roll)
190*bebae9c0SAndroid Build Coastguard Worker {
191*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
192*bebae9c0SAndroid Build Coastguard Worker
193*bebae9c0SAndroid Build Coastguard Worker if (!((-360000 <= heading) && (heading <= 360000) &&
194*bebae9c0SAndroid Build Coastguard Worker (-90000 <= pitch) && (pitch <= 90000) &&
195*bebae9c0SAndroid Build Coastguard Worker (-360000 <= roll) && (roll <= 360000))) {
196*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
197*bebae9c0SAndroid Build Coastguard Worker } else {
198*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
199*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
200*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mHeading = heading;
201*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mPitch = pitch;
202*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mRoll = roll;
203*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
204*bebae9c0SAndroid Build Coastguard Worker thiz->mRotatePending = SL_BOOLEAN_FALSE;
205*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
206*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
207*bebae9c0SAndroid Build Coastguard Worker }
208*bebae9c0SAndroid Build Coastguard Worker
209*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
210*bebae9c0SAndroid Build Coastguard Worker }
211*bebae9c0SAndroid Build Coastguard Worker
212*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_Rotate(SL3DLocationItf self,SLmillidegree theta,const SLVec3D * pAxis)213*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_Rotate(SL3DLocationItf self, SLmillidegree theta, const SLVec3D *pAxis)
214*bebae9c0SAndroid Build Coastguard Worker {
215*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
216*bebae9c0SAndroid Build Coastguard Worker
217*bebae9c0SAndroid Build Coastguard Worker if (!((-360000 <= theta) && (theta <= 360000)) || (NULL == pAxis)) {
218*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
219*bebae9c0SAndroid Build Coastguard Worker } else {
220*bebae9c0SAndroid Build Coastguard Worker SLVec3D axis = *pAxis;
221*bebae9c0SAndroid Build Coastguard Worker // NTH Check that axis is not (close to) zero vector, length does not matter
222*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
223*bebae9c0SAndroid Build Coastguard Worker interface_lock_exclusive(thiz);
224*bebae9c0SAndroid Build Coastguard Worker while (thiz->mRotatePending)
225*bebae9c0SAndroid Build Coastguard Worker #if 0
226*bebae9c0SAndroid Build Coastguard Worker interface_cond_wait(thiz);
227*bebae9c0SAndroid Build Coastguard Worker #else
228*bebae9c0SAndroid Build Coastguard Worker break;
229*bebae9c0SAndroid Build Coastguard Worker #endif
230*bebae9c0SAndroid Build Coastguard Worker thiz->mTheta = theta;
231*bebae9c0SAndroid Build Coastguard Worker thiz->mAxis = axis;
232*bebae9c0SAndroid Build Coastguard Worker thiz->mRotatePending = SL_BOOLEAN_TRUE;
233*bebae9c0SAndroid Build Coastguard Worker interface_unlock_exclusive(thiz);
234*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
235*bebae9c0SAndroid Build Coastguard Worker }
236*bebae9c0SAndroid Build Coastguard Worker
237*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
238*bebae9c0SAndroid Build Coastguard Worker }
239*bebae9c0SAndroid Build Coastguard Worker
240*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_GetOrientationVectors(SL3DLocationItf self,SLVec3D * pFront,SLVec3D * pUp)241*bebae9c0SAndroid Build Coastguard Worker static SLresult I3DLocation_GetOrientationVectors(SL3DLocationItf self,
242*bebae9c0SAndroid Build Coastguard Worker SLVec3D *pFront, SLVec3D *pUp)
243*bebae9c0SAndroid Build Coastguard Worker {
244*bebae9c0SAndroid Build Coastguard Worker SL_ENTER_INTERFACE
245*bebae9c0SAndroid Build Coastguard Worker
246*bebae9c0SAndroid Build Coastguard Worker if (NULL == pFront || NULL == pUp) {
247*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_PARAMETER_INVALID;
248*bebae9c0SAndroid Build Coastguard Worker } else {
249*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
250*bebae9c0SAndroid Build Coastguard Worker interface_lock_shared(thiz);
251*bebae9c0SAndroid Build Coastguard Worker SLVec3D front = thiz->mOrientationVectors.mFront;
252*bebae9c0SAndroid Build Coastguard Worker SLVec3D up = thiz->mOrientationVectors.mUp;
253*bebae9c0SAndroid Build Coastguard Worker interface_unlock_shared(thiz);
254*bebae9c0SAndroid Build Coastguard Worker *pFront = front;
255*bebae9c0SAndroid Build Coastguard Worker *pUp = up;
256*bebae9c0SAndroid Build Coastguard Worker result = SL_RESULT_SUCCESS;
257*bebae9c0SAndroid Build Coastguard Worker }
258*bebae9c0SAndroid Build Coastguard Worker
259*bebae9c0SAndroid Build Coastguard Worker SL_LEAVE_INTERFACE
260*bebae9c0SAndroid Build Coastguard Worker }
261*bebae9c0SAndroid Build Coastguard Worker
262*bebae9c0SAndroid Build Coastguard Worker
263*bebae9c0SAndroid Build Coastguard Worker static const struct SL3DLocationItf_ I3DLocation_Itf = {
264*bebae9c0SAndroid Build Coastguard Worker I3DLocation_SetLocationCartesian,
265*bebae9c0SAndroid Build Coastguard Worker I3DLocation_SetLocationSpherical,
266*bebae9c0SAndroid Build Coastguard Worker I3DLocation_Move,
267*bebae9c0SAndroid Build Coastguard Worker I3DLocation_GetLocationCartesian,
268*bebae9c0SAndroid Build Coastguard Worker I3DLocation_SetOrientationVectors,
269*bebae9c0SAndroid Build Coastguard Worker I3DLocation_SetOrientationAngles,
270*bebae9c0SAndroid Build Coastguard Worker I3DLocation_Rotate,
271*bebae9c0SAndroid Build Coastguard Worker I3DLocation_GetOrientationVectors
272*bebae9c0SAndroid Build Coastguard Worker };
273*bebae9c0SAndroid Build Coastguard Worker
I3DLocation_init(void * self)274*bebae9c0SAndroid Build Coastguard Worker void I3DLocation_init(void *self)
275*bebae9c0SAndroid Build Coastguard Worker {
276*bebae9c0SAndroid Build Coastguard Worker I3DLocation *thiz = (I3DLocation *) self;
277*bebae9c0SAndroid Build Coastguard Worker thiz->mItf = &I3DLocation_Itf;
278*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.x = 0;
279*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.y = 0;
280*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationCartesian.z = 0;
281*bebae9c0SAndroid Build Coastguard Worker memset(&thiz->mLocationSpherical, 0x55, sizeof(thiz->mLocationSpherical));
282*bebae9c0SAndroid Build Coastguard Worker thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN;
283*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mHeading = 0;
284*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mPitch = 0;
285*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationAngles.mRoll = 0;
286*bebae9c0SAndroid Build Coastguard Worker memset(&thiz->mOrientationVectors, 0x55, sizeof(thiz->mOrientationVectors));
287*bebae9c0SAndroid Build Coastguard Worker thiz->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN;
288*bebae9c0SAndroid Build Coastguard Worker thiz->mTheta = 0x55555555;
289*bebae9c0SAndroid Build Coastguard Worker thiz->mAxis.x = 0x55555555;
290*bebae9c0SAndroid Build Coastguard Worker thiz->mAxis.y = 0x55555555;
291*bebae9c0SAndroid Build Coastguard Worker thiz->mAxis.z = 0x55555555;
292*bebae9c0SAndroid Build Coastguard Worker thiz->mRotatePending = SL_BOOLEAN_FALSE;
293*bebae9c0SAndroid Build Coastguard Worker }
294