1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model

Metallic-Roughness shading model Graphic3d_TOSM_PBR has been implemented.
New materials descriptors Graphic3d_PBRMaterial have been added to Graphic3d_MaterialAspect.
PBR shading model requires OpenGL 3.0+ or OpenGL ES 3.0+ hardware.
Environment cubemap is expected to be provided for realistic look of metallic materials.

occLight_IsHeadlight() now returns bool instead of int.
Avoid using lowp for enumerations to workaround occLight_IsHeadlight()
ignorance on Adreno 308 caused by some GLSL optimizator bugs.

OpenGl_Texture::EstimatedDataSize() - fixed estimation for Cubemap textures.
OpenGl_Sampler::applySamplerParams() - fixed uninitialized GL_TEXTURE_WRAP_R in case of GL_TEXTURE_CUBE_MAP target.
This commit is contained in:
iko
2019-06-20 09:53:20 +03:00
committed by apn
parent f4a7308f61
commit 67312b7991
75 changed files with 7204 additions and 272 deletions

View File

@@ -266,6 +266,31 @@ public:
};
//! POD structure for packed float RG color value (2 floats)
struct Image_ColorRGF
{
//! Component type.
typedef Standard_ShortReal ComponentType_t;
//! Returns the number of components.
static Standard_Integer Length() { return 2; }
//! Alias to 1st component (red intensity).
Standard_ShortReal r() const { return v[0]; }
//! Alias to 2nd component (green intensity).
Standard_ShortReal g() const { return v[1]; }
//! Alias to 1st component (red intensity).
Standard_ShortReal& r() { return v[0]; }
//! Alias to 2nd component (green intensity).
Standard_ShortReal& g() { return v[1]; }
public:
Standard_ShortReal v[2];
};
//! POD structure for packed float RGB color value (3 floats)
struct Image_ColorRGBF
{

View File

@@ -28,6 +28,7 @@ enum Image_Format
Image_Format_BGRA, //!< same as RGBA but with different components order
Image_Format_GrayF, //!< 1 float (4-bytes) per pixel (1-component plane), intensity of the color
Image_Format_AlphaF, //!< 1 float (4-bytes) per pixel (1-component plane), transparency
Image_Format_RGF, //!< 2 floats (8-bytes) RG image plane
Image_Format_RGBF, //!< 3 floats (12-bytes) RGB image plane
Image_Format_BGRF, //!< same as RGBF but with different components order
Image_Format_RGBAF, //!< 4 floats (16-bytes) RGBA image plane

View File

@@ -47,6 +47,8 @@ Standard_Size Image_PixMap::SizePixelBytes (const Image_Format thePixelFormat)
case Image_Format_GrayF:
case Image_Format_AlphaF:
return sizeof(float);
case Image_Format_RGF:
return sizeof(float) * 2;
case Image_Format_RGBAF:
case Image_Format_BGRAF:
return sizeof(float) * 4;
@@ -214,6 +216,11 @@ Quantity_ColorRGBA Image_PixMap::PixelColor (const Standard_Integer theX,
const Standard_ShortReal& aPixel = Value<Standard_ShortReal> (theY, theX);
return Quantity_ColorRGBA (NCollection_Vec4<float> (1.0f, 1.0f, 1.0f, aPixel));
}
case Image_Format_RGF:
{
const Image_ColorRGF& aPixel = Value<Image_ColorRGF> (theY, theX);
return Quantity_ColorRGBA (NCollection_Vec4<float> (aPixel.r(), aPixel.g(), 0.0f, 1.0f));
}
case Image_Format_RGBAF:
{
const Image_ColorRGBAF& aPixel = Value<Image_ColorRGBAF> (theY, theX);
@@ -339,6 +346,13 @@ void Image_PixMap::SetPixelColor (const Standard_Integer theX,
ChangeValue<Standard_ShortReal> (theY, theX) = aColor.a();
return;
}
case Image_Format_RGF:
{
Image_ColorRGF& aPixel = ChangeValue<Image_ColorRGF> (theY, theX);
aPixel.r() = aColor.r();
aPixel.g() = aColor.g();
return;
}
case Image_Format_RGBAF:
{
Image_ColorRGBAF& aPixel = ChangeValue<Image_ColorRGBAF> (theY, theX);