/// <summary> /// Creates an array of instances of the mesh /// </summary> /// <param name = "names">The names array for all the instances to be created</param> /// <param name = "transforms">The World matrix array for all the instances to be created</param> /// <returns>Returns the array of InstanceEntity created</returns> public InstanceEntity[] CreateInstances(string[] names, Matrix[] transforms) { var instances = new InstanceEntity[names.Length]; for (int i = 0; i < names.Length; i++) { instances[i] = CreateInstance(names[i], transforms[i]); } return(instances); }
/// <summary> /// Create one unique instance of the mesh /// </summary> /// <param name = "name">The name of the instance</param> /// <param name = "transform">The Matrix containing the instance World position/rotation/scale</param> /// <returns>Returns the created InstanceEntity so the developer can change its World matrix</returns> public InstanceEntity CreateInstance(string name, Matrix transform) { var instanceIndex = _instancesCount%75; if (_instancesCount < 75) { AddGeometry(instanceIndex); BuildGeometry(); } var instanceEntity = new InstanceEntity(name, instanceIndex, GetSceneObject(), transform); _entities.Add(instanceEntity); _instancesCount++; if(_instancesCount >= 75) ClearIntermediateData(); return instanceEntity; }
/// <summary> /// Create one unique instance of the mesh /// </summary> /// <param name = "name">The name of the instance</param> /// <param name = "transform">The Matrix containing the instance World position/rotation/scale</param> /// <returns>Returns the created InstanceEntity so the developer can change its World matrix</returns> public InstanceEntity CreateInstance(string name, Matrix transform) { var instanceIndex = _instancesCount % 75; if (_instancesCount < 75) { AddGeometry(instanceIndex); BuildGeometry(); } var instanceEntity = new InstanceEntity(name, instanceIndex, GetSceneObject(), transform); _entities.Add(instanceEntity); _instancesCount++; if (_instancesCount >= 75) { ClearIntermediateData(); } return(instanceEntity); }
/// <summary> /// Creates an array of instances of the mesh /// </summary> /// <param name = "names">The names array for all the instances to be created</param> /// <param name = "transforms">The World matrix array for all the instances to be created</param> /// <returns>Returns the array of InstanceEntity created</returns> public InstanceEntity[] CreateInstances(string[] names, Matrix[] transforms) { var instances = new InstanceEntity[names.Length]; for (int i = 0; i < names.Length; i++) { instances[i] = CreateInstance(names[i], transforms[i]); } return instances; }