mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 11:36:27 +02:00
sent correct position for injected audio, first bird index is 1
This commit is contained in:
parent
0873be94d4
commit
33b6ca31b0
3 changed files with 18 additions and 12 deletions
|
@ -41,7 +41,7 @@ int main(int argc, const char* argv[]) {
|
|||
|
||||
// wrap back to 0 if the bird index is 6 now
|
||||
if (birdIndex == 6) {
|
||||
birdIndex = 0;
|
||||
birdIndex = 1;
|
||||
}
|
||||
|
||||
// send the assignment
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "Operative.h"
|
||||
|
||||
const float BUG_VOXEL_SIZE = 0.0625f / 128;
|
||||
const int VOXELS_PER_BUG = 18;
|
||||
|
||||
glm::vec3 rotatePoint(glm::vec3 point, float angle) {
|
||||
// First, create the quaternion based on this angle of rotation
|
||||
|
@ -127,7 +126,6 @@ void Operative::removeOldBug() {
|
|||
}
|
||||
|
||||
void Operative::renderMovingBug() {
|
||||
VoxelDetail details[VOXELS_PER_BUG];
|
||||
unsigned char* bufferOut;
|
||||
int sizeOut;
|
||||
|
||||
|
@ -168,24 +166,24 @@ void Operative::renderMovingBug() {
|
|||
|
||||
// Generate voxels for where bug is going to
|
||||
for (int i = 0; i < VOXELS_PER_BUG; i++) {
|
||||
details[i].s = BUG_VOXEL_SIZE;
|
||||
_bugDetails[i].s = BUG_VOXEL_SIZE;
|
||||
|
||||
glm::vec3 partAt = BUG_PARTS[i].partLocation * BUG_VOXEL_SIZE * (_bugDirection.x < 0 ? -1.0f : 1.0f);
|
||||
glm::vec3 rotatedPartAt = rotatePoint(partAt, _bugRotation);
|
||||
glm::vec3 offsetPartAt = rotatedPartAt + _bugPosition;
|
||||
|
||||
details[i].x = offsetPartAt.x;
|
||||
details[i].y = offsetPartAt.y;
|
||||
details[i].z = offsetPartAt.z;
|
||||
_bugDetails[i].x = offsetPartAt.x;
|
||||
_bugDetails[i].y = offsetPartAt.y;
|
||||
_bugDetails[i].z = offsetPartAt.z;
|
||||
|
||||
details[i].red = BUG_PARTS[i].partColor[0];
|
||||
details[i].green = BUG_PARTS[i].partColor[1];
|
||||
details[i].blue = BUG_PARTS[i].partColor[2];
|
||||
_bugDetails[i].red = BUG_PARTS[i].partColor[0];
|
||||
_bugDetails[i].green = BUG_PARTS[i].partColor[1];
|
||||
_bugDetails[i].blue = BUG_PARTS[i].partColor[2];
|
||||
}
|
||||
|
||||
// send the "create message" ...
|
||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE;
|
||||
if (createVoxelEditMessage(message, 0, VOXELS_PER_BUG, (VoxelDetail*)&details, bufferOut, sizeOut)){
|
||||
if (createVoxelEditMessage(message, 0, VOXELS_PER_BUG, (VoxelDetail*)&_bugDetails, bufferOut, sizeOut)){
|
||||
|
||||
_packetsSent++;
|
||||
_bytesSent += sizeOut;
|
||||
|
@ -221,7 +219,9 @@ void Operative::run() {
|
|||
|
||||
renderMovingBug();
|
||||
|
||||
injector->setPosition(_bugPosition);
|
||||
glm::vec3 latestPosition(_bugDetails[5].x, _bugDetails[5].y, _bugDetails[5].z);
|
||||
latestPosition *= 128;
|
||||
injector->setPosition(latestPosition);
|
||||
|
||||
if (!injector->isInjectingAudio() && randIntInRange(1, 100) == 99) {
|
||||
AudioInjectionManager::threadInjector(injector);
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
|
||||
const int VOXELS_PER_BUG = 18;
|
||||
|
||||
class Operative {
|
||||
public:
|
||||
Operative();
|
||||
|
@ -26,6 +30,8 @@ private:
|
|||
void renderMovingBug();
|
||||
void removeOldBug();
|
||||
|
||||
VoxelDetail _bugDetails[VOXELS_PER_BUG];
|
||||
|
||||
glm::vec3 _bugPosition;
|
||||
glm::vec3 _bugDirection;
|
||||
glm::vec3 _bugPathCenter;
|
||||
|
|
Loading…
Reference in a new issue