internal PixelBuffer(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2) { int errorCode = PsmPixelBuffer.Create(type, width, height, mipmap, format, option, option2, out this.handle); if (errorCode != 0) { Error.ThrowNativeException(errorCode); } PsmPixelBuffer.GetInfo(this.handle, out this.type, out this.width, out this.height, out this.level, out this.format, out this.option); }
internal Texture(PixelBufferType type, byte[] fileImage, bool mipmap, PixelFormat format) { int errorCode = PsmTexture.FromImage(type, fileImage, mipmap, format, out this.handle); if (errorCode != 0) { Error.ThrowNativeException(errorCode); } PsmPixelBuffer.GetInfo(this.handle, out this.type, out this.width, out this.height, out this.level, out this.format, out this.option); this.state = new TextureState(); }
internal PixelBuffer(PixelBuffer buffer) { int errorCode = PsmPixelBuffer.AddRef(buffer.handle); if (errorCode != 0) { Error.ThrowNativeException(errorCode); } this.handle = buffer.handle; this.type = buffer.type; this.option = buffer.option; this.format = buffer.format; this.width = buffer.width; this.height = buffer.height; this.level = buffer.level; }
bool SetShaderParameters(DeviceContext deviceContext, Matrix world, Matrix view, Matrix projection, ShaderResourceView texture, Color4 pixelColor) { try { var constantBufferType = new ConstantBufferType { World = Matrix.Transpose(world), View = Matrix.Transpose(view), Projection = Matrix.Transpose(projection) }; deviceContext.UpdateSubresource(ref constantBufferType, constantBuffer); deviceContext.VertexShader.SetConstantBuffer(0, constantBuffer); deviceContext.PixelShader.SetShaderResource(0, texture); var pixelBufferType = new PixelBufferType { PixelColor = pixelColor }; deviceContext.UpdateSubresource(ref pixelBufferType, pixelBuffer); deviceContext.PixelShader.SetConstantBuffer(0, pixelBuffer); } catch { return(false); } return(true); }
public static extern int FromImage(PixelBufferType type, byte[] fileImage, bool mipmap, PixelFormat format, out int result);
public static extern int FromFile(PixelBufferType type, string fileName, bool mipmap, PixelFormat format, out int result);
public static extern int GetInfo(int handle, out PixelBufferType type, out int width, out int height, out int level, out PixelFormat format, out PixelBufferOption option);
public static extern int Create(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2, out int result);
/// <summary>Creates a texture</summary> /// <param name="type">Texture type</param> /// <param name="width">Texture width</param> /// <param name="height">Texture height</param> /// <param name="mipmap">Existence/Lack of mipmap</param> /// <param name="format">Pixel format</param> /// <param name="option">Pixel buffer creation option</param> internal Texture(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2) : base(type, width, height, mipmap, format, option, option2) { this.state = new TextureState(); }