CI / build (push) Successful in 48s
While the renderer process runs, the adapter makes the client's render targets itself and the renderer process draws frames into them: texture targets are drawn with like any texture, and a pixmap target's frame is read back through the channel into its Pixmap (protocol version 4: BeginFrame names its target, CreateRenderTarget, Channel::readSize and the -read event). Frames into render targets are drawn even while the window is hidden. The client uses pixmap targets for snapshots (outfit pictures, photos), checked to look right. The render target interfaces are declared from IMVU's vtables. Co-Authored-By: Claude Opus 5.5 <[email protected]>
76 lines
3.1 KiB
C++
76 lines
3.1 KiB
C++
#pragma once
|
|
// The objects a PiRenderEngine creates and hands to IMVU's code: buffers, textures, render targets. IMVU's code keeps
|
|
// them, calls their virtual methods, and deletes them through their virtual destructors. Declared from the vtables in
|
|
// SceneWindow.dll; method names are ours, from what IMVU's implementations do. Not yet verified by a renderer of our
|
|
// own.
|
|
|
|
#include <cstdint>
|
|
|
|
#include "t5de/imvu/shared_ptr.hpp"
|
|
#include "t5de/imvu/types.hpp"
|
|
|
|
namespace t5de::imvu {
|
|
|
|
class PiInternalIndexBuffer {
|
|
public:
|
|
virtual ~PiInternalIndexBuffer() = default;
|
|
};
|
|
|
|
class PiInternalVertexBuffer {
|
|
public:
|
|
virtual ~PiInternalVertexBuffer() = default;
|
|
// Replaces a dynamic buffer's contents: elementCount elements of elementSize bytes, stride bytes apart (a multiple
|
|
// of 4, at least elementSize). Element size and count are the ones the buffer was created with.
|
|
virtual void update(const void* data, std::uint32_t stride, std::uint32_t elementSize,
|
|
std::uint32_t elementCount) = 0;
|
|
// Unknown: IMVU's software buffer forgets its data; its Direct3D buffer asserts, so it isn't called there.
|
|
virtual void unknown2() = 0;
|
|
};
|
|
|
|
class PiRenderTexture {
|
|
public:
|
|
virtual ~PiRenderTexture() = default;
|
|
virtual Vec2i size() const = 0;
|
|
// Copies the parts of pixmap in regions into the texture. (Not overloaded with update: MSVC orders overloaded
|
|
// virtual methods unlike their declaration.)
|
|
virtual void updateRegions(const Pixmap& pixmap, const CompoundRegion& regions) = 0;
|
|
// Copies all of pixmap into the texture.
|
|
virtual void update(const Pixmap& pixmap) = 0;
|
|
// Reads the texture into a new Pixmap, constructed in result (a Pixmap returned by value).
|
|
virtual Pixmap* read(Pixmap* result) const = 0;
|
|
};
|
|
|
|
// What frames can be drawn into besides the window (PiRenderEngine::beginRendering). IMVU's Direct3D engine returns
|
|
// each as a pointer into its own object (single inheritance from these, so the PiRenderTarget pointer is the same).
|
|
class PiRenderTarget {
|
|
public:
|
|
virtual ~PiRenderTarget() = default;
|
|
};
|
|
|
|
// Drawn into, then read: after each frame drawn into it, getPixmap() has its pixels (IMVU's engine copies them at the
|
|
// end of the frame). Used for snapshots: outfit pictures, the photo widget.
|
|
class PiPixmapRenderTarget : public PiRenderTarget {
|
|
public:
|
|
// Constructs a copy of the pixels in result (a Pixmap returned by value).
|
|
virtual Pixmap* getPixmap(Pixmap* result) const = 0;
|
|
};
|
|
|
|
// The part of the texture the target covers, in texture coordinates. IMVU's Direct3D engine always returns 0, 0, 1, 1.
|
|
struct TextureArea {
|
|
float left;
|
|
float top;
|
|
float right;
|
|
float bottom;
|
|
};
|
|
|
|
// Drawn into, then drawn with as a texture.
|
|
class PiTextureRenderTarget : public PiRenderTarget {
|
|
public:
|
|
// Constructs the area in result (returned by value).
|
|
virtual TextureArea* area(TextureArea* result) const = 0;
|
|
// Constructs, in result, a new texture object for what's been drawn (a shared pointer returned by value).
|
|
virtual SharedPtr<PiRenderTexture>* texture(SharedPtr<PiRenderTexture>* result) const = 0;
|
|
};
|
|
|
|
} // namespace t5de::imvu
|