engine/particle/src/test/test_particle.cpp
/**
* Verify particle rotation along movement direction
*/
Verify particle rotation along movement direction
Verify particle rotation along movement direction
TEST_F(ParticleTest, ParticleOrientationMovementDirection)
{
    float dt = 1.0f;
    ASSERT_TRUE(LoadPrototype("movement_direction.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);
    Quat q = e->m_Particles[0].GetRotation();
    ASSERT_EQ(0.0f, q.getX());
    ASSERT_EQ(0.0f, q.getY());
    ASSERT_NEAR(cos(M_PI / 4.0f), q.getZ(), EPSILON);
    ASSERT_NEAR(cos(M_PI / 4.0f), q.getW(), EPSILON);
    dmParticle::DestroyInstance(m_Context, instance);
}
TEST_F ( ParticleTest , ParticleOrientationMovementDirection ) { 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 ) ; Quat q = e -> m_Particles [ 0 ] . GetRotation ( ) ; ASSERT_EQ ( 0.0f , q . getX ( ) ) ; ASSERT_EQ ( 0.0f , q . getY ( ) ) ; ASSERT_NEAR ( cos ( M_PI / 4.0f ) , q . getZ ( ) , EPSILON ) ; ASSERT_NEAR ( cos ( M_PI / 4.0f ) , q . getW ( ) , EPSILON ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; }
Verify particle rotation along movement direction
Verify particle rotation along movement direction
// Represents an euler rotation of 90 deg around Z