Esempio n. 1
0
bool SkeletonSlot::HitTestLocal(const Point2F& localPos) const
{
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;
		return boundingBox->HitTestLocal(localPos);
	}
	return INode::HitTestLocal(localPos);
}
Esempio n. 2
0
Rect2F SkeletonSlot::GetModelBoundingBox() const
{
	//no rotation or scale on this slot
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;
		return boundingBox->Polygon().BoundingBox();
	}
	return Rect2F::Zero;
}
Esempio n. 3
0
Rect2F SkeletonSlot::CalculateBoundingBox()
{
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;


		const List<Point2F>& vertices = boundingBox->Polygon().Vertices();

		RangeF rangeX;
		RangeF rangeY;
		FOR_EACH_COLLECTION(i, vertices)
		{
			Point2F pos = *i;
			pos = TransformToWorld(pos);
			rangeX.Expand(pos.X);
			rangeY.Expand(pos.Y);
		}
Esempio n. 4
0
Rect2F SkeletonSlot::CalculateBoundingBox()
{
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;


		const List<Point2F>& vertices = boundingBox->Polygon().Vertices();

		RangeF rangeX;
		RangeF rangeY;
		for(auto pos: vertices)
		{
			pos = TransformToWorld(pos);
			rangeX.Expand(pos.X);
			rangeY.Expand(pos.Y);
		}

		return Rect2F(rangeX.Min, rangeY.Min, rangeX.Length(), rangeY.Length());
	}
	return Rect2F::Zero;
}