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


C++ GLFrame::SetOrigin方法代码示例

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


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

示例1: SetUpFrame

void SetUpFrame(GLFrame &frame,const M3DVector3f origin, const M3DVector3f forward, const M3DVector3f up) {
	frame.SetOrigin(origin);
	frame.SetForwardVector(forward);
	M3DVector3f side,oUp;
	m3dCrossProduct3(side,forward,up);
	m3dCrossProduct3(oUp,side,forward);
	frame.SetUpVector(oUp);
	frame.Normalize();
}
开发者ID:mateuszbartczak,项目名称:PPG1,代码行数:9,代码来源:triangle.cpp

示例2: SetUpFrame

void SetUpFrame(GLFrame &cameraFrame,const M3DVector3f origin,
				const M3DVector3f forward,
				const M3DVector3f cameraUpDirection) {
					cameraFrame.SetOrigin(origin);
					cameraFrame.SetForwardVector(forward);
	M3DVector3f side,oUp;
	m3dCrossProduct3(side,forward,cameraUpDirection);
	m3dCrossProduct3(oUp,side,forward);
	cameraFrame.SetUpVector(oUp);
	cameraFrame.Normalize();
};
开发者ID:tbprojects,项目名称:pkg,代码行数:11,代码来源:excercise4.cpp

示例3: draw

void KamehamehaRenderer::draw()
{
    m_kkhStatus->currentIntensity = getCurrentIntensity();

    if (!m_active) {
        return;
    }

    float t = m_ticker.tick();

    m_rctx->modelViewMatrix.PushMatrix();
    {
        float length = getCurrentLength();
        float radius = getCurrentRadius();

        GLFrame f;
        f.SetOrigin(XV3toM3D(m_origin + m_forward * length));
        f.SetForwardVector(XV3toM3D(-m_forward));
        m_rctx->modelViewMatrix.MultMatrix(f);

        float planeColor[] = { 0.95f, 1.0f, 1.0f, 1.5f };

        glUseProgram(s_shaderID);
        glUniformMatrix4fv(glGetUniformLocation(s_shaderID, "mvMatrix"), 1, GL_FALSE, m_rctx->transform.GetModelViewMatrix());
        glUniformMatrix4fv(glGetUniformLocation(s_shaderID, "pMatrix"), 1, GL_FALSE, m_rctx->transform.GetProjectionMatrix());
        glUniform4fv(glGetUniformLocation(s_shaderID, "vColor"), 1, planeColor);

        drawBeam(radius, length);
        //glutSolidSphere(radius, 64, 64);
    }
    m_rctx->modelViewMatrix.PopMatrix();

    if (t > m_lifeTime) {
        m_active = false;
    }

    drawIntensityText();
}
开发者ID:hisyatokaku,项目名称:kinect-kamehameha,代码行数:38,代码来源:KamehamehaRenderer.cpp

示例4: RenderScene

///////////////////////////////////////////////////////////////////////////////
// Render a frame. The owning framework is responsible for buffer swaps,
// flushes, etc.
void RenderScene(void)
{
    static CStopWatch animationTimer;
    float yRot = animationTimer.GetElapsedSeconds() * 60.0f;
    
    M3DVector3f vCameraPos;
    M3DVector3f vCameraForward;
    M3DVector3f vMirrorPos;
    M3DVector3f vMirrorForward;
    cameraFrame.GetOrigin(vCameraPos);
    cameraFrame.GetForwardVector(vCameraForward);
    
    // Set position of mirror frame (camera)
    vMirrorPos[0] = 0.0;
    vMirrorPos[1] = 0.1f;
    vMirrorPos[2] = -6.0f; // view pos is actually behind mirror
    mirrorFrame.SetOrigin(vMirrorPos);
    
    // Calculate direction of mirror frame (camera)
    // Because the position of the mirror is known relative to the origin
    // find the direction vector by adding the mirror offset to the vector
    // of the viewer-origin
    vMirrorForward[0] = vCameraPos[0];
    vMirrorForward[1] = vCameraPos[1];
    vMirrorForward[2] = (vCameraPos[2] + 5);
    m3dNormalizeVector3(vMirrorForward);
    mirrorFrame.SetForwardVector(vMirrorForward);
    
    // first render from the mirrors perspective
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboName);
    glDrawBuffers(1, fboBuffs);
    glViewport(0, 0, mirrorTexWidth, mirrorTexHeight);
    
    // Draw scene from the perspective of the mirror camera
    modelViewMatrix.PushMatrix();
    M3DMatrix44f mMirrorView;
    mirrorFrame.GetCameraMatrix(mMirrorView);
    modelViewMatrix.MultMatrix(mMirrorView);
    
    // Flip the mirror camera horizontally for the reflection
    modelViewMatrix.Scale(-1.0f, 1.0f, 1.0f);
    
    glBindTexture(GL_TEXTURE_2D, textures[0]); // Marble
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_MODULATE, transformPipeline.GetModelViewProjectionMatrix(), vWhite, 0);
    floorBatch.Draw();
    DrawWorld(yRot);
    
    // Now draw a cylinder representing the viewer
    M3DVector4f vLightTransformed;
    modelViewMatrix.GetMatrix(mMirrorView);
    m3dTransformVector4(vLightTransformed, vLightPos, mMirrorView);
    modelViewMatrix.Translate(vCameraPos[0],vCameraPos[1]-0.8f,vCameraPos[2]-1.0f);
    modelViewMatrix.Rotate(-90.0f, 1.0f, 0.0f, 0.0f);
    
    shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF,
                                 modelViewMatrix.GetMatrix(),
                                 transformPipeline.GetProjectionMatrix(),
                                 vLightTransformed, vBlue, 0);
    cylinderBatch.Draw();
    modelViewMatrix.PopMatrix();
    
    // Reset FBO. Draw world again from the real cameras perspective
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
    glDrawBuffers(1, windowBuff);
    glViewport(0, 0, screenWidth, screenHeight);
    modelViewMatrix.PushMatrix();
    M3DMatrix44f mCamera;
    cameraFrame.GetCameraMatrix(mCamera);
    modelViewMatrix.MultMatrix(mCamera);
    
    glBindTexture(GL_TEXTURE_2D, textures[0]); // Marble
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_MODULATE, transformPipeline.GetModelViewProjectionMatrix(), vWhite, 0);
    
    floorBatch.Draw();
    DrawWorld(yRot);
    
    // Now draw the mirror surfaces
    modelViewMatrix.PushMatrix();
    modelViewMatrix.Translate(0.0f, -0.4f, -5.0f);
    if(vCameraPos[2] > -5.0)
    {
        glBindTexture(GL_TEXTURE_2D, mirrorTexture); // Reflection
        shaderManager.UseStockShader(GLT_SHADER_TEXTURE_REPLACE, transformPipeline.GetModelViewProjectionMatrix(), 0);
    }
    else
    {
        // If the camera is behind the mirror, just draw black
        shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vBlack);
    }
    mirrorBatch.Draw();
    shaderManager.UseStockShader(GLT_SHADER_FLAT, transformPipeline.GetModelViewProjectionMatrix(), vGrey);
    mirrorBorderBatch.Draw();
    modelViewMatrix.PopMatrix();
    modelViewMatrix.PopMatrix();
    
