SpriteComponent struct in Thread

A textured quad placed in the 3D world (as opposed to a screen-space UI image). Rendered through the batched Renderer2D with the scene camera and depth-tested against geometry. The texture is lazy-loaded from TexturePath at render time.

Properties

TexturePathstd::stringTexture asset path (VFS). Empty = solid quad.
ColorVec4Tint multiplied with the texture (alpha included).
SizeVec2World-space width/height of the quad.
ModeSpriteModeBillboard (always faces camera) or Flat (entity's local XY plane).
EnabledboolMaster switch.

SpriteMode

BillboardenumAlways faces the camera — icons, health bars, impostors.
FlatenumLies in the entity's local XY plane — 2D/2.5D, decals.

Example

auto e = scene.CreateEntity("Icon");
auto& s = e.AddComponent<Thread::SpriteComponent>();
s.TexturePath = "assets/textures/marker.png";
s.Size        = { 1.0f, 1.0f };
s.Mode        = Thread::SpriteMode::Billboard;

For screen-space 2D, use the UI system (UIImage / UICanvas).

SpriteComponent struct w Thread

Teksturowany prostokąt umieszczony w świecie 3D (w odróżnieniu od obrazu UI na ekranie). Renderowany przez wsadowy Renderer2D kamerą sceny, z testem głębi względem geometrii. Tekstura wczytuje się leniwie z TexturePath przy renderowaniu.

Właściwości

TexturePathstd::stringŚcieżka assetu tekstury (VFS). Pusta = jednolity prostokąt.
ColorVec4Odcień mnożony przez teksturę (razem z alfą).
SizeVec2Szerokość/wysokość prostokąta w świecie.
ModeSpriteModeBillboard (zawsze przodem do kamery) lub Flat (lokalna płaszczyzna XY encji).
EnabledboolGłówny przełącznik.

SpriteMode

BillboardenumZawsze przodem do kamery — ikony, paski zdrowia, impostory.
FlatenumLeży w lokalnej płaszczyźnie XY encji — 2D/2.5D, decale.

Przykład

auto e = scene.CreateEntity("Icon");
auto& s = e.AddComponent<Thread::SpriteComponent>();
s.TexturePath = "assets/textures/marker.png";
s.Size        = { 1.0f, 1.0f };
s.Mode        = Thread::SpriteMode::Billboard;

Do 2D na ekranie użyj systemu UI (UIImage / UICanvas).