MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / update3dVoices

Method update3dVoices

extlibs/soloud/src/core/soloud_core_3d.cpp:177–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175 }
176
177 void Soloud::update3dVoices(unsigned int *aVoiceArray, unsigned int aVoiceCount)
178 {
179 vec3 speaker[MAX_CHANNELS];
180
181 int i;
182 for (i = 0; i < (signed)mChannels; i++)
183 {
184 speaker[i].mX = m3dSpeakerPosition[3 * i + 0];
185 speaker[i].mY = m3dSpeakerPosition[3 * i + 1];
186 speaker[i].mZ = m3dSpeakerPosition[3 * i + 2];
187 speaker[i].normalize();
188 }
189 for (; i < MAX_CHANNELS; i++)
190 {
191 speaker[i].mX = 0;
192 speaker[i].mY = 0;
193 speaker[i].mZ = 0;
194 }
195
196 vec3 lpos, lvel, at, up;
197 at.mX = m3dAt[0];
198 at.mY = m3dAt[1];
199 at.mZ = m3dAt[2];
200 up.mX = m3dUp[0];
201 up.mY = m3dUp[1];
202 up.mZ = m3dUp[2];
203 lpos.mX = m3dPosition[0];
204 lpos.mY = m3dPosition[1];
205 lpos.mZ = m3dPosition[2];
206 lvel.mX = m3dVelocity[0];
207 lvel.mY = m3dVelocity[1];
208 lvel.mZ = m3dVelocity[2];
209 mat3 m;
210 if (mFlags & LEFT_HANDED_3D)
211 {
212 m.lookatLH(at, up);
213 }
214 else
215 {
216 m.lookatRH(at, up);
217 }
218
219 for (i = 0; i < (signed)aVoiceCount; i++)
220 {
221 AudioSourceInstance3dData * v = &m3dData[aVoiceArray[i]];
222
223 float vol = 1;
224
225 // custom collider
226 if (v->mCollider)
227 {
228 vol *= v->mCollider->collide(this, v, v->mColliderData);
229 }
230
231 vec3 pos, vel;
232 pos.mX = v->m3dPosition[0];
233 pos.mY = v->m3dPosition[1];
234 pos.mZ = v->m3dPosition[2];

Callers

nothing calls this directly

Calls 12

attenuateInvDistanceFunction · 0.85
attenuateLinearDistanceFunction · 0.85
dopplerFunction · 0.85
lookatLHMethod · 0.80
lookatRHMethod · 0.80
subMethod · 0.80
magMethod · 0.80
mulMethod · 0.80
dotMethod · 0.80
normalizeMethod · 0.45
nullMethod · 0.45

Tested by

no test coverage detected