载入中...
搜索中...
未找到
VrmSurface.cpp
浏览该文件的文档.
18 if (auto* gfx = ModuleManager::getInstance<graphics::Graphics>("Graphics"); gfx && !providerLifetime.expired()) {
23graphics::Texture& buildVrmAtlas(graphics::Graphics& gfx, const VrmDocument& d, std::vector<VrmAtlasRect>& rects) {
51std::unique_ptr<VrmSurface> buildVrmSurface(graphics::Graphics& gfx, const VrmMaterial& data, graphics::Texture& atlas,
53 if (gfx.getBackendName() != "vulkan") throw std::runtime_error("VRM MToon requires the Vulkan graphics provider");
69 values[4] = {data.mtoon ? 1.f : 0.f, data.doubleSided ? 1.f : 0.f, data.textures[5].image >= 0 ? 1.f : 0.f,
78 values[7 + t * 3] = {slot.rotation, float(slot.wrapS), float(slot.wrapT), slot.image >= 0 ? 1.f : 0.f};
88 s->shader = gfx.newMeshShaderFromSpv({mesh3d_mtoon_vert_spv, mesh3d_mtoon_vert_spv + mesh3d_mtoon_vert_spv_count},
91 *s->shader, data.alphaMode == "BLEND" ? graphics::BlendMode::Alpha : graphics::BlendMode::Opaque,
101 m->setSurfaceMode(data.alphaMode == "BLEND" ? "transparent" : data.alphaMode == "MASK" ? "masked" : "opaque");
129 if (outlineMaterial) outlineMaterial->setFloat("vrm" + std::to_string(i), i == 24 ? 1.f : v[i]);
Data buffer paired with a filename (used for type identification).
Definition FileData.h:14
Definition Graphics.h:125
virtual std::string getBackendName() const =0
Renderer backend id used by sibling modules (e.g. Gpgpu).
virtual Shader * newMeshShaderFromSpv(const std::vector< uint32_t > &vertSpv, const std::vector< uint32_t > &fragSpv)=0
Create a Mesh3D custom shader (MeshVertex + Frame UBO + albedo). Empty vert → default mesh3d....
std::weak_ptr< const void > resourceLifetime() const
Observe this provider's resource lifetime without extending it.
Definition GraphicsLifetime.cpp:27
virtual Texture * newTexture(int width, int height, const uint8_t *rgba, bool repeatU=false, bool repeatV=false)=0
Creates a texture. @ownership Caller deletes unless documented otherwise.
virtual eve::Result< void > configureMeshShaderSurface(Shader &, BlendMode, bool, bool)
Prepare a custom mesh shader's blend, depth and culling state.
Definition Graphics.h:1830
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:18
void paste(ImageData *src, int dx, int dy, int sx, int sy, int sw, int sh)
Paste part of one ImageData onto another. The subregion defined by the top-left corner (sx,...
Definition ImageData.cpp:1074
Definition Avatar.cpp:12
graphics::Texture & buildVrmAtlas(graphics::Graphics &gfx, const VrmDocument &d, std::vector< VrmAtlasRect > &rects)
Prepare an atlas using the provider's owning resource factory. @ownership Graphics owns the result; c...
Definition VrmSurface.cpp:23
std::unique_ptr< VrmSurface > buildVrmSurface(graphics::Graphics &gfx, const VrmMaterial &data, graphics::Texture &atlas, const std::vector< VrmAtlasRect > &rects)
Builds vrm surface.
Definition VrmSurface.cpp:51
Validated VRM schema data. Unknown optional fields are ignored; unknown versions fail.
Definition VrmDocument.h:88
Linear material factors and image references from VRMC_materials_mtoon.
Definition VrmDocument.h:21
std::unique_ptr< graphics::Material > outlineMaterial
Definition VrmSurface.h:26
std::unique_ptr< graphics::Material > material
Definition VrmSurface.h:25
std::weak_ptr< const void > providerLifetime
Definition VrmSurface.h:23