mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
Adding dummy head for testing
This commit is contained in:
parent
77f32b8211
commit
5f65913486
6 changed files with 33 additions and 11 deletions
|
@ -28,7 +28,7 @@ const float AMPLITUDE_RATIO_AT_90 = 0.5;
|
|||
const short RING_BUFFER_FRAMES = 10;
|
||||
const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES;
|
||||
|
||||
const short JITTER_BUFFER_LENGTH_MSECS = 40;
|
||||
const short JITTER_BUFFER_LENGTH_MSECS = 10;
|
||||
const int SAMPLE_RATE = 22050;
|
||||
|
||||
const short NUM_AUDIO_SOURCES = 2;
|
||||
|
@ -267,7 +267,7 @@ void *receiveAudioViaUDP(void *args) {
|
|||
// we'll need a jitter buffer
|
||||
// reset the ring buffer and write
|
||||
copyToPointer = ringBuffer->buffer;
|
||||
std::cout << "Writing jitter buffer\n";
|
||||
//std::cout << "Writing jitter buffer\n";
|
||||
} else {
|
||||
copyToPointer = ringBuffer->endOfLastWrite;
|
||||
|
||||
|
|
|
@ -53,7 +53,9 @@ Head::Head()
|
|||
eyeContact = 1;
|
||||
eyeContactTarget = LEFT_EYE;
|
||||
scale = 1.0;
|
||||
setNoise(1);
|
||||
renderYaw = 0.0;
|
||||
renderPitch = 0.0;
|
||||
setNoise(0);
|
||||
}
|
||||
|
||||
void Head::reset()
|
||||
|
@ -211,6 +213,9 @@ void Head::render()
|
|||
|
||||
glScalef(scale, scale, scale);
|
||||
glTranslatef(leanSideways, 0.f, leanForward);
|
||||
//printf("x: %3.1f\n", position.x);
|
||||
glTranslatef(3,3,2);
|
||||
//glTranslatef(position.x, position.y, position.z);
|
||||
|
||||
glRotatef(Yaw/2.0, 0, 1, 0);
|
||||
glRotatef(Pitch/2.0, 1, 0, 0);
|
||||
|
@ -320,7 +325,8 @@ void Head::render()
|
|||
int Head::getBroadcastData(char* data)
|
||||
{
|
||||
// Copy data for transmission to the buffer, return length of data
|
||||
sprintf(data, "H%f,%f,%f,%f,%f,%f", Pitch, Yaw, Roll, position.x, position.y, position.z);
|
||||
sprintf(data, "H%f,%f,%f,%f,%f,%f", Pitch + getRenderPitch(), Yaw + getRenderYaw(), Roll, position.x, position.y, position.z);
|
||||
//printf("x: %3.1f\n", position.x);
|
||||
return strlen(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ class Head {
|
|||
float PitchRate;
|
||||
float YawRate;
|
||||
float RollRate;
|
||||
float renderYaw;
|
||||
float EyeballPitch[2];
|
||||
float EyeballYaw[2];
|
||||
float EyebrowPitch[2];
|
||||
|
@ -50,6 +49,7 @@ class Head {
|
|||
int eyeContact;
|
||||
eyeContactTargets eyeContactTarget;
|
||||
void readSensors();
|
||||
float renderYaw, renderPitch; // Pitch from view frustum when this is own head.
|
||||
|
||||
|
||||
public:
|
||||
|
@ -62,6 +62,9 @@ public:
|
|||
void setRoll(float r) {Roll = r; };
|
||||
void setScale(float s) {scale = s; };
|
||||
void setRenderYaw(float y) {renderYaw = y;}
|
||||
void setRenderPitch(float p) {renderPitch = p;}
|
||||
float getRenderYaw() {return renderYaw;}
|
||||
float getRenderPitch() {return renderPitch;}
|
||||
void setLeanForward(float dist);
|
||||
void setLeanSideways(float dist);
|
||||
void addPitch(float p) {Pitch -= p; }
|
||||
|
@ -71,7 +74,7 @@ public:
|
|||
float getPitch() {return Pitch;}
|
||||
float getRoll() {return Roll;}
|
||||
float getYaw() {return Yaw;}
|
||||
float getRenderYaw() {return renderYaw;}
|
||||
|
||||
void render();
|
||||
void simulate(float);
|
||||
// Send and receive network data
|
||||
|
|
|
@ -367,6 +367,9 @@ void reset_sensors()
|
|||
// Reset serial I/O sensors
|
||||
//
|
||||
myHead.setRenderYaw(start_yaw);
|
||||
dummyHead.setRenderPitch(0);
|
||||
dummyHead.setRenderYaw(0);
|
||||
|
||||
yaw = render_yaw_rate = 0;
|
||||
pitch = render_pitch = render_pitch_rate = 0;
|
||||
lateral_vel = 0;
|
||||
|
@ -443,8 +446,7 @@ void update_pos(float frametime)
|
|||
else
|
||||
render_pitch_rate += (measured_pitch_rate + MIN_PITCH_RATE) * PITCH_SENSITIVITY * frametime;
|
||||
}
|
||||
|
||||
myHead.setRenderYaw(myHead.getRenderYaw() + render_yaw_rate);
|
||||
|
||||
render_pitch += render_pitch_rate;
|
||||
|
||||
// Decay render_pitch toward zero because we never look constantly up/down
|
||||
|
@ -500,15 +502,20 @@ void update_pos(float frametime)
|
|||
location[0] += fwd_vec[2]*-lateral_vel;
|
||||
location[2] += fwd_vec[0]*lateral_vel;
|
||||
|
||||
// Update head and manipulator objects with object with current location
|
||||
myHead.setPos(glm::vec3(location[0], location[1], location[2]));
|
||||
// Update manipulator objects with object with current location
|
||||
balls.updateHand(myHead.getPos() + myHand.getPos(), glm::vec3(0,0,0), myHand.getRadius());
|
||||
|
||||
// Update own head data
|
||||
myHead.setRenderYaw(myHead.getRenderYaw() + render_yaw_rate);
|
||||
myHead.setRenderPitch(render_pitch);
|
||||
myHead.setPos(glm::vec3(location[0], location[1], location[2]));
|
||||
|
||||
// Update all this stuff to any agents that are nearby and need to see it!
|
||||
|
||||
const int MAX_BROADCAST_STRING = 200;
|
||||
char broadcast_string[MAX_BROADCAST_STRING];
|
||||
int broadcast_bytes = myHead.getBroadcastData(broadcast_string);
|
||||
dummyHead.recvBroadcastData(broadcast_string, broadcast_bytes);
|
||||
//printf("head bytes: %d\n", broadcast_bytes);
|
||||
broadcast_to_agents(UDP_socket, broadcast_string, broadcast_bytes);
|
||||
|
||||
|
@ -542,7 +549,7 @@ void display(void)
|
|||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
|
||||
// Rotate, translate to camera location
|
||||
glRotatef(render_pitch, 1, 0, 0);
|
||||
glRotatef(myHead.getRenderPitch(), 1, 0, 0);
|
||||
glRotatef(myHead.getRenderYaw(), 0, 1, 0);
|
||||
glTranslatef(location[0], location[1], location[2]);
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ void getVoxel(float * pos, int scale, float * vpos) {
|
|||
vpos[Z] = floor(pos[Z]*vscale)/vscale;
|
||||
}
|
||||
|
||||
//
|
||||
// Given a pointer to an octal code and some domain owner data, iterate the tree and add the node(s) as needed.
|
||||
//
|
||||
domainNode* createNode(int lengthInBits, char * octalData,
|
||||
char * hostname, char * nickname, int domain_id) {
|
||||
domainNode * currentNode = &rootNode;
|
||||
|
|
|
@ -18,6 +18,9 @@ struct domainNode {
|
|||
int domain_id;
|
||||
};
|
||||
|
||||
domainNode* createNode(int lengthInBits, char * octalData,
|
||||
char * hostname, char * nickname, int domain_id);
|
||||
|
||||
|
||||
|
||||
#endif /* defined(__interface__octal__) */
|
||||
|
|
Loading…
Reference in a new issue