//.........这里部分代码省略.........
开发者ID:1019459067,项目名称:iOS9_OC_Learning,代码行数:101,代码来源:main.cpp

示例5: Display

void Display()
{
    static CStopWatch timer;
    GLfloat yRot = timer.GetElapsedSeconds() * 60.0;

    M3DVector3f vCameraPosition;
    M3DVector3f vCameraForward;
    M3DVector3f vMirrorPosition;
    M3DVector3f vMirrorForward;
    void movingCylinder();

    cameraFrame.GetOrigin(vCameraPosition);
    cameraFrame.GetForwardVector(vCameraForward);

    vMirrorPosition[0] = 0.0f;
    vMirrorPosition[1] = 0.1f;
    vMirrorPosition[2] = -20.0f;
    mirrorFrame.SetOrigin(vMirrorPosition);

    vMirrorForward[0] = vCameraPosition[0];
    vMirrorForward[1] = vCameraPosition[1];
    vMirrorForward[2] = (vCameraPosition[2] + 20);
    m3dNormalizeVector3(vMirrorForward);
    mirrorFrame.SetForwardVector(vMirrorForward);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBindFramebuffer(GL_DRAW_FRAMEBUFFER,fboName);
    glDrawBuffers(1,fboBuffers);
    glViewport(0,0,mirrorWidth,mirrorHeight);

    modelViewMatrix.PushMatrix();
    M3DMatrix44f mMirrorView;
    mirrorFrame.GetCameraMatrix(mMirrorView);
    modelViewMatrix.MultMatrix(mMirrorView);
    modelViewMatrix.Scale(-1.0f,1.0f,1.0f);
    glBindTexture(GL_TEXTURE_2D,textures[0]);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_MODULATE,
                                 transformPipeline.GetModelViewProjectionMatrix(),
                                 vWhite,0);
    floorBatch.Draw();

    drawSun();
    drawTorus(yRot);
    modelViewMatrix.PopMatrix();

    glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0);
    glDrawBuffers(1,windowBuffer);
    glViewport(0,0,mirrorWidth,mirrorHeight);

    modelViewMatrix.PushMatrix();
    M3DMatrix44f mCamera;
    cameraFrame.GetCameraMatrix(mCamera);
    modelViewMatrix.MultMatrix(mCamera);

    modelViewMatrix.PushMatrix();
    glBindTexture(GL_TEXTURE_2D,mirrorTexture);
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_REPLACE,
                                 transformPipeline.GetModelViewProjectionMatrix(),0);
    mirrorFrontBatch.Draw();
    modelViewMatrix.PopMatrix();
    modelViewMatrix.PushMatrix();
    glBindTexture(GL_TEXTURE_2D,textures[0]);
    shaderManager.UseStockShader(GLT_SHADER_TEXTURE_MODULATE,
                                 transformPipeline.GetModelViewProjectionMatrix(),
                                 vWhite,0);
    floorBatch.Draw();

    drawSun();
    drawTorus(yRot);
    modelViewMatrix.PopMatrix();
    modelViewMatrix.PopMatrix();


    //control to moving cylinder
    movingCylinder();

    glutSwapBuffers();
    glutPostRedisplay();
}
开发者ID:ybbai,项目名称:workspace,代码行数:81,代码来源:fbotextures.cpp


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