Added sparks

This commit is contained in:
Vladislav Khorev committed 2026-04-24 19:53:18 +03:00
1 parent 2bb7da2e37
commit 393ebcd831
6 files changed
+202 -27

No files matched your search

+16 -1
View File
@@ -3,6 +3,7 @@
#include "render/Renderer.h"
#include "render/TextureManager.h"
#include "items/Item.h"
#include "SparkEmitter.h"
#include <functional>
#include <memory>
#include <map>
@@ -51,7 +52,19 @@ public:
void drawWithShadow(Renderer& renderer, const Eigen::Matrix4f& lightFromCamera, GLuint shadowMapTex, const Eigen::Vector3f& lightDirCamera);
void applyDamage(float damageAmount);
// attackDirection is a world-space horizontal vector pointing from the
// attacker toward this character — i.e. the direction the hit pushes
// them. A zero vector disables directional sparks (isotropic burst).
void applyDamage(float damageAmount, const Eigen::Vector3f& attackDirection = Eigen::Vector3f::Zero());
// Configures the per-character hit-spark emitter with the shared spark
// texture. Safe to call once per character after construction.
void setupHitSparks(std::shared_ptr<Texture> sparkTexture);
// Call per-frame between update() and draw(), with the active camera
// view matrix (world → eye). The emitter billboards and sorts its
// particles against that camera before its VBO is uploaded.
void prepareHitSparksForDraw(const Eigen::Matrix4f& cameraViewMatrix);
// Public: read by Game for camera tracking and ray-cast origin
Eigen::Vector3f position = Eigen::Vector3f(0.f, 0.f, 0.f);
@@ -92,6 +105,8 @@ public:
std::string weaponAttachBoneName = "RightHand";
bool showWeapon = true;
SparkEmitter hitSparkEmitter;
private: