mirror of
https://github.com/wiiu-env/libgui.git
synced 2024-11-14 12:25:10 +01:00
Removed some hardcoded frm the GuiParticleImage
This commit is contained in:
parent
b783255b2d
commit
90ff87fd12
@ -30,12 +30,16 @@ static inline f32 getRandMinusOneToOneF32()
|
||||
return getRandZeroToOneF32() * 2.0f - 1.0f;
|
||||
}
|
||||
|
||||
GuiParticleImage::GuiParticleImage(s32 w, s32 h, u32 particleCount)
|
||||
GuiParticleImage::GuiParticleImage(s32 w, s32 h, u32 particleCount, f32 minRadius, f32 maxRadius, f32 minSpeed, f32 maxSpeed)
|
||||
: GuiImage(NULL)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
imgType = IMAGE_COLOR;
|
||||
this->minRadius = minRadius;
|
||||
this->maxRadius = maxRadius;
|
||||
this->minSpeed = minSpeed;
|
||||
this->maxSpeed = maxSpeed;
|
||||
|
||||
posVertexs = (f32 *) memalign(GX2_VERTEX_BUFFER_ALIGNMENT, ColorShader::cuVertexAttrSize * CIRCLE_VERTEX_COUNT);
|
||||
colorVertexs = (u8 *) memalign(GX2_VERTEX_BUFFER_ALIGNMENT, ColorShader::cuColorAttrSize * CIRCLE_VERTEX_COUNT);
|
||||
@ -62,8 +66,8 @@ GuiParticleImage::GuiParticleImage(s32 w, s32 h, u32 particleCount)
|
||||
particles[i].position.y = getRandMinusOneToOneF32() * getHeight() * 0.5f;
|
||||
particles[i].position.z = 0.0f;
|
||||
particles[i].colors = glm::vec4(1.0f, 1.0f, 1.0f, (getRandZeroToOneF32() * 0.6f) + 0.05f);
|
||||
particles[i].radius = getRandZeroToOneF32() * 30.0f + 60.0f;
|
||||
particles[i].speed = (getRandZeroToOneF32() * 0.4f) + 0.6f;
|
||||
particles[i].radius = getRandZeroToOneF32() * (maxRadius - minRadius) + minRadius;
|
||||
particles[i].speed = (getRandZeroToOneF32() * (maxSpeed - minSpeed)) + minSpeed;
|
||||
particles[i].direction = getRandMinusOneToOneF32();
|
||||
}
|
||||
}
|
||||
@ -97,8 +101,8 @@ void GuiParticleImage::draw(CVideo *pVideo)
|
||||
particles[i].position.x = getRandMinusOneToOneF32() * getWidth() * 0.5f;
|
||||
particles[i].position.y = -getHeight() * 0.5f - 30.0f;
|
||||
particles[i].colors = glm::vec4(1.0f, 1.0f, 1.0f, (getRandZeroToOneF32() * 0.6f) + 0.05f);
|
||||
particles[i].radius = getRandZeroToOneF32() * 30.0f + 60.0f;
|
||||
particles[i].speed = (getRandZeroToOneF32() * 0.4f) + 0.6f;
|
||||
particles[i].radius = getRandZeroToOneF32() * (maxRadius - minRadius) + minRadius;
|
||||
particles[i].speed = (getRandZeroToOneF32() * (maxSpeed - minSpeed)) + minSpeed;
|
||||
particles[i].direction = getRandMinusOneToOneF32();
|
||||
}
|
||||
if(particles[i].position.x < (-getWidth() * 0.5f - 50.0f))
|
||||
|
@ -22,7 +22,7 @@
|
||||
class GuiParticleImage : public GuiImage, public sigslot::has_slots<>
|
||||
{
|
||||
public:
|
||||
GuiParticleImage(s32 w, s32 h, u32 particleCount);
|
||||
GuiParticleImage(s32 w, s32 h, u32 particleCount, f32 minRadius, f32 maxRadius, f32 minSpeed, f32 maxSpeed);
|
||||
virtual ~GuiParticleImage();
|
||||
|
||||
void draw(CVideo *pVideo);
|
||||
@ -30,6 +30,11 @@ private:
|
||||
f32 *posVertexs;
|
||||
u8 *colorVertexs;
|
||||
|
||||
f32 minRadius;
|
||||
f32 maxRadius;
|
||||
f32 minSpeed;
|
||||
f32 maxSpeed;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
glm::vec3 position;
|
||||
|
Loading…
Reference in New Issue
Block a user