corrected zbuffer data access, but screenblock not works for me (or rather never for me)
This commit is contained in:
parent
934c88961c
commit
3a6a28ff05
6 changed files with 30 additions and 26 deletions
16
scene.cpp
16
scene.cpp
|
@ -172,7 +172,7 @@ void Scene::setSetup(int num) {
|
|||
return;
|
||||
|
||||
if (_currSetup->_bkgndZBm)
|
||||
screenBlocksInit(_currSetup->_bkgndZBm->getData() );
|
||||
screenBlocksInit(_currSetup->_bkgndZBm->getZbufferData());
|
||||
else
|
||||
screenBlocksInitEmpty();
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ ObjectState *Scene::findState(const char *filename) {
|
|||
|
||||
void Scene::setSoundPosition(const char *soundName, Vector3d pos) {
|
||||
Vector3d cameraPos = _currSetup->_pos;
|
||||
Vector3d vector;
|
||||
Vector3d vector, vector2;
|
||||
vector.set(fabs(cameraPos.x() - pos.x()), fabs(cameraPos.y() - pos.y()), fabs(cameraPos.z() - pos.z()));
|
||||
float distance = vector.magnitude();
|
||||
float maxDistance = 8.0f;
|
||||
|
@ -238,8 +238,16 @@ void Scene::setSoundPosition(const char *soundName, Vector3d pos) {
|
|||
newVolume += _minVolume;
|
||||
g_imuse->setVolume(soundName, newVolume);
|
||||
|
||||
// TODO: pan
|
||||
// roll, fov
|
||||
vector.set(_currSetup->_interest.x() - cameraPos.x(), _currSetup->_interest.y() - cameraPos.y(),
|
||||
_currSetup->_interest.z() - cameraPos.z());
|
||||
vector2.set(pos.x() - cameraPos.x(), pos.y() - cameraPos.y(), pos.z() - cameraPos.z());
|
||||
// printf("a pos (%2.2f, %2.2f, %2.2f) i pos (%2.2f, %2.2f, %2.2f) c pos (%2.2f, %2.2f, %2.2f)\n", pos.x(), pos.y(), pos.z(),
|
||||
// _currSetup->_interest.x(), _currSetup->_interest.y(), _currSetup->_interest.z(),
|
||||
// cameraPos.x(), cameraPos.y(), cameraPos.z());
|
||||
float a = angle(vector, vector2);
|
||||
int pan = a * 127 * 1.5;
|
||||
pan = (pan / 2) + 64;
|
||||
// g_imuse->setPan(soundName, pan);
|
||||
}
|
||||
|
||||
void Scene::setSoundParameters(int minVolume, int maxVolume) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue