void CGraphicsRigidDiaphragmLoad::Draw( double arrowLength )
{
	ASSERT_RETURN( m_pRDL );  // Normal Precaution for pointer function parameters
	float length = (float)arrowLength;
	if( length <= 0 )
		length = ini.size().nodalLoadLength;
	float width = (ini.size().nodalLoadWidth+2);
	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
	glTranslatef( (float)m_loc.x, (float)m_loc.y, (float)m_loc.z );
	//can have up to 3 diaphragm loads...
	///ETCoordinate dir = Z;
	//if( m_pRDL->diaphragm() )  // plane's normal
	//	dir = m_pRDL->diaphragm()->normalDirection();  
	// up to three magnitudes may be entered for each plane possiblity,
	if( !zero( m_pRDL->magnitude( DX ) ) ){
		//draw x dir arrow
		DrawLineArrow( float( length ), float( width ) );
	}
	if( !zero( m_pRDL->magnitude( DY ) ) ){
		//draw y dir arrow
		glPushMatrix();
		glRotatef( 90.f, 0.f, 0.f, 1.f );
		DrawLineArrow( float( length ), float( width ) );
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( DZ ) ) ){
		//draw z dir arrow
		glPushMatrix();
		glRotatef( -90.f, 0.f, 1.f, 0.f );
		DrawLineArrow( float( length ), float( width ) );
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RX ) ) ){
		//draw moment arrow about x-axis
		glPushMatrix();
		glRotatef( 90.f, 0.f, 1.f, 0.f );
		DrawLineMomentArrow( float( length ), float( width ) );
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RY ) ) ){
		//draw moment arrow about y-axis
		glPushMatrix();
		glRotatef( -90.f, 1.f, 0.f, 0.f );
		DrawLineMomentArrow( float( length ), float( width ) );
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RZ ) ) ){
		//draw moment arrow about z-axis
		DrawLineMomentArrow( float( length ), float( width ) );
	}
	glGetDoublev( GL_MODELVIEW_MATRIX, m_mv );
	glPopMatrix();
}
void CGraphicsNodeLoad::Draw( CDC* pDC, const CWindowFilter& filter, CGLText* text, double size, double offset  )
{
	ASSERT_RETURN( m_pNL && pDC );

	float w = (float)ini.size().nodalLoadWidth;
	float l = (float)size;
	if( size <= 0 )
		l = ini.size().nodalLoadLength;
	//get the label
	CString label;
	ETUnit quantity;
	text->ClearText();
	if( filter.loadValues )
	{
		if( m_pNL->type() == NODAL_FORCE )
		{
			if( isTranslation( m_pNL->direction() ) )
				quantity = FORCE_UNIT;
			else
				quantity = MOMENT_UNIT;
			label = Units::show(  quantity , m_pNL->magnitude() );
		}
		else if( m_pNL->type() == NODAL_SETTLEMENT )
		{
			if( isTranslation( m_pNL->direction() ) )
				quantity = LENGTH_SMALL_UNIT;
			else
				quantity = ANGLE_UNIT;
			label = Units::show(  quantity , m_pNL->magnitude() );
		}
		text->AddLine( label );
	}
	
	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
		glTranslatef( (float)m_loc.x, (float)m_loc.y, (float)m_loc.z );
		glRotatef( float(m_rot*180/M_PI), (float)(m_axis.x), (float)(m_axis.y), (float)(m_axis.z) );
		if( isTranslation( m_etDir ) )
		{   glTranslatef( -offset, 0, 0 );
			DrawLineArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		}
		else
			DrawSolidMomentArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
	glPopMatrix();
}
void CGraphicsReaction::Draw( CDC* pDC, const CWindowFilter& filter, double scale, CGLText* text, double length )
{
	ASSERT( m_pN && m_pRC );

	if( !m_pN || !m_pRC || m_pN->isFree() )
		return;

	float w = (float)ini.size().reactionWidth;
	float l = length;
	
	const CResult* cR = m_pRC->result( *m_pN );
	double xi = m_pN->x();
	double yi = m_pN->y();
	double zi = m_pN->z();
	if( cR )
	{
		xi += scale*cR->displacement( DX );
		yi += scale*cR->displacement( DY );
		zi += scale*cR->displacement( DZ );
		
	}
	COLORREF c = ini.color().nodes;
	ApplyAmbientGLMaterialiv( c );
	glPushMatrix();
	glTranslatef( float( xi ), float( yi ), float( zi ) );
	double mv[16];
	glGetDoublev( GL_MODELVIEW_MATRIX, mv );
	for( int i=0; i<3; i++ ){ 
		for( int j=0; j<3; j++ ) {
			if ( i==j )
				mv[i*4+j] = 1.0;
			else
				mv[i*4+j] = 0.0;
		}
	}
	CPoint p2D;
	CVector3D mvz( mv[8], mv[9], mv[10] );
	CPoint3D p3D( 0., -l, 0. );
	if( m_pN->isFixed( DX ) && !zero(cR->force( DX )) && filter.node.fx )
	{
		CString label = "FX = ";
		label += Units::show( FORCE_UNIT, cR->force( DX ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
			if( cR->force( DX ) < 0. )
				glRotatef( 180.f, 0.f, 0.f, 1.f );
			DrawLineArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();
	}
	if( m_pN->isFixed( DY ) && !zero(cR->force( DY )) && filter.node.fy )
	{
		CString label = "FY = ";
		label += Units::show( FORCE_UNIT, cR->force( DY ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
		glRotatef( 90.f, 0.f, 0.f, 1.f );
			if( cR->force( DY ) < 0. )
				glRotatef( 180.f, 0.f, 0.f, 1.f );
			DrawLineArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();
	}
	if( m_pN->isFixed( DZ ) && !zero(cR->force( DZ )) && filter.node.fz )
	{
		CString label = "FZ = ";
		label += Units::show( FORCE_UNIT, cR->force( DZ ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
			glRotatef( 90.f, 0.f, 1.f, 0.f );
			if( cR->force( DZ ) < 0. )
				glRotatef( 180.f, 0.f, 0.f, 1.f );
			DrawLineArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();
	}
	if( m_pN->isFixed( RX ) && !zero(cR->force( RX )) && filter.node.mx )
	{
		CString label = "MX = ";
		label += Units::show( MOMENT_UNIT, cR->force( RX ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
			glRotatef( 90.f, 0.f, 1.f, 0.f );
			if( cR->force( RX ) < 0. )
				glRotatef( 180.f, 0.f, 0.f, 1.f );
			DrawSolidMomentArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();	
		text->AddLine( label );
	}
	if( m_pN->isFixed( RY ) && !zero(cR->force( RY )) && filter.node.my )
	{
		CString label = "MY = ";
		label += Units::show( MOMENT_UNIT, cR->force( RY ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
			glRotatef( 90.f, 1.f, 0.f, 0.f );
			if( cR->force( RY ) > 0. )
				glRotatef( 180.f, 0.f, 0.f, 1.f );
			DrawSolidMomentArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();	
	}
	if( m_pN->isFixed( RZ ) && !zero(cR->force( RZ )) && filter.node.mz )
	{
		CString label = "MZ = ";
		label += Units::show( MOMENT_UNIT, cR->force( RZ ));
		text->ClearText();
		text->AddLine( label );
		glPushMatrix();
			if( cR->force( RZ ) < 0. )
				glRotatef( 180.f, 0.f, 1.f, 0.f );
			DrawSolidMomentArrow( l, w, pDC, text,
						ini.font().graphWindow.name, 
						ini.font().graphWindow.size, 
						ini.color().nodalLoads); 
		glPopMatrix();
	}
	glPopMatrix();
}
void CGraphicsRigidDiaphragmLoad::Draw( CDC* pDC, const CWindowFilter& filter, CGLText* text, double size )
{
	Draw( size );
	ASSERT_RETURN( m_pRDL && pDC && text );  // Normal Precaution for pointer function parameters
	float length = (float)size;
	if( size <= 0 )
		length = ini.size().nodalLoadLength;
	float width = (ini.size().nodalLoadWidth+2);
	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
	glTranslatef( (float)m_loc.x, (float)m_loc.y, (float)m_loc.z );
	//can have up to 3 diaphragm loads...
	///ETCoordinate dir = Z;
	//if( m_pRDL->diaphragm() )  // plane's normal
	//	dir = m_pRDL->diaphragm()->normalDirection();  
	// up to three magnitudes may be entered for each plane possiblity,
	if( !filter.loadValues )
		return;
	CPoint tip2D;
	CPoint tail2D;
	double l = length;
	ETUnit quantity;
	CString label;
	if( !zero( m_pRDL->magnitude( DX ) ) ){
		//draw x dir arrow
		DrawLineArrow( float( length ), float( width ) );
		//now text...
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l, 0, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(DX) );
			label = "FX: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}

	}
	if( !zero( m_pRDL->magnitude( DY ) ) ){
		//draw y dir arrow
		glPushMatrix();
		glRotatef( 90.f, 0.f, 0.f, 1.f );
		DrawLineArrow( float( length ), float( width ) );
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l, 0, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(DY) );
			label = "FY: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( DZ ) ) ){
		//draw z dir arrow
		glPushMatrix();
		glRotatef( -90.f, 0.f, 1.f, 0.f );
		DrawLineArrow( float( length ), float( width ) );
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l, 0, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(DZ) );
			label = "FZ: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RX ) ) ){
		//draw moment arrow about x-axis
		glPushMatrix();
		glRotatef( 90.f, 0.f, 1.f, 0.f );
		DrawLineMomentArrow( float( length ), float( width ) );
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l*0.5f, -l*0.5f, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(RX) );
			label = "RX: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RY ) ) ){
		//draw moment arrow about y-axis
		glPushMatrix();
		glRotatef( -90.f, 1.f, 0.f, 0.f );
		DrawLineMomentArrow( float( length ), float( width ) );
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l*0.5f, -l*0.5f, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(RY) );
			label = "RY: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}
		glPopMatrix();
	}
	if( !zero( m_pRDL->magnitude( RZ ) ) ){
		//draw moment arrow about z-axis
		DrawLineMomentArrow( float( length ), float( width ) );
		if( GetScreenPtFrom3DPoint( CPoint3D( 0, 0, 0 ), tip2D ) &&
				GetScreenPtFrom3DPoint( CPoint3D( -l*0.5f, -l*0.5f, 0), tail2D ))
		{
			quantity = FORCE_UNIT;
			label = Units::show(  quantity , m_pRDL->magnitude(RZ) );
			label = "RZ: " + label;
			text->ClearText();
			text->AddLine( label );
			double angle = atan2( -(float)(tip2D.y - tail2D.y), (float)(tip2D.x - tail2D.x) );
			//text->SetVAlignment( CGLOutlineText::VMIDDLE );
			text->SetHAlignment( CGLOutlineText::HRIGHT );
			text->DrawText2D( pDC, ini.font().graphWindow.name, 
			ini.font().graphWindow.size/*m_printScale*/, 
			ini.color().nodalLoads, tail2D, angle  ); 
		}
	}
	glGetDoublev( GL_MODELVIEW_MATRIX, m_mv );
	glPopMatrix();
}
void FDebugRenderSceneProxy::GetDynamicMeshElements(const TArray<const FSceneView*>& Views, const FSceneViewFamily& ViewFamily, uint32 VisibilityMap, FMeshElementCollector& Collector) const 
{
	QUICK_SCOPE_CYCLE_COUNTER( STAT_DebugRenderSceneProxy_GetDynamicMeshElements );

	// Draw solid spheres
	struct FMaterialCache
	{
		FMaterialCache() : bUseFakeLight(false) {}

		FMaterialRenderProxy* operator[](FLinearColor Color)
		{
			FMaterialRenderProxy* MeshColor = NULL;
			const uint32 HashKey = GetTypeHash(Color);
			if (MeshColorInstances.Contains(HashKey))
			{
				MeshColor = *MeshColorInstances.Find(HashKey);
			}
			else
			{
				if (bUseFakeLight && SolidMeshMaterial.IsValid())
				{
					
					MeshColor = new(FMemStack::Get())  FColoredMaterialRenderProxy(
						SolidMeshMaterial->GetRenderProxy(false, false),
						Color,
						"GizmoColor"
						);
				}
				else
				{
					MeshColor = new(FMemStack::Get()) FColoredMaterialRenderProxy(GEngine->DebugMeshMaterial->GetRenderProxy(false, false), Color);
				}

				MeshColorInstances.Add(HashKey, MeshColor);
			}

			return MeshColor;
		}

		void UseFakeLight(bool UseLight, class UMaterial* InMaterial) { bUseFakeLight = UseLight; SolidMeshMaterial = InMaterial; }

		TMap<uint32, FMaterialRenderProxy*> MeshColorInstances;
		TWeakObjectPtr<class UMaterial> SolidMeshMaterial;
		bool bUseFakeLight;
	};

	FMaterialCache MaterialCache[2];
	MaterialCache[1].UseFakeLight(true, SolidMeshMaterial.Get());

	for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
	{
		if (VisibilityMap & (1 << ViewIndex))
		{
			const FSceneView* View = Views[ViewIndex];
			FPrimitiveDrawInterface* PDI = Collector.GetPDI(ViewIndex);

			// Draw Lines
			const int32 LinesNum = Lines.Num();
			PDI->AddReserveLines(SDPG_World, LinesNum, false, false);
			for (const auto& CurrentLine : Lines)
			{
				PDI->DrawLine(CurrentLine.Start, CurrentLine.End, CurrentLine.Color, SDPG_World, CurrentLine.Thickness, 0, CurrentLine.Thickness > 0);
			}

			// Draw Dashed Lines
			for(int32 DashIdx=0; DashIdx<DashedLines.Num(); DashIdx++)
			{
				const FDashedLine& Dash = DashedLines[DashIdx];

				DrawDashedLine(PDI, Dash.Start, Dash.End, Dash.Color, Dash.DashSize, SDPG_World);
			}

			// Draw Arrows
			const uint32 ArrowsNum = ArrowLines.Num();
			PDI->AddReserveLines(SDPG_World, 5 * ArrowsNum, false, false);
			for (const auto& CurrentArrow : ArrowLines)
			{
				DrawLineArrow(PDI, CurrentArrow.Start, CurrentArrow.End, CurrentArrow.Color, 8.0f);
			}

			// Draw Stars
			for(int32 StarIdx=0; StarIdx<Stars.Num(); StarIdx++)
			{
				const FWireStar& Star = Stars[StarIdx];

				DrawWireStar(PDI, Star.Position, Star.Size, Star.Color, SDPG_World);
			}

			// Draw Cylinders
			for(const auto& Cylinder : Cylinders)
			{
				if (DrawType == SolidAndWireMeshes || DrawType == WireMesh)
				{
					DrawWireCylinder(PDI, Cylinder.Base, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1), Cylinder.Color, Cylinder.Radius, Cylinder.HalfHeight, (DrawType == SolidAndWireMeshes) ? 9 : 16, SDPG_World, DrawType == SolidAndWireMeshes ? 2 : 0, 0, true);
				}

				if (DrawType == SolidAndWireMeshes || DrawType == SolidMesh)
				{
					GetCylinderMesh(Cylinder.Base, FVector(1, 0, 0), FVector(0, 1, 0), FVector(0, 0, 1), Cylinder.Radius, Cylinder.HalfHeight, 16, MaterialCache[0][Cylinder.Color.WithAlpha(DrawAlpha)], SDPG_World, ViewIndex, Collector);
				}
			}

			// Draw Boxes
			for(const auto& Box :  Boxes)
			{
				if (DrawType == SolidAndWireMeshes || DrawType == WireMesh)
				{
					DrawWireBox(PDI, Box.Transform.ToMatrixWithScale(), Box.Box, Box.Color, SDPG_World, DrawType == SolidAndWireMeshes ? 2 : 0, 0, true);
				}
				if (DrawType == SolidAndWireMeshes || DrawType == SolidMesh)
				{
					GetBoxMesh(FTransform(Box.Box.GetCenter()).ToMatrixNoScale() * Box.Transform.ToMatrixWithScale(), Box.Box.GetExtent(), MaterialCache[0][Box.Color.WithAlpha(DrawAlpha)], SDPG_World, ViewIndex, Collector);
				}
			}

			// Draw Boxes
			TArray<FVector> Verts;
			for (auto& CurrentCone : Cones)
			{
				if (DrawType == SolidAndWireMeshes || DrawType == WireMesh)
				{
					DrawWireCone(PDI, Verts, CurrentCone.ConeToWorld, 1, CurrentCone.Angle2, (DrawType == SolidAndWireMeshes) ? 9 : 16, CurrentCone.Color, SDPG_World, DrawType == SolidAndWireMeshes ? 2 : 0, 0, true);
				}
				if (DrawType == SolidAndWireMeshes || DrawType == SolidMesh)
				{
					GetConeMesh(CurrentCone.ConeToWorld, CurrentCone.Angle1, CurrentCone.Angle2, 16, MaterialCache[0][CurrentCone.Color.WithAlpha(DrawAlpha)], SDPG_World, ViewIndex, Collector);
				}
			}

			for (auto It = Spheres.CreateConstIterator(); It; ++It)
			{
				if (PointInView(It->Location, View))
				{
					if (DrawType == SolidAndWireMeshes || DrawType == WireMesh)
					{
						DrawWireSphere(PDI, It->Location, It->Color.WithAlpha(255), It->Radius, 20, SDPG_World, DrawType == SolidAndWireMeshes ? 2 : 0, 0, true);
					}
					if (DrawType == SolidAndWireMeshes || DrawType == SolidMesh)
					{
						GetSphereMesh(It->Location, FVector(It->Radius), 20, 7, MaterialCache[0][It->Color.WithAlpha(DrawAlpha)], SDPG_World, false, ViewIndex, Collector);
					}
				}
			}

			for (auto It = Capsles.CreateConstIterator(); It; ++It)
			{
				if (PointInView(It->Location, View))
				{
					if (DrawType == SolidAndWireMeshes || DrawType == WireMesh)
					{
						const float HalfAxis = FMath::Max<float>(It->HalfHeight - It->Radius, 1.f);
						const FVector BottomEnd = It->Location + It->Radius * It->Z;
						const FVector TopEnd = BottomEnd + (2 * HalfAxis) * It->Z;
						const float CylinderHalfHeight = (TopEnd - BottomEnd).Size() * 0.5;
						const FVector CylinderLocation = BottomEnd + CylinderHalfHeight * It->Z;
						DrawWireCapsule(PDI, CylinderLocation, It->X, It->Y, It->Z, It->Color, It->Radius, It->HalfHeight, (DrawType == SolidAndWireMeshes) ? 9 : 16, SDPG_World, DrawType == SolidAndWireMeshes ? 2 : 0, 0, true);
					}
					if (DrawType == SolidAndWireMeshes || DrawType == SolidMesh)
					{
						GetCapsuleMesh(It->Location, It->X, It->Y, It->Z, It->Color, It->Radius, It->HalfHeight, 16, MaterialCache[0][It->Color.WithAlpha(DrawAlpha)], SDPG_World, false, ViewIndex, Collector);
					}
				}
			}

			for (const auto& Mesh : Meshes)
			{
				FDynamicMeshBuilder MeshBuilder;
				MeshBuilder.AddVertices(Mesh.Vertices);
				MeshBuilder.AddTriangles(Mesh.Indices);

				MeshBuilder.GetMesh(FMatrix::Identity, MaterialCache[Mesh.Color.A == 255 ? 1 : 0][Mesh.Color.WithAlpha(DrawAlpha)], SDPG_World, false, false, ViewIndex, Collector);
			}

		}
	}
}