载入中...
搜索中...
未找到
PbrMaterialScript.cpp
浏览该文件的文档.
2#include <functional>
3#include <simplesquirrel/simplesquirrel.hpp>
4#include "image/ImageData.h"
6namespace eve::procgen {
7void exposePbrMaterial(ssq::Table& table) {
8 auto pbr = table.addClass<PbrTextureSet>(
9 "ProcgenPbrMaterial", std::function<PbrTextureSet*()>([]() -> PbrTextureSet* { return nullptr; }), true);
10 pbr.addFunc("destroy", &PbrTextureSet::destroy);
11 pbr.addFunc("getAlbedo", &PbrTextureSet::getAlbedo);
12 pbr.addFunc("getNormal", &PbrTextureSet::getNormal);
13 pbr.addFunc("getRoughness", &PbrTextureSet::getRoughness);
14 pbr.addFunc("getMetallic", &PbrTextureSet::getMetallic);
15 pbr.addFunc("getHeight", &PbrTextureSet::getHeight);
16 pbr.addFunc("getAo", &PbrTextureSet::getAo);
17 pbr.addFunc("getTransmission", &PbrTextureSet::getTransmission);
18 pbr.addFunc("getIor", &PbrTextureSet::getIor);
19 pbr.addFunc("getAlbedoWidth", [](const PbrTextureSet* s) { return s->albedo->getWidth(); });
20 pbr.addFunc("getAlbedoHeight", [](const PbrTextureSet* s) { return s->albedo->getHeight(); });
21 pbr.addFunc("getNormalWidth", [](const PbrTextureSet* s) { return s->normal->getWidth(); });
22 pbr.addFunc("getRoughnessWidth", [](const PbrTextureSet* s) { return s->roughness->getWidth(); });
23 pbr.addFunc("getMetallicWidth", [](const PbrTextureSet* s) { return s->metallic->getWidth(); });
24 pbr.addFunc("getHeightWidth", [](const PbrTextureSet* s) { return s->height->getWidth(); });
25 pbr.addFunc("getAoWidth", [](const PbrTextureSet* s) { return s->ao->getWidth(); });
26 pbr.addFunc("hasAllMaps", [](const PbrTextureSet* s) {
27 return s->albedo && s->normal && s->roughness && s->metallic && s->height && s->ao;
28 });
29}
30} // namespace eve::procgen
const std::string & s
graphics::PbrSurface pbr
void exposePbrMaterial(ssq::Table &table)
Register material map and optical metadata accessors; owner-thread only.
Owning metallic-roughness PBR map set; destruction releases all maps. Image accessors return borrows ...
Definition PbrMaterial.h:26
image::ImageData * getRoughness() const
Return the generated roughness image.
Definition PbrMaterial.h:53
float getTransmission() const
Return optical transmission, independent of alpha coverage.
Definition PbrMaterial.h:45
void destroy()
Deletes all maps and nulls the pointers (defined in PbrMaterial.cpp).
image::ImageData * getNormal() const
Return the generated normal image.
Definition PbrMaterial.h:51
image::ImageData * getMetallic() const
Return the generated metallic image.
Definition PbrMaterial.h:55
image::ImageData * getAlbedo() const
Return the generated albedo image.
Definition PbrMaterial.h:49
image::ImageData * getAo() const
Return the generated ambient-occlusion image.
Definition PbrMaterial.h:59
image::ImageData * getHeight() const
Return the generated height image.
Definition PbrMaterial.h:57
float getIor() const
Return dielectric index of refraction.
Definition PbrMaterial.h:47