コード例 #1
0
	CustomVehicleControllerBodyStateTire* AddTire (const dVector& offset, dFloat width, dFloat radius, dFloat mass, dFloat suspensionLength, dFloat suspensionSpring, dFloat suspensionDamper, dFloat lateralStiffness, dFloat longitudinalStiffness, dFloat aligningMomentTrail, const dMatrix& tireAligmentMatrix) 
	{
		NewtonBody* const body = m_controller->GetBody();

		// make the tire matrix from the offset and the body matrix
		dMatrix tireMatrix (GetNextMatrix());
		tireMatrix.m_posit = offset;

		// add the visual representation of the is tire to as a child of the vehicle model 
		NewtonCollision*  const tireMeshGenerator = NewtonCreateChamferCylinder (NewtonBodyGetWorld(body), 0.5f, 1.0f, 0, NULL);
		NewtonCollisionSetScale (tireMeshGenerator, width, radius, radius);

		DemoEntity* const tireEntity = new DemoEntity (tireMatrix, this);
		DemoMesh* const visualMesh = new DemoMesh ("tireMesh", tireMeshGenerator, "smilli.tga", "smilli.tga", "smilli.tga");
		tireEntity->SetMesh (visualMesh, dYawMatrix(3.141592f * 90.0f / 180.0f));
		visualMesh->Release();
		NewtonDestroyCollision (tireMeshGenerator);

		// add the tire to the vehicle
		CustomVehicleControllerBodyStateTire::TireCreationInfo tireInfo;
		tireInfo.m_location = tireMatrix.m_posit;
		tireInfo.m_mass = mass;
		tireInfo.m_radio = radius;
		tireInfo.m_width = width;
		tireInfo.m_dampingRatio = suspensionDamper;
		tireInfo.m_springStrength = suspensionSpring;
		tireInfo.m_suspesionlenght = suspensionLength;
		tireInfo.m_lateralStiffness = lateralStiffness;
		tireInfo.m_longitudialStiffness = longitudinalStiffness;
		tireInfo.m_aligningMomentTrail = aligningMomentTrail;
		tireInfo.m_userData = tireEntity;

		return m_controller->AddTire (tireInfo);
	}
コード例 #2
0
	void UpdateTireTransforms()
	{
		NewtonBody* const body = m_controller->GetBody();
		DemoEntityManager* const scene = (DemoEntityManager*) NewtonWorldGetUserData(NewtonBodyGetWorld(body));
#if 0
		// this is the general way for getting the tire matrices
		dMatrix rootMatrixInv (GetNextMatrix().Inverse());
		for (CustomVehicleControllerBodyStateTire* tire = m_controller->GetFirstTire(); tire; tire = m_controller->GetNextTire(tire)) {
			DemoEntity* const tirePart = (DemoEntity*) tire->GetUserData();
			dMatrix matrix (m_tireaLigmentMatrix * tire->CalculateGlobalMatrix() * rootMatrixInv);
			dQuaternion rot (matrix);
			tirePart->SetMatrix(*scene, rot, matrix.m_posit);
		}
#else
		// this saves some calculation since it get the tire local to the chassis
		for (CustomVehicleControllerBodyStateTire* tire = m_controller->GetFirstTire(); tire; tire = m_controller->GetNextTire(tire)) {
			DemoEntity* const tirePart = (DemoEntity*) tire->GetUserData();
			dMatrix matrix (m_tireaLigmentMatrix * tire->CalculateLocalMatrix());
			dQuaternion rot (matrix);
			tirePart->SetMatrix(*scene, rot, matrix.m_posit);
		}
#endif

	}
