|
|
@@ -14,30 +14,30 @@ namespace bs
|
|
|
*/
|
|
|
|
|
|
/** Pixel formats usable by images, textures and render surfaces. */
|
|
|
- enum BS_SCRIPT_EXPORT() PixelFormat
|
|
|
- {
|
|
|
- /** Unknown pixel format. */
|
|
|
- PF_UNKNOWN BS_SCRIPT_EXPORT(ex:true) = 0,
|
|
|
- /** 8-bit pixel format, all bits red. */
|
|
|
- PF_R8 BS_SCRIPT_EXPORT(n:R8) = 1,
|
|
|
- /** 2 byte pixel format, 1 byte red, 1 byte green. */
|
|
|
- PF_R8G8 BS_SCRIPT_EXPORT(n:R8G8) = 2,
|
|
|
- /** 24-bit pixel format, 8 bits for red, green and blue. */
|
|
|
- PF_R8G8B8 BS_SCRIPT_EXPORT(n:R8G8B8) = 3,
|
|
|
- /** 24-bit pixel format, 8 bits for blue, green and red. */
|
|
|
- PF_B8G8R8 BS_SCRIPT_EXPORT(n:B8G8R8) = 4,
|
|
|
- /** 32-bit pixel format, 8 bits for blue, green, red and alpha. */
|
|
|
- PF_B8G8R8A8 BS_SCRIPT_EXPORT(n:B8G8R8A8) = 7,
|
|
|
- /** 32-bit pixel format, 8 bits for red, green, blue and alpha. */
|
|
|
- PF_R8G8B8A8 BS_SCRIPT_EXPORT(n:R8G8B8A8) = 8,
|
|
|
- /** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
|
|
|
- PF_BC1 BS_SCRIPT_EXPORT(n:BC1) = 13,
|
|
|
+ enum BS_SCRIPT_EXPORT() PixelFormat
|
|
|
+ {
|
|
|
+ /** Unknown pixel format. */
|
|
|
+ PF_UNKNOWN BS_SCRIPT_EXPORT(ex:true) = 0,
|
|
|
+ /** 8-bit 1-channel pixel format, unsigned normalized. */
|
|
|
+ PF_R8 BS_SCRIPT_EXPORT(n:R8) = 1,
|
|
|
+ /** 8-bit 2-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RG8 BS_SCRIPT_EXPORT(n:RG8) = 2,
|
|
|
+ /** 8-bit 3-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RGB8 BS_SCRIPT_EXPORT(n:RGB8) = 3,
|
|
|
+ /** 8-bit 3-channel pixel format, unsigned normalized. */
|
|
|
+ PF_BGR8 BS_SCRIPT_EXPORT(n:BGR8) = 4,
|
|
|
+ /** 8-bit 4-channel pixel format, unsigned normalized. */
|
|
|
+ PF_BGRA8 BS_SCRIPT_EXPORT(n:BGRA8) = 7,
|
|
|
+ /** 8-bit 4-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RGBA8 BS_SCRIPT_EXPORT(n:RGBA8) = 8,
|
|
|
+ /** DXT1/BC1 format containing opaque RGB or 1-bit alpha RGB. 4 bits per pixel. */
|
|
|
+ PF_BC1 BS_SCRIPT_EXPORT(n:BC1) = 13,
|
|
|
/** DXT3/BC2 format containing RGB with premultiplied alpha. 4 bits per pixel. */
|
|
|
PF_BC1a BS_SCRIPT_EXPORT(ex:true) = 14,
|
|
|
- /** DXT3/BC2 format containing RGB with explicit alpha. 8 bits per pixel. */
|
|
|
- PF_BC2 BS_SCRIPT_EXPORT(n:BC2) = 15,
|
|
|
- /** DXT5/BC2 format containing RGB with explicit alpha. 8 bits per pixel. Better alpha gradients than BC2. */
|
|
|
- PF_BC3 BS_SCRIPT_EXPORT(n:BC3) = 16,
|
|
|
+ /** DXT3/BC2 format containing RGB with explicit alpha. 8 bits per pixel. */
|
|
|
+ PF_BC2 BS_SCRIPT_EXPORT(n:BC2) = 15,
|
|
|
+ /** DXT5/BC2 format containing RGB with explicit alpha. 8 bits per pixel. Better alpha gradients than BC2. */
|
|
|
+ PF_BC3 BS_SCRIPT_EXPORT(n:BC3) = 16,
|
|
|
/** One channel compressed format. 4 bits per pixel. */
|
|
|
PF_BC4 BS_SCRIPT_EXPORT(n:BC4) = 17,
|
|
|
/** Two channel compressed format. 8 bits per pixel. */
|
|
|
@@ -49,80 +49,111 @@ namespace bs
|
|
|
* higher decompress overhead. 8 bits per pixel.
|
|
|
*/
|
|
|
PF_BC7 BS_SCRIPT_EXPORT(n:BC7) = 20,
|
|
|
- /** 16-bit pixel format, 16 bits (float) for red. */
|
|
|
- PF_FLOAT16_R BS_SCRIPT_EXPORT(n:Float16_R) = 21,
|
|
|
- /** 32-bit, 2-channel s10e5 floating point pixel format, 16-bit red, 16-bit green. */
|
|
|
- PF_FLOAT16_RG BS_SCRIPT_EXPORT(n:Float16_RG) = 22,
|
|
|
- /** 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue. */
|
|
|
- PF_FLOAT16_RGB BS_SCRIPT_EXPORT(n:Float16_RGB) = 23,
|
|
|
- /**
|
|
|
- * 64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits
|
|
|
- * (float) for alpha.
|
|
|
- */
|
|
|
- PF_FLOAT16_RGBA BS_SCRIPT_EXPORT(n:Float16_RGBA) = 24,
|
|
|
- /** 32-bit pixel format, 32 bits (float) for red. */
|
|
|
- PF_FLOAT32_R BS_SCRIPT_EXPORT(n:Float32_R) = 25,
|
|
|
- /** 64-bit, 2-channel floating point pixel format, 32-bit red, 32-bit green. */
|
|
|
- PF_FLOAT32_RG BS_SCRIPT_EXPORT(n:Float32_RG) = 26,
|
|
|
- /** 96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue. */
|
|
|
- PF_FLOAT32_RGB BS_SCRIPT_EXPORT(n:Float32_RGB) = 27,
|
|
|
- /**
|
|
|
- * 128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue, 32 bits
|
|
|
- * (float) for alpha.
|
|
|
- */
|
|
|
- PF_FLOAT32_RGBA BS_SCRIPT_EXPORT(n:Float32_RGBA) = 28,
|
|
|
- /** Depth stencil format, 32bit depth, 8bit stencil + 24 unused. */
|
|
|
+ /** 16-bit 1-channel pixel format, signed float. */
|
|
|
+ PF_R16F BS_SCRIPT_EXPORT(n:R16F) = 21,
|
|
|
+ /** 16-bit 2-channel pixel format, signed float. */
|
|
|
+ PF_RG16F BS_SCRIPT_EXPORT(n:RG16F) = 22,
|
|
|
+ /** 16-bit 4-channel pixel format, signed float. */
|
|
|
+ PF_RGBA16F BS_SCRIPT_EXPORT(n:RGBA16F) = 24,
|
|
|
+ /** 32-bit 1-channel pixel format, signed float. */
|
|
|
+ PF_R32F BS_SCRIPT_EXPORT(n:R32F) = 25,
|
|
|
+ /** 32-bit 2-channel pixel format, signed float. */
|
|
|
+ PF_RG32F BS_SCRIPT_EXPORT(n:RG32F) = 26,
|
|
|
+ /** 32-bit 3-channel pixel format, signed float. */
|
|
|
+ PF_RGB32F BS_SCRIPT_EXPORT(n:RGB32F) = 27,
|
|
|
+ /** 32-bit 4-channel pixel format, signed float. */
|
|
|
+ PF_RGBA32F BS_SCRIPT_EXPORT(n:RGBA32F) = 28,
|
|
|
+ /** Depth stencil format, 32bit depth, 8bit stencil + 24 unused. Depth stored as signed float. */
|
|
|
PF_D32_S8X24 BS_SCRIPT_EXPORT(n:D32_S8X24) = 29,
|
|
|
- /** Depth stencil fomrat, 24bit depth + 8bit stencil. */
|
|
|
+ /** Depth stencil fomrat, 24bit depth + 8bit stencil. Depth stored as unsigned normalized. */
|
|
|
PF_D24S8 BS_SCRIPT_EXPORT(n:D24S8) = 30,
|
|
|
- /** Depth format, 32bits. */
|
|
|
+ /** Depth format, 32bits. Signed float. */
|
|
|
PF_D32 BS_SCRIPT_EXPORT(n:D32) = 31,
|
|
|
- /** Depth format, 16bits. */
|
|
|
+ /** Depth format, 16bits. Unsigned normalized. */
|
|
|
PF_D16 BS_SCRIPT_EXPORT(n:D16) = 32,
|
|
|
+ /** Packed unsigned float format, 11 bits for red, 11 bits for green, 10 bits for blue. */
|
|
|
+ PF_RG11B10F BS_SCRIPT_EXPORT(ex:true) = 33,
|
|
|
/**
|
|
|
- * 32-bit float format, 11 bits (float) for red, 11 bits (float) for green, 10 bits (float) for blue.
|
|
|
- */
|
|
|
- PF_FLOAT_R11G11B10 BS_SCRIPT_EXPORT(ex:true) = 33,
|
|
|
- /**
|
|
|
- * 32-bit unsigned normalized format, 10 bits (float) for red, 10 bits (float) for green, 10 bits (float) for blue,
|
|
|
- * and two bits for alpha.
|
|
|
- */
|
|
|
- PF_UNORM_R10G10B10A2 BS_SCRIPT_EXPORT(ex:true) = 34,
|
|
|
+ * Packed unsigned normalized format, 10 bits for red, 10 bits for green, 10 bits for blue, and two bits for alpha.
|
|
|
+ */
|
|
|
+ PF_RGB10A2 BS_SCRIPT_EXPORT(ex:true) = 34,
|
|
|
+ /** 8-bit 1-channel pixel format, signed integer. */
|
|
|
+ PF_R8I BS_SCRIPT_EXPORT(n:R8I) = 35,
|
|
|
+ /** 8-bit 2-channel pixel format, signed integer. */
|
|
|
+ PF_RG8I BS_SCRIPT_EXPORT(n:RG8I) = 36,
|
|
|
+ /** 8-bit 4-channel pixel format, signed integer. */
|
|
|
+ PF_RGBA8I BS_SCRIPT_EXPORT(n:RGBA8I) = 37,
|
|
|
+ /** 8-bit 1-channel pixel format, signed normalized. */
|
|
|
+ PF_R8S BS_SCRIPT_EXPORT(n:R8S) = 38,
|
|
|
+ /** 8-bit 2-channel pixel format, signed normalized. */
|
|
|
+ PF_RG8S BS_SCRIPT_EXPORT(n:RG8S) = 39,
|
|
|
+ /** 8-bit 4-channel pixel format, signed normalized. */
|
|
|
+ PF_RGBA8S BS_SCRIPT_EXPORT(n:RGBA8S) = 40,
|
|
|
+ /** 16-bit 1-channel pixel format, signed integer. */
|
|
|
+ PF_R16I BS_SCRIPT_EXPORT(n:R16I) = 41,
|
|
|
+ /** 16-bit 2-channel pixel format, signed integer. */
|
|
|
+ PF_RG16I BS_SCRIPT_EXPORT(n:RG16I) = 42,
|
|
|
+ /** 16-bit 4-channel pixel format, signed integer. */
|
|
|
+ PF_RGBA16I BS_SCRIPT_EXPORT(n:RGBA16I) = 43,
|
|
|
+ /** 32-bit 1-channel pixel format, signed integer. */
|
|
|
+ PF_R32I BS_SCRIPT_EXPORT(n:R32I) = 44,
|
|
|
+ /** 32-bit 2-channel pixel format, signed integer. */
|
|
|
+ PF_RG32I BS_SCRIPT_EXPORT(n:RG32I) = 45,
|
|
|
+ /** 32-bit 3-channel pixel format, signed integer. */
|
|
|
+ PF_RGB32I BS_SCRIPT_EXPORT(n:RGB32I) = 46,
|
|
|
+ /** 32-bit 4-channel pixel format, signed integer. */
|
|
|
+ PF_RGBA32I BS_SCRIPT_EXPORT(n:RGBA32I) = 47,
|
|
|
+ /** 16-bit 1-channel pixel format, signed normalized. */
|
|
|
+ PF_R16S BS_SCRIPT_EXPORT(n:R16S) = 48,
|
|
|
+ /** 16-bit 2-channel pixel format, signed normalized. */
|
|
|
+ PF_RG16S BS_SCRIPT_EXPORT(n:RG16S) = 49,
|
|
|
+ /** 16-bit 4-channel pixel format, signed normalized. */
|
|
|
+ PF_RGBA16S BS_SCRIPT_EXPORT(n:RGBA16S) = 50,
|
|
|
+ /** 16-bit 1-channel pixel format, unsigned normalized. */
|
|
|
+ PF_R16 BS_SCRIPT_EXPORT(n:R16) = 51,
|
|
|
+ /** 16-bit 2-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RG16 BS_SCRIPT_EXPORT(n:RG16) = 52,
|
|
|
+ /** 16-bit 3-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RGB16 BS_SCRIPT_EXPORT(n:RGB16) = 53,
|
|
|
+ /** 16-bit 4-channel pixel format, unsigned normalized. */
|
|
|
+ PF_RGBA16 BS_SCRIPT_EXPORT(n:RGBA16) = 54,
|
|
|
/** Number of pixel formats currently defined. */
|
|
|
- PF_COUNT BS_SCRIPT_EXPORT(ex:true) = 35
|
|
|
- };
|
|
|
+ PF_COUNT BS_SCRIPT_EXPORT(ex:true)
|
|
|
+ };
|
|
|
|
|
|
/** Flags defining some properties of pixel formats. */
|
|
|
- enum PixelFormatFlags {
|
|
|
- /** This format has an alpha channel. */
|
|
|
- PFF_HASALPHA = 0x00000001,
|
|
|
- /**
|
|
|
+ enum PixelFormatFlags {
|
|
|
+ /** This format has an alpha channel. */
|
|
|
+ PFF_HASALPHA = 0x1,
|
|
|
+ /**
|
|
|
* This format is compressed. This invalidates the values in elemBytes, elemBits and the bit counts as these might
|
|
|
* not be fixed in a compressed format.
|
|
|
*/
|
|
|
- PFF_COMPRESSED = 0x00000002,
|
|
|
- /** This is a floating point format. */
|
|
|
- PFF_FLOAT = 0x00000004,
|
|
|
- /** This is a depth format (for depth textures). */
|
|
|
- PFF_DEPTH = 0x00000008,
|
|
|
- /**
|
|
|
- * Format is in native endian. Generally true for the 16, 24 and 32 bits formats which can be represented as
|
|
|
- * machine integers.
|
|
|
- */
|
|
|
- PFF_NATIVEENDIAN = 0x00000010
|
|
|
- };
|
|
|
-
|
|
|
+ PFF_COMPRESSED = 0x2,
|
|
|
+ /** This is a floating point format. */
|
|
|
+ PFF_FLOAT = 0x4,
|
|
|
+ /** This is a depth format (for depth textures). */
|
|
|
+ PFF_DEPTH = 0x8,
|
|
|
+ /** This format stores data internally as integers. */
|
|
|
+ PFF_INTEGER = 0x10,
|
|
|
+ /** Format contains signed data. Absence of this flag implies unsigned data. */
|
|
|
+ PFF_SIGNED = 0x20,
|
|
|
+ /** Format contains normalized data. This will be [0, 1] for unsigned, and [-1,1] for signed formats. */
|
|
|
+ PFF_NORMALIZED = 0x40
|
|
|
+ };
|
|
|
+
|
|
|
/** Types used for individual components of a pixel. */
|
|
|
- enum PixelComponentType
|
|
|
- {
|
|
|
- PCT_BYTE = 0, /**< Byte per component */
|
|
|
- PCT_SHORT = 1, /**< Short per component */
|
|
|
- PCT_FLOAT16 = 2, /**< 16 bit float per component */
|
|
|
- PCT_FLOAT32 = 3, /**< 32 bit float per component */
|
|
|
- PCT_PACKED_R11G11B10 = 4, /**< 11 bits for first two components, 10 for third component. */
|
|
|
- PCT_PACKED_R10G10B10A2 = 5, /**< 10 bits for first three components, 2 bits for last component */
|
|
|
- PCT_COUNT = 4 /**< Number of pixel types */
|
|
|
- };
|
|
|
+ enum PixelComponentType
|
|
|
+ {
|
|
|
+ PCT_BYTE = 0, /**< 8-bit integer per component */
|
|
|
+ PCT_SHORT = 1, /**< 16-bit integer per component. */
|
|
|
+ PCT_INT = 2, /**< 32-bit integer per component. */
|
|
|
+ PCT_FLOAT16 = 3, /**< 16 bit float per component */
|
|
|
+ PCT_FLOAT32 = 4, /**< 32 bit float per component */
|
|
|
+ PCT_PACKED_R11G11B10 = 5, /**< 11 bits for first two components, 10 for third component. */
|
|
|
+ PCT_PACKED_R10G10B10A2 = 6, /**< 10 bits for first three components, 2 bits for last component */
|
|
|
+ PCT_COUNT /**< Number of pixel types */
|
|
|
+ };
|
|
|
|
|
|
/** Determines how are texture pixels filtered during sampling. */
|
|
|
enum TextureFilter
|
|
|
@@ -154,9 +185,9 @@ namespace bs
|
|
|
*
|
|
|
* @see GpuResourceData
|
|
|
*/
|
|
|
- class BS_CORE_EXPORT BS_SCRIPT_EXPORT() PixelData : public GpuResourceData
|
|
|
+ class BS_CORE_EXPORT BS_SCRIPT_EXPORT() PixelData : public GpuResourceData
|
|
|
{
|
|
|
- public:
|
|
|
+ public:
|
|
|
PixelData();
|
|
|
~PixelData() {}
|
|
|
|
|
|
@@ -199,19 +230,19 @@ namespace bs
|
|
|
* Sets the pitch (in pixels) that determines offset between depth slices of the pixel buffer. Call this before
|
|
|
* allocating the buffer.
|
|
|
*/
|
|
|
- void setSlicePitch(UINT32 slicePitch) { mSlicePitch = slicePitch; }
|
|
|
+ void setSlicePitch(UINT32 slicePitch) { mSlicePitch = slicePitch; }
|
|
|
|
|
|
/**
|
|
|
* Returns the number of extra pixels in a row (non-zero only if rows are not consecutive (row pitch is larger
|
|
|
* than width)).
|
|
|
*/
|
|
|
- UINT32 getRowSkip() const { return mRowPitch - getWidth(); }
|
|
|
+ UINT32 getRowSkip() const { return mRowPitch - getWidth(); }
|
|
|
|
|
|
/**
|
|
|
* Returns the number of extra pixels in a depth slice (non-zero only if slices aren't consecutive (slice pitch is
|
|
|
* larger than width*height).
|
|
|
*/
|
|
|
- UINT32 getSliceSkip() const { return mSlicePitch - (getHeight() * mRowPitch); }
|
|
|
+ UINT32 getSliceSkip() const { return mSlicePitch - (getHeight() * mRowPitch); }
|
|
|
|
|
|
/** Returns the pixel format used by the internal buffer for storing the pixels. */
|
|
|
BS_SCRIPT_EXPORT(n:Format,pr:getter)
|
|
|
@@ -270,24 +301,24 @@ namespace bs
|
|
|
* Return whether this buffer is laid out consecutive in memory (meaning the pitches are equal to the dimensions).
|
|
|
*/
|
|
|
BS_SCRIPT_EXPORT(n:RawIsConsecutive,pr:getter)
|
|
|
- bool isConsecutive() const
|
|
|
+ bool isConsecutive() const
|
|
|
{
|
|
|
return mRowPitch == getWidth() && mSlicePitch == getWidth()*getHeight();
|
|
|
}
|
|
|
|
|
|
/** Return the size (in bytes) this image would take if it was laid out consecutive in memory. */
|
|
|
- UINT32 getConsecutiveSize() const;
|
|
|
+ UINT32 getConsecutiveSize() const;
|
|
|
|
|
|
/** Return the size (in bytes) of the buffer this image requires. */
|
|
|
BS_SCRIPT_EXPORT(n:RawSize,pr:getter)
|
|
|
- UINT32 getSize() const;
|
|
|
+ UINT32 getSize() const;
|
|
|
|
|
|
/**
|
|
|
* Returns pixel data containing a sub-volume of this object. Returned data will not have its own buffer, but will
|
|
|
* instead point to this one. It is up to the caller to ensure this object outlives any sub-volume objects.
|
|
|
*/
|
|
|
- PixelData getSubVolume(const PixelVolume& volume) const;
|
|
|
-
|
|
|
+ PixelData getSubVolume(const PixelVolume& volume) const;
|
|
|
+
|
|
|
/**
|
|
|
* Samples a color at the specified coordinates using a specific filter.
|
|
|
*
|
|
|
@@ -302,7 +333,7 @@ namespace bs
|
|
|
Color getColorAt(UINT32 x, UINT32 y, UINT32 z = 0) const;
|
|
|
|
|
|
/** Sets the pixel color at the specified coordinates. */
|
|
|
- void setColorAt(const Color& color, UINT32 x, UINT32 y, UINT32 z = 0);
|
|
|
+ void setColorAt(const Color& color, UINT32 x, UINT32 y, UINT32 z = 0);
|
|
|
|
|
|
/**
|
|
|
* Converts all the internal data into an array of colors. Array is mapped as such:
|
|
|
@@ -361,9 +392,9 @@ namespace bs
|
|
|
|
|
|
private:
|
|
|
PixelVolume mExtents;
|
|
|
- PixelFormat mFormat;
|
|
|
- UINT32 mRowPitch;
|
|
|
- UINT32 mSlicePitch;
|
|
|
+ PixelFormat mFormat;
|
|
|
+ UINT32 mRowPitch;
|
|
|
+ UINT32 mSlicePitch;
|
|
|
|
|
|
/************************************************************************/
|
|
|
/* SERIALIZATION */
|
|
|
@@ -372,7 +403,7 @@ namespace bs
|
|
|
friend class PixelDataRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
RTTITypeBase* getRTTI() const override;
|
|
|
- };
|
|
|
+ };
|
|
|
|
|
|
/** @} */
|
|
|
}
|