void VOpenGLDrawer::DrawPic(float x1, float y1, float x2, float y2, float s1, float t1, float s2, float t2, VTexture* Tex, VTextureTranslation* Trans, float Alpha) { guard(VOpenGLDrawer::DrawPic); SetPic(Tex, Trans, CM_Default); p_glUseProgramObjectARB(DrawSimpleProgram); p_glUniform1iARB(DrawSimpleTextureLoc, 0); p_glUniform1fARB(DrawSimpleAlphaLoc, Alpha); if (Alpha < 1.0) { glEnable(GL_BLEND); } glBegin(GL_QUADS); glTexCoord2f(s1 * tex_iw, t1 * tex_ih); glVertex2f(x1, y1); glTexCoord2f(s2 * tex_iw, t1 * tex_ih); glVertex2f(x2, y1); glTexCoord2f(s2 * tex_iw, t2 * tex_ih); glVertex2f(x2, y2); glTexCoord2f(s1 * tex_iw, t2 * tex_ih); glVertex2f(x1, y2); glEnd(); if (Alpha < 1.0) { glDisable(GL_BLEND); } unguard; }
void Interface::BaseReset() { if (origImageFilename.size() > 0) { SetPic(origImageFilename); SetZoom( ratio ); } sx1->setValue(0); sx2->setValue(0); Top_startX = 0; QApplication::restoreOverrideCursor(); }
void VOpenGLDrawer::DrawPicShadow(float x1, float y1, float x2, float y2, float s1, float t1, float s2, float t2, VTexture* Tex, float shade) { guard(VOpenGLDrawer::DrawPicShadow); SetPic(Tex, NULL, CM_Default); p_glUseProgramObjectARB(DrawShadowProgram); p_glUniform1iARB(DrawSimpleTextureLoc, 0); p_glUniform1fARB(DrawSimpleAlphaLoc, shade); glEnable(GL_BLEND); glBegin(GL_QUADS); glTexCoord2f(s1 * tex_iw, t1 * tex_ih); glVertex2f(x1, y1); glTexCoord2f(s2 * tex_iw, t1 * tex_ih); glVertex2f(x2, y1); glTexCoord2f(s2 * tex_iw, t2 * tex_ih); glVertex2f(x2, y2); glTexCoord2f(s1 * tex_iw, t2 * tex_ih); glVertex2f(x1, y2); glEnd(); glDisable(GL_BLEND); unguard; }
void Interface::SetFormat( QTextImageFormat e ) { nowimage = e; SetPic(e.name()); }
// ----------------------------------------------------------------------- // // // ROUTINE: CLTDialogueWnd::DisplayText // // PURPOSE: Sets up the dialogue text // // ----------------------------------------------------------------------- // BOOL CLTDialogueWnd::DisplayText(char *szText, char *szAvatar, BOOL bStayOpen, char *szDecisions) { if(m_bDecisions) { ASSERT(FALSE); return FALSE; } // Show us -- We have to do this up here because it will set our coordinates correctly // for the clipping calculations that are below... ShowWindow(); ShowAllChildren(); // Set the format width LTIntPt ptPos = g_pLayoutMgr->GetDialogueTextOffset(); m_lfdd.dwFormatWidth = m_nWidth - (ptPos.x * 2); m_lfdd.dwFlags = LTF_DRAW_FORMATTED; if(!szText) { m_csText = "ERROR - NO TEXT FOUND!"; m_lfdd.fLetterDelay = 0.0f; m_lfdd.fLineDelay = 0.0f; } else { // Set the text m_csText = szText; CRect rcClip; GetWindowRect(&rcClip); m_lfdd.rcClip.left = rcClip.left + m_rcTotal.left; m_lfdd.rcClip.top = rcClip.top + m_rcTotal.top; m_lfdd.rcClip.right = rcClip.right - m_rcTotal.right; m_lfdd.rcClip.bottom = rcClip.bottom - m_rcTotal.bottom; // See if it's larger than our height HSTRING hStr = g_pLTClient->CreateString((char *)(LPCSTR)m_csText); LTIntPt pt = m_pFont->GetTextExtentsFormat(hStr,m_lfdd.dwFormatWidth); g_pLTClient->FreeString(hStr); hStr = NULL; if(pt.y > (m_nHeight - (ptPos.y * 2))) { // It's more than we can display all at once so scroll it. m_lfdd.dwFlags |= LTF_TIMED_SCROLL | LTF_EXTRA_LOCKLAST; } else { m_lfdd.dwFlags &= ~(LTF_TIMED_SCROLL | LTF_EXTRA_LOCKLAST); } } // Term the prev string just in case we drew this string last time timed... m_lfsd.szPrevString = NULL; // If we weren't visible, reset our command parameters to the default m_bCanClose = FALSE; m_bMore = bStayOpen; // Parse the text for parameters //if(!ParseText()) //return FALSE; m_csDecisions.Empty(); if(szDecisions) { m_csDecisions = szDecisions; } // Set the pic if(szAvatar && szAvatar[0]) { CString csPic; csPic.Format("/interface/avatar/%s.pcx",szAvatar); SetPic((char *)(LPCSTR)csPic); } // Move us to the top and enable us m_bEnabled = TRUE; SetFocus(); return TRUE; }
void VOpenGLDrawer::DrawAliasModel(const TVec &origin, const TAVec &angles, const TVec& Offset, const TVec& Scale, VMeshModel* Mdl, int frame, int nextframe, VTexture* Skin, VTextureTranslation* Trans, int CMap, vuint32 light, vuint32 Fade, float Alpha, bool Additive, bool is_view_model, float Inter, bool Interpolate) { guard(VOpenGLDrawer::DrawAliasModel); if (is_view_model) { // hack the depth range to prevent view model from poking into walls glDepthRange(0.0, 0.3); } // // get lighting information // float shadelightr = ((light >> 16) & 0xff) / 510.0; float shadelightg = ((light >> 8) & 0xff) / 510.0; float shadelightb = (light & 0xff) / 510.0; float* shadedots = r_avertexnormal_dots[((int)(angles.yaw * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)]; // // draw all the triangles // glPushMatrix(); glTranslatef(origin.x, origin.y, origin.z); glRotatef(angles.yaw, 0, 0, 1); glRotatef(angles.pitch, 0, 1, 0); glRotatef(angles.roll, 1, 0, 0); glScalef(Scale.x, Scale.y, Scale.z); glTranslatef(Offset.x, Offset.y, Offset.z); mmdl_t* pmdl = Mdl->Data; mframe_t* framedesc = (mframe_t*)((byte *)pmdl + pmdl->ofsframes + frame * pmdl->framesize); mframe_t* nextframedesc = (mframe_t*)((byte *)pmdl + pmdl->ofsframes + nextframe * pmdl->framesize); if (!HaveVertexBufferObject) { // Interpolate Scales TVec scale_origin; if (Interpolate) { scale_origin[0] = ((1 - Inter) * framedesc->scale_origin[0] + Inter * nextframedesc->scale_origin[0]); scale_origin[1] = ((1 - Inter) * framedesc->scale_origin[1] + Inter * nextframedesc->scale_origin[1]); scale_origin[2] = ((1 - Inter) * framedesc->scale_origin[2] + Inter * nextframedesc->scale_origin[2]); } else { scale_origin[0] = framedesc->scale_origin[0]; scale_origin[1] = framedesc->scale_origin[1]; scale_origin[2] = framedesc->scale_origin[2]; } glTranslatef(scale_origin[0], scale_origin[1], scale_origin[2]); TVec scale; if (Interpolate) { scale[0] = framedesc->scale[0] + Inter * (nextframedesc->scale[0] - framedesc->scale[0]) * Scale.x; scale[1] = framedesc->scale[1] + Inter * (nextframedesc->scale[1] - framedesc->scale[1]) * Scale.y; scale[2] = framedesc->scale[2] + Inter * (nextframedesc->scale[2] - framedesc->scale[2]) * Scale.z; } else { scale[0] = framedesc->scale[0]; scale[1] = framedesc->scale[1]; scale[2] = framedesc->scale[2]; } glScalef(scale[0], scale[1], scale[2]); } SetPic(Skin, Trans, CMap); p_glUseProgramObjectARB(SurfModelProgram); p_glUniform1iARB(SurfModelTextureLoc, 0); p_glUniform1iARB(SurfModelFogTypeLoc, r_fog & 3); if (Fade) { p_glUniform1iARB(SurfModelFogEnabledLoc, GL_TRUE); p_glUniform4fARB(SurfModelFogColourLoc, ((Fade >> 16) & 255) / 255.0, ((Fade >> 8) & 255) / 255.0, (Fade & 255) / 255.0, Alpha); p_glUniform1fARB(SurfModelFogDensityLoc, Fade == FADE_LIGHT ? 0.3 : r_fog_density); p_glUniform1fARB(SurfModelFogStartLoc, Fade == FADE_LIGHT ? 1.0 : r_fog_start); p_glUniform1fARB(SurfModelFogEndLoc, Fade == FADE_LIGHT ? 1024.0 * r_fade_factor : r_fog_end); } else {