C++ (Qt)inline QVector2D CameraPoint2Screen( const QVector3D & src, float scale, bool perspectiveFlag ){ return src * (scale / (perspectiveFlag ? -src.z() : 1.0f));}
C++ (Qt)void GeometryEngine::PrintVertices(const QMatrix4x4 & mvp , const QMatrix4x4 &viewport){ int count = sizeof(vertices) / sizeof(vertices[0]); for (int i = 0; i < count; ++i) { QVector4D ver(vertices[i].position, 1.0f); ver = mvp * ver; ver /= ver.w();// ver = viewport * ver; // screen coordinates qDebug() << i << ver; } qDebug() << "end";}