//-----------------------------------------------------------------------------
// Purpose: Scales the bones based on the current scales
//-----------------------------------------------------------------------------
void C_PropPuzzleBox::ApplyBoneMatrixTransform( matrix3x4_t& transform )
{
	BaseClass::ApplyBoneMatrixTransform( transform );

	// Find the scale for this frame
	CalculateScale();

	VectorScale( transform[0], m_flCurrentScale[0], transform[0] );
	VectorScale( transform[1], m_flCurrentScale[1], transform[1] );
	VectorScale( transform[2], m_flCurrentScale[2], transform[2] );

	UpdateVisibility();
}
Esempio n. 2
0
//virtual
void CPDObjectSymbolInstance::CalculateBounds()
{
    m_bounds.X = 0;
    m_bounds.Y = 0;
    m_bounds.Width = 0;
    m_bounds.Height = 0;

    m_filterRect.X = 0;
    m_filterRect.Y = 0;
    m_filterRect.Width = 0;
    m_filterRect.Height = 0;

    if (m_symbol)
    {
        CComPtr<IPDObject> symbolObject;
        m_symbol->get_symbolObject(&symbolObject);

        // Get bbox
        CComQIPtr<IPDObjectTransformable> transformable = symbolObject;

        RectD symbolBounds;
        transformable->get_bounds(&symbolBounds);

        m_bounds.X = m_x;
        m_bounds.Y = m_y;
        m_bounds.Width = symbolBounds.Width;
        m_bounds.Height = symbolBounds.Height;

        // Get expanded bbox
        symbolObject->getExpandedBBox(&m_filterRect);
        m_filterRect.X += m_x;
        m_filterRect.Y += m_y;

        // and bbox when transformed
        GetTransformRectBoundingBox(m_matrix, &m_bounds, &m_xbounds);
    }

    m_appearance->SetupChildrenLayers(this);

    m_expandedBBox = m_appearance->m_expandedRect;

    CalculateScale(m_expandedBBox, m_matrix);

    if (m_parent)	// hm.. ?
    {
        static_cast<CPDObjectImpl<IPDObject>*>((IPDObject*)m_parent)->CalculateBounds();
    }
}
Esempio n. 3
0
// Determine whether the specified position is within the bounding
// box that contains the arrow returning the identifier of this arrow
// or notSelectedIdentifier if the position is outside of the bounding
// box.
uint32 Arrow::Hit(const b2Vec2 &position, uint32 notSelectedIdentifier) const
{
	// Calculate the extent of the arrow's bounding box in viewport
	// coordinates.
	const float32 arrowExtent =
		CalculateScale() * Arrow::k_size * 0.5f;
	b2Vec2 arrowPosition;
	// Translate position into this arrow's space.
	const b2Vec2 relativePosition =
		position - *CalculateViewportPosition(&arrowPosition);
	// Determine whether position is within the arrow's bounding box.
	if (fabs(relativePosition.x) < arrowExtent &&
		fabs(relativePosition.y) < arrowExtent)
	{
		return m_identifier;
	}
	return notSelectedIdentifier;
}
//-----------------------------------------------------------------------------
// Purpose: Ensures the render bounds match the scales
//-----------------------------------------------------------------------------
void C_PropPuzzleBox::GetRenderBounds( Vector &theMins, Vector &theMaxs )
{
	BaseClass::GetRenderBounds( theMins, theMaxs );

	// Find the scale for this frame
	CalculateScale();

	// Extend our render bounds to encompass the scaled object
	theMins.x *= m_flCurrentScale[0];
	theMins.y *= m_flCurrentScale[1];
	theMins.z *= m_flCurrentScale[2];

	theMaxs.x *= m_flCurrentScale[0];
	theMaxs.y *= m_flCurrentScale[1];
	theMaxs.z *= m_flCurrentScale[2];

	Assert( theMins.IsValid() && theMaxs.IsValid() );

}
//virtual
void PSVGPolylineElement::CalculateBounds()
{
	SVGPolylineElement* psvgElement = static_cast<SVGPolylineElement*>(m_pNode);

	LDraw::Matrix3d* matrix = GetLocalAnimatedMatrix();

	ASSERT(0);
#if 0

	m_bounds = psvgElement->m_points->m_animated->m_animVal->m_value->CalculateBoundingBox(NULL);
	m_xbounds = psvgElement->m_points->m_animated->m_animVal->m_value->CalculateBoundingBox(matrix->m_matrix);

	LDraw::GraphicsPathF GraphicsPathF(m_computedFillRule == FillRule_nonzero? LDraw::FillModeWinding: LDraw::FillModeAlternate);
	psvgElement->m_animatedPoints->DrawToPath(&GraphicsPathF, true);

	GetFillUriElement();
	GetStrokeUriElement();
	GetFilterElement();
	GetMaskElement();
	GetClipPathElement();

	if (m_pFilterElement)
	{
		m_filterRect = m_pFilterElement->CalculateFilterRegion(this);
	}
	else
	{
		LDraw::Pen* pen = new LDraw::Pen(LDraw::Color(0,0,0), (float)m_computedStrokeWidth);

		LDraw::RectF bounds;
		GraphicsPathF.GetBounds(&bounds, NULL, pen);

		m_filterRect.X = bounds.X;
		m_filterRect.Y = bounds.Y;
		m_filterRect.Width = bounds.Width;
		m_filterRect.Height = bounds.Height;
	}

	m_expandedBBox = m_filterRect;//m_appearance->m_expandedRect;

	CalculateScale(matrix);
#endif
}
	void SceneObject::ScaleTo(const _3point& scale)
	{
		CalculateScale(scale);
	}
	void SceneObject::ScaleZ(const _point& size)
	{
		CalculateScale(m_Scale + _3point(0.0f, 0.0f, size));
	}
	void SceneObject::ScaleX(const _point& size)
	{
		CalculateScale(m_Scale + _3point(size, 0.0f, 0.0f));
	}
	// Scale
	void SceneObject::Scale(const _3point& scale)
	{
		CalculateScale(m_Scale + scale);
	}
