载入中...
搜索中...
未找到
PbrMaterial.cpp
浏览该文件的文档.
48std::unique_ptr<PbrTextureSet> PbrRecipeRegistry::generate(const std::string &id, const Params ¶ms,
85 descriptor.params.push_back(ParamDescriptor::floating("roughnessLow", "Low Roughness", def.pbr.roughnessLow, 0.f, 1.f, 0.01f));
86 descriptor.params.push_back(ParamDescriptor::floating("roughnessHigh", "High Roughness", def.pbr.roughnessHigh, 0.f, 1.f, 0.01f));
87 descriptor.params.push_back(ParamDescriptor::floating("metallic", "Metallic", def.pbr.metallic, 0.f, 1.f, 0.01f));
88 descriptor.params.push_back(ParamDescriptor::floating("normalStrength", "Normal Strength", def.pbr.normalStrength, 0.01f, 32.f, 0.05f));
89 descriptor.params.push_back(ParamDescriptor::floating("aoStrength", "AO Strength", def.pbr.aoStrength, 0.f, 5.f, 0.05f));
90 descriptor.params.push_back(ParamDescriptor::floating("heightStrength", "Height Strength", def.pbr.heightStrength, 0.f, 16.f, 0.05f));
100std::unique_ptr<image::ImageData> grayscaleImage(const std::vector<float> &values, int w, int h) {
112std::unique_ptr<PbrTextureSet> generatePbrSet(const TextureRecipeDef &def, const Params ¶ms, std::string &error) {
const RecipeDescriptor * descriptor(const std::string &id) const
Look up recipe metadata.
Definition PbrMaterial.cpp:58
static PbrRecipeRegistry & instance()
Access the process-wide PBR registry.
Definition PbrMaterial.cpp:27
bool applyDefaults(const std::string &id, Params ¶ms) const
Fill missing values from metadata.
Definition PbrMaterial.cpp:63
std::unique_ptr< PbrTextureSet > generate(const std::string &id, const Params ¶ms, std::string &error) const
Generates a PBR map set and transfers its unique ownership to the caller.
Definition PbrMaterial.cpp:48
void registerPbrRecipe(const std::string &id, PbrRecipeFn fn)
Register a recipe without metadata.
Definition PbrMaterial.cpp:32
Definition EvpackPointGraphLoader.h:12
void registerFloorPbrRecipes(PbrRecipeRegistry ®istry)
Register pbr.floor.wood and pbr.floor.tile with schema metadata.
Definition FloorTextures.cpp:1235
void registerCablePbrRecipes(PbrRecipeRegistry ®istry)
Register pbr.cable.steel / pbr.chain.iron / pbr.rope.hemp.
Definition CableTextures.cpp:467
std::unique_ptr< PbrTextureSet > generatePbrSet(const TextureRecipeDef &def, const Params ¶ms, std::string &error)
Builds a full PBR set from a texture definition and returns unique ownership.
Definition PbrMaterial.cpp:112
RecipeDescriptor makeTextureRecipeDescriptor(const TextureRecipeDef &definition)
Build editable metadata for a texture definition.
Definition TextureRecipe.cpp:88
std::unique_ptr< image::ImageData > grayscaleImage(const std::vector< float > &values, int w, int h)
Builds a grayscale RGBA8 image and returns unique ownership to the caller.
Definition PbrMaterial.cpp:100
const std::vector< TextureRecipeDef > & builtinTextureDefs()
All built-in texture definitions (albedo + PBR). Populated lazily.
Definition BuiltinTextures.cpp:940
void paintHeightToImage(image::ImageData &img, const std::vector< float > &height, int w, int h, const ColorRamp &ramp, int bands, int pixelSize)
Paint height to image.
Definition TextureRecipe.cpp:128
void fillHeightField(const TextureGenContext &ctx, const std::function< float(float, float, const NoiseField &)> &fn, std::vector< float > &height)
Sample a height function over the full [w×h] grid into height (clamped to [0,1]).
Definition TextureRecipe.cpp:108
std::unique_ptr< image::ImageData > heightToNormalImage(const std::vector< float > &height, int w, int h, float strength, bool seamless)
Builds a normal-map image and transfers its unique ownership to the caller.
Definition TextureRecipe.cpp:148
std::function< std::unique_ptr< PbrTextureSet >(const Params ¶ms, std::string &error)> PbrRecipeFn
Recipe returns a newly owned full PBR set, or null on failure.
Definition PbrMaterial.h:52
static ParamDescriptor floating(std::string key, std::string label, float defaultValue, float minimum, float maximum, float step)
Construct a bounded floating-point descriptor.
Definition ParamSchema.cpp:33
PBR surface defaults for a generated material. Every map in a PBR set is derived from the same displa...
Definition TextureRecipe.h:105
~PbrTextureSet()
Releases all generated maps when the owning set is destroyed.
Definition PbrMaterial.cpp:15
void destroy()
Deletes all maps and nulls the pointers (defined in PbrMaterial.cpp).
Definition PbrMaterial.cpp:17
Complete metadata and parameter schema shared by every procgen recipe family.
Definition ParamSchema.h:52
void applyDefaults(Params ¶ms) const
Fill missing Params values from this schema.
Definition ParamSchema.cpp:91
static TextureGenContext fromParams(const Params ¶ms)
From params.
Definition TextureRecipe.cpp:63
A procedural texture is fully described by an albedo ramp + a displacement field + PBR knobs....
Definition TextureRecipe.h:122