public RenderFluid(TextureLayout tex, Color color, float amount, ushort block) { this.layout = tex; this.color = color; this.amount = amount; this.block = block; }
private void button1_Click(object sender, EventArgs e) { if (!File.Exists(pathFile.Text)) { MessageBox.Show($"File doesn't exist!\r\n{pathFile.Text}"); return; } using (Scene scn = Scene.FromFile(pathFile.Text)) { Tim ctr = scn.ctrvram; try { using (BinaryReaderEx br = new BinaryReaderEx(new MemoryStream(StringToByteArrayFastest(textBox1.Text)))) { TextureLayout tl = new TextureLayout(br); pictureBox1.Image = ctr.GetTexture(tl); } } catch (Exception ex) { MessageBox.Show("Attempt failed.\r\n" + ex.Message); } } }
/// <summary> /// Initializes a new instance of the <see cref="ResourceDescription1"/> struct. /// </summary> /// <param name="dimension"></param> /// <param name="alignment"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="depthOrArraySize"></param> /// <param name="mipLevels"></param> /// <param name="format"></param> /// <param name="sampleCount"></param> /// <param name="sampleQuality"></param> /// <param name="layout"></param> /// <param name="flags"></param> /// <param name="samplerFeedbackMipRegionWidth"></param> /// <param name="samplerFeedbackMipRegionHeight"></param> /// <param name="samplerFeedbackMipRegionDepth"></param> public ResourceDescription1( ResourceDimension dimension, ulong alignment, ulong width, int height, ushort depthOrArraySize, ushort mipLevels, Format format, int sampleCount, int sampleQuality, TextureLayout layout, ResourceFlags flags, int samplerFeedbackMipRegionWidth = 0, int samplerFeedbackMipRegionHeight = 0, int samplerFeedbackMipRegionDepth = 0) { Dimension = dimension; Alignment = alignment; Width = width; Height = height; DepthOrArraySize = depthOrArraySize; MipLevels = mipLevels; Format = format; SampleDescription = new SampleDescription(sampleCount, sampleQuality); Layout = layout; Flags = flags; SamplerFeedbackMipRegion = new MipRegion(samplerFeedbackMipRegionWidth, samplerFeedbackMipRegionHeight, samplerFeedbackMipRegionDepth); }
internal OrganicConstructionBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, layout) { }
internal ConstructionBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Basic, layout) { }
internal ModifiableHeightBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Functional, layout) { }
internal PermeableBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Basic, layout) { }
internal OrganicTintedBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Basic, layout) { }
internal GroundedBlock(string name, string namedId, BlockFlags flags, TextureLayout layout) : base( name, namedId, flags, layout) { }
internal EternalFlame(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Basic, layout) { }
internal DirtBlock(string name, string namedId, TextureLayout normal, TextureLayout wet) : base( name, namedId, BlockFlags.Basic, normal) { this.wet = wet; }
internal GrowingBlock(string name, string namedId, TextureLayout layout, Block ground, int maxHeight) : base( name, namedId, BlockFlags.Basic, layout) { requiredGround = ground; this.maxHeight = maxHeight; }
public static ResourceDescription Texture1D(DXGI.Format format, long width, short arraySize = 1, short mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, long alignment = 0) { return new ResourceDescription(ResourceDimension.Texture1D, alignment, width, 1, arraySize, mipLevels, format, 1, 0, layout, flags); }
internal CoveredGrassSpreadableBlock(string name, string namedId, TextureLayout normal, bool hasNeutralTint) : base( name, namedId, normal, normal, hasNeutralTint, supportsFullGrowth: false) { }
internal ConcreteBlock(string name, string namedId, TextureLayout layout) : base( name, namedId, BlockFlags.Functional, BoundingBox.Block, TargetBuffer.VaryingHeight) { this.layout = layout; }
internal GrassBlock(string name, string namedId, TextureLayout normal, TextureLayout wet) : base( name, namedId, normal, wet, hasNeutralTint: true, supportsFullGrowth: false) { }
public static ResourceDescription Texture1D(Format format, ulong width, ushort arraySize = 1, ushort mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, ulong alignment = 0) { return(new ResourceDescription(ResourceDimension.Texture1D, alignment, width, 1, arraySize, mipLevels, format, 1, 0, layout, flags)); }
public static ResourceDescription Texture3D(DXGI.Format format, long width, int height, short depth, short mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, long alignment = 0) { return new ResourceDescription(ResourceDimension.Texture3D, alignment, width, height, depth, mipLevels, format, 1, 0, layout, flags); }
public static ResourceDescription Texture3D(Format format, ulong width, int height, ushort depth, ushort mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, ulong alignment = 0) { return(new ResourceDescription(ResourceDimension.Texture3D, alignment, width, height, depth, mipLevels, format, 1, 0, layout, flags)); }
/// <summary> /// Create a new <see cref="ConcreteLiquid" />. /// </summary> /// <param name="name">The name of the liquid.</param> /// <param name="namedId">The named ID of the liquid.</param> /// <param name="density">The density of the liquid.</param> /// <param name="viscosity">The viscosity of the liquid.</param> /// <param name="movingLayout">The texture layout when this liquid is moving.</param> /// <param name="staticLayout">The texture layout when this liquid is static.</param> public ConcreteLiquid(string name, string namedId, float density, int viscosity, TextureLayout movingLayout, TextureLayout staticLayout) : base( name, namedId, density, viscosity, neutralTint: false, movingLayout, staticLayout) { }
public ResourceDescription(ResourceDimension dimension, long alignment, long width, int height, short depthOrArraySize, short mipLevels, Format format, int sampleCount, int sampleQuality, TextureLayout layout, ResourceFlags optionFlags) { Dimension = dimension; Alignment = alignment; Width = width; Height = height; DepthOrArraySize = depthOrArraySize; MipLevels = mipLevels; Format = format; SampleDescription = new SampleDescription(sampleCount, sampleQuality); Layout = layout; Flags = optionFlags; }
public static ResourceDescription Texture2D(DXGI.Format format, long width, int height, short arraySize = 1, short mipLevels = 0, int sampleCount = 1, int sampleQuality = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, long alignment = 0) { return new ResourceDescription(ResourceDimension.Texture2D, alignment, width, height, arraySize, mipLevels, format, sampleCount, sampleQuality, layout, flags); }
public static ResourceDescription Texture1D(Format format, long width, int arraySize = 1, int mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, long alignment = 0) { checked { return(new ResourceDescription(ResourceDimension.Texture1D, (ulong)alignment, (ulong)width, 1, (ushort)arraySize, (ushort)mipLevels, format, 1, 0, layout, flags)); } }
/// <summary> /// Create a new <see cref="DirtBlock" />. /// </summary> /// <param name="name">The name of the block.</param> /// <param name="namedId">The named ID of the block.</param> /// <param name="normal">The normal texture layout.</param> /// <param name="wet">The texture layout when wet.</param> /// <param name="hasNeutralTint">Whether the block has a neutral tint.</param> /// <param name="supportsFullGrowth">Whether the block supports full growth.</param> protected CoveredDirtBlock(string name, string namedId, TextureLayout normal, TextureLayout wet, bool hasNeutralTint, bool supportsFullGrowth) : base( name, namedId, BlockFlags.Basic, normal) { this.hasNeutralTint = hasNeutralTint; SupportsFullGrowth = supportsFullGrowth; this.wet = wet; }
public ResourceDescription(ResourceDimension dimension, long alignment, long width, int height, short depthOrArraySize, short mipLevels, Format format, int sampleCount, int sampleQuality, TextureLayout layout, ResourceOptionFlags optionFlags) { Dimension = dimension; Alignment = alignment; Width = width; Height = height; DepthOrArraySize = depthOrArraySize; MipLevels = mipLevels; Format = format; SampleDescription = new SampleDescription(sampleCount, sampleQuality); Layout = layout; OptionFlags = optionFlags; }
public static ResourceDescription Texture2D(Format format, ulong width, int height, ushort arraySize = 1, ushort mipLevels = 0, int sampleCount = 1, int sampleQuality = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, ulong alignment = 0) { return(new ResourceDescription(ResourceDimension.Texture2D, alignment, width, height, arraySize, mipLevels, format, sampleCount, sampleQuality, layout, flags)); }
private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { SelectedObjectName = e.Item.SubItems[1].Text; switch (comboBox1.SelectedItem.ToString()) { case "Default": TextureLayout = TextureLayout.Default; break; case "Stretch": TextureLayout = TextureLayout.Stretch; break; case "Tile": TextureLayout = TextureLayout.Tile; break; case "Center": TextureLayout = TextureLayout.Center; break; } }
/// <summary> /// Create a new <see cref="HotLiquid" />. /// </summary> public HotLiquid(string name, string namedId, float density, int viscosity, bool neutralTint, TextureLayout movingLayout, TextureLayout staticLayout, RenderType renderType = RenderType.Opaque) : base( name, namedId, density, viscosity, neutralTint, movingLayout, staticLayout, renderType) { }
internal InsetDirtBlock(string name, string namedId, TextureLayout dry, TextureLayout wet, bool supportsFullGrowth) : base( name, namedId, BlockFlags.Solid, BoundingBox.Block, TargetBuffer.VaryingHeight) { dryLayout = dry; wetLayout = wet; SupportsFullGrowth = supportsFullGrowth; }
private void button2_Click(object sender, EventArgs e) { switch (comboBox1.SelectedItem.ToString()) { case "Default": TextureLayout = TextureLayout.Default; break; case "Stretch": TextureLayout = TextureLayout.Stretch; break; case "Tile": TextureLayout = TextureLayout.Tile; break; case "Center": TextureLayout = TextureLayout.Center; break; } this.Close(); }
public static ResourceDescription1 Texture3D(Format format, long width, int height, int depth, int mipLevels = 0, ResourceFlags flags = ResourceFlags.None, TextureLayout layout = TextureLayout.Unknown, long alignment = 0) { checked { return(new ResourceDescription1(ResourceDimension.Texture3D, (ulong)alignment, (ulong)width, height, (ushort)depth, (ushort)mipLevels, format, 1, 0, layout, flags, 0, 0, 0)); } }
/// <summary> /// Create a new basic liquid. /// </summary> /// <param name="name">The name of the basic liquid.</param> /// <param name="namedId">The named ID of the liquid.</param> /// <param name="density">The density of the liquid.</param> /// <param name="viscosity">The viscosity of the liquid.</param> /// <param name="neutralTint">Whether this liquid has a neutral tint.</param> /// <param name="movingLayout">The texture layout when this liquid is moving.</param> /// <param name="staticLayout">The texture layout when this liquid is static.</param> /// <param name="renderType">The render type of the liquid.</param> public BasicLiquid(string name, string namedId, float density, int viscosity, bool neutralTint, TextureLayout movingLayout, TextureLayout staticLayout, RenderType renderType = RenderType.Opaque) : base( name, namedId, density, viscosity, checkContact: true, receiveContact: false, renderType) { this.neutralTint = neutralTint; this.movingLayout = movingLayout; this.staticLayout = staticLayout; }
/// <summary> /// Loads texture from file with specified texture layout /// </summary> /// <param name="filepath">Filepath to texture</param> /// <param name="textureLayout">Texture layout</param> /// <returns></returns> public static Texture FromFile(string filepath, TextureLayout textureLayout) { try { if (filepath == null) { throw new ArgumentNullException(nameof(filepath)); } Image texImg = Image.FromFile(filepath); Texture texture = new Texture(texImg, textureLayout); return(texture); } catch (Exception ex) { throw new ContentLoadException("Unable to load texture from " + filepath + "! Inner exception message: " + ex.Message, ex); } }
/// <summary> /// Initializes a new instance of the <see cref="Texture2DDescription1"/> struct. /// </summary> /// <param name="format">Texture format.</param> /// <param name="width">Texture width (in texels).</param> /// <param name="height">Texture height (in texels).</param> /// <param name="arraySize">Number of textures in the array.</param> /// <param name="mipLevels">The maximum number of mipmap levels in the texture.</param> /// <param name="bindFlags">The <see cref="Vortice.Direct3D11.BindFlags"/> for binding to pipeline stages.</param> /// <param name="usage">Value that identifies how the texture is to be read from and written to.</param> /// <param name="cpuAccessFlags">The <see cref="Direct3D11.CpuAccessFlags"/> to specify the types of CPU access allowed.</param> /// <param name="sampleCount">Specifies multisampling parameters for the texture.</param> /// <param name="sampleQuality">Specifies multisampling parameters for the texture.</param> /// <param name="optionFlags">The <see cref="ResourceOptionFlags"/> that identify other, less common resource options. </param> /// <param name="textureLayout">A <see cref="TextureLayout"/> value that identifies the layout of the texture.</param> public Texture2DDescription1( Format format, int width, int height, int arraySize = 1, int mipLevels = 0, BindFlags bindFlags = BindFlags.ShaderResource, ResourceUsage usage = ResourceUsage.Default, CpuAccessFlags cpuAccessFlags = CpuAccessFlags.None, int sampleCount = 1, int sampleQuality = 0, ResourceOptionFlags optionFlags = ResourceOptionFlags.None, TextureLayout textureLayout = TextureLayout.Undefined) { if (format == Format.Unknown) { throw new ArgumentException($"format need to be valid", nameof(format)); } if (width < 1 || width > ID3D11Resource.MaximumTexture2DSize) { throw new ArgumentException($"Width need to be in range 1-{ID3D11Resource.MaximumTexture2DSize}", nameof(width)); } if (height < 1 || height > ID3D11Resource.MaximumTexture2DSize) { throw new ArgumentException($"Height need to be in range 1-{ID3D11Resource.MaximumTexture2DSize}", nameof(height)); } if (arraySize < 1 || arraySize > ID3D11Resource.MaximumTexture2DArraySize) { throw new ArgumentException($"Array size need to be in range 1-{ID3D11Resource.MaximumTexture2DArraySize}", nameof(arraySize)); } Width = width; Height = height; MipLevels = mipLevels; ArraySize = arraySize; Format = format; SampleDescription = new SampleDescription(sampleCount, sampleQuality); Usage = usage; BindFlags = bindFlags; CpuAccessFlags = cpuAccessFlags; OptionFlags = optionFlags; TextureLayout = textureLayout; }