engine/particle/src/test/test_particle.cpp
// DEF-3355 Parent scale should only affect simulation in EMISSION_SPACE_WORLD
DEF-3355 Parent scale should only affect simulation in EMISSION_SPACE_WORLD
DEF - 3355 Parent scale should only affect simulation in EMISSION_SPACE_WORLD
TEST_F(ParticleTest, AccelerationScaledEmitter)
{
    float dt = 1.0f;
    ASSERT_TRUE(LoadPrototype("mod_acc_em.particlefxc", &m_Prototype));
    Vector3 delta[2];
    for (uint32_t i = 0; i < 2; ++i)
    {
        dmParticle::HInstance instance = dmParticle::CreateInstance(m_Context, m_Prototype, 0x0);
        if (i == 1)
            dmParticle::SetScale(m_Context, instance, 2.0f);
        uint16_t index = instance & 0xffff;
        dmParticle::Instance* inst = m_Context->m_Instances[index];
        dmParticle::StartInstance(m_Context, instance);
        dmParticle::Update(m_Context, dt, 0x0);
        dmParticle::Particle* particle = &inst->m_Emitters[0].m_Particles[0];
        delta[i] = Vector3(particle->GetPosition());
        dmParticle::DestroyInstance(m_Context, instance);
    }
    ASSERT_EQ(delta[0].getX(), delta[1].getX());
    ASSERT_EQ(delta[0].getY(), delta[1].getY());
    ASSERT_EQ(delta[0].getZ(), delta[1].getZ());
}
TEST_F ( ParticleTest , AccelerationScaledEmitter ) { float dt = 1.0f ; ASSERT_TRUE ( LoadPrototype ( " " , & m_Prototype ) ) ; Vector3 delta [ 2 ] ; for ( uint32_t i = 0 ; i < 2 ; ++ i ) { dmParticle :: HInstance instance = dmParticle :: CreateInstance ( m_Context , m_Prototype , 0x0 ) ; if ( i == 1 ) dmParticle :: SetScale ( m_Context , instance , 2.0f ) ; uint16_t index = instance & 0xffff ; dmParticle :: Instance * inst = m_Context -> m_Instances [ index ] ; dmParticle :: StartInstance ( m_Context , instance ) ; dmParticle :: Update ( m_Context , dt , 0x0 ) ; dmParticle :: Particle * particle = & inst -> m_Emitters [ 0 ] . m_Particles [ 0 ] ; delta [ i ] = Vector3 ( particle -> GetPosition ( ) ) ; dmParticle :: DestroyInstance ( m_Context , instance ) ; } ASSERT_EQ ( delta [ 0 ] . getX ( ) , delta [ 1 ] . getX ( ) ) ; ASSERT_EQ ( delta [ 0 ] . getY ( ) , delta [ 1 ] . getY ( ) ) ; ASSERT_EQ ( delta [ 0 ] . getZ ( ) , delta [ 1 ] . getZ ( ) ) ; }
DEF-3355 Parent scale should only affect simulation in EMISSION_SPACE_WORLD
DEF - 3355 Parent scale should only affect simulation in EMISSION_SPACE_WORLD
// Set scale should not affect position in emitter space