Represents one single instance of a mesh.
The World property can be used to move the instance. All other SunBurn properties aren't used
Inheritance: SceneEntity
Example #1
0
        /// <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);
        }
Example #2
0
        /// <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;
        }
Example #3
0
        /// <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);
        }
Example #4
0
        /// <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;
        }