本文整理汇总了C++中QMatrix4x4类的典型用法代码示例。如果您正苦于以下问题:C++ QMatrix4x4类的具体用法?C++ QMatrix4x4怎么用?C++ QMatrix4x4使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMatrix4x4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeOpenGLFunctions
void Tutorial05::initializeGL()
{
// initialize OpenGL
initializeOpenGLFunctions();
// Dark blue background
glClearColor(0.0f, 0.0f, 0.3f, 0.0f);
// Enable depth test
glEnable(GL_DEPTH_TEST);
// Accept fragment if it closer to the camera than the former one
glDepthFunc(GL_LESS);
bool success;
// load and compile vertex shader
success = shaderProgram.addShaderFromSourceFile(QOpenGLShader::Vertex,
":/TransformVertexShader.vert");
// load and compile fragment shader
success = shaderProgram.addShaderFromSourceFile(QOpenGLShader::Fragment,
":/TextureFragmentShader.frag");
programID = shaderProgram.programId();
// Projection matrix : 45° Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
QMatrix4x4 projection;
projection.perspective(45.0, 4.0/3.0, 0.1, 100.0);
// Camera matrix
QMatrix4x4 view;
view.lookAt( QVector3D(4,3,3), // Camera is at (4,3,3), in World Space
QVector3D(0,0,0), // and looks at the origin
QVector3D(0,1,0) // Head is up (set to 0,-1,0 to look upside-down)
);
// Model matrix : an identity matrix (model will be at the origin)
QMatrix4x4 model;
model.setToIdentity();
// Our ModelViewProjection : multiplication of our 3 matrices
MVP = projection * view * model; // Remember, matrix multiplication is the other way around
shaderProgram.link();
// Get a handle for our "MVP" uniform
MatrixID = glGetUniformLocation(programID, "MVP");
// Get a handle for our buffers
vertexPosition_modelspaceID = glGetAttribLocation(programID, "vertexPosition_modelspace");
vertexUVID = glGetAttribLocation(programID, "vertexUV");
// Load the texture Qt methods
QImage image = QImage(":/uvtemplate.bmp").mirrored();
mTexture = new QOpenGLTexture(image);
mTexture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
mTexture->setMagnificationFilter(QOpenGLTexture::Linear);
shaderProgram.setUniformValue("myTextureSampler", 0);
//enable texturing
glEnable(GL_TEXTURE_2D);
//generate textures
//bind the texture
mTexture->bind();
// ... nice trilinear filtering.
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
//glGenerateMipmap(GL_TEXTURE_2D);
glGenBuffers(1, &vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
glGenBuffers(1, &uvbuffer);
glBindBuffer(GL_ARRAY_BUFFER, uvbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_uv_buffer_data), g_uv_buffer_data, GL_STATIC_DRAW);
}
示例2: transform
void tst_QVectorArray::transform()
{
QMatrix4x4 m;
m.translate(-1.0f, 2.5f, 5.0f);
m.rotate(45.0f, 1.0f, 1.0f, 1.0f);
m.scale(23.5f);
QVector2DArray v2array;
QVector3DArray v3array;
QVector4DArray v4array;
QVector2DArray v2arrayb;
QVector3DArray v3arrayb;
QVector4DArray v4arrayb;
for (int index = 0; index < 64; ++index) {
v2array.append(index * 4, index * 4 + 1);
v3array.append(index * 4, index * 4 + 1, index * 4 + 2);
v4array.append(index * 4, index * 4 + 1, index * 4 + 2,
index * 4 + 3);
v2arrayb.append(index * 4, index * 4 + 1);
v3arrayb.append(index * 4, index * 4 + 1, index * 4 + 2);
v4arrayb.append(index * 4, index * 4 + 1, index * 4 + 2,
index * 4 + 3);
}
// Perform a simple in-place transform.
v2array.transform(m);
v3array.transform(m);
v4array.transform(m);
QCOMPARE(v2array.size(), 64);
QCOMPARE(v3array.size(), 64);
QCOMPARE(v4array.size(), 64);
for (int index = 0; index < 64; ++index) {
QVector2D v2(index * 4, index * 4 + 1);
QVector3D v3(index * 4, index * 4 + 1, index * 4 + 2);
QVector4D v4(index * 4, index * 4 + 1, index * 4 + 2, index * 4 + 3);
QVERIFY(fuzzyCompare(v2array[index], (m * QVector3D(v2)).toVector2D()));
QVERIFY(fuzzyCompare(v3array[index], m * v3));
QVERIFY(fuzzyCompare(v4array[index], m * v4));
}
// Increase ref-count on an array and check that detach occurs.
v2array = v2arrayb;
v3array = v3arrayb;
v4array = v4arrayb;
QVERIFY(v2array.constData() == v2arrayb.constData());
QVERIFY(v3array.constData() == v3arrayb.constData());
QVERIFY(v4array.constData() == v4arrayb.constData());
v2array.transform(m);
v3array.transform(m);
v4array.transform(m);
QVERIFY(v2array.constData() != v2arrayb.constData());
QVERIFY(v3array.constData() != v3arrayb.constData());
QVERIFY(v4array.constData() != v4arrayb.constData());
QCOMPARE(v2array.size(), 64);
QCOMPARE(v3array.size(), 64);
QCOMPARE(v4array.size(), 64);
for (int index = 0; index < 64; ++index) {
QVector2D v2(index * 4, index * 4 + 1);
QVector3D v3(index * 4, index * 4 + 1, index * 4 + 2);
QVector4D v4(index * 4, index * 4 + 1, index * 4 + 2, index * 4 + 3);
QVERIFY(fuzzyCompare(v2array[index], (m * QVector3D(v2)).toVector2D()));
QVERIFY(fuzzyCompare(v3array[index], m * v3));
QVERIFY(fuzzyCompare(v4array[index], m * v4));
QVERIFY(fuzzyCompare(v2arrayb[index], v2));
QVERIFY(fuzzyCompare(v3arrayb[index], v3));
QVERIFY(fuzzyCompare(v4arrayb[index], v4));
}
// Perform the test again, with translated() this time.
v2array = v2arrayb.transformed(m);
v3array = v3arrayb.transformed(m);
v4array = v4arrayb.transformed(m);
QCOMPARE(v2array.size(), 64);
QCOMPARE(v3array.size(), 64);
QCOMPARE(v4array.size(), 64);
for (int index = 0; index < 64; ++index) {
QVector2D v2(index * 4, index * 4 + 1);
QVector3D v3(index * 4, index * 4 + 1, index * 4 + 2);
QVector4D v4(index * 4, index * 4 + 1, index * 4 + 2, index * 4 + 3);
QVERIFY(fuzzyCompare(v2array[index], (m * QVector3D(v2)).toVector2D()));
QVERIFY(fuzzyCompare(v3array[index], m * v3));
QVERIFY(fuzzyCompare(v4array[index], m * v4));
QVERIFY(fuzzyCompare(v2arrayb[index], v2));
QVERIFY(fuzzyCompare(v3arrayb[index], v3));
QVERIFY(fuzzyCompare(v4arrayb[index], v4));
}
}
示例3: epoch
void SatGL::RenderTrail(Satellite *sat, QMatrix4x4 projection, float distance, QQuaternion quat, bool trackon) // QMatrix4x4 modelview, bool trackon)
{
QVector<GLfloat> postrail;
double
tsince, // Time since epoch (in minutes)
jul_epoch, // Julian date of epoch
jul_utc; // Julian UTC date
QSgp4Date nowutc = QSgp4Date::NowUTC();
jul_utc = nowutc.Julian();
jul_epoch = Julian_Date_of_Epoch(sat->GetEpoch());
QMatrix4x4 model;
model.translate(0.0, 0.0, distance);
model.rotate(quat);
QMatrix4x4 modelview;
modelview = model;
QMatrix4x4 modelocta;
QColor col(0,255,255);
QEci qeci;
QVector3D pos;
double id;
int nbrVertices = 0;
tsince = (jul_utc - jul_epoch) * MIN_PER_DAY; // in minutes
for( id = tsince - 5; id < tsince; id++ )
{
(*sat).qsgp4->getPosition(id, qeci);
QGeodetic qgeo = qeci.ToGeo();
LonLat2PointRad(qgeo.latitude, qgeo.longitude, &pos, 1.001f);
if(id < tsince && id >= tsince - 5 )
{
modelocta = model;
modelocta.translate(pos.x(), pos.y(), pos.z());
modelocta.scale(0.004f);
octa->render(projection, modelocta, col);
}
}
if(trackon)
{
for( id = tsince - opts.realminutesshown + 1; id <= tsince + opts.realminutesshown; id++ ) // nbr of id's = 2 * opts.realminutesshown
{
(*sat).qsgp4->getPosition(id, qeci);
QGeodetic qgeo = qeci.ToGeo();
LonLat2PointRad(qgeo.latitude, qgeo.longitude, &pos, 1.001f);
postrail.append(pos.x());
postrail.append(pos.y());
postrail.append(pos.z());
}
positionsTrail.bind();
if(tdiff != opts.realminutesshown)
{
tdiff = opts.realminutesshown;
positionsTrail.allocate(postrail.data(), postrail.size() * sizeof(GLfloat));
}
else
{
positionsTrail.write(0, postrail.data(), postrail.size() * sizeof(GLfloat));
}
nbrVertices = positionsTrail.size() / (3 * sizeof(GLfloat));
positionsTrail.release();
QOpenGLVertexArrayObject::Binder vaoBinder(&vaotrail);
program->bind();
program->setUniformValue("MVP", projection * modelview);
QMatrix3x3 norm = modelview.normalMatrix();
program->setUniformValue("NormalMatrix", norm);
QColor rendercolor(opts.sattrackcolor);
program->setUniformValue("outcolor", QVector4D(rendercolor.redF(), rendercolor.greenF(), rendercolor.blueF(), 1.0f));
glDrawArrays(GL_LINE_STRIP, 0, nbrVertices);
}
}
示例4: Renderable3DEntity
bool BrainSurfaceTreeItem::addData(const Surface& tSurface, Qt3DCore::QEntity* parent)
{
//Create renderable 3D entity
m_pParentEntity = parent;
m_pRenderable3DEntity = new Renderable3DEntity(parent);
m_pRenderable3DEntityActivationOverlay = new Renderable3DEntity(parent);
QMatrix4x4 m;
Qt3DCore::QTransform* transform = new Qt3DCore::QTransform();
m.rotate(180, QVector3D(0.0f, 1.0f, 0.0f));
m.rotate(-90, QVector3D(1.0f, 0.0f, 0.0f));
transform->setMatrix(m);
m_pRenderable3DEntity->addComponent(transform);
m_pRenderable3DEntityActivationOverlay->addComponent(transform);
//Create color from curvature information with default gyri and sulcus colors
QByteArray arrayCurvatureColor = createCurvatureVertColor(tSurface.curv());
//Set renderable 3D entity mesh and color data
m_pRenderable3DEntity->setMeshData(tSurface.rr(), tSurface.nn(), tSurface.tris(), -tSurface.offset(), arrayCurvatureColor);
//Generate activation overlay surface
// MatrixX3f overlayAdds = tSurface.rr();
// for(int i = 0; i<tSurface.nn().rows(); i++) {
// RowVector3f direction = tSurface.nn().row(i);
// direction.normalize();
// overlayAdds.row(i) = direction*0.0001;
// }
// m_pRenderable3DEntityActivationOverlay->setMeshData(tSurface.rr()+overlayAdds, tSurface.nn(), tSurface.tris(), -tSurface.offset(), matCurvatureColor);
//Add data which is held by this BrainSurfaceTreeItem
QVariant data;
data.setValue(arrayCurvatureColor);
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceCurrentColorVert);
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceCurvatureColorVert);
data.setValue(tSurface.rr());
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceVert);
data.setValue(tSurface.tris());
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceTris);
data.setValue(tSurface.nn());
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceNorm);
data.setValue(tSurface.curv());
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceCurv);
data.setValue(tSurface.offset());
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceOffset);
data.setValue(m_pRenderable3DEntity);
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceRenderable3DEntity);
data.setValue(m_pRenderable3DEntityActivationOverlay);
this->setData(data, BrainSurfaceTreeItemRoles::SurfaceRenderable3DEntityAcivationOverlay);
//Add surface meta information as item children
m_pItemSurfColorInfoOrigin = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceColorInfoOrigin, "Color from curvature");
connect(m_pItemSurfColorInfoOrigin, &BrainTreeMetaItem::colorInfoOriginChanged,
this, &BrainSurfaceTreeItem::onColorInfoOriginOrCurvColorChanged);
*this<<m_pItemSurfColorInfoOrigin;
data.setValue(QString("Color from curvature"));
m_pItemSurfColorInfoOrigin->setData(data, BrainTreeMetaItemRoles::SurfaceColorInfoOrigin);
m_pItemSurfColSulci = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceColorSulci, "Sulci color");
connect(m_pItemSurfColSulci, &BrainTreeMetaItem::curvColorsChanged,
this, &BrainSurfaceTreeItem::onColorInfoOriginOrCurvColorChanged);
*this<<m_pItemSurfColSulci;
data.setValue(QColor(50,50,50));
m_pItemSurfColSulci->setData(data, BrainTreeMetaItemRoles::SurfaceColorSulci);
m_pItemSurfColSulci->setData(data, Qt::DecorationRole);
m_pItemSurfColGyri = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceColorGyri, "Gyri color");
connect(m_pItemSurfColGyri, &BrainTreeMetaItem::curvColorsChanged,
this, &BrainSurfaceTreeItem::onColorInfoOriginOrCurvColorChanged);
*this<<m_pItemSurfColGyri;
data.setValue(QColor(125,125,125));
m_pItemSurfColGyri->setData(data, BrainTreeMetaItemRoles::SurfaceColorGyri);
m_pItemSurfColGyri->setData(data, Qt::DecorationRole);
BrainTreeMetaItem *itemSurfFileName = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceFileName, tSurface.fileName());
itemSurfFileName->setEditable(false);
*this<<itemSurfFileName;
data.setValue(tSurface.fileName());
itemSurfFileName->setData(data, BrainTreeMetaItemRoles::SurfaceFileName);
BrainTreeMetaItem *itemSurfType = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceType, tSurface.surf());
itemSurfType->setEditable(false);
*this<<itemSurfType;
data.setValue(tSurface.surf());
itemSurfType->setData(data, BrainTreeMetaItemRoles::SurfaceType);
BrainTreeMetaItem *itemSurfPath = new BrainTreeMetaItem(BrainTreeMetaItemTypes::SurfaceFilePath, tSurface.filePath());
itemSurfPath->setEditable(false);
*this<<itemSurfPath;
data.setValue(tSurface.filePath());
//.........这里部分代码省略.........
示例5: glEnable
void TApplication::RenderToFBO() {
Fbo->bind();
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
Shader.bind();
glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
QMatrix4x4 view;
view.lookAt(QVector3D(0.0, 0.0, 6.0), QVector3D(0.0, 0.0, 0.0), QVector3D(0.0, 1.0, 0.0));
QMatrix4x4 projection;
projection.perspective(45.0f, float(WINDOW_WIDTH) / float(WINDOW_HEIGHT), 0.1f, 10.0f);
Shader.setUniformValue("projection", projection);
Shader.setUniformValue("view", view);
Shader.setUniformValue("lightIntensities", QVector3D(1.0, 1.0, 1.0));
Shader.setUniformValue("lightPosition", QVector3D(-30.0, 30.0, 30.0));
QMatrix4x4 model;
model.translate(0, 0, 0.0);
model.rotate(AngleX, 1.0, 0.0, 0.0);
model.rotate(AngleY, 0.0, 1.0, 0.0);
model.rotate(AngleZ, 0.0, 0.0, 1.0);
model.scale(0.42);
QMatrix3x3 normalMatrix = model.normalMatrix();
Shader.setUniformValue("model", model);
Shader.setUniformValue("normalMatrix", normalMatrix);
VertexBuff->bind();
GLint attribute;
GLint offset = 0;
attribute = Shader.attributeLocation("gl_Vertex");
Shader.enableAttributeArray(attribute);
Shader.setAttributeBuffer(attribute, GL_FLOAT, offset, 3, sizeof(TVertex));
offset += sizeof(QVector3D);
attribute = Shader.attributeLocation("gl_Normal");
Shader.enableAttributeArray(attribute);
Shader.setAttributeBuffer(attribute, GL_FLOAT, offset, 3, sizeof(TVertex));
offset += sizeof(QVector3D);
attribute = Shader.attributeLocation("vertTexCoord");
Shader.enableAttributeArray(attribute);
Shader.setAttributeBuffer(attribute, GL_FLOAT, offset, 2, sizeof(TVertex));
offset += sizeof(QVector2D);
attribute = Shader.attributeLocation("tangent");
Shader.enableAttributeArray(attribute);
Shader.setAttributeBuffer(attribute, GL_FLOAT, offset, 3, sizeof(TVertex));
offset += sizeof(QVector3D);
attribute = Shader.attributeLocation("bitangent");
Shader.enableAttributeArray(attribute);
Shader.setAttributeBuffer(attribute, GL_FLOAT, offset, 3, sizeof(TVertex));
offset += sizeof(QVector3D);
VertexBuff->release();
Texture->bind(0, QOpenGLTexture::ResetTextureUnit);
Shader.setUniformValue("texture", 0);
NormalMap->bind(1, QOpenGLTexture::ResetTextureUnit);
Shader.setUniformValue("normalMap", 1);
glDrawArrays(GL_TRIANGLES, 0, 3 * ObjectSize);
Shader.disableAttributeArray("gl_Vertex");
Shader.disableAttributeArray("gl_Normal");
Shader.disableAttributeArray("vertTexCoord");
Shader.disableAttributeArray("tangent");
Shader.disableAttributeArray("bitangent");
Texture->release(0, QOpenGLTexture::ResetTextureUnit);
NormalMap->release(1, QOpenGLTexture::ResetTextureUnit);
Shader.disableAttributeArray("coord2d");
Shader.disableAttributeArray("v_color");
Shader.release();
/*
/// DEBUG INFO
QMatrix4x4 modelView = view * model;
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(projection.data());
//.........这里部分代码省略.........
示例6: QVector3D
void GLWidget::paintMesh()
{
QMatrix4x4 mMatrix;
QMatrix4x4 vMatrix;
QMatrix4x4 cameraTransformation;
cameraTransformation.rotate(alpha, 0, 1, 0);
cameraTransformation.rotate(beta, 1, 0, 0);
QVector3D cameraPosition = cameraTransformation * QVector3D(0, 0, distance);
QVector3D cameraUpDirection = cameraTransformation * QVector3D(0, 1, 0);
vMatrix.lookAt(cameraPosition, lastCenterPosition, cameraUpDirection);
mMatrix.setToIdentity();
QMatrix4x4 mvMatrix;
mvMatrix = vMatrix * mMatrix;
QMatrix3x3 normalMatrix;
normalMatrix = mvMatrix.normalMatrix();
QMatrix4x4 lightTransformation;
lightTransformation.rotate(lightAngle, 0, 1, 0);
QVector3D lightPosition = lightTransformation * QVector3D(0, 10, 10);
shaderProgram.bind();
shaderProgram.setUniformValue("mvpMatrix", pMatrix * mvMatrix);
shaderProgram.setUniformValue("mvMatrix", mvMatrix);
shaderProgram.setUniformValue("normalMatrix", normalMatrix);
shaderProgram.setUniformValue("lightPosition", vMatrix * lightPosition);
shaderProgram.setUniformValue("ambientColor", QColor(32, 32, 32));
shaderProgram.setUniformValue("diffuseColor", QColor(128, 128, 128));
shaderProgram.setUniformValue("specularColor", QColor(255, 255, 255));
shaderProgram.setUniformValue("ambientReflection", (GLfloat) 1.0);
shaderProgram.setUniformValue("diffuseReflection", (GLfloat) 1.0);
shaderProgram.setUniformValue("specularReflection", (GLfloat) 1.0);
shaderProgram.setUniformValue("shininess", (GLfloat) 100.0);
glPointSize(INITIAL_POINT_SIZE);
renderGrid();
renderMesh(mode);
shaderProgram.release();
mMatrix.setToIdentity();
mMatrix.translate(lightPosition);
mMatrix.rotate(lightAngle, 0, 1, 0);
mMatrix.rotate(45, 1, 0, 0);
// mMatrix.scale(0.1);
coloringShaderProgram.bind();
coloringShaderProgram.setUniformValue("mvpMatrix", pMatrix * vMatrix * mMatrix);
coloringShaderProgram.setAttributeArray("vertex", lightSource.getSpotlightVertices().constData());
coloringShaderProgram.enableAttributeArray("vertex");
coloringShaderProgram.setAttributeArray("color", lightSource.getSpotlightColors().constData());
coloringShaderProgram.enableAttributeArray("color");
glDrawArrays(GL_TRIANGLES, 0, lightSource.getSpotlightVertices().size());
coloringShaderProgram.disableAttributeArray("vertex");
coloringShaderProgram.disableAttributeArray("color");
coloringShaderProgram.release();
}
示例7: TestForSegmentGLerr
bool SegmentListOLCI::TestForSegmentGLerr(int x, int realy, float distance, const QMatrix4x4 &m, bool showallsegments, QString &segmentname)
{
bool isselected = false;
qDebug() << QString("Nbr of segments = %1").arg(segmentlist.count());
QList<Segment*>::iterator segit = segmentlist.begin();
QVector2D winvec1, winvec2, winvecend1, winvecend2, winvecend3, winvecend4;
QVector3D vecZ = m.row(2).toVector3D();
segmentname = "";
while ( segit != segmentlist.end() )
{
if(showallsegments ? true : (*segit)->segmentshow)
{
for(int i = 0; i < (*segit)->winvectorfirst.length()-1; i++)
{
winvecend1.setX((*segit)->winvectorfirst.at(i).x()); winvecend1.setY((*segit)->winvectorfirst.at(i).y());
winvecend2.setX((*segit)->winvectorfirst.at(i+1).x()); winvecend2.setY((*segit)->winvectorfirst.at(i+1).y());
winvecend3.setX((*segit)->winvectorlast.at(i).x()); winvecend3.setY((*segit)->winvectorlast.at(i).y());
winvecend4.setX((*segit)->winvectorlast.at(i+1).x()); winvecend4.setY((*segit)->winvectorlast.at(i+1).y());
// first last
// winvecend1 ------------------------------------ winvecend3
// | p01 | p03
// | |
// | |
// | |
// | |
// | |
// | p02 | p04
// winvecend2 ------------------------------------ winvecend4
//
qreal angle = ArcCos(QVector3D::dotProduct( vecZ, (*segit)->vecvector.at(i)));
//qDebug() << QString("angle = %1").arg(angle * 180.0 / PI);
if (angle < PI/2 + (asin(1/distance)))
{
struct point p01;
p01.x = (int)winvecend1.x();
p01.y = (int)winvecend1.y();
struct point p02;
p02.x = (int)winvecend2.x();
p02.y = (int)winvecend2.y();
struct point p03;
p03.x = (int)winvecend3.x();
p03.y = (int)winvecend3.y();
struct point p04;
p04.x = (int)winvecend4.x();
p04.y = (int)winvecend4.y();
QPoint points[4] = {
QPoint(p01.x, p01.y),
QPoint(p02.x, p02.y),
QPoint(p04.x, p04.y),
QPoint(p03.x, p03.y)
};
int result = pnpoly( 4, points, x, realy);
if (result)
{
if((*segit)->ToggleSelected())
{
qDebug() << QString("segment selected is = %1").arg((*segit)->fileInfo.fileName());
isselected = true;
segmentname = (*segit)->fileInfo.fileName();
qApp->processEvents();
}
break;
}
}
}
}
++segit;
}
return isselected;
}
示例8: WARNM
void RayCastRenderer::render_impl(const QQuaternion & rotation,
const QVector3D & scale,
const QVector3D & translation,
const QQuaternion & /* camera_rotation */,
GLuint /* vbo_positions */,
GLuint /* vbo_colors */,
size_t /* part_cnt */,
const QVector3D & volume_size)
//float peel_depth,
//int detail
{
if (!isDataValid())
{
WARNM("Not rendering because: Failed to create 3D texture for data");
return;
}
// Transformacna model-view matica
QMatrix4x4 mv;
mv.translate(0.0f, 0.0f, -1.0f);
mv.translate(translation);
mv.rotate(rotation);
mv.scale(scale);
// Uprava rozmerov volumetrickych dat, tak aby presne sedeli na jednotkovu kocku
float max_size = std::max(volume_size.x(), std::max(volume_size.y(), volume_size.z()));
mv.scale((volume_size.x() / max_size),
(volume_size.y() / max_size),
(volume_size.z() / max_size));
mv.scale(volume_size.x(), volume_size.y(), volume_size.z());
//mv.scale(volume_size.x() / 2.0f, volume_size.y() / 2.0f, volume_size.z() / 2.0f);
//mv.scale(volume_size.x() / 4.0f, volume_size.y() / 4.0f, volume_size.z() / 4.0f);
//mv.scale(volume_size.x() / 8.0f, volume_size.y() / 8.0f, volume_size.z() / 8.0f);
// nabindovanie textur, geometrie, povolenie cullingu, depth testovania a HW blendingu (robi sa v shaderi)
OGLF->glActiveTexture(GL_TEXTURE0);
OGLF->glBindTexture(GL_TEXTURE_1D, m_transfer_func.textureId());
OGLF->glActiveTexture(GL_TEXTURE1);
OGLF->glBindTexture(GL_TEXTURE_2D, m_color_attach);
OGLF->glActiveTexture(GL_TEXTURE2);
OGLF->glBindTexture(GL_TEXTURE_3D, m_data.textureId());
m_vao.bind();
OGLF->glEnable(GL_DEPTH_TEST);
OGLF->glDepthMask(GL_FALSE);
OGLF->glEnable(GL_CULL_FACE);
// blending je potreba povolit, aby neboli casti ciar z bounding box-u prekryte
// farbou vzduchu vo volumetrickych datach
OGLF->glEnable(GL_BLEND);
//OGLF->glDisable(GL_BLEND);
// Kreslenie sceny do framebufferu (vygenerovanie exit pointov)s
OGLF->glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
OGLF->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
OGLF->glCullFace(GL_FRONT);
m_prog_gen_back_faces.bind();
m_prog_gen_back_faces.setUniformValue("mvp", m_proj * mv);
OGLF->glDrawElements(GL_TRIANGLES, g_cube_indices_cnt, GL_UNSIGNED_INT, nullptr);
// Ray-casting
OGLF->glBindFramebuffer(GL_FRAMEBUFFER, m_default_fbo);
// Toto uz netreba, pretoze defaultny frame buffer clearuje base class
// a pripadne este aj kresli bounding box ak treba
//OGLF->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
OGLF->glCullFace(GL_BACK);
int detail = 1000; //5000;
float default_step = 1.0f / max_size;
float step;
if (detail <= 0)
step = default_step;
else
step = 1.0f / float(detail);
//qDebug() << "step=" << step << ", default_step=" << default_step << ", correction factor=" << (step / default_step);
m_prog_ray_cast.bind();
m_prog_ray_cast.setUniformValue("mvp", m_proj * mv);
m_prog_ray_cast.setUniformValue("step", step);
//m_prog_ray_cast.setUniformValue("offset", peel_depth);
m_prog_ray_cast.setUniformValue("offset", 0.0f);
m_prog_ray_cast.setUniformValue("alpha_correction_factor", step / default_step);
m_prog_ray_cast.setUniformValue("tex_transfer_func", 0);
m_prog_ray_cast.setUniformValue("tex_back_faces", 1);
m_prog_ray_cast.setUniformValue("tex_volume_data", 2);
//m_prog_ray_cast.setUniformValue("use_tf", m_use_transfer_func);
if (m_use_lighting && m_use_transfer_func)
{
m_prog_ray_cast.setUniformValue("method", 1);
m_prog_ray_cast.setUniformValue("La", m_light_ambient_col);
m_prog_ray_cast.setUniformValue("Ld", m_light_diffuse_col);
m_prog_ray_cast.setUniformValue("light_pos", m_light_pos);
}
//.........这里部分代码省略.........
示例9: devicePixelRatio
void TriangleWindow::render()
{
const qreal retinaScale = devicePixelRatio();
glViewport(0, 0, width() * retinaScale, height() * retinaScale);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
m_program->bind();
QMatrix4x4 matrix;
matrix.perspective(60.0f, 1.0 * _width/_height, 0.1f, 300.0f);
matrix.translate(_camX, _camY, _camZ);
matrix.rotate(20, 1, 0, 0);
matrix.rotate(_angle, 0, 1, 0);
matrix.translate(-70, 0, -60);
m_program->setUniformValue(m_matrixUniform, matrix);
vao.bind();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture->textureId());
glDrawArrays(GL_TRIANGLES, 0, _map.size());
vao.release();
m_program->release();
if(allSeasons[currentSeason] == "WINTER")
{
_fall->setPointSize(4.0);
_fall->setFaster(0.0);
_fall->setPointColor(QVector4D(0.9, 0.9, 0.9, 0.0));
}
else if(allSeasons[currentSeason] == "AUTUMN")
{
_fall->setPointSize(1.0);
_fall->setFaster(1.0);
_fall->setPointColor(QVector4D(0.0, 0.9, 0.9, 0.5));
}
else
return;
particuleShader->bind();
particuleShader->setUniformValue(particuleMatrixUniform, matrix);
particuleShader->setUniformValue(particulePointSize, _fall->getPointSize());
particuleShader->setUniformValue(particulePointColor, _fall->getPointColor());
fallVao.bind();
fallVbo.bind();
size_t fallSize = _fall->getParticules().size()*sizeof(QVector3D);
fallVbo.write(0, _fall->getParticules().constData(), fallSize);
glDrawArrays(GL_POINTS, 0, _fall->getParticules().size());
fallVao.release();
particuleShader->release();
++m_frame;
}
示例10: ShowWinvec
void SegmentListOLCI::ShowWinvec(QPainter *painter, float distance, const QMatrix4x4 modelview)
{
QList<Segment*>::iterator segit = segmentlist.begin();
QVector2D winvecend1, winvecend2, winvecend3, winvecend4;
QVector3D vecZ = modelview.row(2).toVector3D();
// static GLfloat mat[16];
// const float *data = modelview.constData();
// for (int index = 0; index < 16; ++index)
// mat[index] = data[index];
//modelview.inverted( &ok );
while ( segit != segmentlist.end() )
{
if( (*segit)->segmentshow)
{
for(int i = 0; i < (*segit)->winvectorfirst.length()-1; i++)
{
winvecend1.setX((*segit)->winvectorfirst.at(i).x()); winvecend1.setY((*segit)->winvectorfirst.at(i).y());
winvecend2.setX((*segit)->winvectorfirst.at(i+1).x()); winvecend2.setY((*segit)->winvectorfirst.at(i+1).y());
winvecend3.setX((*segit)->winvectorlast.at(i).x()); winvecend3.setY((*segit)->winvectorlast.at(i).y());
winvecend4.setX((*segit)->winvectorlast.at(i+1).x()); winvecend4.setY((*segit)->winvectorlast.at(i+1).y());
//qDebug() << "winvec1 x = " << winvec1.x() << " y = " << winvec1.y();
// first last
// winvecend1 ------------------------------------ winvecend3
// | p01 | p03
// | |
// | |
// | |
// | |
// | |
// | p02 | p04
// winvecend2 ------------------------------------ winvecend4
//
qreal angle = ArcCos(QVector3D::dotProduct( vecZ, (*segit)->vecvector.at(i)));
if (angle < PI/2) // + (asin(1/distance)))
{
painter->drawLine((int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y(), (int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y() );
painter->drawLine((int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y(), (int)winvecend2.x(), (painter->device())->height() - (int)winvecend2.y() );
painter->drawLine((int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y(), (int)winvecend4.x(), (painter->device())->height() - (int)winvecend4.y() );
// painter->drawLine((int)winvec1.x(), (painter->device())->height() - (int)winvec1.y(), (int)winvecend1.x(), (painter->device())->height() - (int)winvecend1.y() );
// painter->drawLine((int)winvec2.x(), (painter->device())->height() - (int)winvec2.y(), (int)winvecend2.x(), (painter->device())->height() - (int)winvecend2.y() );
// painter->drawLine((int)winvec1.x(), (painter->device())->height() - (int)winvec1.y(), (int)winvecend3.x(), (painter->device())->height() - (int)winvecend3.y() );
// painter->drawLine((int)winvec2.x(), (painter->device())->height() - (int)winvec2.y(), (int)winvecend4.x(), (painter->device())->height() - (int)winvecend4.y() );
}
}
}
++segit;
}
}
示例11: logToFile
void Canvas::paintGL()
{
#ifndef NDEBUG
logToFile("Painting started.");
#endif
gl()->glClear(GL_COLOR_BUFFER_BIT);
if (ready())
{
// Calculate the transformMatrix.
double ratio = samplesRecorded/getInfoTable()->getVirtualWidth();
QMatrix4x4 matrix;
matrix.ortho(QRectF(getInfoTable()->getPosition()*ratio, 0, width()*ratio, height()));
gl()->glUseProgram(signalProgram->getGLProgram());
GLuint location = gl()->glGetUniformLocation(signalProgram->getGLProgram(), "transformMatrix");
checkNotErrorCode(location, static_cast<GLuint>(-1), "glGetUniformLocation() failed.");
gl()->glUniformMatrix4fv(location, 1, GL_FALSE, matrix.data());
gl()->glUseProgram(eventProgram->getGLProgram());
location = gl()->glGetUniformLocation(eventProgram->getGLProgram(), "transformMatrix");
checkNotErrorCode(location, static_cast<GLuint>(-1), "glGetUniformLocation() failed.");
gl()->glUniformMatrix4fv(location, 1, GL_FALSE, matrix.data());
location = gl()->glGetUniformLocation(eventProgram->getGLProgram(), "divideBy");
checkNotErrorCode(location, static_cast<GLuint>(-1), "glGetUniformLocation() failed.");
gl()->glUniform1i(location, eventMode);
location = gl()->glGetUniformLocation(eventProgram->getGLProgram(), "eventWidth");
checkNotErrorCode(location, static_cast<GLuint>(-1), "glGetUniformLocation() failed.");
gl()->glUniform1f(location, 0.45*height()/signalProcessor->getTrackCount());
gl()->glUseProgram(rectangleLineProgram->getGLProgram());
location = gl()->glGetUniformLocation(rectangleLineProgram->getGLProgram(), "transformMatrix");
checkNotErrorCode(location, static_cast<GLuint>(-1), "glGetUniformLocation() failed.");
gl()->glUniformMatrix4fv(location, 1, GL_FALSE, matrix.data());
// Create the data block range needed.
int firstSample = static_cast<unsigned int>(floor(getInfoTable()->getPosition()*ratio));
int lastSample = static_cast<unsigned int>(ceil((getInfoTable()->getPosition() + width())*ratio));
auto fromTo = DataFile::sampleRangeToBlockRange(make_pair(firstSample, lastSample), signalProcessor->getBlockSize());
set<int> indexSet;
for (int i = fromTo.first; i <= fromTo.second; ++i)
{
indexSet.insert(i);
}
// Get events.
vector<tuple<int, int, int>> allChannelEvents;
vector<tuple<int, int, int, int>> singleChannelEvents;
currentEventTable()->getEventsForRendering(firstSample, lastSample, &allChannelEvents, &singleChannelEvents);
// Draw.
drawTimeLines();
drawAllChannelEvents(allChannelEvents);
while (indexSet.empty() == false)
{
SignalBlock block = signalProcessor->getAnyBlock(indexSet);
drawSingleChannelEvents(block, singleChannelEvents);
drawSignal(block);
gl()->glFlush();
indexSet.erase(block.getIndex());
//logToFile("Block " << block.getIndex() << " painted.");
}
drawPositionIndicator();
drawCross();
glBindVertexArray(0);
}
gl()->glFinish();
checkGLMessages();
#ifndef NDEBUG
logToFile("Painting finished.");
#endif
}
示例12: spotDirection
/*!
Returns the spotDirection() for this light after transforming it
from world co-ordinates to eye co-ordinates using the top-left
3x3 submatrix within \a transform.
The returned result is suitable to be applied to the GL_SPOT_DIRECTION
property of \c{glLight()}, assuming that the modelview transformation
in the GL context is set to the identity.
\sa eyePosition()
*/
QVector3D QGLLightParameters::eyeSpotDirection
(const QMatrix4x4& transform) const
{
Q_D(const QGLLightParameters);
return transform.mapVector(d->spotDirection);
}
示例13: glClear
//! [3]
void GlWidget::paintGL()
{
//! [3]
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QMatrix4x4 mMatrix;
QMatrix4x4 vMatrix;
QMatrix4x4 cameraTransformation;
cameraTransformation.rotate(alpha, 0, 1, 0);
cameraTransformation.rotate(beta, 1, 0, 0);
QVector3D cameraPosition = cameraTransformation * QVector3D(0, 0, distance);
QVector3D cameraUpDirection = cameraTransformation * QVector3D(0, 1, 0);
vMatrix.lookAt(cameraPosition, QVector3D(0, 0, 0), cameraUpDirection);
mMatrix.setToIdentity();
QMatrix4x4 mvMatrix;
mvMatrix = vMatrix * mMatrix;
QMatrix3x3 normalMatrix;
normalMatrix = mvMatrix.normalMatrix();
QMatrix4x4 lightTransformation;
lightTransformation.rotate(lightAngle, 0, 1, 0);
QVector3D lightPosition = lightTransformation * QVector3D(0, 1, 1);
lightingShaderProgram.bind();
lightingShaderProgram.setUniformValue("mvpMatrix", pMatrix * mvMatrix);
lightingShaderProgram.setUniformValue("mvMatrix", mvMatrix);
lightingShaderProgram.setUniformValue("normalMatrix", normalMatrix);
lightingShaderProgram.setUniformValue("lightPosition", vMatrix * lightPosition);
lightingShaderProgram.setUniformValue("ambientColor", QColor(32, 32, 32));
lightingShaderProgram.setUniformValue("diffuseColor", QColor(128, 128, 128));
lightingShaderProgram.setUniformValue("specularColor", QColor(255, 255, 255));
lightingShaderProgram.setUniformValue("ambientReflection", (GLfloat) 1.0);
lightingShaderProgram.setUniformValue("diffuseReflection", (GLfloat) 1.0);
lightingShaderProgram.setUniformValue("specularReflection", (GLfloat) 1.0);
lightingShaderProgram.setUniformValue("shininess", (GLfloat) 100.0);
lightingShaderProgram.setUniformValue("texture", 0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, cubeTexture);
glActiveTexture(0);
//! [4]
cubeBuffer.bind();
int offset = 0;
lightingShaderProgram.setAttributeBuffer("vertex", GL_FLOAT, offset, 3, 0);
lightingShaderProgram.enableAttributeArray("vertex");
offset += numCubeVertices * 3 * sizeof(GLfloat);
lightingShaderProgram.setAttributeBuffer("normal", GL_FLOAT, offset, 3, 0);
lightingShaderProgram.enableAttributeArray("normal");
offset += numCubeVertices * 3 * sizeof(GLfloat);
lightingShaderProgram.setAttributeBuffer("textureCoordinate", GL_FLOAT, offset, 2, 0);
lightingShaderProgram.enableAttributeArray("textureCoordinate");
cubeBuffer.release();
glDrawArrays(GL_TRIANGLES, 0, numCubeVertices);
//! [4]
lightingShaderProgram.disableAttributeArray("vertex");
lightingShaderProgram.disableAttributeArray("normal");
lightingShaderProgram.disableAttributeArray("textureCoordinate");
lightingShaderProgram.release();
mMatrix.setToIdentity();
mMatrix.translate(lightPosition);
mMatrix.rotate(lightAngle, 0, 1, 0);
mMatrix.rotate(45, 1, 0, 0);
mMatrix.scale(0.1);
coloringShaderProgram.bind();
coloringShaderProgram.setUniformValue("mvpMatrix", pMatrix * vMatrix * mMatrix);
//! [5]
spotlightBuffer.bind();
offset = 0;
coloringShaderProgram.setAttributeBuffer("vertex", GL_FLOAT, offset, 3, 0);
coloringShaderProgram.enableAttributeArray("vertex");
offset += numSpotlightVertices * 3 * sizeof(GLfloat);
coloringShaderProgram.setAttributeBuffer("color", GL_FLOAT, offset, 3, 0);
coloringShaderProgram.enableAttributeArray("color");
spotlightBuffer.release();
glDrawArrays(GL_TRIANGLES, 0, numSpotlightVertices);
//! [5]
coloringShaderProgram.disableAttributeArray("vertex");
coloringShaderProgram.disableAttributeArray("color");
coloringShaderProgram.release();
//.........这里部分代码省略.........
示例14: makeCurrent
void MainWidget::paintGL()
{
makeCurrent();
QPainter painter;
painter.begin(this);
painter.beginNativePainting();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Enable depth buffer
if(bDepthTest)
glEnable(GL_DEPTH_TEST);
QQuaternion quat = this->trackball.rotation();
// Calculate model view transformation
QMatrix4x4 modelviewearth;
modelviewearth.translate(0.0, 0.0, distance);
modelviewearth.rotate(quat);
QMatrix4x4 rotmatrix;
rotmatrix.rotate(quat);
programskybox.bind();
skybox->render(projection, modelviewearth, rotmatrix);
programskybox.release();
if(bWireFrame) // Draw as wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if(bTexture)
{
if(bNoBump)
{
programearthnobump.bind();
textureearth->bind(0);
geometries->render(projection, modelviewearth, bNoBump);
textureearth->release();
programearthnobump.release();
}
else
{
programearth.bind();
textureearth->bind(0);
texturenormal->bind(1);
geometries->render(projection, modelviewearth, bNoBump);
texturenormal->release();
textureearth->release();
programearth.release();
}
}
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if(bBorders)
{
programgshhs.bind();
gshhs->render(projection, modelviewearth);
gshhs->rendersoc(projection, modelviewearth);
programgshhs.release();
}
glDisable(GL_DEPTH_TEST);
painter.endNativePainting();
QString framesPerSecond;
if (const int elapsed = m_time.elapsed()) {
framesPerSecond.setNum(m_frames /(elapsed / 1000.0), 'f', 2);
painter.setPen(Qt::white);
painter.drawText(20, 40, framesPerSecond + " paintGL calls / s");
}
//this->setWindowTitle(framesPerSecond + " paintGL calls / s" );
painter.end();
if (!(m_frames % 100)) {
m_time.start();
m_frames = 0;
}
++m_frames;
}
示例15: devicePixelRatio
void MyGLWidget::draw()
{
#ifdef MOBILE_OS
const qreal retinaScale = devicePixelRatio();
glViewport(0, 0, width() * retinaScale, height() * retinaScale);
glClear(GL_COLOR_BUFFER_BIT);
m_program->bind();
QMatrix4x4 matrix;
matrix.ortho(0.0f,width(), 0.f,height(), -1, 1);
m_program->setUniformValue(m_matrixUniform, matrix);
GLfloat vertices[] = {
0.0f, 0.f,
0.0f, 100.f,
100.0f, 0.0f,
};
GLfloat colors[] = {
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
};
GLfloat texts[] = {
0.0f, 0.f,
0.0f, 1.f,
1.0f, 0.0f
};
auto obj = m_app_seg.get_dsc_obj();
static GLfloat vptr[100000];// = new GLfloat[obj.get_no_faces()*3*2];
static GLfloat cptr[100000];// = new GLfloat[obj.get_no_faces()*3*3];
int idx = 0;
for(auto fkey : obj->faces()){
auto tris = obj->get_pos(fkey);
for(int i = 0; i < 3; i++){
auto v = tris[i];
vptr[idx*6 + i*2 + 0] = v[0];
vptr[idx*6 + i*2 + 1] = v[1];
cptr[idx*9 + i*3 + 0] = v[0]/600.f;
cptr[idx*9 + i*3 + 1] = v[0]/600.f;
cptr[idx*9 + i*3 + 2] = v[0]/600.f;
}
idx ++;
}
// for(int i = 0; i < obj.get_no_faces()*3; i++){
// printf("%f %f %f %f %f\n", vptr[i*2], vptr[i*2 + 1],
// cptr[i*3], cptr[i*3 + 1], cptr[i*3 + 2]);
// }
// glVertexAttribPointer(m_posAttr, 2, GL_FLOAT, GL_FALSE, 0, vptr);
// glVertexAttribPointer(m_colAttr, 3, GL_FLOAT, GL_FALSE, 0, cptr);
// glEnableVertexAttribArray(0);
// glEnableVertexAttribArray(1);
// glDrawArrays(GL_TRIANGLES, 0, obj->get_no_faces()*3);
// glDisableVertexAttribArray(1);
// glDisableVertexAttribArray(0);
static GLfloat edge_v[10000];
GLfloat edge_cl[10000];
int eidx = 0;
for(auto ekey : obj->halfedges()){
auto hew = obj->walker(ekey);
{
Vec2 v0 = obj->get_pos(hew.vertex());
Vec2 v1 = obj->get_pos(hew.opp().vertex());
edge_v[eidx*4] = v0[0];
edge_v[eidx*4 + 1] = v0[1];
edge_v[eidx*4 + 2] = v1[0];
edge_v[eidx*4 + 3] = v1[1];
for(int i = 0; i < 2; i++){
edge_cl[eidx*6 + i*3] = 1.0;
edge_cl[eidx*6 + i*3 + 1] = 0.0;
edge_cl[eidx*6 + i*3 + 2] = 0.0;
}
}
eidx++;
}
//.........这里部分代码省略.........