Esempio n. 10
0
KonvergoWindow::KonvergoWindow(QWindow* parent) : QQuickWindow(parent), m_debugLayer(false), m_lastScale(1.0)
{
  // NSWindowCollectionBehaviorFullScreenPrimary is only set on OSX if Qt::WindowFullscreenButtonHint is set on the window.
  setFlags(flags() | Qt::WindowFullscreenButtonHint);

  m_infoTimer = new QTimer(this);
  m_infoTimer->setInterval(1000);

  installEventFilter(new EventFilter(this));

  connect(m_infoTimer, &QTimer::timeout, this, &KonvergoWindow::updateDebugInfo);

  InputComponent::Get().registerHostCommand("close", this, "close");
  InputComponent::Get().registerHostCommand("toggleDebug", this, "toggleDebug");
  InputComponent::Get().registerHostCommand("reload", this, "reloadWeb");
  InputComponent::Get().registerHostCommand("fullscreen", this, "toggleFullscreen");

#ifdef TARGET_RPI
  // On RPI, we use dispmanx layering - the video is on a layer below Konvergo,
  // and during playback the Konvergo window is partially transparent. The OSD
  // will be visible on top of the video as part of the Konvergo window.
  setColor(QColor("transparent"));
#else
  setColor(QColor("#111111"));
#endif

  loadGeometry();
  m_lastScale = CalculateScale(size());

  connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated,
          this, &KonvergoWindow::updateMainSectionSettings);

  connect(this, &KonvergoWindow::visibilityChanged,
          this, &KonvergoWindow::onVisibilityChanged);

  connect(this, &KonvergoWindow::enableVideoWindowSignal,
          this, &KonvergoWindow::enableVideoWindow, Qt::QueuedConnection);

