//--------------------------------------------------------------
void ofVboByteColor::setMesh(const ofMesh & mesh, int usage){
	setVertexData(mesh.getVerticesPointer(),mesh.getNumVertices(),usage);
	setColorData(mesh.getColorsPointer(),mesh.getNumColors(),usage);
	setNormalData(mesh.getNormalsPointer(),mesh.getNumNormals(),usage);
	setTexCoordData(mesh.getTexCoordsPointer(),mesh.getNumTexCoords(),usage);
	setIndexData(mesh.getIndexPointer(), mesh.getNumIndices(), usage);
}
示例#2
0
//--------------------------------------------------------------
void ofVbo::setMesh(const ofMesh & mesh, int usage, bool useColors, bool useTextures, bool useNormals){
	if(mesh.getVertices().empty()){
		ofLogWarning("ofVbo") << "setMesh(): ignoring mesh with no vertices";
		return;
	}
	setVertexData(mesh.getVerticesPointer(),mesh.getNumVertices(),usage);
	if(mesh.hasColors() && useColors){
		setColorData(mesh.getColorsPointer(),mesh.getNumColors(),usage);
		enableColors();
	}else{
		disableColors();
	}
	if(mesh.hasNormals() && useNormals){
		setNormalData(mesh.getNormalsPointer(),mesh.getNumNormals(),usage);
		enableNormals();
	}else{
		disableNormals();
	}
	if(mesh.hasTexCoords() && useTextures){
		setTexCoordData(mesh.getTexCoordsPointer(),mesh.getNumTexCoords(),usage);
		enableTexCoords();
	}else{
		disableTexCoords();
	}
	if(mesh.hasIndices()){
		setIndexData(mesh.getIndexPointer(), mesh.getNumIndices(), usage);
		enableIndices();
	}else{
		disableIndices();
	}
}
示例#3
0
void MyItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
{
    bool isDrag = QLineF(e->screenPos(), e->buttonDownScreenPos(Qt::LeftButton)).length() >= QApplication::startDragDistance();
    if (!isDrag) {
        return;
    }

    auto drag = new QDrag(e->widget());
    auto mime = new QMimeData;
    drag->setMimeData(mime);
    mime->setColorData(color);

    QPixmap pix(21, 21);
    pix.fill(Qt::transparent);
    QPainter painter(&pix);
    paint(&painter, nullptr, nullptr);
    drag->setPixmap(pix);

    drag->setHotSpot(QPoint(10, 15));
    drag->exec();
    setCursor(QCursor(Qt::OpenHandCursor));
}
//--------------------------------------------------------------
void ofVboByteColor::setColorData(const ofFloatColor * colors, int total, int usage) {
	setColorData(&colors[0].r,total,usage,sizeof(ofFloatColor));
}
示例#5
0
//--------------------------------------------------------------
void ofVbo::setMesh(const ofMesh & mesh, int usage){
	setVertexData(mesh.getVerticesPointer(),mesh.getNumVertices(),usage,sizeof(ofVec3f));
	setColorData(mesh.getColorsPointer(),mesh.getNumColors(),usage,sizeof(ofColor));
	setNormalData(mesh.getNormalsPointer(),mesh.getNumNormals(),usage,sizeof(ofVec3f));
	setTexCoordData(mesh.getTexCoordsPointer(),mesh.getNumTexCoords(),usage,sizeof(ofVec2f));
}
示例#6
0
RDButtonDialog::RDButtonDialog(QString station_name,
			       const QString &label_template,
			       RDCartDialog *cart_dialog,const QString &svcname,
			       QWidget *parent)
  : QDialog(parent,"",true)
{
  //
  // Fix the Window Size
  //
  setMinimumWidth(sizeHint().width());
  setMaximumWidth(sizeHint().width());
  setMinimumHeight(sizeHint().height());
  setMaximumHeight(sizeHint().height());

  setCaption(tr("Edit Button"));
  edit_station_name=station_name;
  edit_label_template=label_template;
  edit_cart_dialog=cart_dialog;
  edit_svcname=svcname;

  //
  // Create Fonts
  //
  QFont font=QFont("Helvetica",12,QFont::Normal);
  font.setPixelSize(12);
  QFont label_font=QFont("Helvetica",12,QFont::Bold);
  label_font.setPixelSize(12);
  QFont button_font=QFont("Helvetica",14,QFont::Bold);
  button_font.setPixelSize(14);
  QFont counter_font=QFont("Helvetica",24,QFont::Bold);
  counter_font.setPixelSize(24);

  //
  // Button Label
  //
  edit_label_edit=new QLineEdit(this,"edit_label_edit");
  edit_label_edit->setGeometry(60,10,300,20);
  edit_label_edit->setFont(font);
  QLabel *label=new QLabel(edit_label_edit,tr("Label:"),
			   this,"edit_label_label");
  label->setGeometry(10,12,45,16);
  label->setFont(label_font);
  label->setAlignment(Qt::AlignRight);

  //
  // Button Cart
  //
  edit_cart_edit=new QLineEdit(this,"edit_cart_edit");
  edit_cart_edit->setGeometry(60,34,300,20);
  edit_cart_edit->setFont(font);
  edit_cart_edit->setReadOnly(true);
  label=new QLabel(edit_cart_edit,tr("Cart:"),this,"edit_cart_label");
  label->setGeometry(10,36,45,16);
  label->setFont(label_font);
  label->setAlignment(Qt::AlignRight);

  //
  // Set Cart Button
  //
  QPushButton *button=new QPushButton(this,"cart_button");
  button->setGeometry(55,60,80,50);
  button->setFont(label_font);
  button->setText(tr("Set\nCart"));
  connect(button,SIGNAL(clicked()),this,SLOT(setCartData()));
  
  //
  // Clear Button
  //
  button=new QPushButton(this,"cart_button");
  button->setGeometry(145,60,80,50);
  button->setFont(label_font);
  button->setText(tr("Clear"));
  connect(button,SIGNAL(clicked()),this,SLOT(clearCartData()));
  
  //
  // Color Button
  //
  edit_color_button=new QPushButton(this,"edit_color_button");
  edit_color_button->setGeometry(sizeHint().width()-135,60,80,50);
  edit_color_button->setFont(label_font);
  edit_color_button->setText(tr("Set\nColor"));
  connect(edit_color_button,SIGNAL(clicked()),this,SLOT(setColorData()));
  
  //
  //  Ok Button
  //
  button=new QPushButton(this,"ok_button");
  button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,80,50);
  button->setDefault(true);
  button->setFont(label_font);
  button->setText(tr("&OK"));
  connect(button,SIGNAL(clicked()),this,SLOT(okData()));

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