예제 #1
0
        public void SetModelEffect(Effect effect, bool CopyEffect)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    Effect toSet = effect;
                    //Copy the effect if necessary
                    if (CopyEffect)
                    {
                        toSet = effect.Clone();
                    }

                    MeshTag tag = ((MeshTag)part.Tag);

                    if (tag.Texture != null)
                    {
                        setEffectParameter(toSet, "xTexture", tag.Texture);
                    }
                    else
                    {
                    }


                    part.Effect = toSet;
                }
            }
        }
예제 #2
0
 private void generateTags()
 {
     foreach (ModelMesh mesh in model.Meshes)
     {
         foreach (ModelMeshPart part in mesh.MeshParts)
         {
             if (part.Effect is BasicEffect)
             {
                 BasicEffect effect = (BasicEffect)part.Effect;
                 MeshTag     tag    = new MeshTag(effect.DiffuseColor, effect.Texture, effect.SpecularPower);
                 part.Tag = tag;
             }
         }
     }
 }