コード例 #1
0
        void ConvertCamera(UsdCamera cam, string path)
        {
            if (cam == null)
            {
                return;
            }

            var tcam = typeof(Camera);
            var cvs  = new CurveData[] {
                new CurveData(tcam, path, "near clip plane", epsilon_Camera),
                new CurveData(tcam, path, "far clip plane", epsilon_Camera),
                new CurveData(tcam, path, "field of view", epsilon_Camera),
            };

            usdi.usdiCameraEachSample(cam.nativeCameraPtr, (ref usdi.CameraData data, double t_) =>
            {
                float t = (float)t_ * m_rcpTimeScale;
                cvs[0].curve.AddKey(t, data.near_clipping_plane);
                cvs[1].curve.AddKey(t, data.far_clipping_plane);
                cvs[2].curve.AddKey(t, data.field_of_view);
            });

            if (m_keyframeReduction)
            {
                foreach (var c in cvs)
                {
                    DoReduction(c);
                }
            }
            foreach (var c in cvs)
            {
                c.Set(m_animClip);
            }
        }
コード例 #2
0
ファイル: UsdStream.cs プロジェクト: zeta1999/USDForUnity
        UsdSchema usdiCreateNode(usdi.Schema schema)
        {
            UsdSchema ret = null;

            if (ret == null)
            {
                var s = usdi.usdiAsPoints(schema);
                if (s)
                {
                    ret = new UsdPoints();
                }
            }
            if (ret == null)
            {
                var s = usdi.usdiAsMesh(schema);
                if (s)
                {
                    ret = new UsdMesh();
                }
            }
            if (ret == null)
            {
                var s = usdi.usdiAsCamera(schema);
                if (s)
                {
                    ret = new UsdCamera();
                }
            }
            if (ret == null)
            {
                // Xform must be latter because some schemas are subclass of Xform
                var s = usdi.usdiAsXform(schema);
                if (s)
                {
                    ret = new UsdXform();
                }
            }
            if (ret == null)
            {
                ret = new UsdSchema();
            }
            ret.nativeSchemaPtr = schema;
            ret.stream          = this;
            return(ret);
        }