Exemple #1
0
        /*private IMeshPart findOrCreatePart(MeshCoreData.Material original)
         * {
         *  foreach (var mat in materials)
         *      if (isIdenticalMaterial(original, mat.Key)) return mat.Value;
         *
         *  var copy = createMaterialCopy(original);
         *  var ret = createPart(copy);
         *  materials.Add(copy, ret);
         *
         *  return ret;
         *
         * }*/

        private IMeshPart createPart(MeshCoreData.Material material)
        {
            var ret  = new RAMMeshPart();
            var part = new MeshCoreData.Part();

            part.MeshMaterial = material;
            part.ObjectMatrix = Matrix.Identity;
            part.MeshPart     = ret;

            mesh.GetCoreData().Parts.Add(part);

            return(ret);
        }
Exemple #2
0
        private MeshBuilder.MeshMaterial getMaterial(MeshCoreData.Material meshMaterial, MeshBuilder builder)
        {
            MeshBuilder.MeshMaterial mat;
            if (materials.TryGetValue(meshMaterial, out mat))
            {
                return(mat);
            }

            mat = builder.CreateMaterial();
            mat.SetFromMeshCoreDataMaterial(meshMaterial);
            materials[meshMaterial] = mat;

            return(mat);
        }
Exemple #3
0
 private bool isIdenticalMaterial(MeshCoreData.Material a, MeshCoreData.Material b)
 {
     if (a.DiffuseColor != b.DiffuseColor)
     {
         return(false);
     }
     if (a.DiffuseMap != b.DiffuseMap)
     {
         return(false);
     }
     if (a.Name != b.Name)
     {
         return(false);
     }
     return(true);
 }
        public static IMesh CreateSimpleTestMesh()
        {
            IMesh mesh;

            mesh = new RAMMesh();

            var part = new MeshCoreData.Part();

            part.ObjectMatrix = Matrix.Identity;
            part.MeshPart     = new RAMMeshPart();
            ((RAMMeshPart)part.MeshPart).SetGeometryData(MeshPartGeometryData.CreateTestSquare());

            var mat = new MeshCoreData.Material();

            mat.DiffuseMap = GetTestTexture();

            part.MeshMaterial = mat;
            mesh.GetCoreData().Parts.Add(part);

            return(mesh);
        }
 public void SetFromMeshCoreDataMaterial(MeshCoreData.Material mat)
 {
     DiffuseColor    = mat.DiffuseColor;
     DiffuseMap      = mat.DiffuseMap;
     ColoredMaterial = mat.ColoredMaterial;
 }
Exemple #6
0
 private MeshCoreData.Material createMaterialCopy(MeshCoreData.Material original)
 {
     return(original.Copy());
 }