예제 #1
0
        public override string[] CreateTextures(World wolrd, ShotProperty prop)
        {
            string[] result = new string[OriginalData.TextureFiles.Length];
            Array.Copy(OriginalData.TextureFiles, result, OriginalData.TextureFiles.Length);

            return(result);
        }
예제 #2
0
        public void CreateMaterials(ShotProperty prop, string[] modelTextures, int propCount, out PmxMaterialData[] materials)
        {
            var textures = prop.Type.CreateTextures(World, prop);

            materials = prop.Type.CreateMaterials(World, prop);
            prop.Type.InitModelData(prop, materials);

            int GetTextureId(int id) => (0 <= id && id < textures.Length) ? Array.IndexOf(modelTextures, textures[id]) : -1;

            foreach (var(material, i) in materials.Select((item, idx) => (item, idx)))
            {
                material.MaterialName = prop.Type.Name + "_" + GetHexColorCode(prop.Color) + (materials.Length != 1 ? "_" + i : "");

                material.TextureId  = GetTextureId(material.TextureId);
                material.SphereId   = GetTextureId(material.SphereId);
                material.FaceCount *= propCount;
            }

            string GetHexColorCode(int i)
            {
                string hex = i.ToString("X");

                return("0x" + (hex.Length == 6 ? hex : new string('0', 6 - hex.Length) + hex));
            }
        }
예제 #3
0
        public ShotModelData(World world, ShotProperty property)
        {
            Property = property;
            World    = world;

            Bones = Property.Type.CreateBones(world, property);
        }
예제 #4
0
        public override int[] CreateVertexIndices(World wolrd, ShotProperty prop)
        {
            int[] result = new int[OriginalData.VertexIndices.Length];
            Array.Copy(OriginalData.VertexIndices, result, OriginalData.VertexIndices.Length);

            return(result);
        }
예제 #5
0
 public override PmxBoneData[] CreateBones(World wolrd, ShotProperty prop)
 {
     PmxBoneData[] result = new PmxBoneData[OriginalData.BoneArray.Length];
     for (int i = 0; i < result.Length; i++)
     {
         result[i] = CloneUtil.Clone(OriginalData.BoneArray[i]);
     }
     return(result);
 }
예제 #6
0
 public override PmxVertexData[] CreateVertices(World wolrd, ShotProperty prop)
 {
     PmxVertexData[] result = new PmxVertexData[OriginalData.VertexArray.Length];
     for (int i = 0; i < result.Length; i++)
     {
         var clone = result[i] = CloneUtil.Clone(OriginalData.VertexArray[i]);
         clone.Pos = (Vector4)clone.Pos * prop.Scale;
     }
     return(result);
 }
예제 #7
0
 public virtual void InitModelData(ShotProperty prop, PmxMaterialData[] materials)
 {
     if (materials != null)
     {
         foreach (var material in materials)
         {
             material.Diffuse = new Vector4(prop.Red, prop.Green, prop.Blue, 1);
             material.Ambient = new Vector3(prop.Red, prop.Green, prop.Blue);
         }
     }
 }
예제 #8
0
 public EntityShotBase(World world, ShotProperty property) : base(world)
 {
     try
     {
         Property = property;
     }
     catch (Exception e)
     {
         try { Console.WriteLine(World.Executor.FormatException(e)); } catch { }
         Console.WriteLine(e);
     }
 }
        public ShotModelData(World world, ShotProperty property)
        {
            Property = property;
            World    = world;

            Bones = Property.Type.CreateBones(world, property);

            if (Property.Type.HasMesh)
            {
                Vertices  = Property.Type.CreateVertices(world, property);
                Indices   = Property.Type.CreateVertexIndices(world, property);
                Materials = Property.Type.CreateMaterials(world, property);
                Textures  = Property.Type.CreateTextures(world, property);
            }
            else
            {
                Vertices  = new PmxVertexData[0];
                Indices   = new int[0];
                Materials = new PmxMaterialData[0];
                Textures  = new string[0];
            }
        }
예제 #10
0
 public abstract PmxMaterialData[] CreateMaterials(World wolrd, ShotProperty prop);
예제 #11
0
 public abstract string[] CreateTextures(World wolrd, ShotProperty prop);
예제 #12
0
 public EntityShootable(World world, ShotProperty property) : base(world, property)
 {
 }
예제 #13
0
 public bool Equals(ShotProperty p) => p.Color == Color && Type == p.Type && ShotGroup == p.ShotGroup;
예제 #14
0
 public bool GroupEquals(ShotProperty p) => p.Color == Color && Type == p.Type && (ShotGroup & p.ShotGroup) > 0;
예제 #15
0
 public abstract PmxVertexData[] CreateVertices(World wolrd, ShotProperty prop);
예제 #16
0
 public abstract int[] CreateVertexIndices(World wolrd, ShotProperty prop);
예제 #17
0
 public abstract PmxMorphData[] CreateMorphs(World world, ShotProperty prop);
예제 #18
0
 public abstract PmxBoneData[] CreateBones(World wolrd, ShotProperty prop);
예제 #19
0
 private int GetPropertyHashCode(ShotProperty prop, Entity entity)
 {
     return(prop.GetHashCode() * 23 + (entity != null ? entity.EntityId : -1));
 }
예제 #20
0
 public static bool EplisionEquals(ShotProperty p1, ShotProperty p2, float epsilon)
 {
     return(p1.Color == p2.Color && p1.Type == p2.Type && Matrix4.EpsilonEquals(p1.Scale, p2.Scale, epsilon));
 }
예제 #21
0
 public bool Equals(ShotProperty p) => p.Color == Color && Type == p.Type && Scale == p.Scale;