载入中...
搜索中...
未找到
StyleChain.cpp
浏览该文件的文档.
32void StyleChain::apply(graphics::Graphics* gfx, graphics::Texture* source, graphics::Canvas* dest,
44 if (!temp->getTexture()) throw eve::Exception("StyleChain.apply: temp canvas has no sampleable texture");
45 if (!dest->getTexture()) throw eve::Exception("StyleChain.apply: dest canvas has no sampleable texture");
62 gfx->drawTexturedRect(temp->getTexture(), 0.f, 0.f, float(dest->getWidth()), float(dest->getHeight()),
68void StyleChain::applyCanvas(graphics::Graphics* gfx, graphics::Canvas* source, graphics::Canvas* dest,
84 if (!desc) throw eve::Exception("StyleInstance: style '%s' has no parameter '%s'", style.c_str(), name.c_str());
90 if (!findStyleDefinition(style_)) throw eve::Exception("StyleInstance: unknown style '%s'", style_.c_str());
95 if (!style_.starts_with("asset://")) throw eve::Exception("External mesh styles require an asset URI");
97 if (name.empty() || !std::isfinite(value)) throw eve::Exception("Invalid external style parameter");
105 if (externalDefaults_) return graphics::postEffectStageName(graphics::PostEffectStage::AfterOpaque);
153 return externalDefaults_ ? externalDefaults_->contains(name) : findStyleParameter(style_, name) != nullptr;
156bool StyleInstance::isOverridden(const std::string& name) const { return overrides_.find(name) != overrides_.end(); }
208StylePass::StylePass(const std::string& style, graphics::Shader* shader) : style_(style), shader_(shader) {
229bool StylePass::hasParam(const std::string& name) const { return shader_ && shader_->hasUniform(name); }
280 const float dw = gfx->getCanvas() ? float(gfx->getCanvas()->getWidth()) : float(gfx->getWidth());
293void StylePass::applyTo(graphics::Graphics* gfx, graphics::Texture* source, graphics::Canvas* dest) {
302void StylePass::applyCanvasTo(graphics::Graphics* gfx, graphics::Canvas* source, graphics::Canvas* dest) {
369void StyleRecipe::apply(graphics::Graphics* gfx, graphics::Texture* source, graphics::Canvas* dest) {
380void StyleRecipe::applyCanvas(graphics::Graphics* gfx, graphics::Canvas* source, graphics::Canvas* dest) {
381 if (!source || !source->getTexture()) throw eve::Exception("StyleRecipe.applyCanvas: source has no texture");
virtual Texture * getTexture()=0
Sampleable color buffer; screen Canvas returns nullptr.
Definition Graphics.h:134
virtual void setCanvas(Canvas *canvas)=0
nullptr or this → screen. Switching flushes pending draws to the previous target.
virtual void drawTexturedRect(Texture *texture, float x, float y, float w, float h, float r, float g, float b, float a=1.f)
RGBA-float overload matching the script-facing drawTexturedRect name.
Definition Graphics.cpp:1917
virtual Canvas * newCanvas(int width, int height)=0
Create an offscreen render target (sampleable). Owned by Graphics.
virtual void drawTexturedRectShader(Texture *texture, Shader *shader, float x, float y, float w, float h, const Color &color)=0
Draw with an explicit Shader (nullptr = default textured pipeline).
bool hasUniform(const std::string &name) const
Definition Shader.cpp:71
void sendFloat(const std::string &name, float x)
Definition Shader.cpp:107
int getFromVar(const std::string &name, void *data, size_t size) const
Definition Shader.cpp:96
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:15
Ordered multi-pass stylize pipeline (extension point).
Definition StyleChain.h:29
void applyCanvas(graphics::Graphics *gfx, graphics::Canvas *source, graphics::Canvas *dest, graphics::Canvas *temp=nullptr)
Applies canvas.
Definition StyleChain.cpp:68
void apply(graphics::Graphics *gfx, graphics::Texture *source, graphics::Canvas *dest, graphics::Canvas *temp=nullptr)
Run passes in order into dest. When more than one pass is present, temp is required for ping-pong (sa...
Definition StyleChain.cpp:32
Mutable parameter instance of an immutable built-in style definition.
Definition StyleInstance.h:25
graphics::Shader * newMeshShader(graphics::Graphics *gfx) const
Create a mesh technique shader and apply compatible overrides.
Definition StyleChain.cpp:196
StylePass * newPass(graphics::Graphics *gfx) const
Create a post pass and apply this instance's parameter overrides.
Definition StyleChain.cpp:189
void applyToShader(graphics::Shader *shader) const
Apply current overrides to an existing compatible shader.
Definition StyleChain.cpp:182
float getParamDefault(const std::string &name) const
Returns the param default.
Definition StyleChain.cpp:132
One stylized post-process pass bound to a style id (built-in or custom label). Draws a full-quad of t...
Definition StylePass.h:26
void applyCanvasTo(graphics::Graphics *gfx, graphics::Canvas *source, graphics::Canvas *dest)
Applies canvas to.
Definition StyleChain.cpp:302
void applyTo(graphics::Graphics *gfx, graphics::Texture *source, graphics::Canvas *dest)
Apply into an explicit destination canvas (restores previous canvas bind). Preferred hook for chains ...
Definition StyleChain.cpp:293
void applyCanvas(graphics::Graphics *gfx, graphics::Canvas *source)
Applies canvas.
Definition StyleChain.cpp:286
void apply(graphics::Graphics *gfx, graphics::Texture *source)
Apply style into the currently bound canvas / screen. Automatically uploads texel size + screen size ...
Definition StyleChain.cpp:262
void setTime(float seconds)
Advance time-driven knobs (watercolor warp / ink jitter).
Definition StyleChain.cpp:244
StylePass(const std::string &style, graphics::Shader *shader)
Style pass.
Definition StyleChain.cpp:208
void applyCanvas(graphics::Graphics *gfx, graphics::Canvas *source, graphics::Canvas *dest)
Applies canvas.
Definition StyleChain.cpp:380
void apply(graphics::Graphics *gfx, graphics::Texture *source, graphics::Canvas *dest)
Applies .
Definition StyleChain.cpp:369
const char * postEffectStageName(PostEffectStage stage)
Post effect stage name.
Definition PostEffect.h:28
@ AfterOpaque
Definition MeshVfxPackage.h:10
graphics::Shader * createMeshShader(graphics::Graphics *gfx, const std::string &style)
Creates mesh shader.
Definition StyleShaders.cpp:590
graphics::Shader * createPostShader(graphics::Graphics *gfx, const std::string &style)
Creates post shader.
Definition StyleShaders.cpp:553
const StyleParameterDesc * findStyleParameter(const std::string &style, const std::string &name)
Finds style parameter.
Definition StyleShaders.cpp:352
std::string styleParamName(const std::string &style, int index)
Style param name.
Definition StyleShaders.cpp:335
const StyleDefinition * findStyleDefinition(const std::string &style)
Return a built-in definition, or nullptr when the id is unknown.
Definition StyleShaders.cpp:175
Definition Container.h:602
Immutable capability metadata for one built-in stylization recipe.
Definition StyleShaders.h:19
Tooling metadata for one user-facing float parameter.
Definition StyleShaders.h:31