Beispiel #1
0
bool StGLWidget::isPointIn(const StPointD_t& thePointZo) const {
    const StRectD_t aRectGl = getRectGl();
    StPointD_t aPointGl = getPointGl(thePointZo);
    return aPointGl.x() > aRectGl.left()
        && aPointGl.x() < aRectGl.right()
        && aPointGl.y() > aRectGl.bottom()
        && aPointGl.y() < aRectGl.top();
}
Beispiel #2
0
StString StGLProjCamera::toString() const {
    StRectD_t aSect; getZParams(aSect);
    return StString("ProjCamera, FOV= ") + myFOVy
       + ";\n Z-Near=   " + myFrustM.zNear
       + "; Z-Screen= "   + myZScreen
       + "; Z-Far=    "   + myFrustM.zFar
       + "; IOD= "    + myIOD
       + ";\nscr L= " + aSect.left()
       + "; R= "      + aSect.right()
       + "; B= "      + aSect.bottom()
       + "; T= "      + aSect.top();
}
Beispiel #3
0
StRectD_t StGLRootWidget::getRectGl(const StRectI_t& theRectPx) const {
    StRectD_t aRectGl;
    aRectGl.left()   = myRectGl.left() + myScaleGlX * theRectPx.left();
    aRectGl.right()  =  aRectGl.left() + myScaleGlX * theRectPx.width();
    aRectGl.top()    = myRectGl.top()  - myScaleGlY * theRectPx.top();
    aRectGl.bottom() =  aRectGl.top()  - myScaleGlY * theRectPx.height();
    return aRectGl;
}
Beispiel #4
0
void StGLProjCamera::getZParams(const GLdouble theZValue,
                                StRectD_t&     theSectRect) const {
    if(myIsPersp) {
        theSectRect.top() = GLdouble(myZoom) * theZValue * std::tan(ST_DTR_HALF * myFOVy);
    } else {
        // Z-value doesn't change the section
        theSectRect.top() = GLdouble(myZoom) * myFrustM.zNear;/// * std::tan(ST_DTR_HALF * myFOVy);
    }
    theSectRect.bottom() = -theSectRect.top();
    theSectRect.left()   = -myAspect * theSectRect.top();
    theSectRect.right()  = -theSectRect.left();
}
Beispiel #5
0
void StGLRootWidget::getRectGl(const StRectI_t& theRectPx,
                               StArray<StGLVec2>& theVertices,
                               const size_t theFromId) const {
    StRectD_t aRectGl = getRectGl(theRectPx);
    theVertices[theFromId + 0] = StGLVec2(GLfloat(aRectGl.right()), GLfloat(aRectGl.top()));
    theVertices[theFromId + 1] = StGLVec2(GLfloat(aRectGl.right()), GLfloat(aRectGl.bottom()));
    theVertices[theFromId + 2] = StGLVec2(GLfloat(aRectGl.left()),  GLfloat(aRectGl.top()));
    theVertices[theFromId + 3] = StGLVec2(GLfloat(aRectGl.left()),  GLfloat(aRectGl.bottom()));
}
Beispiel #6
0
StPointD_t StGLWidget::getPointIn(const StPointD_t& thePointZo) const {
    const StRectD_t aRectGl = getRectGl();
    StPointD_t aPointGl = getPointGl(thePointZo);
    return StPointD_t((aPointGl.x() - aRectGl.left()) / (aRectGl.right() - aRectGl.left()),
                      (aRectGl.top() - aPointGl.y())  / (aRectGl.top() - aRectGl.bottom()));
}