2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CUVELEMENT_HPP__
|
|
|
|
#define __URDE_CUVELEMENT_HPP__
|
2016-02-05 01:27:03 +00:00
|
|
|
|
2016-02-05 08:34:14 +00:00
|
|
|
#include "IElement.hpp"
|
2016-02-06 00:34:40 +00:00
|
|
|
#include "CToken.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "Graphics/CTexture.hpp"
|
2016-02-05 08:34:14 +00:00
|
|
|
|
2016-02-28 06:55:05 +00:00
|
|
|
/* Documentation at: http://www.metroid2002.com/retromodding/wiki/Particle_Script#UV_Elements */
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2016-02-05 01:27:03 +00:00
|
|
|
{
|
2016-02-05 08:34:14 +00:00
|
|
|
class CToken;
|
|
|
|
|
|
|
|
struct SUVElementSet
|
|
|
|
{
|
|
|
|
float xMin, yMin, xMax, yMax;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CUVElement : public IElement
|
|
|
|
{
|
|
|
|
public:
|
2016-02-08 05:10:17 +00:00
|
|
|
virtual TLockedToken<CTexture> GetValueTexture(int frame) const=0;
|
2016-02-05 08:34:14 +00:00
|
|
|
virtual void GetValueUV(int frame, SUVElementSet& valOut) const=0;
|
2016-02-06 00:34:40 +00:00
|
|
|
virtual bool HasConstantTexture() const=0;
|
|
|
|
virtual bool HasConstantUV() const=0;
|
2016-02-05 08:34:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CUVEConstant : public CUVElement
|
|
|
|
{
|
2016-02-08 05:10:17 +00:00
|
|
|
TLockedToken<CTexture> x4_tex;
|
2016-02-05 08:34:14 +00:00
|
|
|
public:
|
2016-02-06 00:34:40 +00:00
|
|
|
CUVEConstant(TToken<CTexture>&& tex)
|
2016-04-02 08:42:00 +00:00
|
|
|
: x4_tex(std::move(tex))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2016-02-08 05:10:17 +00:00
|
|
|
TLockedToken<CTexture> GetValueTexture(int frame) const
|
2016-02-06 00:34:40 +00:00
|
|
|
{
|
2016-02-08 05:10:17 +00:00
|
|
|
return TLockedToken<CTexture>(x4_tex);
|
2016-02-06 00:34:40 +00:00
|
|
|
}
|
|
|
|
void GetValueUV(int frame, SUVElementSet& valOut) const
|
|
|
|
{
|
|
|
|
valOut = {0.f, 0.f, 1.f, 1.f};
|
|
|
|
}
|
|
|
|
bool HasConstantTexture() const {return true;}
|
|
|
|
bool HasConstantUV() const {return true;}
|
2016-02-05 08:34:14 +00:00
|
|
|
};
|
2016-02-05 01:27:03 +00:00
|
|
|
|
2016-02-05 08:34:14 +00:00
|
|
|
struct CUVEAnimTexture : public CUVElement
|
2016-02-05 01:27:03 +00:00
|
|
|
{
|
2016-02-08 05:10:17 +00:00
|
|
|
TLockedToken<CTexture> x4_tex;
|
2016-02-06 07:31:53 +00:00
|
|
|
int x10_tileW, x14_tileH, x18_strideW, x1c_strideH;
|
2016-02-06 00:34:40 +00:00
|
|
|
int x20_tiles;
|
|
|
|
bool x24_loop;
|
2016-02-29 03:03:11 +00:00
|
|
|
std::unique_ptr<CIntElement> x28_cycleFrames;
|
2016-02-06 00:34:40 +00:00
|
|
|
std::vector<SUVElementSet> x2c_uvElems;
|
2016-02-05 08:34:14 +00:00
|
|
|
public:
|
2016-02-06 00:34:40 +00:00
|
|
|
CUVEAnimTexture(TToken<CTexture>&& tex, CIntElement* a, CIntElement* b,
|
|
|
|
CIntElement* c, CIntElement* d, CIntElement* e, bool f);
|
2016-02-08 05:10:17 +00:00
|
|
|
TLockedToken<CTexture> GetValueTexture(int frame) const
|
2016-02-06 00:34:40 +00:00
|
|
|
{
|
2016-02-08 05:10:17 +00:00
|
|
|
return TLockedToken<CTexture>(x4_tex);
|
2016-02-06 00:34:40 +00:00
|
|
|
}
|
2016-02-05 08:34:14 +00:00
|
|
|
void GetValueUV(int frame, SUVElementSet& valOut) const;
|
2016-02-06 00:34:40 +00:00
|
|
|
bool HasConstantTexture() const {return true;}
|
|
|
|
bool HasConstantUV() const {return false;}
|
2016-02-05 01:27:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CUVELEMENT_HPP__
|