//  connect(QGuiApplication::desktop(), &QDesktopWidget::screenCountChanged,
//              this, &KonvergoWindow::onScreenCountChanged);

  connect(&PlayerComponent::Get(), &PlayerComponent::windowVisible,
          this, &KonvergoWindow::playerWindowVisible);

  connect(&PlayerComponent::Get(), &PlayerComponent::playbackStarting,
          this, &KonvergoWindow::playerPlaybackStarting);

  // this is using old syntax because ... reasons. QQuickCloseEvent is not public class
  connect(this, SIGNAL(closing(QQuickCloseEvent*)), this, SLOT(closingWindow()));

  connect(qApp, &QCoreApplication::aboutToQuit, this, &KonvergoWindow::saveGeometry);

  if (!SystemComponent::Get().isOpenELEC())
  {
    // this is such a hack. But I could not get it to enter into fullscreen
    // mode if I didn't trigger this after a while.
    //
    QTimer::singleShot(500, [=]() {
        updateFullscreenState();
    });
  }
  else
  {
    setWindowState(Qt::WindowFullScreen);
  }

  emit enableVideoWindowSignal();
}
Esempio n. 11
0
double CalculateScale(ScreenBase const & screen, m2::AnyRectD const & rect)
{
  return CalculateScale(screen, rect.GetLocalRect());
}
Esempio n. 12
0
//virtual
void PSVGPathElement::CalculateBounds()
{
	PSVGElement::FreeCachedBitmap();

	if (m_pGdipGraphicsPathF)
	{
		delete m_pGdipGraphicsPathF;
		m_pGdipGraphicsPathF = NULL;
	}

	SVGPathElement* psvgElement = static_cast<SVGPathElement*>(m_pNode);

	gm::Matrix3d* matrix = GetLocalAnimatedMatrix();

//	CComPtr<ILSVGPathSegList> seglist;
//	pElement->get_normalizedPathSegList(&seglist);
	SVGPathSegList* seglist = psvgElement->m_d->m_animated->m_animVal->m_value->m_normalizedseglist;

	if (seglist)
	{
		if (true)
		{
			m_pGdipGraphicsPathF = new LDraw::GraphicsPathF(m_computedFillRule == FillRule_nonzero? LDraw::FillModeWinding: LDraw::FillModeAlternate);

			//LDraw::GraphicsPathF GraphicsPathF;
			DrawPathSegList(seglist, m_pGdipGraphicsPathF, NULL);
		}
		else
		{
		}

		gm::RectF bounds;

		LDraw::Pen pen(LDraw::Color(0,0,0), (float)m_computedStrokeWidth);
		m_pGdipGraphicsPathF/*GraphicsPathF.*/->GetBounds(&bounds, NULL, &pen);

		/*
		if (TRUE)	// Just testing how much faster this is
		{
			m_bounds.X = bounds.X;
			m_bounds.Y = bounds.Y;
			m_bounds.Width = bounds.Width;
			m_bounds.Height = bounds.Height;
			m_xbounds = m_bounds;
		}
		else
		*/
		{
			GetPathSegListBBox(seglist, &m_bounds);
			GetPathSegListBBox(seglist, matrix->m_matrix, &m_xbounds);
		}

		GetFillUriElement();
		GetStrokeUriElement();
		GetFilterElement();
		GetMarkerStartElement();
		GetMarkerEndElement();
		GetMarkerMidElement();
		GetMaskElement();
		GetClipPathElement();

		if (m_pFilterElement)
		{
			m_filterRect = m_pFilterElement->CalculateFilterRegion(this);
		}
		else
		{
			m_filterRect.X = bounds.X;
			m_filterRect.Y = bounds.Y;
			m_filterRect.Width = bounds.Width;
			m_filterRect.Height = bounds.Height;
		}

		if (m_pMaskElement)
		{
			LDraw::RectD maskRegion = m_pMaskElement->CalculateMaskRegion(this);
	
			LDraw::RectD::Intersect(m_expandedBBox, maskRegion, m_filterRect);
		}
		else
		{
			m_expandedBBox = m_filterRect;
		}

		//m_expandedBBox = m_filterRect;//m_appearance->m_expandedRect;

		CalculateScale(/*m_expandedBBox,*/ matrix);
	}

	//pMatrix->Release();
}
Esempio n. 13
0
	void ScaleSystem::SetWorkingResolution(const vec2& pixels)
	{
		m_bIninitialized = true;
		m_WorkingRes = pixels;
		CalculateScale();
	}
Esempio n. 14
0
void CPDObjectFrame::CalculateBounds()
{
	m_path->calculateBBox(NULL, &m_bounds);
	m_path->calculateBBox(m_matrix, &m_xbounds);

	for (int i = 0; i < m_subObjects->m_items.GetSize(); i++)
	{
		CPDObjectImpl<IPDObject>* pObject = static_cast<CPDObjectImpl<IPDObject>*>((IPDObject*)m_subObjects->m_items[i]);

		pObject->CalculateBounds();
	}

// TODO This is a Hack
	CComQIPtr<IPDContentText> contentText = m_content;
	if (contentText)
	{
		CPDObjectImpl<IPDObject>* pObject = static_cast<CPDObjectImpl<IPDObject>*>((IPDObject*)m_content);

		pObject->CalculateBounds();
	}
/*
	double left = 9999999;
	double top = 9999999;
	double right = -9999999;
	double bottom = -9999999;
*/
	double left = m_bounds.X;
	double top = m_bounds.Y;
	double right = m_bounds.X+m_bounds.Width;
	double bottom = m_bounds.Y+m_bounds.Height;

	for (i = 0; i < m_subObjects->m_items.GetSize(); i++)
	{
		CComQIPtr<IPDObject> object = m_subObjects->m_items[i];

		RectD objectExpandedRect;
		object->getExpandedBBox(&objectExpandedRect);

		if (objectExpandedRect.X < left) left = objectExpandedRect.X;
		if (objectExpandedRect.Y < top) top = objectExpandedRect.Y;
		if (objectExpandedRect.X+objectExpandedRect.Width > right) right = objectExpandedRect.X+objectExpandedRect.Width;
		if (objectExpandedRect.Y+objectExpandedRect.Height > bottom) bottom = objectExpandedRect.Y+objectExpandedRect.Height;
	}

	m_filterRect.X = left;
	m_filterRect.Y = top;
	m_filterRect.Width = right - left;
	m_filterRect.Height = bottom - top;

	m_appearance->SetupChildrenLayers(this);

	m_expandedBBox = m_appearance->m_expandedRect;

	CalculateScale(m_expandedBBox, m_matrix);

	/*
	if (m_opacityMaskGroup)
	{
		static_cast<CPDObjectImpl<IPDObject>*>((IPDObject*)m_opacityMaskGroup.p)->CalculateBounds();
	}
	*/

	if (m_parent)
	{
		// TODO Have this ???
		static_cast<CPDObjectImpl<IPDObject>*>((IPDObject*)m_parent)->CalculateBounds();
	}
}