예제 #1
0
        public NiTriShapeData(NiTriStripsData data)
        {
            this.unknownInt       = data.GetUnknownInt();
            this.numVertices      = data.GetNumVertices();
            this.hasVertices      = data.HasVertices();
            this.vertices         = data.GetVertices();
            this.numUVSets        = data.GetNumUVSets();
            this.extraVectorFlags = data.GetExtraVertexFlag();
            this.skyrimMaterial   = data.GetSkyrimMaterial();
            this.hasNormals       = data.HasNormals();
            this.normals          = data.GetNormals();
            this.tangents         = data.GetTangents();
            this.bitangents       = data.GetBitangents();
            this.center           = data.GetCenter();
            this.radius           = data.GetRadius();
            this.hasVertexColors  = data.HasVertexColors();
            this.vertexColors     = data.GetVertexColors();
            this.uvCoords         = data.GetUVCoords();
            this.consistencyFlags = data.GetConsistencyFlags();
            this.additionalData   = data.GetAdditionalData();
            this.hasTriangles     = true;
            this.triangles        = new List <Triangle>();
            for (int index1 = 0; index1 < (int)data.GetNumStrips(); ++index1)
            {
                ushort        stripLengthAtIndex = data.GetStripLengthAtIndex(index1);
                List <ushort> pointsAtIndex      = data.GetPointsAtIndex(index1);
                bool          flip = false;;
                ushort        _v1  = pointsAtIndex[0];
                ushort        _v2  = pointsAtIndex[0];
                ushort        _v3  = pointsAtIndex[1];
                for (int index2 = 2; index2 < (int)stripLengthAtIndex; ++index2)
                {
                    _v1 = _v2;
                    _v2 = _v3;
                    _v3 = pointsAtIndex[index2];

                    if ((_v1 != _v2) && (_v2 != _v3) && (_v3 != _v1))
                    {
                        if (flip)
                        {
                            this.triangles.Add(new Triangle(_v1, _v3, _v2));
                        }
                        else
                        {
                            this.triangles.Add(new Triangle(_v1, _v2, _v3));
                        }
                    }
                    flip = !flip;
                }
            }
            this.numTriangles      = (ushort)this.triangles.Count;
            this.numTrianglePoints = (uint)this.triangles.Count * 3U;
            this.numMatchGroups    = (ushort)0;
            this.matchGroups       = new List <MatchGroup>();
        }
        public NiTriShapeData(NiTriStripsData data)
        {
            this.unknownInt = data.GetUnknownInt();
            this.numVertices = data.GetNumVertices();
            this.hasVertices = data.HasVertices();
            this.vertices = data.GetVertices();
            this.bsNumUVSets = data.GetBSNumUVSets();
            this.skyrimMaterial = data.GetSkyrimMaterial();
            this.hasNormals = data.HasNormals();
            this.normals = data.GetNormals();
            this.tangents = data.GetTangents();
            this.bitangents = data.GetBitangents();
            this.center = data.GetCenter();
            this.radius = data.GetRadius();
            this.hasVertexColors = data.HasVertexColors();
            this.vertexColors = data.GetVertexColors();
            this.uvCoords = data.GetUVCoords();
            this.consistencyFlags = data.GetConsistencyFlags();
            this.additionalData = data.GetAdditionalData();
            this.hasTriangles = true;
            this.triangles = new List<Triangle>();
            for (int index1 = 0; index1 < (int)data.GetNumStrips(); ++index1)
            {
                ushort stripLengthAtIndex = data.GetStripLengthAtIndex(index1);
                List<ushort> pointsAtIndex = data.GetPointsAtIndex(index1);
                bool flip = false; ;
                ushort _v1 = pointsAtIndex[0];
                ushort _v2 = pointsAtIndex[0];
                ushort _v3 = pointsAtIndex[1];
                for (int index2 = 2; index2 < (int)stripLengthAtIndex; ++index2)
                {
                    _v1 = _v2;
                    _v2 = _v3;
                    _v3 = pointsAtIndex[index2];

                    if ((_v1 != _v2) && (_v2 != _v3) && (_v3 != _v1))
                    {
                        if (flip)
                        {
                            this.triangles.Add(new Triangle(_v1, _v3, _v2));
                        }
                        else
                        {
                            this.triangles.Add(new Triangle(_v1, _v2, _v3));
                        }
                    }
                    flip = !flip;
                }
            }
            this.numTriangles = (ushort) this.triangles.Count;
            this.numTrianglePoints = (uint) this.triangles.Count * 3U;
            this.numMatchGroups = (ushort) 0;
            this.matchGroups = new List<MatchGroup>();
        }