Ejemplo n.º 1
0
void init(int argc, char** argv)
{
  g_eye = glm::vec3(0.0, 0.0, 2.0);
  g_center = glm::vec3(0, 0, 0);
  viewMatrix = glm::lookAt(g_eye, g_center, glm::vec3(0, 1, 0));
  projMatrix = glm::perspective(45.f, 1.f, 1.f, 5.f);

  Quad* q = new Quad();
  q->setDrawCb(drawQuad);
  q->setMaterialColor(glm::vec4(1.f));
  q->m_modelMatrix = glm::mat4(1.f);
  q->m_normalMatrix = glm::mat3(glm::inverseTranspose(viewMatrix * q->m_modelMatrix));
  TinyGL::getInstance()->addResource(MESH, "quad", q);

  Detector d = HARRIS;
  double thresh = 0.9;

  //Basic argument parsing.
  if(argc >= 3) {
    string param = string(argv[1]);
    if(param == "--shi-tomasi" || param == "-s")
      d = SHI_TOMASI;
    param = string(argv[2]);
    stringstream ss(param);
    ss >> thresh;
  } else if(argc == 2) {
Ejemplo n.º 2
0
Keyframe::Keyframe(map<Vector3f, SharkVertex*, compareVect3> *rawVerts, vector<Quad*> *rawFaces)
{
	//deep copy verts over.
	map<Vector3f, SharkVertex*, compareVect3>::iterator im;
	for(im = rawVerts->begin(); im != rawVerts->end(); im++)
	{
		pair<Vector3f, SharkVertex*> serk = *im;
		SharkVertex * d = new SharkVertex();
		d->sNormal(serk.second->gNormal());
		d->sTransformed(serk.second->gTransformed());
		d->sLocal(serk.second->gLocal());
		uVertices.insert(pair<Vector3f, SharkVertex*>(serk.first, d));
	}

	//create faces.
	vector<Quad*>::iterator iq;
        for(iq = rawFaces->begin(); iq != rawFaces->end(); iq++)
        {
		Quad * nRect = new Quad();
		for(int i = 0; i < 4; i++)
		{
			nRect->sVert(i, uVertices.find((*iq)->gLocalVert(i))->second);
		}
		faces.push_back(nRect);
	}

	//setNormals
	createQuads();
}
Ejemplo n.º 3
0
void UIRenderer::_draw(const rect_type &rect, const color_t &color) {
    Device &r = Device::instance();
    Quad quad;
	quad.setLocation(_modify_rect(rect, r.scaleInPixel())).setColor(_blend(color));
    r.setTexture(0);
    r.drawQuad(quad);
}
Ejemplo n.º 4
0
///Displays
void display(){
    ///--- Clears the color buffer so that we don't display garbage
    glViewport(0,0,windowDimension,windowDimension);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        ///--- Upload viewing matrices externally
        GLuint pid = quad.getProgramID();
        glUseProgram(pid);
            mat4 MODEL = mat4::Identity();
            glUniformMatrix4fv(glGetUniformLocation(pid, "MODEL"), 1, GL_FALSE, MODEL.data());

            float theta_rad = M_PI/180.0*theta;
            //vec3 camera_pos( camX, camY, 2*sin(theta_rad));
            camX = camX + rateX;
            camY = camY + rateY;
            camZ = camZ + rateZ;
            vec3 camera_pos(camX,camY,camZ);
            mat4 VIEW = Eigen::lookAt( camera_pos, vec3(lookX,lookY,lookZ), vec3(0,0,1) ); //< "z" up on screen
            glUniformMatrix4fv(glGetUniformLocation(pid, "VIEW"), 1, GL_FALSE, VIEW.data());

            mat4 PROJ = Eigen::perspective(75.0f, windowDimension/(float)windowDimension, 0.1f, 10.0f);
            glUniformMatrix4fv(glGetUniformLocation(pid, "PROJ"), 1, GL_FALSE, PROJ.data());
        glUseProgram(pid);
    ///--- calls the quad.draw() method which displays the terrain quad (?takes in the ModelViewProjection matrices?)
    quad.draw();
}
Ejemplo n.º 5
0
void MapWindow::on_actionOpen_triggered()
{
  QString filename;
  filename = QFileDialog::getOpenFileName(0, "Open File", QDir::home().absolutePath(), "ProjMapper Files (*.pmap)");
  if (!filename.isEmpty()) {
    QFile fd(filename);
    fd.open(QIODevice::ReadWrite);
    QDataStream ds(&fd);
    Quad *q;
    int size;
    ds >> size;
    quadList->clear();
    for (int i = ui->listWidget->count()-1; i >= 0; i--) {
      ui->listWidget->takeItem(i);
    }

    for (int i = 0; i<size; i++) {
      q = new Quad();
      ds >> *q;
      quadList->append(q);
      new QListWidgetItem(q->getName(), ui->listWidget);
      qDebug() << q->getName();
    }
    fd.close();

    emit updateAllDisplays();
  }
Ejemplo n.º 6
0
void mouseMotion(int x, int y) {
  Point *p = new Point(x, H2-y);

  if ((figType == POINTER) && sel) {
	 Figure *f = figureSet[selected];
	 if (cpsel){ // the user is trying to move a control point (modify)
		f->setPoint(cp - figureSet.size(), p);
	 }
	 else { // the user want to move the figure as a block (move)
		// common points
		int xoffset = x - ox;
		int yoffset = oy - y; // openGl invert y coordinate
		int *pt1 = f->getPoint(1)->getCoords();
		int *pt2 = f->getPoint(2)->getCoords();
		// move coordinates basing on offsets 
		Point *p1 = new Point(pt1[0] + xoffset, pt1[1] + yoffset);
		f->setPoint(1, p1);
		Point *p2 = new Point(pt2[0] + xoffset, pt2[1] + yoffset);
		f->setPoint(2, p2);
		
		if (Triangle *t = dynamic_cast<Triangle*>(f)) {
		  int *pt3 = t->getPoint(3)->getCoords();
		  Point *p3 = new Point(pt3[0] + xoffset, pt3[1] + yoffset);
		  t->setPoint(3, p3);
		}
		else if (Quad *q = dynamic_cast<Quad*>(f)) {
		  int *pt3 = q->getPoint(3)->getCoords();
		  int *pt4 = q->getPoint(4)->getCoords();
		  Point *p3 = new Point(pt3[0] + xoffset, pt3[1] + yoffset);
		  q->setPoint(3, p3);
		  Point *p4 = new Point(pt4[0] + xoffset, pt4[1] + yoffset);
		  q->setPoint(4, p4);
		}
	 }
	 ox = x; // refresh coordinates
	 oy = y;
  }
 
  // show the figure while creating
  switch(figType) {
  case LINE: {
	 Line *l = (Line*) figureSet.back();
	 l->setPoint(2, p);
	 break;
  }
  case TRIANGLE: {
	 Triangle *t = (Triangle*) figureSet.back();
	 t->setTriangle(p);
	 break;
  }
  case QUAD: {
	 Quad *q = (Quad*) figureSet.back();
	 q->setQuad(p);
	 break;
  }
  }

  glutPostRedisplay();
}
Ejemplo n.º 7
0
	void onSrcRectChange()
	{
		if (mirrored)
			quad.setTexRect(srcRect->toFloatRect().hFlipped());
		else
			quad.setTexRect(srcRect->toFloatRect());

		quad.setPosRect(IntRect(0, 0, srcRect->width, srcRect->height));
		recomputeBushDepth();
	}
Ejemplo n.º 8
0
void AutoMap::paint(const Vector &pos)
{
	Quad *q = new Quad("particles/WhiteGlow", pos);
	q->setLife(1);
	q->setDecayRate(0.5);
	q->color = paintColor;
	q->followCamera = 1;
	q->setWidthHeight(8,8);
	dsq->game->addRenderObject(q, this->layer);
}
Ejemplo n.º 9
0
int w_Quad_getViewport(lua_State *L)
{
	Quad *quad = luax_checkquad(L, 1);
	Quad::Viewport v = quad->getViewport();
	lua_pushnumber(L, v.x);
	lua_pushnumber(L, v.y);
	lua_pushnumber(L, v.w);
	lua_pushnumber(L, v.h);
	return 4;
}
Ejemplo n.º 10
0
	int w_Quad_getViewport(lua_State * L)
	{
		Quad * quad = luax_checktype<Quad>(L, 1, "Quad", GRAPHICS_QUAD_T);
		Quad::Viewport v = quad->getViewport();
		lua_pushnumber(L, v.x);
		lua_pushnumber(L, v.y);
		lua_pushnumber(L, v.w);
		lua_pushnumber(L, v.h);
		return 4;
	}
Ejemplo n.º 11
0
	int w_Quad_setViewport(lua_State * L)
	{
		Quad * quad = luax_checktype<Quad>(L, 1, "Quad", GRAPHICS_QUAD_T);
		Quad::Viewport v;
		v.x = (float) luaL_checknumber(L, 2);
		v.y = (float) luaL_checknumber(L, 3);
		v.w = (float) luaL_checknumber(L, 4);
		v.h = (float) luaL_checknumber(L, 5);
		quad->setViewport(v);
		return 0;
	}
Ejemplo n.º 12
0
void UIRenderer::_draw(const rect_type &rect, const color_t &color, const TexturePtr &texture, const vector2f *texcoords) {
    Device &r = Device::instance();
    Quad quad;
	quad.setLocation(_modify_rect(rect, r.scaleInPixel())).setColor(_blend(color));
    quad.vertices[0].texcoord = texcoords[0];
    quad.vertices[1].texcoord = texcoords[1];
    quad.vertices[2].texcoord = texcoords[2];
    quad.vertices[3].texcoord = texcoords[3];
    
    r.setTexture(texture);
    r.drawQuad(quad);
}
Ejemplo n.º 13
0
void Map::renderQuad(int x, int z, DetailLevel detailLevel)
{
  Quad * quad = findQuad(x, z);
  if (quad != NULL)
  {
    quad->render(detailLevel);
  }
  else
  {
    scheduleTask(x, z);
  }
}
Ejemplo n.º 14
0
void LensFlare::addFlare(const std::string &tex, Vector color, int w, int h)
{
	Quad *q = new Quad(tex, Vector(0,0,0));
	q->color = color;
	q->setBlendType(BLEND_ADD);
	if (w != -1)
		q->setWidth(w);
	if (h != -1)
		q->setHeight(h);
	flares.push_back(q);
	addChild(q, PM_POINTER);
}
Ejemplo n.º 15
0
bool PhysicsMesh::LoadFrom(Mesh * mesh)
{
	// Clear old
	triangles.ClearAndDelete();
	quads.ClearAndDelete();

	name = mesh->name;
	source = mesh->source; 
	aabb = *mesh->aabb;

	for (int i = 0; i < mesh->numFaces; ++i)
	{
		// Just copy shit from it
		MeshFace * faces = &mesh->faces[i];
		assert((faces->numVertices <= 4 || faces->numVertices >= 3) && "Bad vertices count in faces");

		int vi0 = faces->vertices[0],
			vi1 = faces->vertices[1],
			vi2 = faces->vertices[2];

		assert(vi0 < mesh->vertices.Size() && 
			vi0 >= 0);

		Vector3f p1 = mesh->vertices[vi0],
			p2 = mesh->vertices[vi1],
			p3 = mesh->vertices[vi2];

		if (faces->numVertices == 4){
			Vector3f p4 = mesh->vertices[faces->vertices[3]];
			Quad * quad = new Quad();
			quad->Set4Points(p1, p2, p3, p4);
			quads.Add(quad);
		}
		else if (faces->numVertices == 3){
			Triangle * tri = new Triangle();
			tri->Set3Points(p1, p2, p3);
			triangles.Add(tri);
		}
	}
	if (quads.Size() == 0 && triangles.Size() == 0)
		assert(false && "Unable to load physicsmesh from mesh source!");
	else
		std::cout<<"\nCreated physics mesh for \""<<source<<"\": ";
	if (triangles.Size())
		std::cout<<"\n- "<<triangles.Size()<<" triangles";
	if (quads.Size())
		std::cout<<"\n- "<<quads.Size()<<" quads";

	// Re-generate it.
	if (useCollisionShapeOctrees)
		GenerateCollisionShapeOctree();
	return true;
}
Ejemplo n.º 16
0
float Map::tileValue(int quadPosX, int quadPosZ, int tilePosX, int tilePosZ)
{
  Quad *quad = findQuad(quadPosX, quadPosZ);
  if (quad == NULL)
    return 0.0f;

  float v1 = _scale.y * quad->value(tilePosX, tilePosZ);
  float v2 = _scale.y * quad->value(tilePosX + 1, tilePosZ);
  float v3 = _scale.y * quad->value(tilePosX + 1, tilePosZ + 1);
  float v4 = _scale.y * quad->value(tilePosX, tilePosZ + 1);
  return (v1 + v2 + v3 + v4) / 4.0f;
}
Ejemplo n.º 17
0
Archivo: Quad.cpp Proyecto: JobstM/ogs
Quad::Quad(const Quad &quad)
	: Face(quad.getValue())
{
	_nodes = new Node*[4];
	_neighbors = new Element*[4];
	for (unsigned i=0; i<4; i++)
	{
		_nodes[i] = quad._nodes[i];
		_neighbors[i] = quad._neighbors[i];
	}
	_area = quad.getArea();
}
Ejemplo n.º 18
0
void setupGeometry()
{
  Sphere** spheres;
  Quad* screenQuad;
  Cube** bottom_box;

  bottom_box = new Cube*[5];
  for(int i = 0; i < 5; i++) {
    bottom_box[i] = new Cube();
    bottom_box[i]->setDrawCb(drawArrays);
  }

  bottom_box[0]->setMaterialColor(glm::vec4(0.4, 0.6, 0.0, 1.0));
  bottom_box[1]->setMaterialColor(glm::vec4(0, 0.8, 0.0, 1.0));
  bottom_box[2]->setMaterialColor(glm::vec4(0.6, 0, 0.0, 1.0));
  bottom_box[3]->setMaterialColor(glm::vec4(0.4, 0.6, 0.9, 1.0));
  bottom_box[4]->setMaterialColor(glm::vec4(0, 0, 0.8, 1.0));

  bottom_box[0]->m_modelMatrix = glm::translate(glm::vec3(25, 0, 25)) * glm::scale(glm::vec3(50, 0.1, 50));
  bottom_box[1]->m_modelMatrix = glm::translate(glm::vec3(25, 2.5, 0)) * glm::scale(glm::vec3(50, 5, 0.3));
  bottom_box[2]->m_modelMatrix = glm::translate(glm::vec3(50, 2.5, 25)) * glm::scale(glm::vec3(0.3, 5, 50));
  bottom_box[3]->m_modelMatrix = glm::translate(glm::vec3(25, 2.5, 50)) * glm::scale(glm::vec3(50, 5, 0.3));
  bottom_box[4]->m_modelMatrix = glm::translate(glm::vec3(0, 2.5, 25)) * glm::scale(glm::vec3(0.3, 5, 50));

  for(int i = 0; i < 5; i++) {
    bottom_box[i]->m_normalMatrix = glm::mat3(glm::inverseTranspose(viewMatrix * bottom_box[i]->m_modelMatrix));
    TinyGL::getInstance()->addResource(MESH, "bottom_box" + to_string(i), bottom_box[i]);
  }

  spheres = new Sphere*[NUM_SPHERES];
  for (int i = 0; i < NUM_SPHERES; i++) {
    spheres[i] = new Sphere(60, 60);
    spheres[i]->setDrawCb(drawSphere);
    spheres[i]->setMaterialColor(glm::vec4(1.0, 0.0, 0.0, 1.0));
  }

  for (int i = 0; i < W_SPHERES; i++) {
    for (int j = 0; j < H_SPHERES; j++) {
      spheres[i * W_SPHERES + j]->m_modelMatrix = glm::translate(glm::vec3((i+1) * 4, 1.6, (j+1) * 4)) * glm::scale(glm::vec3(1.5));
      spheres[i * W_SPHERES + j]->m_normalMatrix = glm::mat3(glm::inverseTranspose(viewMatrix * spheres[i * W_SPHERES + j]->m_modelMatrix));
    }
  }

  for (int i = 0; i < NUM_SPHERES; i++)
    TinyGL::getInstance()->addResource(MESH, "sphere" + to_string(i), spheres[i]);

  screenQuad = new Quad();
  screenQuad->setDrawCb(drawQuad);
  screenQuad->setMaterialColor(glm::vec4(0.f, 0.f, 0.f, 1.f));
  screenQuad->m_modelMatrix = glm::mat4(1.f);
  screenQuad->m_normalMatrix = glm::mat3(glm::inverseTranspose(viewMatrix * screenQuad->m_modelMatrix));
  TinyGL::getInstance()->addResource(MESH, "screenQuad", screenQuad);
}
Ejemplo n.º 19
0
Quad& Mesh:: createQuad
(
  Edge& edgeOne,
  Edge& edgeTwo,
  Edge& edgeThree,
  Edge& edgeFour )
{
  Quad* newQuad = new Quad (
      edgeOne, edgeTwo, edgeThree, edgeFour, _manageQuadIDs.getFreeID());
  newQuad->addParent(*this);
  _content.add(newQuad);
  return *newQuad;
}
Ejemplo n.º 20
0
void loop() {
  unsigned char data[8];
  if (mySerial.available() > 0) {
    if (readFrame(&mySerial, data) == FRAME_COMPLETE)
      controller.updateFromDataArray(data);
  }

  acc.read();
  gyro.read();
  alt.start();

  quad.computePIDs();
  quad.setESCs();
}
Ejemplo n.º 21
0
	void onSrcRectChange()
	{
		if (mirrored)
			quad.setTexRect(srcRect->toFloatRect().hFlipped());
		else
			quad.setTexRect(srcRect->toFloatRect());

		quad.setPosRect(IntRect(0, 0, srcRect->width, srcRect->height));
		recomputeBushDepth();

#ifdef RGSS2
		wave.dirty = true;
#endif
	}
Ejemplo n.º 22
0
HRESULT FXAAPostProcess::Render(ID3D11DeviceContext* pd3dImmediateContext, ID3D11ShaderResourceView* src,
                                ID3D11RenderTargetView* dstRTV, Camera* camera, GBuffer* gBuffer, ParticleBuffer* pBuffer, LightBuffer* lightBuffer)
{
    BEGIN_EVENT_D3D(L"FXAA");

    HRESULT hr;
    D3D11_MAPPED_SUBRESOURCE mappedResource;

    // Map the properties and set them
    V_RETURN(pd3dImmediateContext->Map(_propertiesBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource));
    CB_FXAA_PROPERTIES* properties = (CB_FXAA_PROPERTIES*)mappedResource.pData;

    properties->InverseSceneSize = _invSceneSize;
    properties->Subpixel = _subpixel;
    properties->EdgeThreshold = _edgeThreshold;
    properties->EdgeThresholdMin = _edgeThresholdMin;

    pd3dImmediateContext->Unmap(_propertiesBuffer, 0);

    pd3dImmediateContext->PSSetConstantBuffers(0, 1, &_propertiesBuffer);

    // Set the sampler
    ID3D11SamplerState* samplers[1] = { GetSamplerStates()->GetLinearClamp() };

    pd3dImmediateContext->PSSetSamplers(0, 1, samplers);

    // Set the other states
    pd3dImmediateContext->OMSetDepthStencilState(GetDepthStencilStates()->GetDepthDisabled(), 0);

    float blendFactor[4] = {1, 1, 1, 1};
    pd3dImmediateContext->OMSetBlendState(GetBlendStates()->GetBlendDisabled(), blendFactor, 0xFFFFFFFF);

    // Set the render target
    pd3dImmediateContext->OMSetRenderTargets(1, &dstRTV, NULL);

    // Set the resources
    pd3dImmediateContext->PSSetShaderResources(0, 1, &src);

    // Render the quad
    Quad* fsQuad = GetFullScreenQuad();

    V_RETURN(fsQuad->Render(pd3dImmediateContext, _fxaaPSs[_qualityIndex]->PixelShader));

    // Unset the resources
    ID3D11ShaderResourceView* ppSRVNULL[1] = { NULL };
    pd3dImmediateContext->PSSetShaderResources(0, 1, ppSRVNULL);

    END_EVENT_D3D(L"");
    return S_OK;
}
Ejemplo n.º 23
0
Status Stroke::traverse(Ticks tCurrent, QuadStepper &stepper) {
    Quad<StepCoord> dGoal = goalPos(tCurrent);
    if (tStart <= 0) {
        return STATUS_STROKE_START;
    }
#ifdef TEST
    Ticks endTicks = tCurrent - (tStart + dtTotal);
    if (endTicks > -5) {
        TESTCOUT2("traverse(", endTicks, ") ", dGoal.toString());
    }
#endif

    Status status = STATUS_BUSY_MOVING;
    Quad<StepDV> pulse;
#define PULSE_BLOCK 32 /* pulses emitted without limit checks */
    Quad<StepCoord> dPosSeg = dGoal - dPos;
    for (bool done = true; ; done = true) {
        for (QuadIndex i = 0; i < QUAD_ELEMENTS; i++) {
            StepCoord dp = dPosSeg.value[i];
            if (dp < -PULSE_BLOCK) {
                pulse.value[i] = -PULSE_BLOCK;
                done = false;
            } else if (dp > PULSE_BLOCK) {
                pulse.value[i] = PULSE_BLOCK;
                done = false;
            } else if (dp) {
                pulse.value[i] = dp;
                done = false;
            } else {
                pulse.value[i] = 0;
            }
            dPosSeg.value[i] -= (StepCoord) pulse.value[i];
            dPos.value[i] += (StepCoord) pulse.value[i];
        }
        if (done) {
            break;
        }
        if (0 > (status = stepper.stepDirection(pulse))) {
            return status;
        }
        if (0 > (status = stepper.stepFast(pulse))) {
            return status;
        }
    }
    if (tCurrent >= tStart + dtTotal) {
        TESTCOUT3("Stroke::traverse() tCurrent:", tCurrent, " tStart:", tStart, " dtTotal:", dtTotal);
        return STATUS_OK;
    }
    return STATUS_BUSY_MOVING;
}
Ejemplo n.º 24
0
BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(StyleResolverState& state, CSSValue* value)
{
    if (!value || !value->isPrimitiveValue())
        return BorderImageLengthBox(Length(Auto));

    Quad* slices = toCSSPrimitiveValue(value)->getQuadValue();

    // Set up a border image length box to represent our image slices.
    return BorderImageLengthBox(
        toBorderImageLength(*slices->top(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->right(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->bottom(), state.cssToLengthConversionData()),
        toBorderImageLength(*slices->left(), state.cssToLengthConversionData()));
}
Ejemplo n.º 25
0
bool Quad::CollidesWith (Quad& other, Vector* vIntersection )
{
	// just do a line to quad check with all of the other quad's lines
	if (other.CollidesWith (Line (v1,v2), vIntersection))
		return true;
	if (other.CollidesWith (Line (v2,v3), vIntersection))
		return true;
	if (other.CollidesWith (Line (v3,v4), vIntersection))
		return true;
	if (other.CollidesWith (Line (v4,v1), vIntersection))
		return true;

	return false;
}
Ejemplo n.º 26
0
    void insertPoints(const Point* points_begin, const Point* points_end) {
        const auto pointCount = points_end - points_begin;

        pointRegion.alloc(pointCount);

        const auto quadCount = 1 + (pointCount / Quad::MAX_LEAF_POINTS + 1) * 4;
        quadRegion.alloc(quadCount);
        quad = quadRegion.next();
        quad->init(0);

        auto my_points = pointRegion.next();
        memcpy(my_points, points_begin, pointCount * sizeof(Point));

        quad->insertPoints(quadRegion, my_points, my_points + pointCount);
    }
Ejemplo n.º 27
0
void
Port::frameRect(const Quad& quad, Color rgba) {
	PortImpl& port = static_cast<PortImpl&>(*this); // get us access to our private data
	if (quad.getBounds().intersection(port.drawableRect()).empty()) return; // exit early if completely clipped
	port.setOpenGLModesForDrawing((rgba.alpha < 1.0f));  // sets up clip rect too

	glColor4f ( (float) rgba.red, rgba.green, rgba.blue, rgba.alpha);

	glBegin(GL_LINE_LOOP);
	glVertex2f( quad.points[lftBot].x, quad.points[lftBot].y );
	glVertex2f( quad.points[rgtBot].x, quad.points[rgtBot].y );
	glVertex2f( quad.points[rgtTop].x, quad.points[rgtTop].y );
	glVertex2f( quad.points[lftTop].x, quad.points[lftTop].y );
	glEnd();

/*	for some reason this mode generates a lot of flicker... possibly because it is drawing directly to the screen and not to the back buffer?
	GLshort thePoints[] = {
			rect.left, rect.top, // origin of the line
			rect.right, rect.top, // next line segment
			rect.right, rect.bottom, // next line segment
			rect.left, rect.bottom  // next line segment and back to first
	};
	glVertexPointer(2, GL_SHORT, 0, thePoints);
	glDrawArrays(GL_LINE_LOOP, 0, 4);
 */
	port.mNeedRedraw = true;
	gPortDirty = true;
}
Ejemplo n.º 28
0
BorderImageLengthBox CSSToStyleMap::mapNinePieceImageQuad(CSSValue* value) const
{
    if (!value || !value->isPrimitiveValue())
        return BorderImageLengthBox(Length(Auto));

    float zoom = useSVGZoomRules() ? 1.0f : cssToLengthConversionData().zoom();
    Quad* slices = toCSSPrimitiveValue(value)->getQuadValue();

    // Set up a border image length box to represent our image slices.
    const CSSToLengthConversionData& conversionData = cssToLengthConversionData().copyWithAdjustedZoom(zoom);
    return BorderImageLengthBox(
        toBorderImageLength(*slices->top(), conversionData),
        toBorderImageLength(*slices->right(), conversionData),
        toBorderImageLength(*slices->bottom(), conversionData),
        toBorderImageLength(*slices->left(), conversionData));
}
Ejemplo n.º 29
0
void init(){
    ///--- Sets background color
    glClearColor(/*gray*/ .937,.937,.937, /*solid*/1.0 );
    
    triangle.init();
    quad.init();
}
Ejemplo n.º 30
0
void MapWindow::on_actionQuad_triggered()
{
  Quad *q = new Quad();
  q->setName(QString("Quad %1").arg(quadList->size()+1));
  quadList->append(q);

  new QListWidgetItem(quadList->last()->getName(), ui->listWidget);
  ui->listWidget->item(ui->listWidget->count() - 1)->setFlags(ui->listWidget->item(ui->listWidget->count()-1)->flags() | Qt::ItemIsEditable);
  on_clearSelectionButton_clicked();
//  on_listWidget_currentItemChanged(ui->listWidget->currentItem(), ui->listWidget->item(ui->listWidget->count()-1));
  ui->listWidget->item(ui->listWidget->count() - 1)->setSelected(true);
  q->setSelected(true);
  ui->widget->setFocus();

  emit updateAllDisplays();
}