/*!*************************************************************************** @Function RotationZ @Input angle the angle of rotation @Returns rotation matrix @Description generates a 3x3 rotation matrix about the Z axis ****************************************************************************/ PVRTMat3 PVRTMat3::RotationZ(VERTTYPE angle) { PVRTMat4 out; PVRTMatrixRotationZ(out,angle); return PVRTMat3(out); }
/*!*************************************************************************** @Function RotationZ @Input angle the angle of rotation @Returns rotation matrix @Description generates a 4x4 rotation matrix about the Z axis ****************************************************************************/ PVRTMat4 PVRTMat4::RotationZ(VERTTYPE angle) { PVRTMat4 out; PVRTMatrixRotationZ(out,angle); return out; }
/*!*************************************************************************** @Function APIDrawLogo @Description *****************************************************************************/ void CPVRTPrint3D::APIDrawLogo(const EPVRTPrint3DLogo uLogoToDisplay, const int ePos) { GLuint tex = 0; float fScale = 1.0f; if(m_ui32ScreenDim[1] >= 720) fScale = 2.0f; SPVRTPrint3DAPI::SInstanceData& Data = (m_pAPI->m_pInstanceData ? *m_pAPI->m_pInstanceData : SPVRTPrint3DAPI::s_InstanceData); switch(uLogoToDisplay) { case ePVRTPrint3DLogoIMG: tex = Data.uTextureIMGLogo; break; case ePVRTPrint3DLogoPowerVR: tex = Data.uTexturePowerVRLogo; break; default: return; // Logo not recognised } const float fLogoXSizeHalf = (128.0f / m_ui32ScreenDim[0]); const float fLogoYSizeHalf = (64.0f / m_ui32ScreenDim[1]); const float fLogoXShift = 0.035f / fScale; const float fLogoYShift = 0.035f / fScale; const float fLogoSizeXHalfShifted = fLogoXSizeHalf + fLogoXShift; const float fLogoSizeYHalfShifted = fLogoYSizeHalf + fLogoYShift; static float Vertices[] = { -fLogoXSizeHalf, fLogoYSizeHalf , 0.5f, -fLogoXSizeHalf, -fLogoYSizeHalf, 0.5f, fLogoXSizeHalf , fLogoYSizeHalf , 0.5f, fLogoXSizeHalf , -fLogoYSizeHalf, 0.5f }; static float UVs[] = { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f }; float *pVertices = ( (float*)&Vertices ); float *pUV = ( (float*)&UVs ); // Matrices PVRTMATRIX matModelView; PVRTMATRIX matTransform; PVRTMatrixIdentity(matModelView); PVRTMatrixScaling(matTransform, f2vt(fScale), f2vt(fScale), f2vt(1.0f)); PVRTMatrixMultiply(matModelView, matModelView, matTransform); int nXPos = (ePos & eLeft) ? -1 : 1; int nYPos = (ePos & eTop) ? 1 : -1; PVRTMatrixTranslation(matTransform, nXPos - (fLogoSizeXHalfShifted * fScale * nXPos), nYPos - (fLogoSizeYHalfShifted * fScale * nYPos), 0.0f); PVRTMatrixMultiply(matModelView, matModelView, matTransform); if(m_bRotate) { PVRTMatrixRotationZ(matTransform, -90.0f*PVRT_PI/180.0f); PVRTMatrixMultiply(matModelView, matModelView, matTransform); } _ASSERT(Data.uProgramLogo != UNDEFINED_HANDLE); glUseProgram(Data.uProgramLogo); // Bind the model-view-projection to the shader glUniformMatrix4fv(Data.mvpLocationLogo, 1, GL_FALSE, matModelView.f); // Render states glActiveTexture(GL_TEXTURE0); _ASSERT(tex != UNDEFINED_HANDLE); glBindTexture(GL_TEXTURE_2D, tex); // Vertices glEnableVertexAttribArray(VERTEX_ARRAY); glEnableVertexAttribArray(UV_ARRAY); glVertexAttribPointer(VERTEX_ARRAY, 3, GL_FLOAT, GL_FALSE, 0, (const void*)pVertices); glVertexAttribPointer(UV_ARRAY, 2, GL_FLOAT, GL_FALSE, 0, (const void*)pUV); glDrawArrays(GL_TRIANGLE_STRIP,0,4); glDisableVertexAttribArray(VERTEX_ARRAY); glDisableVertexAttribArray(UV_ARRAY); }