当前位置: 首页>>代码示例>>C++>>正文


C++ GLC_Matrix4x4::setMatScaling方法代码示例

本文整理汇总了C++中GLC_Matrix4x4::setMatScaling方法的典型用法代码示例。如果您正苦于以下问题:C++ GLC_Matrix4x4::setMatScaling方法的具体用法?C++ GLC_Matrix4x4::setMatScaling怎么用?C++ GLC_Matrix4x4::setMatScaling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLC_Matrix4x4的用法示例。


在下文中一共展示了GLC_Matrix4x4::setMatScaling方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getTransformationMatrix

////////////////////////////////////////////////////////////////////////////////
/// @brief
////////////////////////////////////////////////////////////////////////////////
GLC_Matrix4x4 SchematicsRenderingManager::getTransformationMatrix(Object* element) {
	//Calculate scale
	double scale = element->getVariable("scale");
	if (scale <= 0.0) {
		//if (firstRecursive) { //Use default scale for firstmost object
			scale = schematics_editor->getCurrentSheet()->getVariable("sheet.scale");
			if (scale <= 0.0) scale = 1.0;
		//} else { //No scaling change
			//scale = 1.0;
		//}
	}

	//Get state vector
	EVDS_STATE_VECTOR vector;
	EVDS_Object_GetStateVector(element->getEVDSObject(),&vector);

	//Calculate transformation
	GLC_Matrix4x4 scaling;
	GLC_Matrix4x4 transformation;
	EVDS_MATRIX rotationMatrix;
	EVDS_Quaternion_ToMatrix(&vector.orientation,rotationMatrix);
	scaling.setMatScaling(1/scale,1/scale,1/scale);

	transformation = transformation*GLC_Matrix4x4(vector.position.x,vector.position.y,vector.position.z);
	transformation = transformation*GLC_Matrix4x4(rotationMatrix);
	if (element->getParent() && (element->getParent()->getType() != "foxworks.schematics.sheet")) {
		transformation = transformation*getTransformationMatrix(element->getParent());
	} else {
		transformation = transformation*scaling; //First operation is scaling
	}
	return transformation;
}
开发者ID:shevav,项目名称:FWE,代码行数:35,代码来源:fwe_schematics_renderer.cpp

示例2: moveManipulatorRep

void GLC_CuttingPlane::moveManipulatorRep(const GLC_Point3d& pos)
{
	// Create the widget rotation matrix
	const GLC_Matrix4x4 rotationMatrix(m_CompMatrix.rotationMatrix());

	const GLC_Matrix4x4 translationMatrix(pos);
	const GLC_Matrix4x4 offsetMatrix(m_Normal * m_ManipulatorOffsetFactor);
	GLC_Matrix4x4 scaleMatrix;
	scaleMatrix.setMatScaling(m_ScaleFactor, m_ScaleFactor, m_ScaleFactor);
	GLC_3DWidget::instanceHandle(1)->setMatrix(offsetMatrix * translationMatrix * rotationMatrix *scaleMatrix);

	// Rotation manipulator
	QVector<GLC_Matrix4x4> rotations(3);
	rotations[0].setMatRot(glc::Y_AXIS, glc::PI / 2.0); // X
	rotations[0]= GLC_Matrix4x4(glc::X_AXIS, -glc::PI / 2.0) * rotations[0];
	rotations[1].setMatRot(glc::X_AXIS, -glc::PI / 2.0); // Y
	// Z
	for (int i= 0; i < 3; ++i)
	{
		GLC_3DWidget::instanceHandle(2 + i)->setMatrix(offsetMatrix * translationMatrix * rotationMatrix * rotations.at(i) * scaleMatrix);
	}

	GLC_Arrow* pArrow= dynamic_cast<GLC_Arrow*>(GLC_3DWidget::instanceHandle(1)->geomAt(0));
	Q_ASSERT(NULL != pArrow);

	pArrow->setViewDir(rotationMatrix * GLC_3DWidget::widgetManagerHandle()->cameraHandle()->forward().normalize());
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:27,代码来源:glc_cuttingplane.cpp

示例3: renderText

void GLC_Viewport::renderText(const GLC_Point3d& point, const QString &text, const QColor &color, const QFont &font)
{
    m_TextRenderingCollection.clear();
    if (!text.isEmpty())
    {
        QFontMetrics fontMetrics(font);
        const double width= fontMetrics.width(text);
        const double height= fontMetrics.height();

        // Compute the ratio betwwen screen and world
        const GLC_Matrix4x4 invertedViewMatrix(GLC_Context::current()->modelViewMatrix().rotationMatrix().invert());
        const GLC_Vector2d projectedPoint1(project(point, false));
        const GLC_Vector3d vector(invertedViewMatrix * GLC_Vector3d(0.0, height, 0.0));
        const GLC_Vector2d projectedPoint2(project((point + vector), false));
        const double ratio= height / (projectedPoint2 - projectedPoint1).length();

        QPixmap pixmap(width, height);
        pixmap.fill(Qt::transparent);
        QPainter painter;

        painter.begin(&pixmap);
        painter.setRenderHints(QPainter::HighQualityAntialiasing | QPainter::TextAntialiasing);
        painter.setFont(font);
        painter.setPen(color);
        painter.drawText(0, fontMetrics.ascent(), text);
        painter.end();

        QImage image= pixmap.toImage();

        GLC_Texture *pTexture= new GLC_Texture(image);
        GLC_Material* pMaterial= new GLC_Material(Qt::black);
        pMaterial->setTexture(pTexture);
        pMaterial->setOpacity(0.99);

        GLC_3DViewInstance rectangle= GLC_Factory::instance()->createRectangle(width, height);

        GLC_Matrix4x4 scaleMatrix;
        scaleMatrix.setMatScaling(ratio, ratio, ratio);
        rectangle.setMatrix(scaleMatrix);
        rectangle.multMatrix(invertedViewMatrix);
        rectangle.multMatrix(GLC_Matrix4x4(point));
        rectangle.geomAt(0)->addMaterial(pMaterial);
        m_TextRenderingCollection.add(rectangle);

        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
        glDisable(GL_DEPTH_TEST);
        m_TextRenderingCollection.render(0, glc::TransparentRenderFlag);
        glEnable(GL_DEPTH_TEST);
        glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
        m_TextRenderingCollection.clear();
    }
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:52,代码来源:glc_viewport.cpp

示例4: gluPickMatrix

void glc::gluPickMatrix(GLdouble x, GLdouble y, GLdouble deltax, GLdouble deltay,
		  GLint viewport[4])
{
    if (deltax <= 0 || deltay <= 0) { 
	return;
    }

    /* Translate and scale the picked region to the entire window */
    GLC_Matrix4x4 translate;
    translate.setMatTranslate((viewport[2] - 2 * (x - viewport[0])) / deltax, (viewport[3] - 2 * (y - viewport[1])) / deltay, 0.0);

    GLC_Matrix4x4 scaling;
    scaling.setMatScaling(viewport[2] / deltax, viewport[3] / deltay, 0.0);
    GLC_ContextManager::instance()->currentContext()->glcMultMatrix(translate * scaling);
}
开发者ID:JasonWinston,项目名称:GLC_lib,代码行数:15,代码来源:glc_project.cpp

示例5: glcScaled

void GLC_Context::glcScaled(double x, double y, double z)
{
	GLC_Matrix4x4 scale;
	scale.setMatScaling(x, y, z);
	glcMultMatrix(scale);
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:6,代码来源:glc_context.cpp


注:本文中的GLC_Matrix4x4::setMatScaling方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。