18 mTextureName(textureName)
24 const float width =
static_cast<float>(texture->GetCpuImageData().GetWidth());
25 const float height =
static_cast<float>(texture->GetCpuImageData().GetHeight());
27 const std::string materialName =
"Sprite2D_" +
mTextureName +
"Mat";
30 Material* material = materialCache->GetMaterial(materialName);
42 materialCache->AddMaterial(materialSettings);
44 material = materialCache->GetMaterial(materialName);
71 renderBatch.renderResources->SubmitResources(transformations, renderBatch.materialParameters);
Represents a 2D camera with position, rotation, and zoom control.
glm::mat4 GetProjectionMatrix() const
Returns the current orthographic projection matrix.
const glm::mat4 & GetWorldView() const
Gets the world-view (model) matrix for the camera.
2D drawable component for rendering objects in 2D space.
SceneComponent2D & GetTransform()
Access to the underlying SceneComponent2D (transform).
void Update(float deltaTime) override
Updates model matrix (and any other logic).
void Initialize() override
Initializes render resources.
void SetScale(const glm::vec2 &scale)
Sets the quad scale along each axis.
std::vector< RenderBatch > mRenderBatches
RenderResourceContext mRenderContext
void AddRenderBatch(std::string meshName, std::string materialName)
Represents a material instance with parameter values, texture bindings, and rendering configuration.
void InitializeRenderResources()
Initializes backend-specific GPU resources associated with this material.
void AddTexture(const std::string &textureName)
Adds a texture name to the material's list of used textures.
const glm::mat4 & GetWorldMatrix()
Returns the world transformation matrix.
Base class representing a renderable scene.
void SetSpriteScale(float scale)
Sets a uniform scale relative to the sprite's texture size.
glm::vec2 mTextureRespectiveScale
void Update(float deltaTime) override
Updates logic (animation, movement, etc.) for this drawable.
void Initialize() override
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...
void Draw(const Camera2D &camera) override
Submits this quad to the renderer for drawing.
Sprite2D(RenderResourceContext renderContext, Scene &scene, std::string textureName)
Constructs the Sprite2D with a render context.
std::shared_ptr< ImageDataGpu > GetTextureResources(std::string filename)
Retrieves the full texture resource wrapper from cache.
Settings required to define a material instance.
MaterialDomain materialDomain
ShadingModel shadingModel
std::string parentMaterialName
Aggregates pointers to global rendering resource managers.
TextureCache * textureCache
MaterialCache * materialCache