PixelList shader fixed with Lephe's help
This commit is contained in:
parent
8558238290
commit
758abed55f
|
@ -3,4 +3,4 @@
|
|||
|
||||
void azrp_pixel(int x1, int y1, int color);
|
||||
|
||||
void azrp_pixellist(std::vector<Pixel*> list, int fragnum );
|
||||
void azrp_pixellist(std::vector<Pixel*> const &list, int fragnum );
|
|
@ -222,7 +222,7 @@ int main(void)
|
|||
usb_fxlink_videocapture(false);
|
||||
}
|
||||
|
||||
if (textouput && usb_is_open())
|
||||
if (textoutput && usb_is_open())
|
||||
{
|
||||
char texttosend[1024];
|
||||
for(unsigned int i=0; i<MyStarField->MyStars.size(); i++)
|
||||
|
|
|
@ -23,17 +23,19 @@ void azrp_shader_pixellist_configure(void)
|
|||
|
||||
struct command {
|
||||
uint8_t shader_id;
|
||||
std::vector<Pixel*> data;
|
||||
uint16_t length;
|
||||
Pixel * const *data;
|
||||
};
|
||||
|
||||
|
||||
void azrp_pixellist(std::vector<Pixel*> list, int fragnum )
|
||||
void azrp_pixellist(std::vector<Pixel*> const &list, int fragnum )
|
||||
{
|
||||
prof_enter(azrp_perf_cmdgen);
|
||||
|
||||
struct command cmd;
|
||||
cmd.shader_id = AZRP_SHADER_PIXELLIST;
|
||||
cmd.data = list;
|
||||
cmd.length = list.size();
|
||||
cmd.data = list.data();
|
||||
|
||||
azrp_queue_command(&cmd, sizeof cmd, fragnum, 1);
|
||||
prof_leave(azrp_perf_cmdgen);
|
||||
|
@ -45,6 +47,8 @@ void azrp_shader_pixellist( void *uniforms, void *comnd, void *fragment )
|
|||
struct command *cmd = (struct command *) comnd;
|
||||
uint16_t *frag = (uint16_t *) fragment;
|
||||
|
||||
for( auto& pix : cmd->data )
|
||||
for(int i = 0; i < cmd->length; i++) {
|
||||
Pixel *pix = cmd->data[i];
|
||||
frag[azrp_width * pix->y + pix->x] = pix->c;
|
||||
}
|
||||
}
|
|
@ -24,10 +24,13 @@ Star::Star( void )
|
|||
|
||||
int colorrandom = rand() % 4;
|
||||
|
||||
color = 0xFFFF;
|
||||
/*
|
||||
if (colorrandom==0) color = 0xFFFF;
|
||||
else if (colorrandom==1) color = 0xFFE0;
|
||||
else if (colorrandom==2) color = 0xFB80;
|
||||
else color = 0xF80D;
|
||||
*/
|
||||
}
|
||||
|
||||
Star::~Star()
|
||||
|
@ -55,7 +58,7 @@ Starfield::Starfield( )
|
|||
{
|
||||
srand(rtc_ticks());
|
||||
|
||||
for(int i=0; i<10; i++)
|
||||
for(int i=0; i<100; i++)
|
||||
{
|
||||
Star *s = new Star( );
|
||||
MyStars.push_back( s );
|
||||
|
@ -79,10 +82,8 @@ Starfield::~Starfield( )
|
|||
|
||||
void Starfield::Update( float dt )
|
||||
{
|
||||
// for(auto& s : MyStars)
|
||||
// s->Update( dt );
|
||||
libnum::num a = libnum::num( dt / 50000.f );
|
||||
|
||||
libnum::num a = libnum::num( dt / 120000.f );
|
||||
for(auto& s : MyStars)
|
||||
s->Update( a );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue