Standard_ShortReal TransparencyCoef;
Standard_ShortReal RefractionIndex;
Standard_ShortReal Shininess;
- Standard_ShortReal EnvReflexion;
Graphic3d_TypeOfMaterial MaterialType;
Graphic3d_NameOfMaterial MaterialName;
Standard_Boolean ReflActivity[Graphic3d_TypeOfReflection_NB];
TransparencyCoef(0.0f),
RefractionIndex (1.0f),
Shininess (0.039f),
- EnvReflexion (0.0f),
MaterialType (Graphic3d_MATERIAL_ASPECT),
MaterialName (theName)
{
myTransparencyCoef = aMat.TransparencyCoef;
myRefractionIndex = aMat.RefractionIndex;
myShininess = aMat.Shininess;
- myEnvReflexion = aMat.EnvReflexion;
myMaterialType = aMat.MaterialType;
myMaterialName = theName;
myRequestedMaterialName = theName;
//! Set material type.
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.
Standard_Boolean IsDifferent (const Graphic3d_MaterialAspect& theOther) const { return !IsEqual (theOther); }
&& myRefractionIndex == theOther.myRefractionIndex
&& myBSDF == theOther.myBSDF
&& myShininess == theOther.myShininess
- && myEnvReflexion == theOther.myEnvReflexion
&& myColors[Graphic3d_TOR_AMBIENT] == theOther.myColors[Graphic3d_TOR_AMBIENT]
&& myColors[Graphic3d_TOR_DIFFUSE] == theOther.myColors[Graphic3d_TOR_DIFFUSE]
&& myColors[Graphic3d_TOR_SPECULAR] == theOther.myColors[Graphic3d_TOR_SPECULAR]
Standard_ShortReal myTransparencyCoef;
Standard_ShortReal myRefractionIndex;
Standard_ShortReal myShininess;
- Standard_ShortReal myEnvReflexion;
Graphic3d_TypeOfMaterial myMaterialType;
Graphic3d_NameOfMaterial myMaterialName;
OpenGl_MaterialState.hxx
OpenGl_Matrix.hxx
OpenGl_MatrixState.hxx
-OpenGl_NamedStatus.hxx
OpenGl_TextParam.hxx
OpenGl_LineAttributes.hxx
OpenGl_LineAttributes.cxx
// =======================================================================
void OpenGl_Context::SetShadingMaterial (const OpenGl_AspectFace* theAspect,
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
- const Standard_Boolean theUseDepthWrite,
- Standard_Integer& theRenderingPassFlags)
+ const Standard_Boolean theUseDepthWrite)
{
const Handle(Graphic3d_AspectFillArea3d)& anAspect = (!theHighlight.IsNull() && !theHighlight->BasicFillAreaAspect().IsNull())
? theHighlight->BasicFillAreaAspect()
aTranspFront = 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;
if (aTranspFront != 0.0f
|| aTranspBack != 0.0f)
//! Setup current shading material.
Standard_EXPORT void SetShadingMaterial (const OpenGl_AspectFace* theAspect,
const Handle(Graphic3d_PresentationAttributes)& theHighlight,
- const Standard_Boolean theUseDepthWrite,
- Standard_Integer& theRenderingPassFlags);
+ const Standard_Boolean theUseDepthWrite);
//! Setup current color.
Standard_EXPORT void SetColor4fv (const OpenGl_Vec4& theColor);
+++ /dev/null
-// 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
aContext->ShaderManager()->UpdateClippingState();
}
- // Clear status bitfields
- myWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
-
- // First pass
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
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.
aContext->ApplyWorldViewMatrix();
// purpose :
// =======================================================================
OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Window)& theWindow)
-: NamedStatus (0),
- myView (theView),
+: myView (theView),
myWindow (theWindow),
myGlContext (!theWindow.IsNull() ? theWindow->GetGlContext() : NULL),
myUseZBuffer (Standard_True),
{
myGlContext->BindDefaultVao();
- NamedStatus = 0;
myHighlightStyle.Nullify();
myToAllowFaceCulling = false;
myAspectLineSet = &myDefaultAspectLine;
}
if (toSuppressBackFaces)
{
- if (!(NamedStatus & OPENGL_NS_2NDPASSDO)
- && (float )myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f)
+ if ((float )myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f)
{
// disable culling in case of translucent shading aspect
toSuppressBackFaces = false;
}
else
{
- myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, myUseDepthWrite, NamedStatus);
+ myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle, myUseDepthWrite);
}
if (myAspectFaceSet->Aspect()->ToMapTexture())
#include <OpenGl_FrameBuffer.hxx>
#include <OpenGl_Material.hxx>
#include <OpenGl_Matrix.hxx>
-#include <OpenGl_NamedStatus.hxx>
#include <OpenGl_RenderFilter.hxx>
#include <OpenGl_ShaderObject.hxx>
#include <OpenGl_ShaderProgram.hxx>
//! @return true if clipping algorithm enabled
Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
- Standard_Integer NamedStatus;
-
//// RELATED TO STATUS ////
//! Return true if active group might activate face culling (e.g. primitives are closed).