载入中...
搜索中...
未找到
TextureRecipe.cpp
浏览该文件的文档.
33std::unique_ptr<image::ImageData> TextureRecipeRegistry::generate(const std::string &id, const Params ¶ms,
98 RecipeDescriptor descriptor = RecipeDescriptor::grid(definition.id, displayName, "Texture", 1, 1);
99 descriptor.params.push_back(ParamDescriptor::floating("scale", "Scale", 4.f, 0.05f, 256.f, 0.05f));
bool applyDefaults(const std::string &id, Params ¶ms) const
Fill missing values from metadata.
Definition TextureRecipe.cpp:48
std::unique_ptr< image::ImageData > generate(const std::string &id, const Params ¶ms, std::string &error) const
Generates an image and transfers its unique ownership to the caller.
Definition TextureRecipe.cpp:33
const RecipeDescriptor * descriptor(const std::string &id) const
Look up recipe metadata.
Definition TextureRecipe.cpp:43
void registerRecipe(const std::string &id, TextureRecipeFn fn)
Register a recipe without metadata.
Definition TextureRecipe.cpp:17
static TextureRecipeRegistry & instance()
Access the process-wide texture recipe registry.
Definition TextureRecipe.cpp:12
Definition EvpackPointGraphLoader.h:12
std::function< std::unique_ptr< image::ImageData >(const Params ¶ms, std::string &error)> TextureRecipeFn
Recipe returns a newly owned RGBA8 image, or null on failure.
Definition TextureRecipe.h:24
RecipeDescriptor makeTextureRecipeDescriptor(const TextureRecipeDef &definition)
Build editable metadata for a texture definition.
Definition TextureRecipe.cpp:88
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
Piecewise-linear color ramp in t∈[0,1], with optional hard banding.
Definition ColorRamp.h:16
Rgba8 sampleBanded(float t, int bands) const
Quantize continuous t into bands steps then sample (pixel look).
Definition ColorRamp.cpp:34
Deterministic value-noise helpers for pixel textures. When periodX/periodY > 0, lattice wraps for sea...
Definition NoiseField.h:13
static ParamDescriptor boolean(std::string key, std::string label, bool defaultValue)
Construct a Boolean descriptor stored as zero or one in Params.
Definition ParamSchema.cpp:47
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
static ParamDescriptor integer(std::string key, std::string label, int defaultValue, int minimum, int maximum, int step=1)
Construct a bounded integer descriptor.
Definition ParamSchema.cpp:19
PBR surface defaults for a generated material. Every map in a PBR set is derived from the same displa...
Definition TextureRecipe.h:105
Complete metadata and parameter schema shared by every procgen recipe family.
Definition ParamSchema.h:52
static RecipeDescriptor grid(std::string id, std::string displayName, std::string category, int minimumWidth, int minimumHeight, int maximumWidth=4096, int maximumHeight=4096)
Create a schema with common seed, width and height parameters.
Definition ParamSchema.cpp:73
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