a6268595fb
Window quads need to be in some coordinate space. Since we want items to be used not only for rendering windows, window-local coordinates do not suffice. This change makes scene items generate quads in the item-local coordinate space. The model matrix is used to map the quads to the global screen coordinate system from the item coordinate space. Since the quads are in the item local coordinate space, the mvp matrix needs to be updated on every draw call. Given the render data, tracking the last mvp matrix won't result in less glUniform calls. If this indeed becomes a serious performance bottleneck, we can explore the possibility of dumping mvp matrices in a UBO, which have been introduced in OpenGL 3.1.
38 lines
687 B
C++
38 lines
687 B
C++
/*
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "item.h"
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
/**
|
|
* The ShadowItem class represents a nine-tile patch server-side drop-shadow.
|
|
*/
|
|
class KWIN_EXPORT ShadowItem : public Item
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ShadowItem(Shadow *shadow, Scene::Window *window, Item *parent = nullptr);
|
|
~ShadowItem() override;
|
|
|
|
Shadow *shadow() const;
|
|
|
|
protected:
|
|
WindowQuadList buildQuads() const override;
|
|
|
|
private Q_SLOTS:
|
|
void handleTextureChanged();
|
|
void updateGeometry();
|
|
|
|
private:
|
|
QScopedPointer<Shadow> m_shadow;
|
|
};
|
|
|
|
} // namespace KWin
|