Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        public void SetLight(DataSources dataSource, short lightIndex)
        {
            switch (dataSource)
            {
            case DataSources.Primary:
                if (lightIndex == NativeObject.PrimaryLightsourceIndex ||
                    NativeObject.Primary.Texture.UsesLandscapeCollection())
                {
                    // Light is not different, so exit
                    return;
                }

                NativeObject.PrimaryLightsourceIndex = lightIndex;

                PrimarySurface.ApplyLight();

                break;

            case DataSources.Secondary:
                if (lightIndex == NativeObject.SecondaryLightsourceIndex ||
                    NativeObject.Secondary.Texture.UsesLandscapeCollection())
                {
                    // Light is not different, so exit
                    return;
                }

                NativeObject.SecondaryLightsourceIndex = lightIndex;

                SecondarySurface.ApplyLight();

                break;

            case DataSources.Transparent:
                if (lightIndex == NativeObject.TransparentLightsourceIndex ||
                    NativeObject.Transparent.Texture.UsesLandscapeCollection())
                {
                    // Light is not different, so exit
                    return;
                }

                NativeObject.TransparentLightsourceIndex = lightIndex;

                TransparentSurface.ApplyLight(innerLayer: !NativeObject.HasLayeredTransparentSide(ParentLevel.Level));

                break;

            default:
                return;
            }
        }
Ejemplo n.º 3
0
        public void SetShapeDescriptor(DataSources dataSource, ShapeDescriptor shapeDescriptor)
        {
            short transferMode;

            switch (dataSource)
            {
            case DataSources.Primary:
                if (shapeDescriptor.Equals(NativeObject.Primary.Texture))
                {
                    // Texture is not different, so exit
                    return;
                }

                NativeObject.Primary.Texture = shapeDescriptor;
                transferMode = NativeObject.PrimaryTransferMode;

                break;

            case DataSources.Secondary:
                if (shapeDescriptor.Equals(NativeObject.Secondary.Texture))
                {
                    // Texture is not different, so exit
                    return;
                }

                NativeObject.Secondary.Texture = shapeDescriptor;
                transferMode = NativeObject.SecondaryTransferMode;

                break;

            case DataSources.Transparent:
                if (shapeDescriptor.Equals(NativeObject.Transparent.Texture))
                {
                    // Texture is not different, so exit
                    return;
                }

                NativeObject.Transparent.Texture = shapeDescriptor;
                transferMode = NativeObject.TransparentTransferMode;

                break;

            default:
                return;
            }

            short newTransferMode = 0;

            if (shapeDescriptor.UsesLandscapeCollection())
            {
                newTransferMode = 9;
            }
            else if (transferMode != 9)
            {
                newTransferMode = transferMode;
            }

            switch (dataSource)
            {
            case LevelEntity_Side.DataSources.Primary:
                NativeObject.PrimaryTransferMode = newTransferMode;
                PrimarySurface.ApplyTexture();
                break;

            case LevelEntity_Side.DataSources.Secondary:
                NativeObject.SecondaryTransferMode = newTransferMode;
                SecondarySurface.ApplyTexture();
                break;

            case LevelEntity_Side.DataSources.Transparent:
                NativeObject.TransparentTransferMode = newTransferMode;
                TransparentSurface.ApplyTexture(innerLayer: !NativeObject.HasLayeredTransparentSide(ParentLevel.Level));
                break;
            }
        }