예제 #1
0
void SpriteGroup::Update(const float& delta)
{
	Element::Update(delta);

	for (int i = 0; i < m_sprite_list.size(); ++i)
	{
		Sprite* sprite = m_sprite_list.at(i);
		sprite->SetPosition(
			sprite->GetPositionX() + GetPositionX(),
			sprite->GetPositionY() + GetPositionY(),
			sprite->GetPositionZ() + GetPositionZ());

		sprite->SetAngle(
			sprite->GetAngleX() + GetAngleX(),
			sprite->GetAngleY() + GetAngleY(),
			sprite->GetAngleZ() + GetAngleZ());

		sprite->SetAnchor(
			(sprite->GetAnchorX() + GetAnchorX()) / 2.0f,
			(sprite->GetAnchorY() + GetAnchorY()) / 2.0f);

		sprite->SetScale(
			sprite->GetScaleX() * GetScaleX(),
			sprite->GetScaleY() * GetScaleY());

		sprite->Update(delta);
	}
}
예제 #2
0
void SpriteGroup::Render()
{
	Element::Render();

	for (int i = 0; i < m_sprite_list.size(); ++i)
	{
		Sprite* sprite = m_sprite_list.at(i);
		sprite->Render();

		sprite->SetPosition(
			sprite->GetPositionX() - GetPositionX(),
			sprite->GetPositionY() - GetPositionY(),
			sprite->GetPositionZ() - GetPositionZ());

		sprite->SetAngle(
			sprite->GetAngleX() - GetAngleX(),
			sprite->GetAngleY() - GetAngleY(),
			sprite->GetAngleZ() - GetAngleZ());

		sprite->SetAnchor(
			sprite->GetAnchorX() * 2.0f - GetAnchorX(),
			sprite->GetAnchorY() * 2.0f - GetAnchorY());

		if (GetScaleX() != 0)
		{
			sprite->SetScaleX(sprite->GetScaleX() / GetScaleX());
		}
		if (GetScaleY() != 0)
		{
			sprite->SetScaleY(sprite->GetScaleY() / GetScaleY());
		}
	}
}
// Checks for moving of mouse and rotates camera.
void CFlyingCamera::RotateWithMouse()
{
	GetCursorPos(&pCur);
	RECT rRect; GetWindowRect(appMain.hWnd, &rRect);
	int iCentX = (rRect.left+rRect.right)>>1,
		iCentY = (rRect.top+rRect.bottom)>>1;

	float deltaX = (float)(iCentX-pCur.x)*fSensitivity;
	float deltaY = (float)(iCentY-pCur.y)*fSensitivity;

	if(deltaX != 0.0f)
	{
		vView -= vEye;
		vView = glm::rotate(vView, deltaX, glm::vec3(0.0f, 1.0f, 0.0f));
		vView += vEye;
	}
	if(deltaY != 0.0f)
	{
		glm::vec3 vAxis = glm::cross(vView-vEye, vUp);
		vAxis = glm::normalize(vAxis);
		float fAngle = deltaY;
		float fNewAngle = fAngle+GetAngleX();
		if(fNewAngle > -89.80f && fNewAngle < 89.80f)
		{
			vView -= vEye;
			vView = glm::rotate(vView, deltaY, vAxis);
			vView += vEye;
		}
	}
	SetCursorPos(iCentX, iCentY);
}
/**
 * {@inheritDoc}
 */
void ADIS16448_IMU::UpdateTable() {
  auto table = GetTable();
  if (table) {
    table->PutNumber("Value", GetAngle());
    table->PutNumber("Pitch", GetPitch());
    table->PutNumber("Roll", GetRoll());
    table->PutNumber("Yaw", GetYaw());
    table->PutNumber("AccelX", GetAccelX());
    table->PutNumber("AccelY", GetAccelY());
    table->PutNumber("AccelZ", GetAccelZ());
    table->PutNumber("AngleX", GetAngleX());
    table->PutNumber("AngleY", GetAngleY());
    table->PutNumber("AngleZ", GetAngleZ());
  }
}