示例#1
0
 private void InitLazyProps()
 {
     this._ModelData             = new Lazy <ModelBase>(() => _ModelDataInitializer());
     this._Vertices              = new Lazy <Vertex[]>(() => Triangles.SelectMany(t => t).Union(new Vertex[0]).ToArray());
     this._Textures              = new Lazy <Texture[]>(() => Triangles.Select(t => t.Texture).Union(new Texture[0]).ToArray());
     this._Joints                = new Lazy <Joint[]>(() => RootJoint == null ? new Joint[0] : RootJoint.GetSelfAndDescendents().ToArray());
     this._Animations            = new Lazy <AnimationSequence[]>(() => Joints.Select(j => j.Animation).ToArray());
     this._IsVisible             = new Lazy <bool>(() => Textures.Where(t => ExcludeTexturePrefixes.Count(v => t.Name.StartsWith(v)) == 0).Count() != 0);
     this._IsAnimated            = new Lazy <bool>(() => Animations.Count() != 0 && NumAnimationKeyFrames != 0);
     this._HasMultipleTextures   = new Lazy <bool>(() => Textures.Count() > 1);
     this._HasGeometry           = new Lazy <bool>(() => Triangles.Count() != 0);
     this._HasNormals            = new Lazy <bool>(() => HasGeometry && Vertices.First().Normal != Vector4.Zero);
     this._HasTangents           = new Lazy <bool>(() => HasGeometry && Vertices.First().Tangent != Vector4.Zero);
     this._HasBinormals          = new Lazy <bool>(() => HasGeometry && Vertices.First().Binormal != Vector4.Zero);
     this._HasSkeleton           = new Lazy <bool>(() => RootJoint != null);
     this._NumJoints             = new Lazy <int>(() => Joints.Count());
     this._NumAnimationFrames    = new Lazy <int>(() => Animations.Select(a => a.NumFrames).Union(new[] { 0 }).Max());
     this._NumAnimationKeyFrames = new Lazy <int>(() => Animations.Select(anim => anim.Frames.Select(f => f.FrameNum)).Aggregate((a, v) => a.Union(v)).Count());
 }
示例#2
0
 public Collada.Exporter <T> CreateUnanimatedExporter <T>(bool overwrite, T state)
 {
     return(new Collada.Exporter <T>(Path.Combine(".", Name + ".noanim.dae"), () => true, () => GetFiltered(), () => RootJoint == null ? null : RootJoint.WithoutAnimation(), () => ExtraData, CreatTime, ModTime, overwrite, state));
 }
示例#3
0
 public override ModelBase GetAnimated(int startframe, int numframes, double framerate)
 {
     return(new AnimatedModel(new List <Triangle>(Triangles), RootJoint.WithTrimmedAnimation(startframe, numframes, framerate), ExtraData));
 }