예제 #1
0
void Mesh::addQuad(float width, float height) {
  int indexOffset = positions.size();
  float x = width / 2.0f;
  float y = height / 2.0f;

  VVec4 quad;
  // C++11      { glm::vec3(-x, -y, 0), glm::vec3(x, -y, 0), glm::vec3(x, y, 0), glm::vec3(-x, y, 0),  });
  quad.push_back(glm::vec4(-x, -y, 0, 1));
  quad.push_back(glm::vec4(x, -y, 0, 1));
  quad.push_back(glm::vec4(x, y, 0, 1));
  quad.push_back(glm::vec4(-x, y, 0, 1));

  // Positions are transformed
  add_all_transformed(model.top(), positions, quad);
  if (normals.size()) {
    // normals are transformed with only the rotation, not the translation
    model.push().untranslate();
    add_all_transformed(model.top(), normals, quad);
    model.pop();
  }

  // indices are copied and incremented
  VS quadIndices;
  // C++11 VS( { 0, 1, 2, 0, 2, 3 } );
  quadIndices.push_back(0);
  quadIndices.push_back(1);
  quadIndices.push_back(2);
  quadIndices.push_back(0);
  quadIndices.push_back(2);
  quadIndices.push_back(3);
  add_all_incremented(indexOffset, indices, quadIndices);

  fillColors();
  fillNormals();
}
예제 #2
0
    SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_DataLoaderJNI_fillColors(JNIEnv *jenv, jclass jcls, jstring jarg1, jobject jarg2, jint jarg3, jint jarg4)
    {
        char *arg1 = (char *) 0 ;
        float *arg2 = (float *) 0 ;
        int arg3 ;
        int arg4 ;

        (void)jenv;
        (void)jcls;
        arg1 = 0;
        if (jarg1)
        {
            arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0);
            if (!arg1)
            {
                return ;
            }
        }
        {
            arg2 = (*jenv)->GetDirectBufferAddress(jenv, jarg2);
            if (arg2 == NULL)
            {
                SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of direct buffer. Buffer must be allocated direct.");
            }
        }
        arg3 = (int)jarg3;
        arg4 = (int)jarg4;
        fillColors(arg1, arg2, arg3, arg4);
        if (arg1)
        {
            (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1);
        }
    }
