void EERIEDrawBitmapUVs(Rectf rect, float z, TextureContainer * tex, Color color, Vec2f uv0, Vec2f uv1, Vec2f uv2, Vec2f uv3) { rect.move(-.5f, -.5f); ColorRGBA col = color.toRGBA(); TexturedVertex v[4]; v[0] = TexturedVertex(Vec3f(rect.topLeft(), z), 1.f, col, uv0); v[1] = TexturedVertex(Vec3f(rect.topRight(), z), 1.f, col, uv1); v[2] = TexturedVertex(Vec3f(rect.bottomLeft(), z), 1.f, col, uv2); v[3] = TexturedVertex(Vec3f(rect.bottomRight(), z), 1.f, col, uv3); SetTextureDrawPrim(tex, v, Renderer::TriangleStrip); }
void EERIEDrawBitmap_uv(Rectf rect, float z, TextureContainer * tex, Color color, float u0, float v0, float u1, float v1) { rect.move(-.5f, -.5f); Vec2f uv = (tex) ? tex->uv : Vec2f_ONE; u0 *= uv.x, u1 *= uv.x, v0 *= uv.y, v1 *= uv.y; ColorRGBA col = color.toRGBA(); TexturedVertex v[4]; v[0] = TexturedVertex(Vec3f(rect.topLeft(), z), 1.f, col, Vec2f(u0, v0)); v[1] = TexturedVertex(Vec3f(rect.topRight(), z), 1.f, col, Vec2f(u1, v0)); v[2] = TexturedVertex(Vec3f(rect.bottomRight(), z), 1.f, col, Vec2f(u1, v1)); v[3] = TexturedVertex(Vec3f(rect.bottomLeft(), z), 1.f, col, Vec2f(u0, v1)); SetTextureDrawPrim(tex, v, Renderer::TriangleFan); }
void CreateBitmap(TexturedQuad& s, Rectf rect, float z, TextureContainer * tex, Color color, bool isRhw) { rect.move(-.5f, -.5f); Vec2f uv = (tex) ? tex->uv : Vec2f_ZERO; ColorRGBA col = color.toRGBA(); float val = 1.f; if(isRhw) { val -= z; } s.v[0] = TexturedVertex(Vec3f(rect.topLeft(), z), val, col, Vec2f(0.f, 0.f)); s.v[1] = TexturedVertex(Vec3f(rect.topRight(), z), val, col, Vec2f(uv.x, 0.f)); s.v[2] = TexturedVertex(Vec3f(rect.bottomRight(), z), val, col, Vec2f(uv.x, uv.y)); s.v[3] = TexturedVertex(Vec3f(rect.bottomLeft(), z), val, col, Vec2f(0.f, uv.y)); }
void PrecastSpellsGui::update() { m_icons.clear(); if(!isVisible()) return; float intensity = 1.f - PULSATE * 0.5f; intensity = glm::clamp(intensity, 0.f, 1.f); for(size_t i = 0; i < Precast.size(); i++) { PRECAST_STRUCT & precastSlot = Precast[i]; float val = intensity; if(precastSlot.launch_time > 0 && g_gameTime.now() >= precastSlot.launch_time) { float tt = (g_gameTime.now() - precastSlot.launch_time) / GameDurationMs(1000); if(tt > 1.f) tt = 1.f; val *= (1.f - tt); } Color color = Color3f(0, val * 0.5f, val).to<u8>(); Rectf childRect = createChild(m_rect, Anchor_BottomLeft, m_iconSize * m_scale, Anchor_BottomLeft); childRect.move(i * m_iconSize.x * m_scale, 0); SpellType typ = precastSlot.typ; TextureContainer * tc = spellicons[typ].tc; arx_assert(tc); PrecastSpellIconSlot icon; icon.update(childRect, tc, color, PrecastHandle(i)); if(!(player.Interface & INTER_COMBATMODE)) icon.updateInput(); m_icons.push_back(icon); } }
void EERIEDrawBitmap2DecalY(Rectf rect, float z, TextureContainer * tex, Color color, float _fDeltaY) { rect.move(-.5f, -.5f); rect.top = rect.top + _fDeltaY * rect.height(); Vec2f uv = (tex) ? tex->uv : Vec2f_ZERO; float sv = uv.y * _fDeltaY; ColorRGBA col = color.toRGBA(); Vec2f uv1(0.f, sv); Vec2f uv2(uv.x, sv); Vec2f uv3(uv.x, uv.y); Vec2f uv4(0.f, uv.y); TexturedVertex v[4]; v[0] = TexturedVertex(Vec3f(rect.topLeft(), z), 1.f, col, uv1); v[1] = TexturedVertex(Vec3f(rect.topRight(), z), 1.f, col, uv2); v[2] = TexturedVertex(Vec3f(rect.bottomRight(), z), 1.f, col, uv3); v[3] = TexturedVertex(Vec3f(rect.bottomLeft(), z), 1.f, col, uv4); SetTextureDrawPrim(tex, v, Renderer::TriangleFan); }