Example #1
0
        // TODO
        // Enable whole GO: nothing drawn.
        // Click any component in inspector: drawn
        // (NO its not.. wth) Hey hey! Light sprite can be toggled np. Sooo. Its a camera thing.
        public void ComponentUpdate(ComponentUpdatePass pass)
        {
            var scale = Scale;

            scale.x *= FlipX ? -1 : 1;
            if (Sprite != null && Material != null)
            {
                Horde.Sprites.AddQuad(trans_.position + Offset, scale, Rotation, Scale.y, Color, Sprite, Material, layer_);
            }
        }
Example #2
0
        public void ComponentUpdate(ComponentUpdatePass pass)
        {
            Matrix4x4 matrix = Matrix4x4.identity;

            matrix.SetTRS(Offset, Quaternion.identity, Vector3.one);

            SpritesRendered = 0;
            MeshesRendered  = 0;
            for (int i = 0; i < rendererCount_; ++i)
            {
                var batch = batches_[i];
                batch.ApplyChanges();
                int activeMeshes = batch.GetActiveMeshCount();
                for (int j = 0; j < activeMeshes; ++j)
                {
                    // TODO: DrawMesh does not always show in the editor. Seems to lag exactly one update behind.
                    Graphics.DrawMesh(batch.Meshes[j].Mesh, matrix, batch.Material, batch.Layer);
                    SpritesRendered += batch.Meshes[j].ActiveQuadCount;
                    MeshesRendered++;
                }
                batch.Clear();
            }
        }