fixed HEADEROFFSET which had the wrong value
parent
4be489ca09
commit
ed27c3e48a
|
@ -39,7 +39,7 @@ segments = 8
|
|||
segwidth = 12
|
||||
segchannels = 4
|
||||
|
||||
sleeptime = 0.03
|
||||
sleeptime = 0.02
|
||||
t = 0
|
||||
|
||||
#timer will hold the elapsed time in seconds
|
||||
|
@ -51,7 +51,7 @@ while (1):
|
|||
data += z_buffer
|
||||
for i in range(0,width):
|
||||
for j in range(0,height):
|
||||
pixel = fabs(sin(2*pi*(float(i+1)/width)+t*frequency)*sin(2*pi*(float(j+1)/height)+t*frequency))
|
||||
pixel = 0.5+0.5*sin(2*pi*(float(i+1)/width)+t*frequency)*sin(2*pi*(float(j+1)/height)+t*frequency)
|
||||
data = data + chr(int(255*pixel)) + alpha
|
||||
data = data + "\n"
|
||||
for i in range(0,segwidth):
|
||||
|
|
|
@ -66,6 +66,10 @@ void Server::listen()
|
|||
socket.receive_from(boost::asio::buffer(recv_buf),
|
||||
remote_endpoint, 0, error);
|
||||
|
||||
|
||||
// DEBUG OUTPUT RAW BUFFER DATA from packet
|
||||
// std::cout << recv_buf.data() << std::endl;
|
||||
|
||||
// check whether this is a valid packet and discard it if it isn't
|
||||
// note, this is a very hack way of comparing strings...
|
||||
if( std::string( (char*)recv_buf.data(), (size_t)10 ) != std::string(HASH) )
|
||||
|
@ -122,8 +126,7 @@ void Server::listen()
|
|||
{
|
||||
for(int a = 0; a < CHANNELS; a++)
|
||||
{
|
||||
frame.windows[i][j][a] = recv_buf[HEADEROFFSET+ i*(CHANNELS*WIDTH+1) + j*CHANNELS + a];
|
||||
//cout << int( recv_buf[HEADEROFFSET+ i*(CHANNELS*WIDTH+1) + j*CHANNELS + a] ) << endl;
|
||||
frame.windows[i][j][a] = recv_buf[HEADEROFFSET + i*(CHANNELS*WIDTH+1) + j*CHANNELS + a];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -237,8 +240,11 @@ void Server::mix()
|
|||
int counter = 0;
|
||||
int pixel = 0;
|
||||
|
||||
int frames = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
frames++;
|
||||
frame_t temp_frame;
|
||||
float temp_alpha;
|
||||
|
||||
|
@ -448,6 +454,8 @@ void Server::console_printframe(frame_t _frame)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: correct segment numbering
|
||||
|
||||
for(int w = 0; w < SEGWIDTH; w++)
|
||||
{
|
||||
for(int n = 0; n < SEGNUM; n++)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef __DEFINES_H_
|
||||
#define __DEFINES_H_
|
||||
|
||||
#define HASH "abcdefghij"
|
||||
|
||||
// four minutes should be enough (seconds)
|
||||
// timeout set to two seconds for testing purposes
|
||||
#define BUFTIMEOUT 2
|
||||
|
@ -12,8 +10,10 @@
|
|||
#define REMOTE_IP "127.0.0.1"
|
||||
#define REMOTE_PORT 1234
|
||||
|
||||
// one byte number + 10 character hash
|
||||
#define HEADEROFFSET 11
|
||||
|
||||
#define HASH "abcdefghij"
|
||||
// one byte number + 10 character hash plus newline
|
||||
#define HEADEROFFSET 12
|
||||
|
||||
// 12 windows per floor, 7 floors, Value:Alpha
|
||||
#define WIDTH 12
|
||||
|
@ -27,7 +27,7 @@
|
|||
#define SEGWIDTH 12
|
||||
#define SEGCHANNELS 4
|
||||
|
||||
#define BUFLEN HEADEROFFSET+WINDOWOFFSET+ (SEGNUM*SEGCHANNELS+1)*SEGWIDTH
|
||||
#define BUFLEN HEADEROFFSET+WINDOWOFFSET+(SEGNUM*SEGCHANNELS+1)*SEGWIDTH
|
||||
|
||||
// not used for simplicity
|
||||
//#define SEGHEIGHT 1
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
1c2b3a495867768594a3b2c1
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
}}}}}}}}}}}}}}}}}}}}}}}}
|
||||
rgbargbargbargbargbargbargbargba
|
||||
rgbargbargbargbargbargbargbargba
|
||||
rgbargbargbargbargbargbargbargba
|
||||
|
|
Loading…
Reference in New Issue