Ejemplo n.º 1
0
        public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf)
        {
            dst_buf.indices = mesh.triangles;
            dst_buf.uvs     = mesh.uv;
            if (cloth == null)
            {
                dst_buf.vertices = mesh.vertices;
                dst_buf.normals  = mesh.normals;
            }
            else
            {
                dst_buf.vertices = cloth.vertices;
                dst_buf.normals  = cloth.normals;
            }

            var data = new AbcAPI.aePolyMeshData();

            data.indices   = GetArrayPtr(dst_buf.indices);
            data.positions = GetArrayPtr(dst_buf.vertices);
            if (dst_buf.normals != null)
            {
                data.normals = GetArrayPtr(dst_buf.normals);
            }
            if (dst_buf.uvs != null)
            {
                data.uvs = GetArrayPtr(dst_buf.uvs);
            }
            data.positionCount = dst_buf.vertices.Length;
            data.indexCount    = dst_buf.indices.Length;

            AbcAPI.aePolyMeshWriteSample(abc, ref data);
        }
Ejemplo n.º 2
0
        public static void CaptureTransform(
            AbcAPI.aeObject abc, Transform trans,
            bool inherits, bool invertForward, bool scale)
        {
            AbcAPI.aeXFormData data;

            data.inherits = inherits;
            if (invertForward)
            {
                trans.forward = trans.forward * -1.0f;
            }
            if (inherits)
            {
                data.translation = trans.localPosition;
                data.rotation    = trans.localRotation;
                data.scale       = scale ? trans.localScale : Vector3.one;
            }
            else
            {
                data.translation = trans.position;
                data.rotation    = trans.rotation;
                data.scale       = scale ? trans.lossyScale : Vector3.one;
            }

            if (invertForward)
            {
                trans.forward = trans.forward * -1.0f;
            }
            AbcAPI.aeXFormWriteSample(abc, ref data);
        }
Ejemplo n.º 3
0
        public static void CaptureMesh(AbcAPI.aeObject abc, Mesh mesh, Cloth cloth, MeshBuffer dst_buf)
        {
            dst_buf.Clear();
            dst_buf.indices.LockList(ls => mesh.GetTriangles(ls, 0));
            dst_buf.uvs.LockList(ls => mesh.GetUVs(0, ls));

            if (cloth == null)
            {
                dst_buf.vertices.LockList(ls => mesh.GetVertices(ls));
                dst_buf.normals.LockList(ls => mesh.GetNormals(ls));
            }
            else
            {
                dst_buf.vertices.Assign(cloth.vertices);
                dst_buf.normals.Assign(cloth.normals);
            }

            var data = new AbcAPI.aePolyMeshData();

            data.indices       = dst_buf.indices;
            data.positions     = dst_buf.vertices;
            data.normals       = dst_buf.normals;
            data.uvs           = dst_buf.uvs;
            data.positionCount = dst_buf.vertices.Count;
            data.indexCount    = dst_buf.indices.Count;

            AbcAPI.aePolyMeshWriteSample(abc, ref data);
        }
Ejemplo n.º 4
0
        public static void CaptureCamera(AbcAPI.aeObject abc, Camera cam, AlembicCameraParams cparams = null)
        {
            var data = AbcAPI.aeCameraData.default_value;

            data.nearClippingPlane = cam.nearClipPlane;
            data.farClippingPlane  = cam.farClipPlane;
            data.fieldOfView       = cam.fieldOfView;
            if (cparams != null)
            {
                data.focalLength   = cparams.m_focalLength;
                data.focusDistance = cparams.m_focusDistance;
                data.aperture      = cparams.m_aperture;
                data.aspectRatio   = cparams.GetAspectRatio();
            }
            AbcAPI.aeCameraWriteSample(abc, ref data);
        }
Ejemplo n.º 5
0
 public override void CreateAbcObject(AbcAPI.aeObject parent)
 {
     m_abc = AbcAPI.aeNewPoints(parent, gameObject.name);
 }
 public abstract void CreateAbcObject(AbcAPI.aeObject parent);
Ejemplo n.º 7
0
 public RootCapturer(AbcAPI.aeObject abc)
     : base(null)
 {
     m_abc = abc;
 }