亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? glanalyzer3.cpp

?? Amarok是一款在LINUX或其他類UNIX操作系統(tǒng)中運行的音頻播放器軟件。 經(jīng)過兩年開發(fā)后
?? CPP
字號:
/***************************************************************************                      glanalyzer3.cpp  -  Bouncing Ballzz                             -------------------    begin                : Feb 19 2004    copyright            : (C) 2004 by Enrico Ros    email                : eros.kde@email.it ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include <config.h>#ifdef HAVE_QGLWIDGET#include <cmath>#include <cstdlib>#include "glanalyzer3.h"#include <kdebug.h>#include <kstandarddirs.h>#include <qimage.h>#include <sys/time.h>#ifndef HAVE_FABSFinline float fabsf(float f){    return f < 0.f ? -f : f;}#endifclass Ball{    public:    Ball() : x( drand48() - drand48() ), y( 1 - 2.0 * drand48() ),        z( drand48() ), vx( 0.0 ), vy( 0.0 ), vz( 0.0 ),        mass( 0.01 + drand48()/10.0 )        //,color( (float[3]) { 0.0, drand48()*0.5, 0.7 + drand48() * 0.3 } )    {        //this is because GCC < 3.3 can't compile the above line, we aren't sure why though        color[0] = 0.0; color[1] = drand48()*0.5; color[2] = 0.7 + drand48() * 0.3;    };    float x, y, z, vx, vy, vz, mass;    float color[3];    void updatePhysics( float dT )    {        x += vx * dT;                // position        y += vy * dT;                // position        z += vz * dT;                // position        if ( y < -0.8 ) vy = fabsf( vy );        if ( y > 0.8 ) vy = -fabsf( vy );        if ( z < 0.1 ) vz = fabsf( vz );        if ( z > 0.9 ) vz = -fabsf( vz );        vx += (( x > 0 ) ? 4.94 : -4.94) * dT;    // G-force        vx *= (1 - 2.9 * dT);            // air friction        vy *= (1 - 2.9 * dT);            // air friction        vz *= (1 - 2.9 * dT);            // air friction    }};class Paddle{    public:    Paddle( float xPos ) : onLeft( xPos < 0 ), mass( 1.0 ),        X( xPos ), x( xPos ), vx( 0.0 ) {};    void updatePhysics( float dT )    {        x += vx * dT;                // posision        vx += (1300 * (X - x) / mass) * dT;        // elasticity        vx *= (1 - 4.0 * dT);            // air friction    }    void renderGL()    {        glBegin( GL_TRIANGLE_STRIP );         glColor3f( 0.0f, 0.1f, 0.3f );         glVertex3f( x, -1.0f, 0.0 );         glVertex3f( x, 1.0f, 0.0 );         glColor3f( 0.1f, 0.2f, 0.6f );         glVertex3f( x, -1.0f, 1.0 );         glVertex3f( x, 1.0f, 1.0 );        glEnd();    }    void bounce( Ball * ball )    {        if ( onLeft && ball->x < x )        {        ball->vx = vx * mass / (mass + ball->mass) + fabsf( ball->vx );        ball->vy = (drand48() - drand48()) * 1.8;        ball->vz = (drand48() - drand48()) * 0.9;        ball->x = x;        }        else if ( !onLeft && ball->x > x )        {        ball->vx = vx * mass / (mass + ball->mass) - fabsf( ball->vx );        ball->vy = (drand48() - drand48()) * 1.8;        ball->vz = (drand48() - drand48()) * 0.9;        ball->x = x;        }    }    void impulse( float strength )    {        if ( (onLeft && strength > vx) || (!onLeft && strength < vx) )        vx += strength;    }    private:    bool onLeft;    float mass, X, x, vx;};GLAnalyzer3::GLAnalyzer3( QWidget *parent ):Analyzer::Base3D(parent, 15){    //initialize openGL context before managing GL calls    makeCurrent();    loadTexture( locate("data","amarok/data/ball.png"), ballTexture );    loadTexture( locate("data","amarok/data/grid.png"), gridTexture );    balls.setAutoDelete( true );    leftPaddle = new Paddle( -1.0 );    rightPaddle = new Paddle( 1.0 );    for ( int i = 0; i < NUMBER_OF_BALLS; i++ )    balls.append( new Ball() );    show.colorK = 0.0;    show.gridScrollK = 0.0;    show.gridEnergyK = 0.0;    show.camRot = 0.0;    show.camRoll = 0.0;    show.peakEnergy = 1.0;    frame.silence = true;    frame.energy = 0.0;    frame.dEnergy = 0.0;}GLAnalyzer3::~GLAnalyzer3(){    freeTexture( ballTexture );    freeTexture( gridTexture );    delete leftPaddle;    delete rightPaddle;    balls.clear();}void GLAnalyzer3::initializeGL(){    // Set a smooth shade model    glShadeModel(GL_SMOOTH);    // Disable depth test (all is drawn 'z-sorted')    glDisable( GL_DEPTH_TEST );    // Set blending function (Alpha addition)    glBlendFunc( GL_SRC_ALPHA, GL_ONE );    // Clear frame with a black background    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);}void GLAnalyzer3::resizeGL( int w, int h ){    // Setup screen. We're going to manually do the perspective projection    glViewport( 0, 0, (GLint)w, (GLint)h );    glMatrixMode( GL_PROJECTION );    glLoadIdentity();    glFrustum( -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 4.5f );    // Get the aspect ratio of the screen to draw 'circular' particles    float ratio = (float)w / (float)h;    if ( ratio >= 1.0 ) {    unitX = 0.34 / ratio;    unitY = 0.34;    } else {    unitX = 0.34;    unitY = 0.34 * ratio;    }    // Get current timestamp.    timeval tv;    gettimeofday( &tv, NULL );    show.timeStamp = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;}void GLAnalyzer3::paused(){    analyze( Scope() );}void GLAnalyzer3::analyze( const Scope &s ){    // compute the dTime since the last call    timeval tv;    gettimeofday( &tv, NULL );    double currentTime = (double)tv.tv_sec + (double)tv.tv_usec/1000000.0;    show.dT = currentTime - show.timeStamp;    show.timeStamp = currentTime;    // compute energy integrating frame's spectrum    if ( !s.empty() )    {    int bands = s.size();    float currentEnergy = 0,          maxValue = 0;    // integrate spectrum -> energy    for ( int i = 0; i < bands; i++ )    {        float value = s[i];        currentEnergy += value;        if ( value > maxValue )        maxValue = value;    }    currentEnergy *= 100.0 / (float)bands;    // emulate a peak detector: currentEnergy -> peakEnergy (3tau = 30 seconds)    show.peakEnergy = 1.0 + ( show.peakEnergy - 1.0 ) * exp( - show.dT / 10.0 );    if ( currentEnergy > show.peakEnergy )        show.peakEnergy = currentEnergy;    // check for silence    frame.silence = currentEnergy < 0.001;    // normalize frame energy against peak energy and compute frame stats    currentEnergy /= show.peakEnergy;    frame.dEnergy = currentEnergy - frame.energy;    frame.energy = currentEnergy;    } else    frame.silence = true;    // update the frame    updateGL();}void GLAnalyzer3::paintGL(){    // limit max dT to 0.05 and update color and scroll constants    if ( show.dT > 0.05 )    show.dT = 0.05;    show.colorK += show.dT * 0.4;    if ( show.colorK > 3.0 )    show.colorK -= 3.0;    show.gridScrollK += 0.2 * show.peakEnergy * show.dT;    // Switch to MODEL matrix and clear screen    glMatrixMode( GL_MODELVIEW );    glLoadIdentity();    glClear( GL_COLOR_BUFFER_BIT );    // Draw scrolling grid    if ( (show.gridEnergyK > 0.05) || (!frame.silence && frame.dEnergy < -0.3) )    {    show.gridEnergyK *= exp( -show.dT / 0.1 );    if ( -frame.dEnergy > show.gridEnergyK )        show.gridEnergyK = -frame.dEnergy*2.0;    float gridColor[4] = { 0.0, 1.0, 0.6, show.gridEnergyK };    drawScrollGrid( show.gridScrollK, gridColor );    }    // Roll camera up/down handling the beat    show.camRot += show.camRoll * show.dT;        // posision    show.camRoll -= 400 * show.camRot * show.dT;    // elasticity    show.camRoll *= (1 - 2.0 * show.dT);        // friction    if ( !frame.silence && frame.dEnergy > 0.4 )    show.camRoll += show.peakEnergy*2.0;    glRotatef( show.camRoll / 2.0, 1,0,0 );    // Translate the drawing plane    glTranslatef( 0.0f, 0.0f, -1.8f );    // Draw upper/lower planes and paddles    drawHFace( -1.0 );    drawHFace( 1.0 );    leftPaddle->renderGL();    rightPaddle->renderGL();    // Draw Balls    if ( ballTexture ) {    glEnable( GL_TEXTURE_2D );    glBindTexture( GL_TEXTURE_2D, ballTexture );    } else    glDisable( GL_TEXTURE_2D );    glEnable( GL_BLEND );    Ball * ball = balls.first();    for ( ; ball; ball = balls.next() )    {    float color[3],          angle = show.colorK;    // Rotate the color based on 'angle' value [0,3)    if ( angle < 1.0 )    {        color[ 0 ] = ball->color[ 0 ] * (1 - angle) + ball->color[ 1 ] * angle;        color[ 1 ] = ball->color[ 1 ] * (1 - angle) + ball->color[ 2 ] * angle;        color[ 2 ] = ball->color[ 2 ] * (1 - angle) + ball->color[ 0 ] * angle;    }    else if ( angle < 2.0 )    {        angle -= 1.0;        color[ 0 ] = ball->color[ 1 ] * (1 - angle) + ball->color[ 2 ] * angle;        color[ 1 ] = ball->color[ 2 ] * (1 - angle) + ball->color[ 0 ] * angle;        color[ 2 ] = ball->color[ 0 ] * (1 - angle) + ball->color[ 1 ] * angle;    }    else    {        angle -= 2.0;        color[ 0 ] = ball->color[ 2 ] * (1 - angle) + ball->color[ 0 ] * angle;        color[ 1 ] = ball->color[ 0 ] * (1 - angle) + ball->color[ 1 ] * angle;        color[ 2 ] = ball->color[ 1 ] * (1 - angle) + ball->color[ 2 ] * angle;    }    // Draw the dot and update its physics also checking at bounces    glColor3fv( color );    drawDot3s( ball->x, ball->y, ball->z, 1.0 );    ball->updatePhysics( show.dT );    if ( ball->x < 0 )        leftPaddle->bounce( ball );    else        rightPaddle->bounce( ball );    }    glDisable( GL_BLEND );    glDisable( GL_TEXTURE_2D );    // Update physics of paddles    leftPaddle->updatePhysics( show.dT );    rightPaddle->updatePhysics( show.dT );    if ( !frame.silence )    {    leftPaddle->impulse( frame.energy*3.0 + frame.dEnergy*6.0 );    rightPaddle->impulse( -frame.energy*3.0 - frame.dEnergy*6.0 );    }}void GLAnalyzer3::drawDot3s( float x, float y, float z, float size ){    // Circular XY dot drawing functions    float sizeX = size * unitX,      sizeY = size * unitY,      pXm = x - sizeX,      pXM = x + sizeX,      pYm = y - sizeY,      pYM = y + sizeY;    // Draw the Dot    glBegin( GL_QUADS );    glTexCoord2f( 0, 0 );    // Bottom Left    glVertex3f( pXm, pYm, z );    glTexCoord2f( 0, 1 );    // Top Left    glVertex3f( pXm, pYM, z );    glTexCoord2f( 1, 1 );    // Top Right    glVertex3f( pXM, pYM, z );    glTexCoord2f( 1, 0 );    // Bottom Right    glVertex3f( pXM, pYm, z );    glEnd();    // Shadow XZ drawing functions    float sizeZ = size / 10.0,      pZm = z - sizeZ,      pZM = z + sizeZ,      currentColor[4];    glGetFloatv( GL_CURRENT_COLOR, currentColor );    float alpha = currentColor[3],      topSide = (y + 1) / 4,      bottomSide = (1 - y) / 4;    // Draw the top shadow    currentColor[3] = topSide * topSide * alpha;    glColor4fv( currentColor );    glBegin( GL_QUADS );    glTexCoord2f( 0, 0 );    // Bottom Left    glVertex3f( pXm, 1, pZm );    glTexCoord2f( 0, 1 );    // Top Left    glVertex3f( pXm, 1, pZM );    glTexCoord2f( 1, 1 );    // Top Right    glVertex3f( pXM, 1, pZM );    glTexCoord2f( 1, 0 );    // Bottom Right    glVertex3f( pXM, 1, pZm );    glEnd();    // Draw the bottom shadow    currentColor[3] = bottomSide * bottomSide * alpha;    glColor4fv( currentColor );    glBegin( GL_QUADS );    glTexCoord2f( 0, 0 );    // Bottom Left    glVertex3f( pXm, -1, pZm );    glTexCoord2f( 0, 1 );    // Top Left    glVertex3f( pXm, -1, pZM );    glTexCoord2f( 1, 1 );    // Top Right    glVertex3f( pXM, -1, pZM );    glTexCoord2f( 1, 0 );    // Bottom Right    glVertex3f( pXM, -1, pZm );    glEnd();}void GLAnalyzer3::drawHFace( float y ){    glBegin( GL_TRIANGLE_STRIP );    glColor3f( 0.0f, 0.1f, 0.2f );    glVertex3f( -1.0f, y, 0.0 );    glVertex3f( 1.0f, y, 0.0 );    glColor3f( 0.1f, 0.6f, 0.5f );    glVertex3f( -1.0f, y, 2.0 );    glVertex3f( 1.0f, y, 2.0 );    glEnd();}void GLAnalyzer3::drawScrollGrid( float scroll, float color[4] ){    if ( !gridTexture )    return;    glMatrixMode( GL_TEXTURE );    glLoadIdentity();    glTranslatef( 0.0, -scroll, 0.0 );    glMatrixMode( GL_MODELVIEW );    float backColor[4] = { 1.0, 1.0, 1.0, 0.0 };    for ( int i = 0; i < 3; i++ )    backColor[ i ] = color[ i ];    glEnable( GL_TEXTURE_2D );    glBindTexture( GL_TEXTURE_2D, gridTexture );    glEnable( GL_BLEND );    glBegin( GL_TRIANGLE_STRIP );     glColor4fv( color );    // top face    glTexCoord2f( 0.0f, 1.0f );    glVertex3f( -1.0f, 1.0f, -1.0f );    glTexCoord2f( 1.0f, 1.0f );    glVertex3f( 1.0f, 1.0f, -1.0f );     glColor4fv( backColor );    // central points    glTexCoord2f( 0.0f, 0.0f );    glVertex3f( -1.0f, 0.0f, -3.0f );    glTexCoord2f( 1.0f, 0.0f );    glVertex3f( 1.0f, 0.0f, -3.0f );     glColor4fv( color );    // bottom face    glTexCoord2f( 0.0f, 1.0f );    glVertex3f( -1.0f, -1.0f, -1.0f );    glTexCoord2f( 1.0f, 1.0f );    glVertex3f( 1.0f, -1.0f, -1.0f );    glEnd();    glDisable( GL_BLEND );    glDisable( GL_TEXTURE_2D );    glMatrixMode( GL_TEXTURE );    glLoadIdentity();    glMatrixMode( GL_MODELVIEW );}bool GLAnalyzer3::loadTexture( QString fileName, GLuint& textureID ){    //reset texture ID to the default EMPTY value    textureID = 0;    //load image    QImage tmp;    if ( !tmp.load( fileName ) )    return false;    //convert it to suitable format (flipped RGBA)    QImage texture = QGLWidget::convertToGLFormat( tmp );    if ( texture.isNull() )    return false;    //get texture number and bind loaded image to that texture    glGenTextures( 1, &textureID );    glBindTexture( GL_TEXTURE_2D, textureID );    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );    glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );    glTexImage2D( GL_TEXTURE_2D, 0, 4, texture.width(), texture.height(),    0, GL_RGBA, GL_UNSIGNED_BYTE, texture.bits() );    return true;}void GLAnalyzer3::freeTexture( GLuint& textureID ){    if ( textureID > 0 )    glDeleteTextures( 1, &textureID );    textureID = 0;}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩国产高清影视| 91在线码无精品| 国产成人免费在线观看不卡| 日本丰满少妇一区二区三区| 精品美女一区二区| 一区二区理论电影在线观看| 国产精品一区二区在线观看不卡| 欧美综合天天夜夜久久| 国产午夜精品一区二区| 亚洲一二三区不卡| av男人天堂一区| 久久久一区二区| 麻豆精品在线看| 欧美日韩中文国产| 亚洲男人的天堂av| 丁香六月综合激情| 精品国产乱码久久久久久夜甘婷婷| 亚洲婷婷在线视频| 成人免费av资源| 精品成人佐山爱一区二区| 午夜精品福利一区二区三区av| www.在线欧美| 国产精品丝袜黑色高跟| 狠狠色伊人亚洲综合成人| 欧美日韩欧美一区二区| 亚洲综合一区二区精品导航| 91猫先生在线| 国产精品的网站| 成人午夜在线播放| 久久精品人人做人人综合| 久久精品国产99久久6| 欧美久久久影院| 午夜精品福利久久久| 欧美三日本三级三级在线播放| 亚洲日本青草视频在线怡红院 | 亚洲人成人一区二区在线观看 | 中文字幕一区二区三区在线播放| 国产一区二区三区四区五区入口| 欧美成人vps| 国产一区二区三区av电影| 日韩欧美国产综合在线一区二区三区| 亚洲国产日韩一级| 欧美日韩黄色一区二区| 五月天网站亚洲| 欧美一区二区三级| 久久福利资源站| xf在线a精品一区二区视频网站| 国精产品一区一区三区mba视频| 久久久久久久电影| 国产99久久久国产精品免费看| 国产日本欧洲亚洲| 一本久久a久久精品亚洲| 一区二区三区四区高清精品免费观看| 色综合久久66| 日韩黄色在线观看| 欧美精品一区二区三区在线播放| 国产在线精品不卡| 国产精品久久久久久一区二区三区| 成人免费黄色在线| 亚洲一区二区av在线| 91精品国产麻豆| 国产成人午夜99999| 亚洲色图第一区| 欧美高清视频不卡网| 国产一区二区在线观看免费| 中文字幕亚洲在| 欧美日韩国产综合草草| 韩国精品主播一区二区在线观看| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 国产伦理精品不卡| 亚洲卡通欧美制服中文| 欧美肥妇bbw| 成人激情av网| 男女性色大片免费观看一区二区| 精品国产乱码久久久久久久 | 日本韩国精品在线| 精品一区二区在线视频| 综合色中文字幕| 日韩女优制服丝袜电影| www.一区二区| 麻豆精品视频在线观看免费| 亚洲私人影院在线观看| 亚洲精品在线免费播放| 在线观看一区二区精品视频| 国内外成人在线| 亚洲综合av网| 国产精品你懂的| 91精品国产91综合久久蜜臀| 91一区二区三区在线观看| 狠狠色狠狠色综合日日91app| 夜夜操天天操亚洲| 中文字幕不卡三区| 日韩精品在线看片z| 欧美性大战xxxxx久久久| 国产69精品久久久久毛片| 日本亚洲天堂网| 一区二区三区欧美久久| 中文字幕第一区第二区| 欧美精品一区二区三区蜜桃视频| 欧美性色综合网| 91在线视频播放| 成人高清视频在线观看| 国产精品自拍av| 久久成人久久爱| 日本不卡123| 日本亚洲视频在线| 青青青爽久久午夜综合久久午夜| 亚洲永久免费视频| 亚洲精品大片www| 国产精品成人免费| 欧美韩国日本不卡| 国产色一区二区| 国产欧美日韩在线| 国产欧美精品在线观看| 日本va欧美va精品| 亚洲免费在线观看视频| 国产精品无码永久免费888| 99综合影院在线| 国产精品亚洲专一区二区三区 | 久久精品亚洲精品国产欧美| 久久亚洲影视婷婷| 成人自拍视频在线观看| 91黄色激情网站| 91麻豆精品国产91久久久资源速度| 精品久久久久久久一区二区蜜臀| 国产精品国产成人国产三级| 一区二区三区蜜桃| 免费观看久久久4p| av亚洲精华国产精华精华| 日本高清视频一区二区| 91精品国产综合久久福利| 亚洲精品在线电影| 中文字幕一区二区三区不卡| 亚洲午夜私人影院| 美女网站视频久久| 国产精品一二二区| 欧美日韩免费在线视频| 精品国产乱码久久| 色综合天天视频在线观看| 日韩国产一二三区| 美女在线视频一区| 91婷婷韩国欧美一区二区| 欧美日韩免费观看一区三区| 精品国产精品网麻豆系列| 国产三级久久久| 美女网站一区二区| 成人h版在线观看| 日韩欧美中文一区二区| 中文字幕欧美区| 日韩高清欧美激情| 97精品久久久午夜一区二区三区| 欧美精品三级日韩久久| 国产午夜三级一区二区三| 亚洲午夜日本在线观看| 精品一区二区三区在线视频| 97久久精品人人爽人人爽蜜臀| 欧美另类高清zo欧美| 最新不卡av在线| 久久99国产精品久久99| 在线视频亚洲一区| 国产精品沙发午睡系列990531| 午夜精品免费在线| 97精品国产露脸对白| 欧美mv日韩mv| 日韩一区精品视频| 91在线精品秘密一区二区| 国产视频一区不卡| 激情综合亚洲精品| 在线观看网站黄不卡| 国产精品久99| 国产一区二区在线观看免费| 精品国产一二三| 黄页视频在线91| 精品成人免费观看| 日韩和欧美一区二区三区| 91免费在线视频观看| 欧美经典一区二区三区| 国产精品 日产精品 欧美精品| 精品美女在线观看| 蜜桃久久久久久| 欧美年轻男男videosbes| 亚洲午夜视频在线| 91片在线免费观看| 国产精品成人免费在线| 高清国产午夜精品久久久久久| 久久久亚洲精华液精华液精华液| 午夜伊人狠狠久久| 在线成人av网站| 丝袜美腿高跟呻吟高潮一区| 欧美午夜精品久久久久久孕妇| 亚洲综合成人网| 日韩一区二区不卡| 福利91精品一区二区三区| 国产精品成人在线观看| 欧美丝袜自拍制服另类| 麻豆一区二区三区| 中文字幕av资源一区| 色婷婷激情综合| 蜜桃av一区二区三区电影| 久久综合久久综合亚洲|