A single textured face. Don't instantiate this class yourself, use the methods in TextureEntry
Наследование: ICloneable
Пример #1
0
 /// <summary>
 /// Construct a new instance of the AvatarAppearanceEventArgs class
 /// </summary>
 /// <param name="sim">The simulator request was from</param>
 /// <param name="avatarID">The ID of the agent</param>
 /// <param name="isTrial">true of the agent is a trial account</param>
 /// <param name="defaultTexture">The default agent texture</param>
 /// <param name="faceTextures">The agents appearance layer textures</param>
 /// <param name="visualParams">The <see cref="VisualParams"/> for the agent</param>
 public AvatarAppearanceEventArgs(Simulator sim, UUID avatarID, bool isTrial, Primitive.TextureEntryFace defaultTexture,
     Primitive.TextureEntryFace[] faceTextures, List<byte> visualParams)
 {
     this.m_Simulator = sim;
     this.m_AvatarID = avatarID;
     this.m_IsTrial = isTrial;
     this.m_DefaultTexture = defaultTexture;
     this.m_FaceTextures = faceTextures;
     this.m_VisualParams = visualParams;
 }
Пример #2
0
        private MeshData[] GetMeshsDataFromPrimFaces(Primitive prim, ViewerFace[] faces)
        {
            int dt_index = Primitive.TextureEntry.MAX_FACES;
            Primitive.TextureEntryFace[] entries = new Primitive.TextureEntryFace[Primitive.TextureEntry.MAX_FACES + 1];

            for (int i = 0; i < Primitive.TextureEntry.MAX_FACES; i++)
                entries[i] = prim.Textures.FaceTextures[i];
            entries[dt_index] = prim.Textures.DefaultTexture;

            int faceCount = 0;
            Dictionary<int, int> faceDic = new Dictionary<int, int>();
            List<int> faceList = new List<int>();
            List<VertexData>[] vertexList = new List<VertexData>[entries.Length];
            List<uint>[] indexList = new List<uint>[entries.Length];
            foreach (ViewerFace face in faces)
            {
                int face_number = (entries[face.primFaceNumber] == null) ? dt_index : face.primFaceNumber;
                if (!faceDic.ContainsKey(face_number))
                {
                    vertexList[faceCount] = new List<VertexData>();
                    indexList[faceCount] = new List<uint>();
                    faceList.Add(face_number);
                    faceDic.Add(face_number, faceCount++);
                }
                int index = faceDic[face_number];
                uint i_count = (uint)indexList[index].Count;

                // Vertex 1
                vertexList[index].Add(new VertexData(
                    new float[] { face.v1.X, face.v1.Y, face.v1.Z },
                    new float[] { face.n1.X, face.n1.Y, face.n1.Z },
                    new float[] { face.uv1.U, face.uv1.V },
                    null
                    ));
                indexList[index].Add(i_count++);

                // Vertex 2
                vertexList[index].Add(new VertexData(
                    new float[] { face.v2.X, face.v2.Y, face.v2.Z },
                    new float[] { face.n2.X, face.n2.Y, face.n2.Z },
                    new float[] { face.uv2.U, face.uv2.V },
                    null
                    ));
                indexList[index].Add(i_count++);

                // Vertex 3
                vertexList[index].Add(new VertexData(
                    new float[] { face.v3.X, face.v3.Y, face.v3.Z },
                    new float[] { face.n3.X, face.n3.Y, face.n3.Z },
                    new float[] { face.uv3.U, face.uv3.V },
                    null
                    ));
                indexList[index].Add(i_count++);
            }

            MeshData[] meshes = new MeshData[faceCount];
            for (int i = 0; i < meshes.Length; i++)
            {
                Primitive.TextureEntryFace entry = entries[faceList[i]];

                meshes[i] = new MeshData();
                meshes[i].Vertices = new VertexData[vertexList[i].Count];
                meshes[i].Indices = new uint[indexList[i].Count];
                meshes[i].Texture1 = entry.TextureID.ToString() + ".tga";
                meshes[i].Color = new float[] { entry.RGBA.A, entry.RGBA.R, entry.RGBA.G, entry.RGBA.B };
                vertexList[i].CopyTo(meshes[i].Vertices);
                indexList[i].CopyTo(meshes[i].Indices);
            }

            return meshes;
        }