mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0028400: Visualization, Graphic3d_MaterialAspect - remove undocumented and unsupported flag EnvReflexion()
This commit is contained in:
parent
59edf905b1
commit
1a0dfc1bfd
@ -30,7 +30,6 @@ namespace
|
|||||||
Standard_ShortReal TransparencyCoef;
|
Standard_ShortReal TransparencyCoef;
|
||||||
Standard_ShortReal RefractionIndex;
|
Standard_ShortReal RefractionIndex;
|
||||||
Standard_ShortReal Shininess;
|
Standard_ShortReal Shininess;
|
||||||
Standard_ShortReal EnvReflexion;
|
|
||||||
Graphic3d_TypeOfMaterial MaterialType;
|
Graphic3d_TypeOfMaterial MaterialType;
|
||||||
Graphic3d_NameOfMaterial MaterialName;
|
Graphic3d_NameOfMaterial MaterialName;
|
||||||
Standard_Boolean ReflActivity[Graphic3d_TypeOfReflection_NB];
|
Standard_Boolean ReflActivity[Graphic3d_TypeOfReflection_NB];
|
||||||
@ -81,7 +80,6 @@ RawMaterial::RawMaterial (Graphic3d_NameOfMaterial theName, const char* theStrin
|
|||||||
TransparencyCoef(0.0f),
|
TransparencyCoef(0.0f),
|
||||||
RefractionIndex (1.0f),
|
RefractionIndex (1.0f),
|
||||||
Shininess (0.039f),
|
Shininess (0.039f),
|
||||||
EnvReflexion (0.0f),
|
|
||||||
MaterialType (Graphic3d_MATERIAL_ASPECT),
|
MaterialType (Graphic3d_MATERIAL_ASPECT),
|
||||||
MaterialName (theName)
|
MaterialName (theName)
|
||||||
{
|
{
|
||||||
@ -516,7 +514,6 @@ void Graphic3d_MaterialAspect::init (const Graphic3d_NameOfMaterial theName)
|
|||||||
myTransparencyCoef = aMat.TransparencyCoef;
|
myTransparencyCoef = aMat.TransparencyCoef;
|
||||||
myRefractionIndex = aMat.RefractionIndex;
|
myRefractionIndex = aMat.RefractionIndex;
|
||||||
myShininess = aMat.Shininess;
|
myShininess = aMat.Shininess;
|
||||||
myEnvReflexion = aMat.EnvReflexion;
|
|
||||||
myMaterialType = aMat.MaterialType;
|
myMaterialType = aMat.MaterialType;
|
||||||
myMaterialName = theName;
|
myMaterialName = theName;
|
||||||
myRequestedMaterialName = theName;
|
myRequestedMaterialName = theName;
|
||||||
|
@ -208,10 +208,6 @@ public:
|
|||||||
//! Set material type.
|
//! Set material type.
|
||||||
Standard_EXPORT void SetMaterialType (const Graphic3d_TypeOfMaterial theType);
|
Standard_EXPORT void SetMaterialType (const Graphic3d_TypeOfMaterial theType);
|
||||||
|
|
||||||
Standard_ShortReal EnvReflexion() const { return myEnvReflexion; }
|
|
||||||
|
|
||||||
void SetEnvReflexion (const Standard_ShortReal theValue) { myEnvReflexion = theValue; }
|
|
||||||
|
|
||||||
//! Returns TRUE if this material differs from specified one.
|
//! Returns TRUE if this material differs from specified one.
|
||||||
Standard_Boolean IsDifferent (const Graphic3d_MaterialAspect& theOther) const { return !IsEqual (theOther); }
|
Standard_Boolean IsDifferent (const Graphic3d_MaterialAspect& theOther) const { return !IsEqual (theOther); }
|
||||||
|
|
||||||
@ -229,7 +225,6 @@ public:
|
|||||||
&& myRefractionIndex == theOther.myRefractionIndex
|
&& myRefractionIndex == theOther.myRefractionIndex
|
||||||
&& myBSDF == theOther.myBSDF
|
&& myBSDF == theOther.myBSDF
|
||||||
&& myShininess == theOther.myShininess
|
&& myShininess == theOther.myShininess
|
||||||
&& myEnvReflexion == theOther.myEnvReflexion
|
|
||||||
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
|
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
|
||||||
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
|
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
|
||||||
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
|
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
|
||||||
@ -266,7 +261,6 @@ private:
|
|||||||
Standard_ShortReal myTransparencyCoef;
|
Standard_ShortReal myTransparencyCoef;
|
||||||
Standard_ShortReal myRefractionIndex;
|
Standard_ShortReal myRefractionIndex;
|
||||||
Standard_ShortReal myShininess;
|
Standard_ShortReal myShininess;
|
||||||
Standard_ShortReal myEnvReflexion;
|
|
||||||
|
|
||||||
Graphic3d_TypeOfMaterial myMaterialType;
|
Graphic3d_TypeOfMaterial myMaterialType;
|
||||||
Graphic3d_NameOfMaterial myMaterialName;
|
Graphic3d_NameOfMaterial myMaterialName;
|
||||||
|
@ -40,7 +40,6 @@ OpenGl_Material.hxx
|
|||||||
OpenGl_MaterialState.hxx
|
OpenGl_MaterialState.hxx
|
||||||
OpenGl_Matrix.hxx
|
OpenGl_Matrix.hxx
|
||||||
OpenGl_MatrixState.hxx
|
OpenGl_MatrixState.hxx
|
||||||
OpenGl_NamedStatus.hxx
|
|
||||||
OpenGl_TextParam.hxx
|
OpenGl_TextParam.hxx
|
||||||
OpenGl_LineAttributes.hxx
|
OpenGl_LineAttributes.hxx
|
||||||
OpenGl_LineAttributes.cxx
|
OpenGl_LineAttributes.cxx
|
||||||
|
@ -2848,8 +2848,7 @@ Handle(OpenGl_FrameBuffer) OpenGl_Context::SetDefaultFrameBuffer (const Handle(O
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||||
const Standard_Boolean theUseDepthWrite,
|
const Standard_Boolean theUseDepthWrite)
|
||||||
Standard_Integer& theRenderingPassFlags)
|
|
||||||
{
|
{
|
||||||
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
|
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
|
||||||
? theHighlight->BasicFillAreaAspect()
|
? theHighlight->BasicFillAreaAspect()
|
||||||
@ -2887,21 +2886,7 @@ void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
|||||||
aTranspFront = theHighlight->Transparency();
|
aTranspFront = theHighlight->Transparency();
|
||||||
aTranspBack = theHighlight->Transparency();
|
aTranspBack = theHighlight->Transparency();
|
||||||
}
|
}
|
||||||
if ((theRenderingPassFlags & OPENGL_NS_2NDPASSDO) != 0)
|
|
||||||
{
|
{
|
||||||
// second pass
|
|
||||||
myMatFront.Diffuse.a() = aMatFrontSrc.EnvReflexion();
|
|
||||||
myMatBack .Diffuse.a() = aMatBackSrc .EnvReflexion();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (aMatFrontSrc.EnvReflexion() != 0.0f
|
|
||||||
|| aMatBackSrc .EnvReflexion() != 0.0f)
|
|
||||||
{
|
|
||||||
// if the material reflects the environment scene, the second pass is needed
|
|
||||||
theRenderingPassFlags |= OPENGL_NS_2NDPASSNEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLboolean aDepthMask = GL_TRUE;
|
GLboolean aDepthMask = GL_TRUE;
|
||||||
if (aTranspFront != 0.0f
|
if (aTranspFront != 0.0f
|
||||||
|| aTranspBack != 0.0f)
|
|| aTranspBack != 0.0f)
|
||||||
|
@ -628,8 +628,7 @@ public: //! @name methods to alter or retrieve current state
|
|||||||
//! Setup current shading material.
|
//! Setup current shading material.
|
||||||
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
|
||||||
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
|
||||||
const Standard_Boolean theUseDepthWrite,
|
const Standard_Boolean theUseDepthWrite);
|
||||||
Standard_Integer& theRenderingPassFlags);
|
|
||||||
|
|
||||||
//! Setup current color.
|
//! Setup current color.
|
||||||
Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor);
|
Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor);
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
// Created on: 2011-09-20
|
|
||||||
// Created by: Sergey ZERCHANINOV
|
|
||||||
// Copyright (c) 2011-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.
|
|
||||||
|
|
||||||
#ifndef _OpenGl_NamedStatus_Header
|
|
||||||
#define _OpenGl_NamedStatus_Header
|
|
||||||
|
|
||||||
// Dynamic fields
|
|
||||||
#define OPENGL_NS_2NDPASSNEED (1<<6)
|
|
||||||
#define OPENGL_NS_2NDPASSDO (1<<7)
|
|
||||||
|
|
||||||
#endif //_OpenGl_NamedStatus_Header
|
|
@ -938,54 +938,9 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
|
|||||||
aContext->ShaderManager()->UpdateClippingState();
|
aContext->ShaderManager()->UpdateClippingState();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear status bitfields
|
|
||||||
myWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
|
|
||||||
|
|
||||||
// First pass
|
|
||||||
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
|
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
|
||||||
myWorkspace->DisableTexture();
|
myWorkspace->DisableTexture();
|
||||||
|
|
||||||
// Second pass
|
|
||||||
if (myWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED)
|
|
||||||
{
|
|
||||||
myWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO;
|
|
||||||
|
|
||||||
// Remember OpenGl properties
|
|
||||||
GLint aSaveBlendDst = GL_ONE_MINUS_SRC_ALPHA, aSaveBlendSrc = GL_SRC_ALPHA;
|
|
||||||
GLint aSaveZbuffFunc;
|
|
||||||
GLboolean aSaveZbuffWrite;
|
|
||||||
glGetBooleanv (GL_DEPTH_WRITEMASK, &aSaveZbuffWrite);
|
|
||||||
glGetIntegerv (GL_DEPTH_FUNC, &aSaveZbuffFunc);
|
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
|
||||||
glGetIntegerv (GL_BLEND_DST, &aSaveBlendDst);
|
|
||||||
glGetIntegerv (GL_BLEND_SRC, &aSaveBlendSrc);
|
|
||||||
#endif
|
|
||||||
GLboolean wasZbuffEnabled = glIsEnabled (GL_DEPTH_TEST);
|
|
||||||
GLboolean wasBlendEnabled = glIsEnabled (GL_BLEND);
|
|
||||||
|
|
||||||
// Change the properties for second rendering pass
|
|
||||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnable (GL_BLEND);
|
|
||||||
|
|
||||||
glDepthFunc (GL_EQUAL);
|
|
||||||
glDepthMask (GL_FALSE);
|
|
||||||
glEnable (GL_DEPTH_TEST);
|
|
||||||
|
|
||||||
// Render the view
|
|
||||||
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
|
|
||||||
myWorkspace->DisableTexture();
|
|
||||||
|
|
||||||
// Restore properties back
|
|
||||||
glBlendFunc (aSaveBlendSrc, aSaveBlendDst);
|
|
||||||
if (!wasBlendEnabled)
|
|
||||||
glDisable (GL_BLEND);
|
|
||||||
|
|
||||||
glDepthFunc (aSaveZbuffFunc);
|
|
||||||
glDepthMask (aSaveZbuffWrite);
|
|
||||||
if (!wasZbuffEnabled)
|
|
||||||
glDisable (GL_DEPTH_FUNC);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply restored view matrix.
|
// Apply restored view matrix.
|
||||||
aContext->ApplyWorldViewMatrix();
|
aContext->ApplyWorldViewMatrix();
|
||||||
|
|
||||||
|
@ -130,8 +130,7 @@ void OpenGl_Material::Init (const Graphic3d_MaterialAspect& theMat,
|
|||||||
// purpose :
|
// purpose :
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Window)& theWindow)
|
OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Window)& theWindow)
|
||||||
: NamedStatus (0),
|
: myView (theView),
|
||||||
myView (theView),
|
|
||||||
myWindow (theWindow),
|
myWindow (theWindow),
|
||||||
myGlContext (!theWindow.IsNull() ? theWindow->GetGlContext() : NULL),
|
myGlContext (!theWindow.IsNull() ? theWindow->GetGlContext() : NULL),
|
||||||
myUseZBuffer (Standard_True),
|
myUseZBuffer (Standard_True),
|
||||||
@ -211,7 +210,6 @@ void OpenGl_Workspace::ResetAppliedAspect()
|
|||||||
{
|
{
|
||||||
myGlContext->BindDefaultVao();
|
myGlContext->BindDefaultVao();
|
||||||
|
|
||||||
NamedStatus = 0;
|
|
||||||
myHighlightStyle.Nullify();
|
myHighlightStyle.Nullify();
|
||||||
myToAllowFaceCulling = false;
|
myToAllowFaceCulling = false;
|
||||||
myAspectLineSet = &myDefaultAspectLine;
|
myAspectLineSet = &myDefaultAspectLine;
|
||||||
@ -635,8 +633,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
|
|||||||
}
|
}
|
||||||
if (toSuppressBackFaces)
|
if (toSuppressBackFaces)
|
||||||
{
|
{
|
||||||
if (!(NamedStatus & OPENGL_NS_2NDPASSDO)
|
if ((float )myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f)
|
||||||
&& (float )myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f)
|
|
||||||
{
|
{
|
||||||
// disable culling in case of translucent shading aspect
|
// disable culling in case of translucent shading aspect
|
||||||
toSuppressBackFaces = false;
|
toSuppressBackFaces = false;
|
||||||
@ -715,7 +712,7 @@ const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, myUseDepthWrite, NamedStatus);
|
myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, myUseDepthWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myAspectFaceSet->Aspect()->ToMapTexture())
|
if (myAspectFaceSet->Aspect()->ToMapTexture())
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
#include <OpenGl_FrameBuffer.hxx>
|
#include <OpenGl_FrameBuffer.hxx>
|
||||||
#include <OpenGl_Material.hxx>
|
#include <OpenGl_Material.hxx>
|
||||||
#include <OpenGl_Matrix.hxx>
|
#include <OpenGl_Matrix.hxx>
|
||||||
#include <OpenGl_NamedStatus.hxx>
|
|
||||||
#include <OpenGl_RenderFilter.hxx>
|
#include <OpenGl_RenderFilter.hxx>
|
||||||
#include <OpenGl_ShaderObject.hxx>
|
#include <OpenGl_ShaderObject.hxx>
|
||||||
#include <OpenGl_ShaderProgram.hxx>
|
#include <OpenGl_ShaderProgram.hxx>
|
||||||
@ -125,8 +124,6 @@ public:
|
|||||||
//! @return true if clipping algorithm enabled
|
//! @return true if clipping algorithm enabled
|
||||||
Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
|
Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
|
||||||
|
|
||||||
Standard_Integer NamedStatus;
|
|
||||||
|
|
||||||
//// RELATED TO STATUS ////
|
//// RELATED TO STATUS ////
|
||||||
|
|
||||||
//! Return true if active group might activate face culling (e.g. primitives are closed).
|
//! Return true if active group might activate face culling (e.g. primitives are closed).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user