public override void Capture() { if (m_target == null) { return; } // create buffer int count_max = m_target.main.maxParticles; if (m_buf_particles == null || m_buf_particles.Length != count_max) { m_buf_particles = new ParticleSystem.Particle[count_max]; m_buf_positions.Resize(count_max); m_buf_rotations.Resize(count_max); } // copy particle positions & rotations to buffer int count = m_target.GetParticles(m_buf_particles); for (int i = 0; i < count; ++i) { m_buf_positions[i] = m_buf_particles[i].position; } for (int i = 0; i < count; ++i) { var a = m_buf_particles[i].axisOfRotation; m_buf_rotations[i].Set(a.x, a.y, a.z, m_buf_particles[i].rotation); } // write! var data = new aePointsData(); data.positions = m_buf_positions; data.count = count; m_abc.WriteSample(ref data); m_prop_rotatrions.WriteArraySample(m_buf_rotations, count); }
[DllImport("abci")] public static extern void aePointsWriteSample(aeObject obj, ref aePointsData data);
[DllImport("abci")] static extern void aePointsWriteSample(IntPtr self, ref aePointsData data);
public void WriteSample(ref aePointsData data) { aePointsWriteSample(self, ref data); }