Пример #1
0
        public override bool Add(Geometry geometry)
        {
            if (count >= BatchSize)
            {
                return(false);
            }

            if (!geometry.GeometryData.Equals(sharedGeometry) || !geometry.RenderOptions.Equals(sharedRenderOptions))
            {
                return(false);
            }

            VertexTransform transform = geometry.GetVertexTransform();
            VertexColor     color     = geometry.GetVertexColor();

            for (int i = 0; i < TotalVertices; i++)
            {
                vertexPositions[index + i] = new VertexPosition(sharedGeometry.Mesh.Vertices[i]);
                transforms[index + i]      = transform;
                colors[index + i]          = color;
            }

            dataModified = true;

            index += (uint)TotalVertices;
            count++;
            totalPrimitives += (uint)TotalTriangles;

            return(true);
        }
Пример #2
0
        public override bool Add(Sprite sprite)
        {
            if (count >= BatchSize)
            {
                return(false);
            }

            if (!sprite.Texture.Equals(sharedTexture) || !sprite.RenderOptions.Equals(sharedRenderOptions))
            {
                return(false);
            }

            VertexTransform transform = sprite.GetVertexTransform();
            VertexColor     color     = sprite.GetVertexColor();

            VertexTexture[] textureCoords = sprite.GetTextureCoords();

            transforms[count] = transform;
            colors[count]     = color;

            this.textureCoords[textureCoordIndex + 0] = textureCoords[0];
            this.textureCoords[textureCoordIndex + 1] = textureCoords[1];
            this.textureCoords[textureCoordIndex + 2] = textureCoords[2];
            this.textureCoords[textureCoordIndex + 3] = textureCoords[3];

            dataModified = true;

            textureCoordIndex += 4;
            count++;

            return(true);
        }
Пример #3
0
        public override bool Add(Sprite sprite)
        {
            if (count >= BatchSize)
            {
                return(false);
            }

            if (!sprite.Texture.Equals(sharedTexture) || !sprite.RenderOptions.Equals(sharedRenderOptions))
            {
                return(false);
            }

            VertexTransform transform = sprite.GetVertexTransform();
            VertexColor     color     = sprite.GetVertexColor();

            VertexTexture[] textureCoords = sprite.GetTextureCoords();

            vertexPositions[index + 0] = sharedGeometry[0];
            vertexPositions[index + 1] = sharedGeometry[1];
            vertexPositions[index + 2] = sharedGeometry[2];
            vertexPositions[index + 3] = sharedGeometry[3];

            transforms[index + 0] = transform;
            transforms[index + 1] = transform;
            transforms[index + 2] = transform;
            transforms[index + 3] = transform;

            colors[index + 0] = color;
            colors[index + 1] = color;
            colors[index + 2] = color;
            colors[index + 3] = color;

            this.textureCoords[index + 0] = textureCoords[0];
            this.textureCoords[index + 1] = textureCoords[1];
            this.textureCoords[index + 2] = textureCoords[2];
            this.textureCoords[index + 3] = textureCoords[3];

            dataModified = true;

            index += 4;
            count++;
            totalPrimitives += 2;

            return(true);
        }
Пример #4
0
        public override bool Add(Geometry geometry)
        {
            if (count >= BatchSize)
            {
                return(false);
            }

            if (!geometry.GeometryData.Equals(sharedGeometry) || !geometry.RenderOptions.Equals(sharedRenderOptions))
            {
                return(false);
            }

            VertexTransform transform = geometry.GetVertexTransform();
            VertexColor     color     = geometry.GetVertexColor();

            transforms[count] = transform;
            colors[count]     = color;

            dataModified = true;

            count++;

            return(true);
        }