예제 #3
0
SWIGEXPORT void JNICALL Java_org_scilab_modules_graphic_1objects_DataLoaderJNI_fillColors(JNIEnv *jenv, jclass jcls, jint jarg1, jobject jarg2, jint jarg3, jint jarg4) {
  int arg1 ;
  float *arg2 = (float *) 0 ;
  int arg3 ;
  int arg4 ;
  
  (void)jenv;
  (void)jcls;
  arg1 = (int)jarg1; 
  {
    arg2 = (*jenv)->GetDirectBufferAddress(jenv, jarg2);
    if (arg2 == NULL) {
      SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of direct buffer. Buffer must be allocated direct.");
    }
  }
  arg3 = (int)jarg3; 
  arg4 = (int)jarg4; 
  fillColors(arg1,arg2,arg3,arg4);
}
예제 #4
0
void Mesh::addMesh(const Mesh & mesh, bool forceColor) {
  int indexOffset = positions.size();

  // Positions are transformed
  add_all_transformed(model.top(), positions, mesh.positions);

  // normals are transformed with only the rotation, not the translation
  model.push().untranslate();
  add_all_transformed(model.top(), normals, mesh.normals);
  model.pop();

  // colors and tex coords are simply copied
  add_all(colors, mesh.colors);
  fillColors(forceColor);

  add_all(texCoords, mesh.texCoords);
  if (texCoords.size() && texCoords.size() != positions.size()) {
    add_all(texCoords, VVec2(positions.size() - texCoords.size(), glm::vec2()));
  }

  // indices are copied and incremented
  add_all_incremented(indexOffset, indices, mesh.indices);
}
예제 #5
0
//-----------------------------------------------------------------------------
StyleDialog::StyleDialog(QWidget *parent) : QDialog(parent)
{
	grBuf = 0;
	setWindowTitle(tr("UDAV - Insert style/scheme"));
	QWidget *p;
	QHBoxLayout *h;
	QVBoxLayout *v, *u, *vv;
	QGridLayout *g;
	QLabel *l;
	QPushButton *b;
	tab = new QTabWidget(this);

	// line style
	p = new QWidget(this);	v = new QVBoxLayout(p);
	g = new QGridLayout;	g->setAlignment(Qt::AlignTop);	v->addLayout(g);
//	g->setColStretch(0, 1);	g->setColStretch(1, 1);	g->setColStretch(2, 1);
	l = new QLabel(tr("Arrow at start"), p);	g->addWidget(l, 0, 0);
	l = new QLabel(tr("Dashing"), p);		g->addWidget(l, 0, 1);
	l = new QLabel(tr("Arrow at end"), p);	g->addWidget(l, 0, 2);
	a1 = new QComboBox(p);	g->addWidget(a1, 1, 0);	fillArrows(a1);
	dash = new QComboBox(p);	g->addWidget(dash, 1, 1);	fillDashes(dash);
	a2 = new QComboBox(p);	g->addWidget(a2, 1, 2);	fillBArrows(a2);
	l = new QLabel(tr("Color"), p);	g->addWidget(l, 2, 0, Qt::AlignRight);
	cline=new QComboBox(p);	g->addWidget(cline, 2, 1);	fillColors(cline);

	nline = new QSlider(p);		g->addWidget(nline, 2, 2);
	nline->setRange(1, 9);		nline->setValue(5);
	nline->setTickPosition(QSlider::TicksBothSides);
	nline->setTickInterval(1);	nline->setPageStep(2);
	nline->setOrientation(Qt::Horizontal);
	
	l = new QLabel(tr("Marks"), p);	g->addWidget(l, 3, 0, Qt::AlignRight);
	mark = new QComboBox(p);	g->addWidget(mark, 3, 1);	fillMarkers(mark);
	l = new QLabel(tr("Line width"), p);	g->addWidget(l, 4, 0, Qt::AlignRight);
	width = new QSpinBox(p);	g->addWidget(width, 4, 1);
	width->setRange(1,9);	width->setValue(1);
	
	v->addStretch(1);
	l = new QLabel(tr("Manual dashing"), p);	v->addWidget(l);
	h = new QHBoxLayout;	v->addLayout(h);	h->setSpacing(1);
	for(int i=0;i<16;i++)
	{
		dash_bit[i] = new QToolButton(this);
		dash_bit[i]->setCheckable(true);
		h->addWidget(dash_bit[i]);
		connect(dash_bit[i],SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	}
	connect(a1,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(a2,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(dash,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(mark,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(cline,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(nline,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	connect(width,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Line style"));

	// color scheme
	p = new QWidget(this);
	v = new QVBoxLayout(p);	v->setAlignment(Qt::AlignTop);
	g = new QGridLayout();	v->addLayout(g);
//	g->setColStretch(0, 1);			g->setColStretch(1, 1);
	l = new QLabel(tr("Color order"), p);	g->addWidget(l, 0, 0);
	l = new QLabel(tr("Saturation"),p);		g->addWidget(l, 0, 1);
	for(int i=0;i<7;i++)
	{
		cc[i] = new QComboBox(p);	g->addWidget(cc[i], i+1, 0);
		fillColors(cc[i]);
		nn[i] = new QSlider(p);		g->addWidget(nn[i], i+1, 1);
		nn[i]->setRange(1, 9);		nn[i]->setValue(5);
		nn[i]->setTickPosition(QSlider::TicksBothSides);
		nn[i]->setTickInterval(1);	nn[i]->setPageStep(2);
		nn[i]->setOrientation(Qt::Horizontal);
		connect(cc[i],SIGNAL(activated(int)), this, SLOT(updatePic()));
		connect(nn[i],SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	}
	swire = new QCheckBox(tr("Wire or mesh plot"),p);	v->addWidget(swire);
	g = new QGridLayout();	v->addLayout(g);
	l = new QLabel(tr("Axial direction"), p);	g->addWidget(l, 0, 0, Qt::AlignRight);
	l = new QLabel(tr("Text on contours"), p);	g->addWidget(l, 1, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask for bitmap coloring"), p);	g->addWidget(l, 2, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask rotation angle"), p);	g->addWidget(l, 3, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask size"), p);	g->addWidget(l, 4, 0, Qt::AlignRight);
	axial = new QComboBox(p);	g->addWidget(axial, 0, 1);
	axial->addItem(tr("none"));	axial->addItem("x");
	axial->addItem("y");	axial->addItem("z");
	ctext = new QComboBox(p);	g->addWidget(ctext, 1, 1);
	ctext->addItem(tr("none"));	ctext->addItem(tr("under"));	ctext->addItem(tr("above"));
	mask = new QComboBox(p);	g->addWidget(mask, 2, 1);	fillMasks(mask);
	angle = new QComboBox(p);	g->addWidget(angle, 3, 1);
	angle->addItem(tr("none"));	
	angle->addItem(QString::fromWCharArray(L"+45\xb0"));
	angle->addItem(QString::fromWCharArray(L"-45\xb0"));	
	angle->addItem(QString::fromWCharArray(L"90\xb0"));	// \xb0 <-> °
	msize = new QSlider(p);		g->addWidget(msize, 4, 1);
	msize->setRange(1, 9);		msize->setValue(1);
	msize->setTickPosition(QSlider::TicksBothSides);
	msize->setTickInterval(1);	msize->setPageStep(2);
	msize->setOrientation(Qt::Horizontal);

	connect(axial,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(ctext,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(swire,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(mask,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(angle,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(msize,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Color scheme"));

	// font style
	p = new QWidget(this);
	v = new QVBoxLayout(p);	v->setAlignment(Qt::AlignTop);
	h = new QHBoxLayout();	v->addLayout(h);
	u = new QVBoxLayout();	h->addLayout(u);
	bold = new QCheckBox(tr("Bold style"), p);	u->addWidget(bold);
	ital = new QCheckBox(tr("Italic style"), p);u->addWidget(ital);
	wire = new QCheckBox(tr("Wire style"), p);	u->addWidget(wire);
	uline = new QCheckBox(tr("Underline"), p);	u->addWidget(uline);
	oline = new QCheckBox(tr("Overline"), p);	u->addWidget(oline);
	font_sch = new QCheckBox(tr("Use color scheme"), p);	u->addWidget(font_sch);
	u = new QVBoxLayout();	h->addLayout(u);
	l = new QLabel(tr("Text color"), p);		u->addWidget(l);
	cfont = new QComboBox(p);	fillColors(cfont);	u->addWidget(cfont);
	u->addSpacing(6);
	align = new QGroupBox(tr("Text align"), p);	u->addWidget(align);
	vv = new QVBoxLayout(align);		//vv->addSpacing(11);
	rbL = new QRadioButton(tr("left"), align);	vv->addWidget(rbL);
	rbC = new QRadioButton(tr("at center"), align);
	vv->addWidget(rbC);	rbC->setChecked(true);
	rbR = new QRadioButton(tr("right"), align);	vv->addWidget(rbR);
	connect(bold,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(ital,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(wire,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(uline,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(oline,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(font_sch,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(cfont,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(rbL,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(rbC,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(rbR,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Font style"));
	connect(tab,SIGNAL(currentChanged(int)), this, SLOT(updatePic()));

	// hex-mask
	p = new QWidget(this);
	g = new QGridLayout(p);	g->setAlignment(Qt::AlignTop);
	for(int i=0;i<64;i++)
	{
		mask_bit[i] = new QToolButton(this);
		mask_bit[i]->setCheckable(true);
		g->addWidget(mask_bit[i],7-i/8,i%8);
		connect(mask_bit[i],SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	}
	tab->addTab(p, tr("Manual mask"));

	// dialog itself
	v = new QVBoxLayout(this);	v->addWidget(tab);
	h = new QHBoxLayout();		v->addLayout(h);
	l = new QLabel(tr("Resulting string"), this);	h->addWidget(l);	h->addStretch(1);
	pic = new QLabel(this);	pic->setMinimumSize(QSize(128,30));	h->addWidget(pic);
	res = new QLineEdit(this);	res->setReadOnly(true);	v->addWidget(res);

	h = new QHBoxLayout();	v->addLayout(h);	h->addStretch(1);
	b = new QPushButton(tr("Cancel"), this);	h->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(reject()));
	b = new QPushButton(tr("OK"), this);		h->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(accept()));
	b->setDefault(true);
}
예제 #6
0
파일: edit.cpp 프로젝트: ancientlore/hermit
void Edit::draw ()
{
    fillChar (0, 0, ' ', mWidth);
    fillColors (0, 0, getColor (ceEditWindow), mWidth);
    drawText ();
}