Exemple #1
0
        private void DrawModel(Renderer rend)
        {
            Model model = rend.model;

            if (model != null)
            {
                Camera cam = GameCache.currentBuffer.camera;
                foreach (var mesh in model.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        ColorS c = rend.material.color;
                        effect.DiffuseColor = rend.loadColorFromMesh ? effect.DiffuseColor : new Vector3(c.r, c.g, c.b);
                        effect.View         = cam.viewMatrix;
                        effect.Projection   = cam.projectionMatrix;
                        effect.World        = mesh.ParentBone.Transform * rend.matrix.ToXNA();
                        effect.CommitChanges();
                    }
                    mesh.Draw();
                }
            }
            else
            {
                Window.Title = "Null!";
            }
        }
Exemple #2
0
 public Renderer(ColorS color, Matrix4x4 _matrix, string _name)
 {
     loadColorFromMesh = false;
     material          = new Material(color);
     matrix            = _matrix;
     modelName         = _name;
     animations        = new AnimWorks(this);
     GameCache.currentBuffer.renderers.Add(this);
 }
Exemple #3
0
 public Material(ColorS c)
 {
     color = c;
 }
Exemple #4
0
 public MeshPoint(Vector p, ColorS c)
 {
     point = p;
     color = c;
 }