//------------------------------------------------------------------------------------- void CDebugGUI::DrawString(float x, float y, const char* pString, const CColor& Color) { XMMATRIX LocalToWorld = XMMatrixIdentity(); m_rUtilityDraw->BeginTriangleList(); float X0 = -1.0f + x * m_ScreenPixelWidth; float X1 = X0 + 7.0f * m_ScreenPixelWidth; float Y0 = 1.0f - y * m_ScreenPixelHeight; float Y1 = Y0 - 16.0f * m_ScreenPixelHeight; for(unsigned int CharIndex = 0; CharIndex < strlen(pString); CharIndex++) { float U0 = (float)(pString[CharIndex] - ' ') * 8.0f * m_FontPixelWidth; float U1 = U0 + 7.0f * m_FontPixelWidth; XMFLOAT3 Pt0(X0, Y0, 0.999f); XMFLOAT3 Pt1(X0, Y1, 0.999f); XMFLOAT3 Pt2(X1, Y0, 0.999f); XMFLOAT3 Pt3(X1, Y1, 0.999f); XMFLOAT2 Uv0(U0, 0.0f); XMFLOAT2 Uv1(U0, 1.0f); XMFLOAT2 Uv2(U1, 0.0f); XMFLOAT2 Uv3(U1, 1.0f); m_rUtilityDraw->AddTriangle(Pt0, Pt2, Pt1, Uv0, Uv2, Uv1, Color, Color, Color); m_rUtilityDraw->AddTriangle(Pt1, Pt2, Pt3, Uv1, Uv2, Uv3, Color, Color, Color); X1 += (1.0f * m_ScreenPixelWidth); X0 = X1; X1 += (7.0f * m_ScreenPixelWidth); } m_rUtilityDraw->EndTriangleList(LocalToWorld, m_pFontMaterial, CRenderer::eDepthNone, CRenderer::eBlendModulate); }
//---------------------------------------------------------------------------- void CTimeLine::DrawEvent( CEvent* pEvent, unsigned int PrevFrame, unsigned long long ClockFrequency, unsigned int ThreadIndex, float MicroSecondsToViewSpace, float& X0, float& X1, float Y0, float Y1, float PixelWidth, float PixelHeight, const CEventDesc* pEventDesc) { unsigned int Index = pEvent->m_Index; Assert(Index < scMaxEventTypesPerThread); unsigned long long StartTime; unsigned long long StopTime; XMFLOAT2 Uv0(0.0f, 0.0f); StartTime = MAX(pEvent->m_StartTime, m_FrameStart[PrevFrame]); if (pEvent->m_State == CEvent::eStopped) { StopTime = MIN(pEvent->m_StopTime, m_FrameEnd[PrevFrame]); } else { StopTime = m_FrameEnd[PrevFrame]; } unsigned long long CycleTime = StopTime - StartTime; unsigned long Duration = (unsigned long)(CycleTime * 1000000 / ClockFrequency); if (m_CurrentThread == ThreadIndex) { m_Duration[Index] += Duration; } X1 = X0 + MicroSecondsToViewSpace * Duration; if ((X1 - X0) >= PixelWidth) // Only draw if bigger than a pixel { XMFLOAT3 Pt0(X0, Y0 - PixelHeight, 0.999f); XMFLOAT3 Pt1(X0, Y1 + PixelHeight, 0.999f); XMFLOAT3 Pt2(X1, Y0 - PixelHeight, 0.999f); XMFLOAT3 Pt3(X1, Y1 + PixelHeight, 0.999f); CColor Color = pEventDesc[Index].m_Color; m_rUtilityDraw->AddTriangle(Pt0, Pt2, Pt1, Uv0, Uv0, Uv0, Color, Color, Color); m_rUtilityDraw->AddTriangle(Pt1, Pt2, Pt3, Uv0, Uv0, Uv0, Color, Color, Color); X0 = X1; } }
Pt3 TransfMat3x4::preimage (Geom::Point const &pt, double coord, Proj::Axis axis) { double x[4]; double v[3]; v[0] = pt[Geom::X]; v[1] = pt[Geom::Y]; v[2] = 1.0; int index = (int) axis; SysEq::SolutionKind sol = SysEq::gaussjord_solve<3,4>(tmat, x, v, index, coord, true); if (sol != SysEq::unique) { if (sol == SysEq::no_solution) { g_print ("No solution. Please investigate.\n"); } else { g_print ("Infinitely many solutions. Please investigate.\n"); } } return Pt3(x[0], x[1], x[2], x[3]); }