Ejemplo n.º 1
0
/** @return		true if something was selected/deselected, false otherwise. */
bool FModeTool_GeometryModify::FrustumSelect( const FConvexVolume& InFrustum, bool InSelect /* = true */ )
{
	bool bResult = false;
	if( GEditorModeTools().IsModeActive( FBuiltinEditorModes::EM_Geometry ) )
	{
		FEdModeGeometry* mode = (FEdModeGeometry*)GEditorModeTools().GetActiveMode( FBuiltinEditorModes::EM_Geometry );

		for( FEdModeGeometry::TGeomObjectIterator Itor( mode->GeomObjectItor() ) ; Itor ; ++Itor )
		{
			FGeomObject* go = *Itor;
			FTransform ActorToWorld = go->GetActualBrush()->ActorToWorld();
			// Check each vertex to see if its inside the frustum
			for( int32 v = 0 ; v < go->VertexPool.Num() ; ++v )
			{
				FGeomVertex& gv = go->VertexPool[v];
				if( InFrustum.IntersectBox( ActorToWorld.TransformPosition( gv.GetMid() ), FVector::ZeroVector ) )
				{
					gv.Select( InSelect );
					bResult = true;
				}
			}
		}
	}
	return bResult;
}
Ejemplo n.º 2
0
void GetViewFrustumBounds(FConvexVolume& OutResult, const FMatrix& ViewProjectionMatrix, const FPlane& InFarPlane, bool bOverrideFarPlane, bool UseNearPlane)
{
	OutResult.Planes.Empty( 6 );
	FPlane	Temp;

	// Near clipping plane.
	if(UseNearPlane && ViewProjectionMatrix.GetFrustumNearPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	// Left clipping plane.
	if(ViewProjectionMatrix.GetFrustumLeftPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	// Right clipping plane.
	if(ViewProjectionMatrix.GetFrustumRightPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	// Top clipping plane.
	if(ViewProjectionMatrix.GetFrustumTopPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	// Bottom clipping plane.
	if(ViewProjectionMatrix.GetFrustumBottomPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	// Far clipping plane.
	if (bOverrideFarPlane)
	{
		OutResult.Planes.Add(InFarPlane);
	}
	else if(ViewProjectionMatrix.GetFrustumFarPlane(Temp))
	{
		OutResult.Planes.Add(Temp);
	}

	OutResult.Init();
}
Ejemplo n.º 3
0
bool UBillboardComponent::ComponentIsTouchingSelectionFrustum(const FConvexVolume& InFrustum, const FEngineShowFlags& ShowFlags, const bool bConsiderOnlyBSP, const bool bMustEncompassEntireComponent) const
{
	AActor* Actor = GetOwner();

	if (!bConsiderOnlyBSP && ShowFlags.BillboardSprites && Sprite != nullptr && Actor != nullptr)
	{
		const float Scale = ComponentToWorld.GetMaximumAxisScale();
		const float MaxExtent = FMath::Max(Sprite->GetSizeX(), Sprite->GetSizeY());
		const FVector Extent = Scale * MaxExtent * FVector(0.5f, 0.5f, 0.0f);

		bool bIsFullyContained;
		if (InFrustum.IntersectBox(Actor->GetActorLocation(), Extent, bIsFullyContained))
		{
			return !bMustEncompassEntireComponent || bIsFullyContained;
		}
	}

	return false;
}