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