Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ValidateCreationParameters()

static void Microsoft.Xna.Framework.Graphics.TextureCube.ValidateCreationParameters ( ProfileCapabilities profile,
int size,
SurfaceFormat format )
inlinestaticprotected

Definition at line 360 of file TextureCube.cs.

361 {
362 if (size <= 0)
363 {
364 throw new ArgumentOutOfRangeException("size", FrameworkResources.ResourcesMustBeGreaterThanZeroSize);
365 }
366 bool flag = Texture.CheckCompressedTexture(_003CModule_003E.ConvertXnaFormatToWindows(format));
367 if (!profile.ValidCubeFormats.Contains(format))
368 {
369 profile.ThrowNotSupportedException(FrameworkResources.ProfileFormatNotSupported, typeof(TextureCube).Name, format);
370 }
371 int maxCubeSize = profile.MaxCubeSize;
372 if (size > maxCubeSize)
373 {
374 profile.ThrowNotSupportedException(FrameworkResources.ProfileTooBig, typeof(TextureCube).Name, maxCubeSize);
375 }
376 if (!profile.NonPow2Cube && !Texture.IsPowerOfTwo((uint)size))
377 {
378 profile.ThrowNotSupportedException(FrameworkResources.ProfileNotPowerOfTwo, typeof(TextureCube).Name);
379 }
380 if (flag && ((uint)size & 3u) != 0)
381 {
382 throw new ArgumentException(FrameworkResources.DxtNotMultipleOfFour);
383 }
384 }

References Microsoft.Xna.Framework.Graphics.Texture.CheckCompressedTexture(), System.Collections.Generic.List< T >.Contains(), Microsoft.Xna.Framework.FrameworkResources.DxtNotMultipleOfFour, System.format, Microsoft.Xna.Framework.Graphics.Texture.IsPowerOfTwo(), Microsoft.Xna.Framework.Graphics.ProfileCapabilities.MaxCubeSize, Microsoft.Xna.Framework.Graphics.GraphicsResource.Name, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.NonPow2Cube, Microsoft.Xna.Framework.FrameworkResources.ProfileFormatNotSupported, Microsoft.Xna.Framework.FrameworkResources.ProfileNotPowerOfTwo, Microsoft.Xna.Framework.FrameworkResources.ProfileTooBig, Microsoft.Xna.Framework.FrameworkResources.ResourcesMustBeGreaterThanZeroSize, Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ThrowNotSupportedException(), and Microsoft.Xna.Framework.Graphics.ProfileCapabilities.ValidCubeFormats.

Referenced by Microsoft.Xna.Framework.Graphics.RenderTargetCube.CreateRenderTarget(), and Microsoft.Xna.Framework.Graphics.TextureCube.CreateTexture().