//----------------------------------------------------------------------------- //! 描画 //----------------------------------------------------------------------------- void SystemPerformance::drawPerformanceBar() { glDepthMask(GL_FALSE); setBlendMode(BM_BLEND_ALPHA); // 描画座標 Vector3 drawPos = Vector3(1860.0f, 0.0f, 0.0f); // フレームの数 static u32 frameCount = 3; // 線形補完する static f32 height = 1000.0f; // 1フレーム分の高さ static f32 oneFrameHeight = height / (f32)frameCount; // 枠を描画 glColor4f(0.0f,0.0f,0.0f, 0.8f); glBegin(GL_TRIANGLE_STRIP); glVertex3f(drawPos._x , drawPos._y , 0.0f); glVertex3f(drawPos._x + 40.0f, drawPos._y , 0.0f); glVertex3f(drawPos._x , drawPos._y + height, 0.0f); glVertex3f(drawPos._x + 40.0f, drawPos._y + height, 0.0f); glEnd(); // 枠の分だけずらす drawPos._x += 5.0f; // 描画 for( list<Performance*>::iterator itr = _pPerformList.begin(); itr != _pPerformList.end(); itr++ ) { Performance* drawPef = *itr; // 描画 drawPef->DrawPerformance(drawPos, oneFrameHeight, _maxSecond); // 次の描画位置を求める drawPos._y += drawPef->getHeight(); } //---- フレームの分割線の描画 drawPos._x -= 5.0f; glBegin(GL_LINES); glColor4f(0.0f, 1.0f, 0.5f, 1.0f); for( u32 i=0; i<frameCount; ++i ){ glVertex3f(drawPos._x , i * oneFrameHeight, 0.0f); glVertex3f(drawPos._x + 40.0f, i * oneFrameHeight, 0.0f); } glEnd(); // 白で設定しなおす glColor4f(1.0f, 1.0f, 1.0f, 1.0f); setBlendMode(BM_NONE); glDepthMask(GL_TRUE); }
//----------------------------------------------------------------------------- //! 描画 //----------------------------------------------------------------------------- void Performance::DrawPerformance(Vector3 drawPos, f32& parentHeight, s64& maxFrame) { // 線形補完する _height = LinearInterpolation(0.0f, parentHeight, (f32)_totalTime, (f32)maxFrame); // 自分のバーの描画 glBegin(GL_TRIANGLE_STRIP); glColor4ubv((GLubyte*)&_drawColor); glVertex3f(drawPos._x , drawPos._y , 0.0f); glVertex3f(drawPos._x + 30.0f, drawPos._y , 0.0f); glVertex3f(drawPos._x , drawPos._y + _height, 0.0f); glVertex3f(drawPos._x + 30.0f, drawPos._y + _height, 0.0f); glEnd(); // 子のパフォーマンスの描画 for( list<Performance*>::iterator itr = _childPeform.begin(); itr != _childPeform.end(); itr++ ) { Performance* drawPef = *itr; // 描画 drawPef->DrawPerformance(drawPos, _height, _totalTime); // 次の描画位置を求める drawPos._y += drawPef->getHeight(); } }