コード例 #3
0
ファイル: add_matrix.cpp プロジェクト: stgabmp/Rivendell
AddMatrix::AddMatrix(QString station,QWidget *parent,const char *name)
  : QDialog(parent,name,true)
{
  add_station=station;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("Add Switcher"));

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Matrix Number
  //
  add_matrix_box=new QSpinBox(this,"add_matrix_box");
  add_matrix_box->setGeometry(165,11,30,19);
  add_matrix_box->setRange(0,MAX_MATRICES-1);
  QLabel *label=new QLabel(add_matrix_box,tr("&New Matrix Number:"),this,
			   "matrix_label");
  label->setGeometry(10,11,150,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  // Matrix Type
  //
  add_type_box=new QComboBox(this,"add_type_box");
  add_type_box->setGeometry(165,36,200,19);
  add_type_box->insertItem(tr("Local GPIO"));
  add_type_box->insertItem(tr("Generic GPO"));
  add_type_box->insertItem(tr("Generic Serial"));
  add_type_box->insertItem("SAS 32000");
  add_type_box->insertItem("SAS 64000");
  add_type_box->insertItem("Wegener Unity 4000");
  add_type_box->insertItem("BroadcastTools SS8.2");
  add_type_box->insertItem("BroadcastTools 10x1");
  add_type_box->insertItem("SAS 64000-GPI");
  add_type_box->insertItem("BroadcastTools 16x1");
  add_type_box->insertItem("BroadcastTools 8x2");
  add_type_box->insertItem("BroadcastTools ACS82");
  add_type_box->insertItem("SAS User Serial Interface");
  add_type_box->insertItem("BroadcastTools 16x2");
  add_type_box->insertItem("BroadcastTools SS12.4");
  add_type_box->insertItem(tr("Local Audio Adapter"));
  add_type_box->insertItem(tr("Logitek vGuest"));
  add_type_box->insertItem(tr("BroadcastTools SS16.4"));
  add_type_box->insertItem(tr("StarGuide III"));
  add_type_box->insertItem(tr("BroadcastTools SS4.2"));
  add_type_box->insertItem(tr("Axia LiveWire"));
  add_type_box->insertItem(tr("Quartz Type 1"));
  add_type_box->insertItem(tr("BroadcastTools SS4.4"));
  add_type_box->insertItem(tr("BroadcastTools SRC-8 III"));
  add_type_box->insertItem(tr("BroadcastTools SRC-16"));
  label=new QLabel(add_type_box,tr("&Switcher Type:"),this,
		   "matrix_label");
  label->setGeometry(10,36,150,19);
  label->setFont(font);
  label->setAlignment(AlignRight|AlignVCenter|ShowPrefix);

  //
  //  Ok Button
  //
  QPushButton *ok_button=new QPushButton(this,"ok_button");
  ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  ok_button->setDefault(true);
  ok_button->setFont(font);
  ok_button->setText(tr("&OK"));
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  QPushButton *cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  cancel_button->setFont(font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Assign Next Free Matrix
  //
  int n=GetNextMatrix();
  if(n>=0) {
    add_matrix_box->setValue(n);
  }
}
コード例 #4
0
ファイル: add_matrix.cpp プロジェクト: WMTH/rivendell
AddMatrix::AddMatrix(QString station,QWidget *parent,const char *name)
  : QDialog(parent,name)
{
  add_station=station;

  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("RDAdmin - Add Switcher"));

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Bold);
  font.setPixelSize(12);

  //
  // Matrix Number
  //
  add_matrix_box=new QSpinBox(this,"add_matrix_box");
  add_matrix_box->setGeometry(165,11,30,19);
  add_matrix_box->setRange(0,MAX_MATRICES-1);
  QLabel *label=new QLabel(add_matrix_box,tr("&New Matrix Number:"),this,
			   "matrix_label");
  label->setGeometry(10,11,150,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  // Matrix Type
  //
  add_type_box=new QComboBox(this,"add_type_box");
  add_type_box->setGeometry(165,36,200,19);
  for(int i=0;i<RDMatrix::LastType;i++) {
    add_type_box->insertItem(RDMatrix::typeString((RDMatrix::Type)i));
  }
  label=new QLabel(add_type_box,tr("&Switcher Type:"),this,
		   "matrix_label");
  label->setGeometry(10,36,150,19);
  label->setFont(font);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);

  //
  //  Ok Button
  //
  QPushButton *ok_button=new QPushButton(this,"ok_button");
  ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  ok_button->setDefault(true);
  ok_button->setFont(font);
  ok_button->setText(tr("&OK"));
  connect(ok_button,SIGNAL(clicked()),this,SLOT(okData()));

  //
  //  Cancel Button
  //
  QPushButton *cancel_button=new QPushButton(this,"cancel_button");
  cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
			     80,50);
  cancel_button->setFont(font);
  cancel_button->setText(tr("&Cancel"));
  connect(cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));

  //
  // Assign Next Free Matrix
  //
  int n=GetNextMatrix();
  if(n>=0) {
    add_matrix_box->setValue(n);
  }
}