Cleanup
This commit is contained in:
@@ -18,23 +18,25 @@ private:
|
||||
///Pitch Yaw Roll, The orientation of the entity in the world,
|
||||
Vector3 angle = {0,0,0};
|
||||
///Loads the texture for the entity.
|
||||
virtual void loadTexture();
|
||||
///Loads the geometry for it.
|
||||
void loadGeometry();
|
||||
|
||||
///The scale it should be rendered at.
|
||||
Vector3 scale = {1.0f, 1.0f, 1.0f};
|
||||
protected:
|
||||
std::string modelPath;
|
||||
std::string texturePath;
|
||||
///If the entity has a parent entity, It's here.
|
||||
Entity* parent;
|
||||
///Entity list of child entities.
|
||||
std::vector<Entity*> children;
|
||||
|
||||
///Loads the geometry for it.
|
||||
void loadGeometry(const std::string& file);
|
||||
void loadTexture(const std::string& file);
|
||||
void loadMultiTexture(const std::vector<std::string>& files);
|
||||
void loadMotionTexture(const std::vector<std::string>& files, u16 frameDelta, bool doAnim = true);
|
||||
|
||||
public:
|
||||
std::string name; //Entity name. TODO remove this.
|
||||
bool alive;
|
||||
|
||||
|
||||
virtual std::vector<std::string> GetEntityUUIDList() const { return std::vector<std::string> { "" }; }
|
||||
|
||||
template <class T>
|
||||
|
@@ -33,22 +33,24 @@ public:
|
||||
void erase() override;
|
||||
///Every texture other than the base texture.
|
||||
std::vector<Texture> multi;
|
||||
///Loads a multi-texture from a given directory. One must be called "default.png"
|
||||
MultiTexture(Entity* entity, const char* pathContainingTextures, bool storeOnTextureList);
|
||||
///Loads a list of Textures into a MultiTexture.
|
||||
MultiTexture(Entity* entity, const std::vector<std::string>& textures, bool storeOnTextureList);
|
||||
MultiTexture() = default;
|
||||
//TODO load multi-texture from array of std::string of file names.
|
||||
};
|
||||
|
||||
///A list of textures where the one actually displayed depends on how much time has elapsed.
|
||||
class MotionTexture : public Texture {
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point lastUpdate;
|
||||
int lastDisplayedIndex;
|
||||
u16 msDelay;
|
||||
public:
|
||||
int lastDisplayedIndex = 0;
|
||||
u16 msDelay = 0;
|
||||
bool doAnim = true;
|
||||
public:
|
||||
std::vector<Texture> motion;
|
||||
Texture* current();
|
||||
MotionTexture(Entity* entity, const std::vector<std::string>& textures,u16 msBetweenFrames, bool storeOnTextureList);
|
||||
Texture* base();
|
||||
void advance();
|
||||
void toggleAnim();
|
||||
MotionTexture(Entity* entity, const std::vector<std::string>& textures,u16 msBetweenFrames, bool storeOnTextureList, bool doAnim = true);
|
||||
MotionTexture() = default;
|
||||
};
|
Reference in New Issue
Block a user