Example #1
0
        /// <summary>
        /// Create the mesh renderer component.
        /// </summary>
        /// <param name="model">Path of the model asset to draw.</param>
        /// <param name="meshName">Which mesh to draw from model.</param>
        public ModelMeshRenderer(string model, string meshName)
        {
            Model     modelInstance = Resources.GetModel(model);
            ModelMesh mesh          = modelInstance.Meshes[meshName];

            _entity = new Core.Graphics.MeshEntity(modelInstance, mesh);
        }
Example #2
0
        /// <summary>
        /// Clone this component.
        /// </summary>
        /// <returns>Cloned copy of this component.</returns>
        override public BaseComponent Clone()
        {
            CompositeModelRenderer ret = new CompositeModelRenderer(_entity.Model);

            CopyBasics(ret);
            for (int i = 0; i < _entity.MeshesCount; ++i)
            {
                Core.Graphics.MeshEntity other = ret.GetMesh(i);
                Core.Graphics.MeshEntity self  = GetMesh(i);
                other.MaterialOverride = self.MaterialOverride.Clone();
                other.BlendingState    = self.BlendingState;
                other.SetMaterials(self.OverrideMaterials);
                other.RenderingQueue = self.RenderingQueue;
            }
            return(ret);
        }
Example #3
0
 /// <summary>
 /// Create the model renderer component.
 /// </summary>
 /// <param name="model">Model to draw.</param>
 /// <param name="mesh">Mesh to draw.</param>
 public ModelMeshRenderer(Model model, ModelMesh mesh)
 {
     _entity = new Core.Graphics.MeshEntity(model, mesh);
 }