public void ComputeUsingThreads_ComputeThread(NeoAxis.Component_ComputeUsingThreads sender, int threadIndex) { var data = sender.Context.AnyData as Data; if (data == null) { return; } var objects = data.Objects; //get range of objects for the thread var from = (data.Objects.Length * threadIndex) / sender.ThreadCount; var to = (data.Objects.Length * (threadIndex + 1)) / sender.ThreadCount; var random = new NeoAxis.Random(0); //(int)(Time.Current * 0.25)); //compute objects for (int n = from; n < to; n++) { ref var obj = ref objects[n]; var x = n % 100; var y = n / 100; var wavingStart = random.Next(Math.PI * 2); var wavingCycle = random.Next(1.0, 2.0); //use AnyData to store additional data in the object //obj.AnyData = ; obj.Element = (ushort)random.Next(2); obj.Flags = Component_GroupOfObjects.Object.FlagsEnum.Enabled | Component_GroupOfObjects.Object.FlagsEnum.Visible; obj.Position = new Vector3(x * 1.3, y * 1.3, 1.0 + Math.Sin(wavingStart + Time.Current * wavingCycle) * 0.25); obj.Rotation = QuaternionF.Identity; obj.Scale = new Vector3F(1, 1, 1); obj.Color = new ColorValue(random.NextFloat(), random.NextFloat(), random.NextFloat()); //var pos = new Vector3(n * 1.3, 0, 1); //var rot = QuaternionF.Identity; //var scl = new Vector3F(1, 1, 1); //data.Objects[n] = new Component_GroupOfObjects.Object(0, 0, 0, Component_GroupOfObjects.Object.FlagsEnum.Enabled | Component_GroupOfObjects.Object.FlagsEnum.Visible, pos, rot, scl, Vector4F.Zero, ColorValue.One, Vector4F.Zero, Vector4F.Zero); }