Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public static extern int FromImage(PixelBufferType type, byte[] fileImage, bool mipmap, PixelFormat format, out int result);
Esempio n. 6
0
 public static extern int FromFile(PixelBufferType type, string fileName, bool mipmap, PixelFormat format, out int result);
Esempio n. 7
0
 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);
Esempio n. 8
0
 public static extern int Create(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2, out int result);
Esempio n. 9
0
 /// <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();
 }