private void SetHeader(ref int index, ushort nodeIndex, List <VIFPacket> packets) { VIFUnpack headerUnpack = GetUnpack(ref index, packets); _numFaces = (ushort)headerUnpack.Elements[0][0]; _numVertices = (ushort)headerUnpack.Elements[0][1]; _flags = (uint)((ushort)headerUnpack.Elements[0][2] | (ushort)headerUnpack.Elements[0][3] << 16); _usedNodeArrayIndex = nodeIndex; }
private void SetVertexColors(ref int index, List <VIFPacket> packets) { VIFUnpack unpack = GetUnpack(ref index, packets); byte[][] byteArray = ConvertArray <byte>(unpack.Elements); _colors = new Color[_numVertices]; for (int j = 0; j < _numVertices; j++) { _colors[j] = Color.FromArgb(byteArray[j][3], byteArray[j][0], byteArray[j][1], byteArray[j][2]); } }
private void SetTextureCoordinates(ref int index, List <VIFPacket> packets) { VIFUnpack unpack = GetUnpack(ref index, packets); float[][] floatArray = ConvertArray <float>(unpack.Elements); _textureCoords = new Vector2[_numVertices]; for (int j = 0; j < _numVertices; j++) { _textureCoords[j] = new Vector2(floatArray[j][0], floatArray[j][1]); } }
private void SetVertexNormals(ref int index, List <VIFPacket> packets) { VIFUnpack unpack = GetUnpack(ref index, packets); float[][] floatArray = ConvertArray <float>(unpack.Elements); _normals = new Vector3[_numVertices]; for (int j = 0; j < _numVertices; j++) { _normals[j] = new Vector3(floatArray[j][0], floatArray[j][1], floatArray[j][2]); } }
private void SetVertexPositionsAndWeights(ref int index, List <VIFPacket> packets) { VIFUnpack unpack = GetUnpack(ref index, packets); float[][] floatArray = ConvertArray <float>(unpack.Elements); if (BitHelper.IsBitSet(_flags, 27)) { _weights = new float[_numVertices]; for (int j = 0; j < _numVertices; j++) { _weights[j] = floatArray[j][3]; } } _positions = new Vector3[_numVertices]; for (int j = 0; j < _numVertices; j++) { _positions[j] = new Vector3(floatArray[j][0], floatArray[j][1], floatArray[j][2]); } }
private void SetTriangleIndices(ref int index, List <VIFPacket> packets) { VIFUnpack unpack = GetUnpack(ref index, packets); _triangleIndices = ConvertArray <byte>(unpack.Elements); }