Change demo to showcase instancing.
This commit is contained in:
@@ -21,8 +21,9 @@ public:
|
||||
* If there is no instanced alpha mask and unique alpha mask is set
|
||||
* to nullptr, Then there is no alpha mask. - Redacted.
|
||||
*/
|
||||
~InstancedSprite() override;
|
||||
InstancedSprite(const Vector2& position, unsigned int layer, const std::string& instanced_texture_filesystem_path,
|
||||
float face_angle = 0.0f, const Color4& base_color = Colors::White, Texture* unique_alpha_mask = nullptr, const std::string& instanced_alpha_mask_filesystem_path = "")
|
||||
: texture_path(instanced_texture_filesystem_path), alpha_mask_path(instanced_alpha_mask_filesystem_path),
|
||||
Sprite(position, layer, face_angle, base_color, nullptr, unique_alpha_mask) {}
|
||||
: Sprite(position, layer, face_angle, base_color, nullptr, unique_alpha_mask), texture_path(instanced_texture_filesystem_path),
|
||||
alpha_mask_path(instanced_alpha_mask_filesystem_path) {}
|
||||
};
|
||||
|
@@ -34,8 +34,11 @@ public:
|
||||
[[nodiscard]] size_t EntityCount() const;
|
||||
[[nodiscard]] std::string GetName() const;
|
||||
[[nodiscard]] Camera* GetActiveCamera() const;
|
||||
[[nodiscard]] Texture* GetInstancedTexture(const InstancedSprite* user);
|
||||
[[nodiscard]] Texture* GetInstancedAlphaMask(const InstancedSprite* user);
|
||||
[[nodiscard]] InstancedTexture* GetInstancedTexture(const InstancedSprite* user);
|
||||
[[nodiscard]] InstancedTexture* GetInstancedAlphaMask(const InstancedSprite* user);
|
||||
void DestroyInstancedTexture(const InstancedTexture* itx);
|
||||
void DestroyInstancedAlphaMask(const InstancedTexture* alpha_mask);
|
||||
|
||||
public:
|
||||
void AppendEntity(Entity* entity);
|
||||
void AppendFixed(Fixed* fixed);
|
||||
|
@@ -1,17 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <Engine/types/entity/Entity.h>
|
||||
#include <Engine/types/entity/mixins/Movable.h>
|
||||
#include <Engine/types/entity/mixins/Renderable.h>
|
||||
#include <Engine/types/entity/InstancedSprite.h>
|
||||
|
||||
namespace Game {
|
||||
class Box;
|
||||
}
|
||||
|
||||
class Game::Box final : public Engine::Entity, public Engine::Renderable, public Engine::Movable {
|
||||
class Game::Box final : public Engine::InstancedSprite {
|
||||
public:
|
||||
void Render() final;
|
||||
void Update() final;
|
||||
public:
|
||||
explicit Box(const Vector2& position, unsigned int depth = 0, float rotation = 0.0f) : Renderable(depth), Movable(position, rotation) {}
|
||||
explicit Box(const Vector2& position, unsigned int depth = 0, float rad_rotation = 0.0f) : Engine::InstancedSprite(position, depth, "assets/sprites/Re3D.png", rad_rotation) {}
|
||||
};
|
Reference in New Issue
Block a user