engine/particle/src/test/test_particle.cpp
/**
 * Verify that particles exist in the correct space
 */
Verify that particles exist in the correct space
Verify that particles exist in the correct space
TEST_F(ParticleTest, EmissionSpace)
{
    float dt = 1.0f;
    ASSERT_TRUE(LoadPrototype("world_space.particlefxc", &m_Prototype));
    dmParticle::HInstance instance = dmParticle::CreateInstance(m_Context, m_Prototype, 0x0);
    dmParticle::SetPosition(m_Context, instance, Vectormath::Aos::Point3(10.0f, 0.0f, 0.0f));
    dmParticle::StartInstance(m_Context, instance);
    dmParticle::Update(m_Context, dt, 0x0);
    dmParticle::Emitter* e = GetEmitter(m_Context, instance, 0);
    dmParticle::Particle* p = &e->m_Particles[0];
    ASSERT_EQ(10.0f, p->GetPosition().getX());
    dmParticle::DestroyInstance(m_Context, instance);
    dmParticle::Particle_DeletePrototype(m_Prototype);
    ASSERT_TRUE(LoadPrototype("emitter_space.particlefxc", &m_Prototype));
    instance = dmParticle::CreateInstance(m_Context, m_Prototype, 0x0);
    dmParticle::SetPosition(m_Context, instance, Vectormath::Aos::Point3(10.0f, 0.0f, 0.0f));
    dmParticle::StartInstance(m_Context, instance);
    dmParticle::Update(m_Context, dt, 0x0);
    e = GetEmitter(m_Context, instance, 0);
    p = &e->m_Particles[0];
    ASSERT_EQ(0.0f, p->GetPosition().getX());
    dmParticle::DestroyInstance(m_Context, instance);
}
TEST_F ( ParticleTest , EmissionSpace ) { float dt = 1.0f ; ASSERT_TRUE ( LoadPrototype ( " " , & m_Prototype ) ) ; dmParticle :: HInstance instance = dmParticle :: CreateInstance ( m_Context , m_Prototype , 0x0 ) ; dmParticle :: SetPosition ( m_Context , instance , Vectormath :: Aos :: Point3 ( 10.0f , 0.0f , 0.0f ) ) ; dmParticle :: StartInstance ( m_Context , instance ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; dmParticle :: Emitter * e = GetEmitter ( m_Context , instance , 0 ) ; dmParticle :: Particle * p = & e -> m_Particles [ 0 ] ; ASSERT_EQ ( 10.0f , p -> GetPosition ( ) . getX ( ) ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; dmParticle :: Particle_DeletePrototype ( m_Prototype ) ; ASSERT_TRUE ( LoadPrototype ( " " , & m_Prototype ) ) ; instance = dmParticle :: CreateInstance ( m_Context , m_Prototype , 0x0 ) ; dmParticle :: SetPosition ( m_Context , instance , Vectormath :: Aos :: Point3 ( 10.0f , 0.0f , 0.0f ) ) ; dmParticle :: StartInstance ( m_Context , instance ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; e = GetEmitter ( m_Context , instance , 0 ) ; p = & e -> m_Particles [ 0 ] ; ASSERT_EQ ( 0.0f , p -> GetPosition ( ) . getX ( ) ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; }
Verify that particles exist in the correct space
Verify that particles exist in the correct space
// Test world space // Test emitter space