mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 18:38:45 +02:00
Merge branch 'master' of github.com:worklist/hifi
This commit is contained in:
commit
9ab476d3ee
9 changed files with 43 additions and 27 deletions
|
@ -47,7 +47,7 @@ void render_agents() {
|
|||
glm::vec3 pos = agents[i].head.getPos();
|
||||
glPushMatrix();
|
||||
glTranslatef(pos.x, pos.y, pos.z);
|
||||
agents[i].head.render();
|
||||
agents[i].head.render(0);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ int add_agent(std::string * IP) {
|
|||
int broadcast_to_agents(int handle, char * data, int length) {
|
||||
sockaddr_in dest_address;
|
||||
dest_address.sin_family = AF_INET;
|
||||
dest_address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
dest_address.sin_port = htons( (unsigned short) AGENT_UDP_PORT );
|
||||
|
||||
int sent_bytes;
|
||||
for (int i = 0; i < num_agents; i++) {
|
||||
|
|
|
@ -29,7 +29,7 @@ const short RING_BUFFER_FRAMES = 10;
|
|||
const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES;
|
||||
|
||||
const int SAMPLE_RATE = 22050;
|
||||
const float JITTER_BUFFER_LENGTH_MSECS = 10.0;
|
||||
const float JITTER_BUFFER_LENGTH_MSECS = 30.0;
|
||||
const short JITTER_BUFFER_SAMPLES = JITTER_BUFFER_LENGTH_MSECS * (SAMPLE_RATE / 1000.0);
|
||||
|
||||
const short NUM_AUDIO_SOURCES = 2;
|
||||
|
|
|
@ -104,7 +104,7 @@ void Finger::simulate(float deltaTime) {
|
|||
|
||||
// Move the finger
|
||||
float distance = glm::distance(pos, target);
|
||||
float spring_length = 0;
|
||||
//float spring_length = 0;
|
||||
const float SPRING_FORCE = 1000.0;
|
||||
|
||||
if (distance > 0.1) {
|
||||
|
|
|
@ -76,7 +76,7 @@ void Head::UpdatePos(float frametime, SerialInterface * serialInterface, int hea
|
|||
// Update avatar head position based on measured gyro rates
|
||||
const float HEAD_ROTATION_SCALE = 0.80;
|
||||
const float HEAD_ROLL_SCALE = 0.80;
|
||||
const float HEAD_LEAN_SCALE = 0.01;
|
||||
const float HEAD_LEAN_SCALE = 0.03;
|
||||
if (head_mirror) {
|
||||
addYaw(-measured_yaw_rate * HEAD_ROTATION_SCALE * frametime);
|
||||
addPitch(measured_pitch_rate * -HEAD_ROTATION_SCALE * frametime);
|
||||
|
@ -204,18 +204,30 @@ void Head::simulate(float deltaTime)
|
|||
|
||||
}
|
||||
|
||||
void Head::render()
|
||||
void Head::render(int faceToFace)
|
||||
{
|
||||
int side = 0;
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glPushMatrix();
|
||||
|
||||
glScalef(scale, scale, scale);
|
||||
|
||||
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);
|
||||
|
||||
if (!faceToFace)
|
||||
{
|
||||
//printf("x: %3.1f\n", position.x);
|
||||
//glTranslatef(3,3,2);
|
||||
//printf("head: %3.1f, %3.1f, %3.1f\n", position.x, position.y, position.z);
|
||||
float x = position.x;
|
||||
float y = position.y;
|
||||
float z = position.z;
|
||||
|
||||
//glTranslatef(6.1, 0, 1.4);
|
||||
glTranslatef(x,y,z);
|
||||
//glTranslatef(position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
glRotatef(Yaw/2.0, 0, 1, 0);
|
||||
glRotatef(Pitch/2.0, 1, 0, 0);
|
||||
|
@ -290,7 +302,7 @@ void Head::render()
|
|||
glRotatef(EyeballPitch[1], 1, 0, 0);
|
||||
glRotatef(EyeballYaw[1] + PupilConverge, 0, 1, 0);
|
||||
glTranslatef(0,0,.35);
|
||||
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.1,0.1,1.0);
|
||||
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.3,0.3,0.3);
|
||||
//glRotatef(90,0,1,0);
|
||||
glutSolidSphere(PupilSize, 15, 15);
|
||||
|
||||
|
@ -311,7 +323,7 @@ void Head::render()
|
|||
glRotatef(EyeballPitch[0], 1, 0, 0);
|
||||
glRotatef(EyeballYaw[0] - PupilConverge, 0, 1, 0);
|
||||
glTranslatef(0,0,.35);
|
||||
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.1,0.1,1.0);
|
||||
if (!eyeContact) glColor3f(0,0,0); else glColor3f(0.3,0.3,0.3);
|
||||
//glRotatef(90,0,1,0);
|
||||
glutSolidSphere(PupilSize, 15, 15);
|
||||
glPopMatrix();
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
float getRoll() {return Roll;}
|
||||
float getYaw() {return Yaw;}
|
||||
|
||||
void render();
|
||||
void render(int faceToFace);
|
||||
void simulate(float);
|
||||
// Send and receive network data
|
||||
int getBroadcastData(char* data);
|
||||
|
|
|
@ -64,7 +64,7 @@ void Lattice::mouseOver(float x, float y) {
|
|||
// Update lattice based on mouse location, where x and y are floats between 0 and 1 corresponding to screen location clicked
|
||||
// Excite the hovered cell a bit toward firing
|
||||
//printf("X = %3.1f Y = %3.1f\n", x, y);
|
||||
if ((width + height) > 0) {
|
||||
if (0) {
|
||||
int index = int(x*(float)width) + int(y*(float)height)*width;
|
||||
if (tiles[index].type > 0) tiles[index].excited += 0.05;
|
||||
//printf("excited = %3.1f, inhibited = %3.1f\n", tiles[index].excited, tiles[index].inhibited);
|
||||
|
|
|
@ -36,7 +36,7 @@ int network_init()
|
|||
// Bind socket to port
|
||||
address.sin_family = AF_INET;
|
||||
address.sin_addr.s_addr = INADDR_ANY;
|
||||
address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
address.sin_port = htons( (unsigned short) SENDING_UDP_PORT );
|
||||
|
||||
if ( bind( handle, (const sockaddr*) &address, sizeof(sockaddr_in) ) < 0 )
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ int network_init()
|
|||
|
||||
dest_address.sin_family = AF_INET;
|
||||
dest_address.sin_addr.s_addr = inet_addr(DESTINATION_IP);
|
||||
dest_address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
//dest_address.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
domainserver_address.sin_family = AF_INET;
|
||||
domainserver_address.sin_addr.s_addr = inet_addr(DOMAINSERVER_IP);
|
||||
|
@ -71,7 +71,7 @@ int network_init()
|
|||
|
||||
from.sin_family = AF_INET;
|
||||
//from.sin_addr.s_addr = htonl(ip_address);
|
||||
from.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
//from.sin_port = htons( (unsigned short) UDP_PORT );
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ timeval network_send_ping(int handle) {
|
|||
int notify_domainserver(int handle, float x, float y, float z) {
|
||||
char data[100];
|
||||
sprintf(data, "%f,%f,%f", x, y, z);
|
||||
//std::cout << "sending: " << data << "\n";
|
||||
int packet_size = strlen(data);
|
||||
//std::cout << "sending: " << data << " of size: " << packet_size << "\n";
|
||||
int sent_bytes = sendto( handle, (const char*)data, packet_size,
|
||||
0, (sockaddr*)&domainserver_address, sizeof(sockaddr_in) );
|
||||
if ( sent_bytes != packet_size )
|
||||
|
@ -110,7 +110,7 @@ int network_send(int handle, char * packet_data, int packet_size)
|
|||
|
||||
if ( sent_bytes != packet_size )
|
||||
{
|
||||
printf( "failed to send packet: return value = %d\n", sent_bytes );
|
||||
printf( "failed to send packet to address, port: %s, %d, returned = %d\n", inet_ntoa(dest_address.sin_addr), dest_address.sin_port, sent_bytes );
|
||||
return false;
|
||||
}
|
||||
return sent_bytes;
|
||||
|
|
|
@ -18,12 +18,16 @@
|
|||
|
||||
// Port to use for communicating UDP with other nearby agents
|
||||
const int MAX_PACKET_SIZE = 1500;
|
||||
const int UDP_PORT = 30001;
|
||||
const int SENDING_UDP_PORT = 40100;
|
||||
|
||||
const int AGENT_UDP_PORT = 40103;
|
||||
|
||||
const char DESTINATION_IP[] = "127.0.0.1";
|
||||
|
||||
// Address and port of domainserver process to advertise other agents
|
||||
const char DOMAINSERVER_IP[] = "127.0.0.1";
|
||||
const int DOMAINSERVER_PORT = 40000;
|
||||
|
||||
const int DOMAINSERVER_PORT = 40102;
|
||||
|
||||
// Randomly send a ping packet every N packets sent
|
||||
const int PING_PACKET_COUNT = 20;
|
||||
|
|
|
@ -391,8 +391,8 @@ void update_pos(float frametime)
|
|||
{
|
||||
float measured_pitch_rate = serialPort.getRelativeValue(PITCH_RATE);
|
||||
float measured_yaw_rate = serialPort.getRelativeValue(YAW_RATE);
|
||||
float measured_lateral_accel = serialPort.getRelativeValue(ACCEL_X);
|
||||
float measured_fwd_accel = serialPort.getRelativeValue(ACCEL_Z);
|
||||
//float measured_lateral_accel = serialPort.getRelativeValue(ACCEL_X);
|
||||
//float measured_fwd_accel = serialPort.getRelativeValue(ACCEL_Z);
|
||||
|
||||
myHead.UpdatePos(frametime, &serialPort, head_mirror, &gravity);
|
||||
|
||||
|
@ -568,15 +568,15 @@ void display(void)
|
|||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.f, 0.f, -7.f);
|
||||
myHead.render();
|
||||
myHead.render(1);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// Render dummy head
|
||||
if (showDummyHead) dummyHead.render();
|
||||
if (showDummyHead) dummyHead.render(0);
|
||||
|
||||
// Render heads of other agents
|
||||
if (!display_head) render_agents();
|
||||
if (!display_head) render_agents();
|
||||
|
||||
if (display_hand) myHand.render();
|
||||
|
||||
|
@ -789,7 +789,7 @@ void read_network()
|
|||
//
|
||||
// Broadcast packet from another agent
|
||||
//
|
||||
//update_agent(from_addr, &incoming_packet[1], bytes_recvd - 1);
|
||||
update_agent(from_addr, &incoming_packet[1], bytes_recvd - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue