Inheritance: IDisposable
Ejemplo n.º 1
0
 public aiFace(aiFace o) : this(AssimpPINVOKE.new_aiFace__SWIG_1(aiFace.getCPtr(o)), true)
 {
     if (AssimpPINVOKE.SWIGPendingException.Pending)
     {
         throw AssimpPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 2
0
            //-------------------------------------------------------------------------------
            internal static void Face(int[] unity, MeshTopology topology, Interface.Array <aiFace> assimp)
            {
                uint nb_faces = 0;

                switch (topology)
                {
                case MeshTopology.Points:
                    nb_faces = 1;
                    break;

                case MeshTopology.Lines:
                    nb_faces = 2;
                    break;

                case MeshTopology.Triangles:
                    nb_faces = 3;
                    break;

                case MeshTopology.Quads:
                    nb_faces = 4;
                    break;

                default:
                    Debug.LogErrorFormat("Unsupported topology '{0}' in assimp export.", topology);
                    break;
                }

                assimp.Clear();

                if (nb_faces > 0)
                {
                    long size = unity.Length / nb_faces;

                    uint i = 0;
                    for (; i < size; i++)
                    {
                        using (aiFace face = new aiFace())
                        {
                            using (aiUIntArray indices = face.Indices)
                            {
                                for (uint j = 0; j < nb_faces; j++)
                                {
                                    indices.Set(j, (uint)unity[i * nb_faces + j]);
                                }

                                assimp.Set(i, face.Unmanaged());
                            }
                        }
                    }

                    if (i * nb_faces != unity.Length)
                    {
                        Debug.LogError("Invalid number of vertices to compose the faces.");
                    }
                }
            }
Ejemplo n.º 3
0
    public bool __nequal__(aiFace o)
    {
        bool ret = AssimpPINVOKE.aiFace___nequal__(swigCPtr, aiFace.getCPtr(o));

        if (AssimpPINVOKE.SWIGPendingException.Pending)
        {
            throw AssimpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Ejemplo n.º 4
0
    public aiFace __set__(aiFace o)
    {
        aiFace ret = new aiFace(AssimpPINVOKE.aiFace___set__(swigCPtr, aiFace.getCPtr(o)), false);

        if (AssimpPINVOKE.SWIGPendingException.Pending)
        {
            throw AssimpPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Ejemplo n.º 5
0
            //-------------------------------------------------------------------------------
            internal static int[] Face(Interface.DynamicArray <aiFace> assimp, out MeshTopology topology)
            {
                uint size = assimp.Size();

                topology = MeshTopology.Triangles;
                uint nb_faces = 3;

                if (size > 0)
                {
                    // Get the topology from the first face (because option aiProcess_SortByPType is mandatory, all faces have the same topology)
                    using (aiFace face = assimp.Get(0))
                    {
                        using (aiUIntArray indices = face.Indices)
                        {
                            switch (indices.Size())
                            {
                            case 1:
                                topology = MeshTopology.Points;
                                nb_faces = 1;
                                break;

                            case 2:
                                topology = MeshTopology.Lines;
                                nb_faces = 2;
                                break;

                            default:
                                // Because option aiProcess_Triangulate is mandatory
                                topology = MeshTopology.Triangles;
                                nb_faces = 3;
                                break;
                            }
                        }
                    }
                }

                int[] unity = new int[size * nb_faces];

                for (uint i = 0; i < size; i++)
                {
                    using (aiFace face = assimp.Get(i))
                    {
                        using (aiUIntArray indices = face.Indices)
                        {
                            if (indices.Size() >= nb_faces)
                            {
                                for (uint j = 0; j < nb_faces; j++)
                                {
                                    unity[i * nb_faces + j] = (int)indices.Get(j);
                                }

                                if (indices.Size() > nb_faces)
                                {
                                    Debug.LogError("Too many vertices to compose a face. Some data is lost.");
                                }
                            }
                            else
                            {
                                Debug.LogError("Not enough vertices to compose a face.");
                            }
                        }
                    }
                }

                return(unity);
            }
Ejemplo n.º 6
0
 internal static HandleRef getCPtr(aiFace obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 7
0
 public bool __nequal__(aiFace o) {
   bool ret = AssimpPINVOKE.aiFace___nequal__(swigCPtr, aiFace.getCPtr(o));
   if (AssimpPINVOKE.SWIGPendingException.Pending) throw AssimpPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Ejemplo n.º 8
0
 public aiFace __set__(aiFace o) {
   aiFace ret = new aiFace(AssimpPINVOKE.aiFace___set__(swigCPtr, aiFace.getCPtr(o)), false);
   if (AssimpPINVOKE.SWIGPendingException.Pending) throw AssimpPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Ejemplo n.º 9
0
 public aiFace(aiFace o) : this(AssimpPINVOKE.new_aiFace__SWIG_1(aiFace.getCPtr(o)), true) {
   if (AssimpPINVOKE.SWIGPendingException.Pending) throw AssimpPINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 10
0
 internal static HandleRef getCPtr(aiFace obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }