Exemplo n.º 1
0
 public CameraCapturer(Camera target, AbcAPI.aeObject abc)
 {
     m_obj    = target.gameObject;
     m_abc    = abc;
     m_target = target;
     m_params = target.GetComponent <AlembicCameraParams>();
 }
Exemplo n.º 2
0
        public static void CaptureTransform(AbcAPI.aeObject abc, Transform trans, bool inherits, bool invertForward)
        {
            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       = trans.localScale;
            }
            else
            {
                data.translation = trans.position;
                data.rotation    = trans.rotation;
                data.scale       = trans.lossyScale;
            }

            if (invertForward)
            {
                trans.forward = trans.forward * -1.0f;
            }
            AbcAPI.aeXFormWriteSample(abc, ref data);
        }
Exemplo n.º 3
0
 public SkinnedMeshCapturer(SkinnedMeshRenderer target, AbcAPI.aeObject abc)
 {
     m_obj         = target.gameObject;
     m_abc         = abc;
     m_target      = target;
     m_mesh_buffer = new MeshBuffer();
 }
Exemplo n.º 4
0
 public TransformCapturer(Transform target, AbcAPI.aeObject abc)
 {
     m_obj      = target.gameObject;
     m_abc      = abc;
     m_target   = target;
     m_inherits = inherits;
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
            public ParticleCapturer(ParticleSystem target, AbcAPI.aeObject abc)
            {
                m_obj    = target.gameObject;
                m_abc    = abc;
                m_target = target;

                m_prop_rotatrions = AbcAPI.aeNewProperty(m_abc, "rotation", AbcAPI.aePropertyType.Float4Array);
            }
Exemplo n.º 7
0
        public ParticleCapturer CreateComponentCapturer(ParticleSystem target, AbcAPI.aeObject parent)
        {
            if (m_detailedLog)
            {
                Debug.Log("AlembicExporter: new ParticleCapturer(\"" + target.name + "\"");
            }

            var abc = AbcAPI.aeNewPoints(parent, target.name);
            var cap = new ParticleCapturer(target, abc);

            m_capturers.Add(cap);
            return(cap);
        }
Exemplo n.º 8
0
        public MeshCapturer CreateComponentCapturer(MeshRenderer target, AbcAPI.aeObject parent)
        {
            if (m_detailedLog)
            {
                Debug.Log("AlembicExporter: new MeshCapturer(\"" + target.name + "\"");
            }

            var abc = AbcAPI.aeNewPolyMesh(parent, target.name);
            var cap = new MeshCapturer(target, abc);

            m_capturers.Add(cap);
            return(cap);
        }
Exemplo n.º 9
0
        public TransformCapturer CreateComponentCapturer(Transform target, AbcAPI.aeObject parent)
        {
            if (m_detailedLog)
            {
                Debug.Log("AlembicExporter: new TransformCapturer(\"" + target.name + "\"");
            }

            var abc = AbcAPI.aeNewXForm(parent, target.name + " (" + target.GetInstanceID().ToString("X8") + ")");
            var cap = new TransformCapturer(target, abc);

            m_capturers.Add(cap);
            return(cap);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        void SetupComponentCapturer(CaptureNode node, AbcAPI.aeObject parent)
        {
            node.transform          = CreateComponentCapturer(node.obj, parent);
            node.transform.inherits = true;

            if (node.componentType == null)
            {
                // do nothing
            }
            else if (node.componentType == typeof(Camera))
            {
                node.transform.invertForward = true;
                node.component = CreateComponentCapturer(node.obj.GetComponent <Camera>(), node.transform.abc);
            }
            else if (node.componentType == typeof(MeshRenderer))
            {
                node.component = CreateComponentCapturer(node.obj.GetComponent <MeshRenderer>(), node.transform.abc);
            }
            else if (node.componentType == typeof(SkinnedMeshRenderer))
            {
                node.component = CreateComponentCapturer(node.obj.GetComponent <SkinnedMeshRenderer>(), node.transform.abc);
            }
            else if (node.componentType == typeof(ParticleSystem))
            {
                node.component = CreateComponentCapturer(node.obj.GetComponent <ParticleSystem>(), node.transform.abc);
            }
            else if (node.componentType == typeof(AlembicCustomComponentCapturer))
            {
                node.component = CreateComponentCapturer(node.obj.GetComponent <AlembicCustomComponentCapturer>(), node.transform.abc);
            }

            foreach (var c in node.children)
            {
                SetupComponentCapturer(c, node.transform.abc);
            }
        }
 public abstract void CreateAbcObject(AbcAPI.aeObject parent);
Exemplo n.º 13
0
        public CustomCapturerHandler CreateComponentCapturer(AlembicCustomComponentCapturer target, AbcAPI.aeObject parent)
        {
            if (m_detailedLog)
            {
                Debug.Log("AlembicExporter: new CustomCapturerHandler(\"" + target.name + "\"");
            }

            target.CreateAbcObject(parent);
            var cap = new CustomCapturerHandler(target);

            m_capturers.Add(cap);
            return(cap);
        }
Exemplo n.º 14
0
 public RootCapturer(AbcAPI.aeObject abc)
     : base(null)
 {
     m_abc = abc;
 }
Exemplo n.º 15
0
 public override void CreateAbcObject(AbcAPI.aeObject parent)
 {
     m_abc = AbcAPI.aeNewPoints(parent, gameObject.name);
 }
 public override void CreateAbcObject(AbcAPI.aeObject parent)
 {
     m_abc = AbcAPI.aeNewPoints(parent, gameObject.name);
 }