载入中...
搜索中...
未找到
RenderSystem.cpp
浏览该文件的文档.
96void Renderable2D::setFrameLayout(int sourceW, int sourceH, int trimW, int trimH, int offsetX, int offsetY) {
126 DiagnosticCode::InvalidArgument, "pixelsPerUnit must be finite and > 0", "camera2d.pixelsPerUnit"));
157 Diagnostic::error(DiagnosticCode::InvalidArgument, "viewport size must be > 0", "camera2d.viewport"));
160 computePixelPerfectScale(d->pixelsPerUnit, d->pixelRefWidth, d->pixelRefHeight, viewWidth, viewHeight);
245void applyCamera(float wx, float wy, float ww, float wh, const ViewCam &cam, int viewW, int viewH,
343Color modulateUnlit(Color base, float cx, float cy, bool receiveLight, const Lighting2DUBO &ubo) {
557 gfx.drawTexturedRectLitUVRotated(it.texture, it.normal, centerX, centerY, sw, sh, it.rotation, u0, v0,
561 gfx.drawTexturedRectLitUV(it.texture, it.normal, sx, sy, sw, sh, u0, v0, u1, v1, it.color, it.blend);
EVEngine assertion entry point, backed by zeroerr.
#define EV_PROFILE_MODULE(module, name)
Profile the enclosing scope, tagged with a module for grouping.
Definition Profile.h:158
Structured operation status used by the common Result foundation.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
float screenToWorldY(float screenX, float screenY, float viewW, float viewH)
Definition RenderSystem.cpp:182
Result< void > applyPixelPerfect(int viewWidth, int viewHeight)
Resolve integer zoom (and optional position snap) from the live viewport.
Definition RenderSystem.cpp:154
int getPixelScale()
Return the last integer upscale from applyPixelPerfect.
Definition RenderSystem.cpp:174
float worldToScreenY(float worldX, float worldY, float viewW, float viewH)
Definition RenderSystem.cpp:194
void clearPixelConfig()
Clear reference resolution and restore default pixels-per-unit of 1.
Definition RenderSystem.cpp:141
float worldToScreenX(float worldX, float worldY, float viewW, float viewH)
Definition RenderSystem.cpp:188
float screenToWorldX(float screenX, float screenY, float viewW, float viewH)
Convert screen pixel (origin top-left of viewport) to world coordinates. viewW/viewH are the current ...
Definition RenderSystem.cpp:176
Result< void > setPixelConfig(float pixelsPerUnit, int refWidth=0, int refHeight=0)
Store perfect-pixel sizing (pixels-per-unit and optional reference resolution).
Definition RenderSystem.cpp:123
void setAmbient(float r, float g, float b)
Definition RenderSystem.cpp:104
void setPosition(float x, float y)
World-space look-at center and zoom (1 = identity).
Definition RenderSystem.cpp:111
void setPixelSnap(bool enabled)
Enable or disable snapping the camera center onto the pixel grid.
Definition RenderSystem.cpp:151
void setPixelPerfect(bool enabled)
Enable or disable automatic perfect-pixel zoom resolution.
Definition RenderSystem.cpp:149
bool getPixelPerfect()
Return whether perfect-pixel resolution is enabled.
Definition RenderSystem.cpp:150
virtual void clear(std::optional< Color > color, std::optional< int > stencil, std::optional< double > depth)=0
Clears .
Definition Graphics.h:134
virtual void drawTexturedRectShaderUV(Texture *texture, Shader *shader, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha)=0
UV draw with an explicit Shader (nullptr = default textured pipeline).
virtual void drawTexturedRectLitUVRotated(Texture *albedo, Texture *normal, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, const Color &color, BlendMode blend=BlendMode::Alpha)=0
Lit 2D draw rotated degrees clockwise (screen Y-down) around (cx, cy). Fragment tangent frame is rebu...
virtual void setLighting2D(const Lighting2DUBO &ubo)=0
Upload per-frame / per-canvas 2D lighting constants for subsequent lit draws.
virtual SceneColorDistortionStatus drawSceneColorDistortionUVRotated(Texture *displacement, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, float strengthPixels, float opacity, bool rotatedUV=false)
Draws scene color distortion uv rotated.
Definition Graphics.h:795
virtual void drawSolidRect(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 drawSolidRect name.
Definition Graphics.cpp:1913
virtual void drawTexturedRectShaderUVRotated(Texture *texture, Shader *shader, float cx, float cy, float w, float h, float degrees, float u0, float v0, float u1, float v1, const Color &color, bool rotatedUV=false, BlendMode blend=BlendMode::Alpha)=0
UV draw rotated degrees clockwise (screen Y-down) around the rect center. texture may be null → solid...
virtual void drawSolidRectRotated(float cx, float cy, float w, float h, float degrees, const Color &color, BlendMode blend=BlendMode::Alpha)=0
Rotated solid quad degrees clockwise (screen Y-down) around (cx, cy).
virtual void setCanvas(Canvas *canvas)=0
nullptr or this → screen. Switching flushes pending draws to the previous target.
virtual void drawTexturedRectLitUV(Texture *albedo, Texture *normal, float x, float y, float w, float h, float u0, float v0, float u1, float v1, const Color &color, BlendMode blend=BlendMode::Alpha)=0
Lit 2D draw (albedo + normal map). Uses Lighting2DUBO from setLighting2D. normal may be null → treate...
Pixel-space sub-rectangle of a Texture (atlas cell / sprite frame). UV conversion uses the texture's ...
Definition Quad.h:11
void getUV(int texW, int texH, float &u0, float &v0, float &u1, float &v1) const
Convert pixel rect to normalized UVs for a texture of size texW×texH.
Definition Quad.cpp:18
static void render(Graphics &gfx)
Full sprite pass + present (existing tests / sprite-only scenes).
Definition RenderSystem.cpp:601
static void collectSprites(std::vector< DrawItem2D > &out)
Append visible Renderable2D sprites into a shared queue.
Definition RenderSystem.cpp:390
static void drawItems(Graphics &gfx, std::vector< DrawItem2D > &items, bool present)
Sort and draw items. If present=true, calls gfx.present() at the end. Map::render uses present=false ...
Definition RenderSystem.cpp:460
void setCastOcclusion(bool cast)
Enable or disable volumetric occlusion casting.
Definition RenderSystem.cpp:200
void setVisible(bool visible)
Include or exclude the sprite from collection.
Definition RenderSystem.cpp:61
void setBlend(const std::string &blend)
Set blend mode (alpha or additive).
Definition RenderSystem.cpp:65
void setNormalTexture(Texture *texture)
Assign an optional tangent-space normal map for the GPU lit2d path.
Definition RenderSystem.cpp:49
void setFrameLayout(int sourceW, int sourceH, int trimW, int trimH, int offsetX, int offsetY)
Apply trimmed-frame layout while preserving the original canvas origin.
Definition RenderSystem.cpp:96
void setFlip(bool horizontal, bool vertical)
Mirror atlas UVs without changing transform scale.
Definition RenderSystem.cpp:90
Texture * getNormalTexture()
Return the assigned normal map, or nullptr when unlit/flat. @ownership Returns a borrowed Texture*; t...
Definition RenderSystem.cpp:50
bool getCastOcclusion()
Return whether the sprite casts volumetric occlusion.
Definition RenderSystem.cpp:202
void setAnchor(float x, float y)
Set normalized transform pivot; (0,0) top-left, (0.5,0.5) center.
Definition RenderSystem.cpp:84
void setSize(float width, float height)
Set unscaled sprite dimensions in pixels.
Definition RenderSystem.cpp:39
void setReceiveLight(bool receive)
Enable or disable 2D light reception.
Definition RenderSystem.cpp:63
GPU texture created via Graphics::newTexture. Owns GPU resources through an opaque backend handle.
Definition Texture.h:15
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
void light2dSpotCosines(float angleDeg, float softness, float &cosOuter, float &cosInner)
Backward-compatible alias for lightSpotCosines.
Definition Light.h:39
eve::Color Color
RGBA color used by every graphics draw call. Lives inside eve::graphics so including a graphics heade...
Definition Color.h:13
float snapWorldToPixel(float world, float zoom)
Snap a world coordinate onto the pixel grid for the given zoom.
Definition CameraPixel.h:53
void sortDrawItems2D(std::vector< DrawItem2D > &items)
Sort draw items 2 d.
Definition DrawItem2D.h:62
PixelPerfectScale computePixelPerfectScale(float pixelsPerUnit, int refWidth, int refHeight, int viewWidth, int viewHeight)
Compute integer scale and projection spans for a perfect-pixel camera.
Definition CameraPixel.h:31
@ InvalidArgument
@ Premultiplied
@ Additive
@ Alpha
@ Multiply
@ Opaque
float camX
Screen-space camera already resolved; if cameraEntity set, RenderSystem resolves.
Definition DrawItem2D.h:55
float anchorX
Normalized transform pivot; (0,0) top-left, (0.5,0.5) center.
Definition DrawItem2D.h:28
float rotation
Degrees, clockwise, around the rectangle center (screen Y-down).
Definition DrawItem2D.h:26