engine/particle/src/test/test_particle.cpp
/**
* Verify particles stretch with magnitude according to set stretch factors
*/
Verify particles stretch with magnitude according to set stretch factors
Verify particles stretch with magnitude according to set stretch factors
TEST_F(ParticleTest, ParticleStretch)
{
    float dt = 1.0f;
    ASSERT_TRUE(LoadPrototype("stretch.particlefxc", &m_Prototype));
    dmParticle::HInstance instance = dmParticle::CreateInstance(m_Context, m_Prototype, 0x0);
    dmParticle::Emitter* e = GetEmitter(m_Context, instance, 0);
    dmParticle::StartInstance(m_Context, instance);
    dmParticle::Update(m_Context, dt, 0x0);
    ASSERT_NEAR(2.f, e->m_Particles[0].m_Scale[0], EPSILON);
    ASSERT_NEAR(4.f, e->m_Particles[0].m_Scale[1], EPSILON);
    dmParticle::Update(m_Context, dt, 0x0);
    ASSERT_NEAR(2.f, e->m_Particles[0].m_Scale[0], EPSILON);
    ASSERT_NEAR(2.f, e->m_Particles[0].m_Scale[1], EPSILON);
    dmParticle::DestroyInstance(m_Context, instance);
}
TEST_F ( ParticleTest , ParticleStretch ) { float dt = 1.0f ; ASSERT_TRUE ( LoadPrototype ( " " , & m_Prototype ) ) ; dmParticle :: HInstance instance = dmParticle :: CreateInstance ( m_Context , m_Prototype , 0x0 ) ; dmParticle :: Emitter * e = GetEmitter ( m_Context , instance , 0 ) ; dmParticle :: StartInstance ( m_Context , instance ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; ASSERT_NEAR ( 2.f , e -> m_Particles [ 0 ] . m_Scale [ 0 ] , EPSILON ) ; ASSERT_NEAR ( 4.f , e -> m_Particles [ 0 ] . m_Scale [ 1 ] , EPSILON ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; ASSERT_NEAR ( 2.f , e -> m_Particles [ 0 ] . m_Scale [ 0 ] , EPSILON ) ; ASSERT_NEAR ( 2.f , e -> m_Particles [ 0 ] . m_Scale [ 1 ] , EPSILON ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; }
Verify particles stretch with magnitude according to set stretch factors
Verify particles stretch with magnitude according to set stretch factors