public void Setup()
 {
     _source = ClinqTestFactory.CreateSixPersonSourceWithDuplicates();
     _first  = _source[0];
     _second = _source[3];
     _third  = _source[4];
     _target = new ListIndexer <Person>(_source);
 }
Example #2
0
        public int[] GetTriangleIndices()
        {
            var vertIndexer = new ListIndexer <Vertex>(_Vertices);
            var idxList     = new List <int>();

            foreach (var t in Triangles)
            {
                idxList.Add(vertIndexer.IndexOf(t.V1));
                idxList.Add(vertIndexer.IndexOf(t.V2));
                idxList.Add(vertIndexer.IndexOf(t.V3));
            }
            return(idxList.ToArray());
        }
Example #3
0
        private static MESH_DATA SerializeMeshGeometry(MESH_FILE file, ShaderDataHelper shaderData, MeshGeometry meshGeometry)
        {
            var meshData = MESH_DATA.Create(meshGeometry.VertexCount, meshGeometry.IndexCount, file.IsTextured, file.IsFlexible);

            var vertIndexer = new ListIndexer <Vertex>(meshGeometry.Vertices);

            bool isTextured = meshGeometry.IsTextured;

            for (int i = 0; i < meshGeometry.Vertices.Count; i++)
            {
                var vert = meshGeometry.Vertices[i];
                meshData.Positions[i] = vert.Position;
                meshData.Normals[i]   = vert.Normal;

                if (file.IsTextured)
                {
                    meshData.UVs[i] = isTextured ? vert.TexCoord : new Vector2(0f);
                }

                if (file.IsFlexible && vert.BoneWeights.Any())
                {
                    var boneWeights = vert.BoneWeights.Select(x => new MESH_BONE_WEIGHT {
                        BoneID = x.BoneID, Weight = x.Weight
                    });
                    meshData.Bones[i] = new MESH_BONE_MAPPING(boneWeights);
                }
            }

            for (int i = 0; i < meshGeometry.Indices.Count; i++)
            {
                var idx = meshGeometry.Indices[i];
                meshData.Indices[i].VertexIndex = vertIndexer.IndexOf(idx.Vertex);

                meshData.Indices[i].AverageNormalIndex = shaderData.AvgNormals.IndexOf(idx.AverageNormal);

                int reIdx = shaderData.RoundEdgeData.IndexOf(idx.RoundEdgeData);

                int reOffset = reIdx * 12 + ((int)Math.Floor(reIdx / 21d) * 4);

                meshData.Indices[i].REShaderOffset = reOffset;
            }

            return(meshData);
        }
 public void Setup()
 {
     _source = ClinqTestFactory.CreateSixPersonSourceWithDuplicates();
     _first = _source[0];
     _second = _source[3];
     _third = _source[4];
     _target = new ListIndexer<Person>(_source);
 }
Example #5
0
 private void CreateStatus()
 {
     var parameters = new int[StatusKey.HP.GetCount()];
     var indexer = new ListIndexer<StatusKey, int>(parameters);
     indexer[StatusKey.MaxHP] = indexer[StatusKey.HP] = _unit.HP;
     indexer[StatusKey.MaxMP] = indexer[StatusKey.MP] = _unit.MP;
     indexer[StatusKey.Atk] = _unit.Atk;
     indexer[StatusKey.Def] = _unit.Def;
     indexer[StatusKey.Tec] = _unit.Tec;
     indexer[StatusKey.Agi] = _unit.Agi;
     indexer[StatusKey.Mag] = _unit.Mag;
     indexer[StatusKey.Res] = _unit.Res;
     indexer[StatusKey.Mobility] = _unit.Mobility;
     indexer[StatusKey.HpAutoHeal] = _unit.HpHeal;
     indexer[StatusKey.MpAutoHeal] = _unit.MpHeal;
     indexer[StatusKey.Activity] = 0;
     _status = new Status(_unit, parameters);
 }
Example #6
0
 public WarUnit(Unit unit, WarSide warSide, CommandState initState, Area area)
 {
     _unit = unit;
     // ステータスの生成
     CreateStatus();
     // コマンド状態の初期化
     _initCommandState = _commandState = initState;
     _visible = true;
     _unit = unit;
     unit.Acted = true;
     _magicLevels = new ListIndexer<AttackType, byte>(unit.MagicLevel, i => (int)i - (int)AttackType.火);
     _side = warSide;
     _conditions = new ConditionSet(this);
     _area = area;
 }
Example #7
0
 private Status(Status status)
 {
     Params = new ListIndexer<StatusKey, int>(status._parameters);
     Resistivity = status.Resistivity.Clone();
     MoveType = status.MoveType;
     DefaultAttacks = status.DefaultAttacks.ToList();
 }
Example #8
0
 public Status(Unit unit, int[] parameters)
 {
     _parameters = parameters;
     Params = new ListIndexer<StatusKey, int>(parameters);
     Resistivity = unit.Resistivity;
     MoveType = unit.MoveType;
     DefaultAttacks = unit.Attacks.ToList();
 }
Example #9
0
 public ShaderDataHelper(List <Vector3> normals, List <RoundEdgeData> roundEdges)
 {
     AvgNormals    = new ListIndexer <Vector3>(normals);
     RoundEdgeData = new ListIndexer <RoundEdgeData>(roundEdges);
 }