Esempio n. 1
0
        private static StaticBuffer <CliffInfo> CreateCliffDetails(
            GraphicsDevice graphicsDevice,
            ResourceUploadBatch uploadBatch,
            MapFile mapFile)
        {
            var cliffDetails = new CliffInfo[mapFile.BlendTileData.CliffTextureMappings.Length];

            const int cliffScalingFactor = 64;

            for (var i = 0; i < cliffDetails.Length; i++)
            {
                var cliffMapping = mapFile.BlendTileData.CliffTextureMappings[i];
                cliffDetails[i] = new CliffInfo
                {
                    BottomLeftUV  = cliffMapping.BottomLeftCoords * cliffScalingFactor,
                    BottomRightUV = cliffMapping.BottomRightCoords * cliffScalingFactor,
                    TopLeftUV     = cliffMapping.TopLeftCoords * cliffScalingFactor,
                    TopRightUV    = cliffMapping.TopRightCoords * cliffScalingFactor
                };
            }

            return(cliffDetails.Length > 0
                ? StaticBuffer.Create(
                       graphicsDevice,
                       uploadBatch,
                       cliffDetails)
                : null);
        }
Esempio n. 2
0
        private static DeviceBuffer CreateCliffDetails(
            GraphicsDevice graphicsDevice,
            MapFile mapFile)
        {
            var cliffDetails = new CliffInfo[mapFile.BlendTileData.CliffTextureMappings.Length];

            const int cliffScalingFactor = 64;

            for (var i = 0; i < cliffDetails.Length; i++)
            {
                var cliffMapping = mapFile.BlendTileData.CliffTextureMappings[i];
                cliffDetails[i] = new CliffInfo
                {
                    BottomLeftUV  = cliffMapping.BottomLeftCoords * cliffScalingFactor,
                    BottomRightUV = cliffMapping.BottomRightCoords * cliffScalingFactor,
                    TopLeftUV     = cliffMapping.TopLeftCoords * cliffScalingFactor,
                    TopRightUV    = cliffMapping.TopRightCoords * cliffScalingFactor
                };
            }

            return(cliffDetails.Length > 0
                ? graphicsDevice.CreateStaticStructuredBuffer(cliffDetails)
                : null);
        }