Example #1
0
        // TODO: actually set these up to use the new entity system
        public void SetOffset(DataSources dataSource, short x, short y, bool rebatch)
        {
            switch (dataSource)
            {
            case DataSources.Primary:
                if (NativeObject.PrimaryTransferMode == 9 ||
                    NativeObject.Primary.Texture.UsesLandscapeCollection() ||
                    NativeObject.Primary.Texture.IsEmpty())
                {
                    // Don't adjust UVs for landscape or unassigned surfaces.
                    return;
                }

                NativeObject.Primary.X = x;
                NativeObject.Primary.Y = y;

                PrimarySurface.ApplyTextureOffset(rebatchImmediately: rebatch);

                break;

            case DataSources.Secondary:
                if (NativeObject.SecondaryTransferMode == 9 ||
                    NativeObject.Secondary.Texture.UsesLandscapeCollection() ||
                    NativeObject.Secondary.Texture.IsEmpty())
                {
                    // Don't adjust UVs for landscape or unassigned surfaces.
                    return;
                }

                NativeObject.Secondary.X = x;
                NativeObject.Secondary.Y = y;

                SecondarySurface.ApplyTextureOffset(rebatchImmediately: rebatch);

                break;

            case DataSources.Transparent:
                if (NativeObject.TransparentTransferMode == 9 ||
                    NativeObject.Transparent.Texture.UsesLandscapeCollection() ||
                    NativeObject.Transparent.Texture.IsEmpty())
                {
                    // Don't adjust UVs for landscape or unassigned surfaces.
                    return;
                }

                NativeObject.Transparent.X = x;
                NativeObject.Transparent.Y = y;

                TransparentSurface.ApplyTextureOffset(innerLayer: !NativeObject.HasLayeredTransparentSide(ParentLevel.Level),
                                                      rebatchImmediately: rebatch);

                break;

            default:
                return;
            }
        }