void MilkdropWaveform::Draw(RenderContext &context) { WaveformMath(context); #ifndef EMSCRIPTEN glMatrixMode( GL_MODELVIEW ); #endif glPushMatrix(); glLoadIdentity(); if(modulateAlphaByVolume) ModulateOpacityByVolume(context); else temp_a = a; MaximizeColors(context); #ifndef USE_GLES1 if(dots==1) glEnable(GL_LINE_STIPPLE); #endif //Thick wave drawing if (thick==1) glLineWidth( (context.texsize < 512 ) ? 2 : 2*context.texsize/512); else glLineWidth( (context.texsize < 512 ) ? 1 : context.texsize/512); //Additive wave drawing (vice overwrite) if (additive==1)glBlendFunc(GL_SRC_ALPHA, GL_ONE); else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTranslatef(.5, .5, 0); glRotatef(rot, 0, 0, 1); glScalef(aspectScale, 1.0, 1.0); glTranslatef(-.5, -.5, 0); glEnableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glVertexPointer(2,GL_FLOAT,0,wavearray); if (loop) glDrawArrays(GL_LINE_LOOP,0,samples); else glDrawArrays(GL_LINE_STRIP,0,samples); if (two_waves) { glVertexPointer(2,GL_FLOAT,0,wavearray2); if (loop) glDrawArrays(GL_LINE_LOOP,0,samples); else glDrawArrays(GL_LINE_STRIP,0,samples); } #ifndef USE_GLES1 if(dots==1) glDisable(GL_LINE_STIPPLE); #endif glPopMatrix(); }
void MilkdropWaveform::Draw(RenderContext &context) { WaveformMath(context); #ifdef _WII_ #else glMatrixMode( GL_MODELVIEW ); //glPushMatrix(); glLoadIdentity(); #endif if(modulateAlphaByVolume) ModulateOpacityByVolume(context); else temp_a = a; MaximizeColors(context); #ifndef _WII_ if(dots==1) glEnable(GL_LINE_STIPPLE); #else u8 format = GX_TO_ZERO; if(dots==1) format = GX_TO_ONE; // ??? correct ??? #endif #ifdef _WII_ //Thick wave drawing if (thick==1) WII_SetLineWidth( (context.texsize < 512 ) ? 2 : 2*context.texsize/512,format); else WII_SetLineWidth( (context.texsize < 512 ) ? 1 : context.texsize/512,format); //Additive wave drawing (vice overwrite) if (additive)GX_SetBlendMode(GX_BM_BLEND,GX_BL_SRCALPHA, GX_BL_ONE,GX_LO_CLEAR); else GX_SetBlendMode(GX_BM_BLEND,GX_BL_SRCALPHA, GX_BL_INVSRCALPHA,GX_LO_CLEAR); #else //Thick wave drawing if (thick==1) glLineWidth( (context.texsize < 512 ) ? 2 : 2*context.texsize/512); else glLineWidth( (context.texsize < 512 ) ? 1 : context.texsize/512); //Additive wave drawing (vice overwrite) if (additive)glBlendFunc(GL_SRC_ALPHA, GL_ONE); else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); #endif #ifdef _WII_ guMtxIdentity(modelview); guVector cubeAxis = {0, 0, 1}; guMtxTransApply(modelview, modelview, .5, .5, 0); guMtxRotAxisDeg(modelview, &cubeAxis, rot); guMtxScaleApply(modelview,modelview,aspectScale, 1.0, 1.0); guMtxTransApply(modelview, modelview, -.5, -.5, 0); if (loop) WII_VertArrays(GX_LINESTRIP,&wavearray[0][0],0,0,0,samples,2); else WII_VertArrays(GX_LINESTRIP,&wavearray[0][0],0,0,0,samples,2); if (two_waves) { if (loop) WII_VertArrays(GX_LINESTRIP,&wavearray2[0][0],0,0,0,samples,2); else WII_VertArrays(GX_LINESTRIP,&wavearray2[0][0],0,0,0,samples,2); } // glPopMatrix(); #else glTranslatef(.5, .5, 0); glRotatef(rot, 0, 0, 1); glScalef(aspectScale, 1.0, 1.0); glTranslatef(-.5, -.5, 0); glEnableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_COLOR_ARRAY); glVertexPointer(2,GL_FLOAT,0,wavearray); if (loop) glDrawArrays(GL_LINE_LOOP,0,samples); else glDrawArrays(GL_LINE_STRIP,0,samples); if (two_waves) { glVertexPointer(2,GL_FLOAT,0,wavearray2); if (loop) glDrawArrays(GL_LINE_LOOP,0,samples); else glDrawArrays(GL_LINE_STRIP,0,samples); } #ifndef USE_GLES1 if(dots==1) glDisable(GL_LINE_STIPPLE); #endif //glPopMatrix(); #endif }