mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
OpenGl_ShaderManager - metallic-roughness, emissive, occlusion and normal texture maps are now supported by PBR. Emissive, occlusion and normal texture maps are now supported by Phong shading model. Path-Tracing now handles metallic-roughness and emissive texture maps. Graphic3d_TextureUnit enumeration has been extended by new values corresponding to supported texture maps. OpenGl_TextureSet and OpenGl_ShaderProgram have been extended with bitmask Graphic3d_TextureSetBits identifying texture slots read from GLSL Program and slots defined within Texture Set to avoid undefined behavior by binding mock textures. OpenGl_TextureSet now duplicates texture unit information to handle textures shared across multiple slots (like Occlusion [R] + Metallic-Roughness [GB]). OpenGl_Context::BindTextures() has been extended with active GLSL program paramter to set mock textures to texture units used by program but undefined by texture set. OpenGl_Workspace::ApplyAspects() has been extended with parameter to avoid bining texture set.
75 lines
2.5 KiB
C++
75 lines
2.5 KiB
C++
// Created by: Kirill GAVRILOV
|
|
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
|
//
|
|
// This file is part of Open CASCADE Technology software library.
|
|
//
|
|
// This library is free software; you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License version 2.1 as published
|
|
// by the Free Software Foundation, with special exception defined in the file
|
|
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
|
// distribution for complete text of the license and disclaimer of any warranty.
|
|
//
|
|
// Alternatively, this file may be used under the terms of Open CASCADE
|
|
// commercial license or contractual agreement.
|
|
|
|
#include <OpenGl_TextureSet.hxx>
|
|
|
|
#include <OpenGl_Texture.hxx>
|
|
|
|
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_TextureSet, Standard_Transient)
|
|
|
|
// =======================================================================
|
|
// function : OpenGl_TextureSet
|
|
// purpose :
|
|
// =======================================================================
|
|
OpenGl_TextureSet::OpenGl_TextureSet (const Handle(OpenGl_Texture)& theTexture)
|
|
: myTextures (0, 0),
|
|
myTextureSetBits (Graphic3d_TextureSetBits_NONE)
|
|
{
|
|
if (!theTexture.IsNull())
|
|
{
|
|
myTextures.ChangeFirst().Texture = theTexture;
|
|
myTextures.ChangeFirst().Unit = theTexture->Sampler()->Parameters()->TextureUnit();
|
|
}
|
|
}
|
|
|
|
// =======================================================================
|
|
// function : IsModulate
|
|
// purpose :
|
|
// =======================================================================
|
|
bool OpenGl_TextureSet::IsModulate() const
|
|
{
|
|
return myTextures.IsEmpty()
|
|
|| myTextures.First().Texture.IsNull()
|
|
|| myTextures.First().Texture->Sampler()->Parameters()->IsModulate();
|
|
}
|
|
|
|
// =======================================================================
|
|
// function : HasNonPointSprite
|
|
// purpose :
|
|
// =======================================================================
|
|
bool OpenGl_TextureSet::HasNonPointSprite() const
|
|
{
|
|
if (myTextures.IsEmpty())
|
|
{
|
|
return false;
|
|
}
|
|
else if (myTextures.Size() == 1)
|
|
{
|
|
return !myTextures.First().Texture.IsNull()
|
|
&& !myTextures.First().Texture->IsPointSprite();
|
|
}
|
|
return !myTextures.First().Texture.IsNull();
|
|
}
|
|
|
|
// =======================================================================
|
|
// function : HasPointSprite
|
|
// purpose :
|
|
// =======================================================================
|
|
bool OpenGl_TextureSet::HasPointSprite() const
|
|
{
|
|
return !myTextures.IsEmpty()
|
|
&& !myTextures.Last().Texture.IsNull()
|
|
&& myTextures.Last().Texture->IsPointSprite();
|
|
}
|