Beispiel #1
1
void CTyHMProxy::DrawDC_Vecter(CDC *pDC, CElecMapView *pView)
{
	float minx,miny,maxx,maxy;
	pView->GetFloatRect(&minx,&miny,&maxx,&maxy);
	if (!IntersectRect(minx,miny,maxx,maxy)) return;


	GetRect(&minx,&miny,&maxx,&maxy);
	CPoint pt1,pt2;
	pt1=pView->UPtoLP(minx,miny);
	pt2=pView->UPtoLP(maxx,maxy);
	CRect rt;
	rt.SetRect(pt1,pt2);
	rt.NormalizeRect();
  //DrawVector(LPCSTR vectorname,CDC* pDC,CRect viewRect,CRect clipRect,COLORREF color,BOOL blReplace)
	DrawVector(m_str1,pDC,rt,rt,m_color1,m_bTranslate1);
}
Beispiel #2
0
BOOL CDrawing::DrawDataset(CDC* pDC, OgdcDataset* pDataset)
{
    if(OGDCIS0(m_dCoordRatio) || m_rcClient.IsRectEmpty() ||
            pDataset == NULL)
    {
        return FALSE;
    }

    if(!pDataset->IsOpen())
    {
        pDataset->Open();
    }

    if(!pDataset->IsOpen())
    {
        return FALSE;
    }

    OgdcRect2D rcDraw = pDataset->GetBounds();
    if(!m_rcViewBounds.IsIntersect(rcDraw))
    {
        return FALSE;
    }

    if(pDataset->IsRaster())
    {
        return DrawRaster(pDC, (OgdcDatasetRaster*)pDataset);
    }
    return DrawVector(pDC,(OgdcDatasetVector*)pDataset);
}
Beispiel #3
0
void CDirectionEdit::OnPaint() 
{
	CPaintDC dc(this); 

	// get the current vector;
	NLMISC::CVector v = _Wrapper->get();


	// draw a white square, and draw the vector in it
	
	DrawBasis(dc, CornerDist, CornerDist, BasisSize, "X", "Z");
	DrawVector(dc, v.x, v.z, CornerDist, CornerDist, BasisSize);

	DrawBasis(dc, CornerDist, CornerDist + BasisGap + BasisSize, BasisSize, "Y", "Z");	
	DrawVector(dc, v.y, v.z, CornerDist, CornerDist + BasisGap + BasisSize, BasisSize);
	
}
Beispiel #4
0
void Draw3DAxes(void)
{
	Round rCenter;
	Line l;
	
	//center axes
	
	rCenter.Center.X = OFFSET_X_CENTER;
	rCenter.Center.Y = OFFSET_Y_CENTER;
	rCenter.R = 5;
	
	DrawRound(&rCenter, &cCenter, 0);
	
	// y
	l.Start.X = 0;
	l.Start.Y = 0;
	l.Start.Z = 0;
	l.Stop.X = 0;
	l.Stop.Y = 250;
	l.Stop.Z = 0;
	
	DrawVector(&l, &cYLine, 0);
	
	//x
	l.Start.X = 0;
	l.Start.Y = 0;
	l.Start.Z = 0;
	l.Stop.X = 250;
	l.Stop.Y = 0;
	l.Stop.Z = 0;
	
	DrawVector(&l, &cXLine, 0);
	
	//z
	l.Start.X = 0;
	l.Start.Y = 0;
	l.Start.Z = 0;
	l.Stop.X = 0;
	l.Stop.Y = 0;
	l.Stop.Z = 250;
	
	DrawVector(&l, &cZLine, 0);
}
void MeshModelRender::DrawMeshCurvature(int mode)
{
	double scale = 0.75 * kernel->GetModelInfo().GetAvgEdgeLength();

	CoordArray& vCoord = kernel->GetVertexInfo().GetCoord();
	CoordArray& vNormal = kernel->GetVertexInfo().GetNormal();
	CurvatureArray& vCurvature = kernel->GetVertexInfo().GetCurvatures();
	
	glDisable(GL_LIGHTING);
	glEnable(GL_POLYGON_OFFSET_LINE);
	glPolygonOffset(3.0f, -1.0f);
	glEnable(GL_LINE_SMOOTH);
	
	size_t nVertex = vCoord.size();
    size_t j;
	
	for (j = 0; j < nVertex; j++)
	{
		Coord& start = vCoord[j];
		Coord& normal = vNormal[j];
		CCurvature& curv = vCurvature[j];
		
		// draw the kmax curvature here
		if (util.IsSetFlag(mode, RENDER_MODEL_KMAX_CURVATURE))
		{
			glColor3d(1.0f,0.0f,1.0f);
			
			DrawVector(scale, start, curv.m_direction_kmax, normal);
		}
		
		// draw the kmin curvature here.
		if (util.IsSetFlag(mode, RENDER_MODEL_KMIN_CURVATURE))
		{
			glColor3d(0.0f,0.0f,1.0f);
			
			DrawVector(scale, start, curv.m_direction_kmin, normal);
		}
	}
	
	glDisable(GL_LINE_SMOOTH);
	glDisable(GL_POLYGON_OFFSET_LINE);
	glEnable(GL_LIGHTING);
}
Beispiel #6
0
//=========================================================================================
void GAVisToolCanvas::DrawCoordinateAxes( void )
{
	double axisLength = 10.0;
	double ratio = 0.6;

	VectorMath::Vector origin;
	VectorMath::Vector posXaxis, negXaxis;
	VectorMath::Vector posYaxis, negYaxis;
	VectorMath::Vector posZaxis, negZaxis;

	VectorMath::Set( origin, 0.f, 0.f, 0.f );
	
	VectorMath::Set( posXaxis, axisLength, 0.f, 0.f );
	VectorMath::Set( posYaxis, 0.f, axisLength, 0.f );
	VectorMath::Set( posZaxis, 0.f, 0.f, axisLength );

	VectorMath::Set( negXaxis, -axisLength, 0.f, 0.f );
	VectorMath::Set( negYaxis, 0.f, -axisLength, 0.f );
	VectorMath::Set( negZaxis, 0.f, 0.f, -axisLength );

	render.Highlight( GAVisToolRender::NO_HIGHLIGHTING );

	// Make these different colors so that we can differentiate
	// between the X, Y and Z axes.
	render.Color( 1.f, 0.f, 0.f, 1.f );
	DrawVector( origin, posXaxis, ratio );
	render.Color( 0.f, 1.f, 0.f, 1.f );
	DrawVector( origin, posYaxis, ratio );
	render.Color( 0.f, 0.f, 1.f, 1.f );
	DrawVector( origin, posZaxis, ratio );

	// Make these a different color so that we can
	// differentiate between the negative and positive axes.
	render.Color( 0.5f, 0.5f, 0.5f, 1.f );
	DrawVector( origin, negXaxis, ratio );
	DrawVector( origin, negYaxis, ratio );
	DrawVector( origin, negZaxis, ratio );
}
Beispiel #7
0
void DrawScene(void)
{
	Line l;
	float angle;
	int x,z, xr,zr;
	
	cXLine.R = 0;
	cXLine.G = 0;
	cXLine.B = 0xff;
	
	cYLine.R = 0;
	cYLine.G = 0xff;
	cYLine.B = 0;
	
	cZLine.R = 0xff;
	cZLine.G = 0;
	cZLine.B = 0;
	
	cAll.R = 0;
	cAll.G = 0;
	cAll.B = 0;
	
	cCenter.R = 0xff;
	cCenter.G = 0xff;
	cCenter.B = 0;
	
	currentTextPosition = 0;
	
	Draw3DAxes();
	DrawProjection2DAxes();
	
	angle = (float)xClick*M_PI/(float)360.0;
	
	x = 70;
	z = 70;
	
	xr=x*cos(angle)+z*sin(angle);
	zr=-x*sin(angle)+z*cos(angle);
	
	l.Start.X = xr;
	l.Start.Y = yClick;
	l.Start.Z = zr;
	
	l.Stop.X = xr;
	l.Stop.Y = yClick + 70;
	l.Stop.Z = zr;
	
	DrawVector(&l, &cAll, 1);
	
	x = 70;
	z = 70;
	
	xr=x*cos(angle)+z*sin(angle);
	zr=-x*sin(angle)+z*cos(angle);

	l.Start.X = 0;
	l.Start.Y = yClick;
	l.Start.Z = 0;
	
	l.Stop.X = xr;
	l.Stop.Y = yClick;
	l.Stop.Z = zr;
	
	DrawVector(&l, &cAll, 1);

	l.Start.X = 0;
	l.Start.Y = yClick + 70;
	l.Start.Z = 0;
	
	l.Stop.X = xr;
	l.Stop.Y = yClick + 70;
	l.Stop.Z = zr;
	
	DrawVector(&l, &cAll, 1);
	
	ViewText("Object coords");
	ViewText("X1: %3d, X2: %3d",l.Start.X, l.Stop.X);
	ViewText("Y1: %3d, Y2: %3d",l.Start.Y, l.Stop.Y);
	ViewText("Z1: %3d, Z2: %3d",l.Start.Z, l.Stop.Z);
	ViewText("Angle: %3.3f, %2.5f", xClick, angle);
}
UINT DrawLineSegment(const CCagdPoint& p1, const CCagdPoint& p2, double length, BYTE color[3])
{
	return DrawVector(p1, (p2-p1), length, color);
}
Beispiel #9
0
void ScreenGameplay::RenderObjects(float TimeDelta, bool drawPlayable)
{
    Vec2 mpos = WindowFrame.GetRelativeMPos();

    Cursor.SetPosition(mpos);

    Cursor.AddRotation(CursorRotospeed * TimeDelta);

    int Beat = MeasureRatio * MySong->MeasureLength;
    float Fraction = (float(MeasureRatio * MySong->MeasureLength) - Beat);
    Lifebar.SetScaleX(1.0 - 0.05 * Fraction);

    // Rendering ahead.

    if (IsPaused)
    {
        Background.Blue = Background.Red = Background.Green = 0.5;
    }
    else
        Background.Blue = Background.Red = Background.Green = 1;

    Background.Render();

    MarkerA.Render();
    MarkerB.Render();

    if (!EditMode)
        Lifebar.Render();

    if (drawPlayable)
    {
        DrawVector(NotesHeld, TimeDelta);
        DrawVector(AnimateOnly, TimeDelta);

        if (Measure > 0)
        {
            if (NotesInMeasure.size() && // there are measures and
                Measure - 1 < NotesInMeasure.size() && // the measure is within the range and
                NotesInMeasure.at(Measure - 1).size() > 0) // there are notes in this measure
            {
                DrawVector(NotesInMeasure[Measure - 1], TimeDelta);
            }
        }

        // Render current measure on front of the next!
        if (Measure + 1 < CurrentDiff->Measures.size())
        {
            if (NotesInMeasure.size() > Measure + 1 && NotesInMeasure.at(Measure + 1).size() > 0)
            {
                DrawVector(NotesInMeasure[Measure + 1], TimeDelta);
            }
        }

        if (Measure < CurrentDiff->Measures.size())
        {
            if (NotesInMeasure.size() > Measure && NotesInMeasure.at(Measure).size() > 0)
            {
                DrawVector(NotesInMeasure[Measure], TimeDelta);
            }
        }
    }

    Barline.Render();

    if (!EditMode)
        aJudgment.Render();

    // Combo rendering.
    std::stringstream str;
    str << Combo;

    float textX = GetScreenOffset(0.5).x - (str.str().length() * ComboSizeX / 2);
    MyFont.Render(str.str(), Vec2(textX, 0));

    std::stringstream str2;
    str2 << int32_t(1000000.0 * Evaluation.dpScoreSquare / (Evaluation.totalNotes * (Evaluation.totalNotes + 1)));
    textX = GetScreenOffset(0.5).x - (str2.str().length() * ComboSizeX / 2);
    MyFont.Render(str2.str(), Vec2(textX, 720));

    /* Lengthy information printing code goes here.*/
    std::stringstream info;

    if (IsAutoplaying)
        info << "Autoplay";

#ifndef NDEBUG
    info << "\nSongTime: " << SongTime << "\nPlaybackTime: ";
    if (Music)
        info << Music->GetPlayedTime();
    else
        info << "???";
    /*info << "\nStreamTime: ";
    if(Music)
        info << Music->GetStreamedTime();
    else
        info << "???";
        */

    info << "\naudioFactor: " << MixerGetFactor();
    info << "\nSongDelta: " << SongDelta;
    info << "\nDevice Latency: " << (int)(MixerGetLatency() * 1000);
    /*
    if (Music)
        info << Music->GetStreamedTime() - Music->GetPlaybackTime();
    else
        info << "???";
        */
    info << "\nScreenTime: " << GetScreenTime();
    info << "\nMeasureRatio: " << MeasureRatio;
    info << "\nMeasureRatioPerSecond: " << RatioPerSecond;
#endif
    if (TappingMode)
        info << "\nTapping mode";
    if (!FailEnabled)
        info << "\nFailing Disabled";

#ifdef NDEBUG
    if (EditMode)
#endif
        info << "\nMeasure: " << Measure;
    SongInfo.Render(info.str(), Vec2(0, 0));

    ReadySign.Render();

    Cursor.Render();
}