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); }
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)); } }
public ShotModelData(World world, ShotProperty property) { Property = property; World = world; Bones = Property.Type.CreateBones(world, property); }
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); }
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); }
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); }
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); } } }
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]; } }
public abstract PmxMaterialData[] CreateMaterials(World wolrd, ShotProperty prop);
public abstract string[] CreateTextures(World wolrd, ShotProperty prop);
public EntityShootable(World world, ShotProperty property) : base(world, property) { }
public bool Equals(ShotProperty p) => p.Color == Color && Type == p.Type && ShotGroup == p.ShotGroup;
public bool GroupEquals(ShotProperty p) => p.Color == Color && Type == p.Type && (ShotGroup & p.ShotGroup) > 0;
public abstract PmxVertexData[] CreateVertices(World wolrd, ShotProperty prop);
public abstract int[] CreateVertexIndices(World wolrd, ShotProperty prop);
public abstract PmxMorphData[] CreateMorphs(World world, ShotProperty prop);
public abstract PmxBoneData[] CreateBones(World wolrd, ShotProperty prop);
private int GetPropertyHashCode(ShotProperty prop, Entity entity) { return(prop.GetHashCode() * 23 + (entity != null ? entity.EntityId : -1)); }
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)); }
public bool Equals(ShotProperty p) => p.Color == Color && Type == p.Type && Scale == p.Scale;