예제 #1
0
        public void AddPolygon(List <VertexPositionNormalTexture> vertices, Polygon polygon, uint textureID)
        {
            if (!TextureIndex.TryGetValue(textureID, out var textureIdx))
            {
                textureIdx = (byte)TextureIndex.Count;
                TextureIndex.Add(textureID, textureIdx);
            }

            foreach (var idx in polygon.Indices)
            {
                var v = vertices[idx];
                Vertices.Add(new VertexPositionNormalTextures(v.Position, v.Normal, v.TextureCoordinate, textureIdx));
            }
        }
예제 #2
0
        /// <summary>
        /// Returns the starting index into Instances
        /// </summary>
        public int AddParticleSlot(uint textureID, Vector2 dims)
        {
            // since we are looping over this, change so dict lookup only happens once
            if (!TextureIndex.TryGetValue(textureID, out var textureIdx))
            {
                textureIdx = (byte)TextureIndex.Count;
                TextureIndex.Add(textureID, textureIdx);
            }

            var startIdx = Instances.Count;

            var instance = new ParticleDeclaration(textureIdx, dims);

            Instances.Add(instance);

            return(startIdx);
        }