private void populateTextures() { count = Textures.Count(); for (i = 0; i < count; i++) { lbOptions.Items.Add(Textures[i]); } }
public Texture GetTexture(string resourceString) { if (Textures.Count(res => res.ResourceString.Equals(resourceString)) == 1) { return(Textures.First(res => res.ResourceString.Equals(resourceString)).Content); } else { return(null); } }
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()); }