1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026434: Visualization - Textured objects should have priority over the environment mapping.

Add handle on environment texture in OpenGl_Workspace.
Add a new parameter UseEnvironmentTexture to the Graphic3d_ZLayerSettings.
OSD layers don't use environment texture by default.
zbuffertrihedron doesn't use environment texture.
vzlayer can enable/disable environment texture mappping.
Delete unnecessary files Graphic3d_TypeOfSurfaceDetail.hxx and V3d_TypeOfSurface.hxx.
Delete functions SurfaceDetailType and SetSurfaceDetailType functions from Graphic3d_CView.
Delete functions SurfaceDetailState and UpdateSurfaceDetailStateTo from OpenGl_ShaderManager.
Delete class OpenGl_SurfaceDetailState.
Delete functions SurfaceDetailType and SetSurfaceDetailType from OpenGl_View.
Delete functions SetSurfaceDetail and SurfaceDetail() from V3d_View.
Delete functions SetDefaultSurfaceDetail and DefaultSurfaceDetail from V3d_Viewer.
Delete draw command VSetTextureMode.
Add description in dox.
This commit is contained in:
isk
2016-02-17 10:29:48 +03:00
parent 2b5550fae8
commit a9cc8b1a3b
29 changed files with 150 additions and 338 deletions

View File

@@ -971,3 +971,11 @@ Zoom persistent selection introduces a new structure *Graphic3d_TransformPers* f
* Transformation matrix utilities from *OpenGl_Utils* namespace have been moved to *Graphic3d_TransformUtils* and *Graphic3d_TransformUtils.hxx* header respectively.
* Matrix stack utilities from *OpenGl_Utils* namespace have been moved to *OpenGl_MatrixStack* class and *OpenGl_MatrixStack.hxx* header respectively.
* *OpenGl_View* methods *Begin/EndTransformPersistence* have been removed. Please, use *Graphic3d_TransformPers::Apply()* instead to apply persistence to perspective and world-view projection matrices.
Applications that use gp_Quaternion to convert Yaw-Pitch-Roll angles (or other intrinsic Tait-Bryan sequences) may need to be updated to take this change into account.
@subsection Correction of texture mapping of objects
Interaction of texture and environment texture is fixed. Textured objects have priority over the environment mapping.
Redundant enumerations V3d_TypeOfSurface and Graphic3d_TypeOfSurface, class OpenGl_SurfaceDetailState, corresponding methods from Graphic3d_CView, OpenGl_ShaderManager, OpenGl_View, V3d_View, V3d_Viewer are deleted.
Draw command VSetTextureMode is deleted.

View File

@@ -160,7 +160,6 @@ Graphic3d_TypeOfReflection.hxx
Graphic3d_TypeOfShaderObject.hxx
Graphic3d_TypeOfShadingModel.hxx
Graphic3d_TypeOfStructure.hxx
Graphic3d_TypeOfSurfaceDetail.hxx
Graphic3d_TypeOfTexture.hxx
Graphic3d_TypeOfTextureFilter.hxx
Graphic3d_TypeOfTextureMode.hxx

View File

@@ -1068,7 +1068,6 @@ void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
SetTextureEnv (theOther->TextureEnv());
SetCullingEnabled (theOther->IsCullingEnabled());
SetShadingModel (theOther->ShadingModel());
SetSurfaceDetailType (theOther->SurfaceDetailType());
SetBackfacingModel (theOther->BackfacingModel());
SetCamera (new Graphic3d_Camera (theOther->Camera()));
SetBackZClippingOn (theOther->BackZClippingIsOn());

View File

@@ -40,7 +40,6 @@
#include <Graphic3d_TypeOfAnswer.hxx>
#include <Graphic3d_TypeOfBackfacingModel.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Graphic3d_TypeOfSurfaceDetail.hxx>
#include <Graphic3d_TypeOfVisualization.hxx>
#include <Graphic3d_Vec3.hxx>
#include <Graphic3d_ZLayerId.hxx>
@@ -434,12 +433,6 @@ public:
//! Sets shading model of the view.
virtual void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel) = 0;
//! Returns surface detail type of the view.
virtual Graphic3d_TypeOfSurfaceDetail SurfaceDetailType() const = 0;
//! Sets surface detail type of the view.
virtual void SetSurfaceDetailType (const Graphic3d_TypeOfSurfaceDetail theType) = 0;
//! Return backfacing model used for the view.
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;

View File

@@ -1,32 +0,0 @@
// Created on: 1991-10-07
// Created by: NW,JPB,CAL
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-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 _Graphic3d_TypeOfSurfaceDetail_HeaderFile
#define _Graphic3d_TypeOfSurfaceDetail_HeaderFile
//! Modes of visualisation of objects in a view
//!
//! TOD_NONE no texture mapping
//! TOD_ENVIRONMENT only environnement mapping
//! TOD_ALL environnement + texture mapping
enum Graphic3d_TypeOfSurfaceDetail
{
Graphic3d_TOD_NONE,
Graphic3d_TOD_ENVIRONMENT,
Graphic3d_TOD_ALL
};
#endif // _Graphic3d_TypeOfSurfaceDetail_HeaderFile

View File

@@ -35,7 +35,8 @@ struct Graphic3d_ZLayerSettings
Flags (Graphic3d_ZLayerDepthTest
| Graphic3d_ZLayerDepthWrite
| Graphic3d_ZLayerDepthClear),
IsImmediate (false)
IsImmediate (false),
UseEnvironmentTexture (true)
{}
//! Returns true if theSetting is enabled.
@@ -76,10 +77,11 @@ struct Graphic3d_ZLayerSettings
public:
Standard_ShortReal DepthOffsetFactor; //!< factor argument value for OpenGl glPolygonOffset function
Standard_ShortReal DepthOffsetUnits; //!< units argument value for OpenGl glPolygonOffset function
Standard_Integer Flags; //!< storage field for settings
bool IsImmediate; //!< immediate layer will be drawn after all normal layers
Standard_ShortReal DepthOffsetFactor; //!< factor argument value for OpenGl glPolygonOffset function
Standard_ShortReal DepthOffsetUnits; //!< units argument value for OpenGl glPolygonOffset function
Standard_Integer Flags; //!< storage field for settings
bool IsImmediate; //!< immediate layer will be drawn after all normal layers
bool UseEnvironmentTexture; //!< flag to allow/prevent environment texture mapping usage for specific layer
};

View File

@@ -101,6 +101,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
Graphic3d_ZLayerSettings anUnderlaySettings;
anUnderlaySettings.Flags = 0;
anUnderlaySettings.IsImmediate = false;
anUnderlaySettings.UseEnvironmentTexture = false;
myLayerIds.Add (Graphic3d_ZLayerId_BotOSD);
myLayerSeq.Append (Graphic3d_ZLayerId_BotOSD);
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_BotOSD, anUnderlaySettings);
@@ -133,6 +134,7 @@ OpenGl_GraphicDriver::OpenGl_GraphicDriver (const Handle(Aspect_DisplayConnectio
Graphic3d_ZLayerSettings anOsdSettings;
anOsdSettings.Flags = 0;
anOsdSettings.IsImmediate = true;
anOsdSettings.UseEnvironmentTexture = false;
myLayerIds.Add (Graphic3d_ZLayerId_TopOSD);
myLayerSeq.Append (Graphic3d_ZLayerId_TopOSD);
myMapOfZLayerSettings.Bind (Graphic3d_ZLayerId_TopOSD, anOsdSettings);

View File

@@ -365,6 +365,14 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace)& theWorkspace,
glDepthFunc (GL_ALWAYS);
}
// save environment texture
Handle(OpenGl_Texture) anEnvironmentTexture = theWorkspace->EnvironmentTexture();
if (!myLayerSettings.UseEnvironmentTexture)
{
Handle(OpenGl_Texture) anEmptyTexture;
theWorkspace->SetEnvironmentTexture (anEmptyTexture);
}
// handle depth offset
if (IsSettingEnabled (Graphic3d_ZLayerDepthOffset))
{
@@ -390,4 +398,10 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace)& theWorkspace,
theWorkspace->SetPolygonOffset (anAppliedOffsetParams.mode,
anAppliedOffsetParams.factor,
anAppliedOffsetParams.units);
// restore environment texture
if (!myLayerSettings.UseEnvironmentTexture)
{
theWorkspace->SetEnvironmentTexture (anEnvironmentTexture);
}
}

View File

@@ -23,7 +23,6 @@
#define OPENGL_NS_ANTIALIASING (1<<5)
#define OPENGL_NS_2NDPASSNEED (1<<6)
#define OPENGL_NS_2NDPASSDO (1<<7)
#define OPENGL_NS_FORBIDSETTEX (1<<8)
#define OPENGL_NS_WHITEBACK (1<<9)
#define OPENGL_NS_WHITEBACK (1<<8)
#endif //_OpenGl_NamedStatus_Header

View File

@@ -824,25 +824,6 @@ const OpenGl_MaterialState* OpenGl_ShaderManager::MaterialState (const Handle(Op
return &myMaterialStates.Find (theProgram);
}
// =======================================================================
// function : SurfaceDetailState
// purpose : Returns current state of OCCT surface detail
// =======================================================================
const OpenGl_SurfaceDetailState& OpenGl_ShaderManager::SurfaceDetailState() const
{
return mySurfaceDetailState;
}
// =======================================================================
// function : UpdateSurfaceDetailStateTo
// purpose : Updates state of OCCT surface detail
// =======================================================================
void OpenGl_ShaderManager::UpdateSurfaceDetailStateTo (const Graphic3d_TypeOfSurfaceDetail theDetail)
{
mySurfaceDetailState.Set (theDetail);
mySurfaceDetailState.Update();
}
namespace
{

View File

@@ -19,7 +19,6 @@
#include <Graphic3d_ShaderProgram.hxx>
#include <Graphic3d_StereoMode.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Graphic3d_TypeOfSurfaceDetail.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Sequence.hxx>
@@ -253,14 +252,6 @@ public:
//! Returns current state of OCCT material for specified program.
Standard_EXPORT const OpenGl_MaterialState* MaterialState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
public:
//! Returns current state of OCCT surface detail.
Standard_EXPORT const OpenGl_SurfaceDetailState& SurfaceDetailState() const;
//! Updates state of OCCT surface detail.
Standard_EXPORT void UpdateSurfaceDetailStateTo (const Graphic3d_TypeOfSurfaceDetail theDetail);
public:
//! Pushes current state of OCCT graphics parameters to specified program.
@@ -309,7 +300,7 @@ protected:
{
aBits |= OpenGl_PO_ClipPlanes;
}
if (theEnableEnvMap && mySurfaceDetailState.Detail() == Graphic3d_TOD_ENVIRONMENT)
if (theEnableEnvMap)
{
// Environment map overwrites material texture
aBits |= OpenGl_PO_TextureEnv;
@@ -413,7 +404,6 @@ protected:
OpenGl_WorldViewState myWorldViewState; //!< State of OCCT world-view transformation
OpenGl_ClippingState myClippingState; //!< State of OCCT clipping planes
OpenGl_LightSourceState myLightSourceState; //!< State of OCCT light sources
OpenGl_SurfaceDetailState mySurfaceDetailState; //!< State of OCCT surface detail
private:

View File

@@ -16,7 +16,6 @@
#ifndef _OpenGl_State_HeaderFile
#define _OpenGl_State_HeaderFile
#include <Graphic3d_TypeOfSurfaceDetail.hxx>
#include <InterfaceGraphic_tgl_all.hxx>
#include <NCollection_List.hxx>
#include <OpenGl_Element.hxx>
@@ -183,28 +182,4 @@ protected:
};
//! Defines generic state of OCCT surface detail.
class OpenGl_SurfaceDetailState : public OpenGl_StateInterface
{
public:
//! Creates new surface detail state.
OpenGl_SurfaceDetailState (const Graphic3d_TypeOfSurfaceDetail theDetail = Graphic3d_TOD_NONE)
: myDetail (theDetail)
{
//
}
//! Sets new surface detail.
void Set (const Graphic3d_TypeOfSurfaceDetail theDetail) { myDetail = theDetail; }
//! Returns surface detail.
Graphic3d_TypeOfSurfaceDetail Detail() const { return myDetail; }
private:
Graphic3d_TypeOfSurfaceDetail myDetail; //!< OCCT surface detail
};
#endif // _OpenGl_State_HeaderFile

View File

@@ -66,7 +66,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
myAntiAliasing (Standard_False),
myCulling (Standard_True),
myShadingModel (Graphic3d_TOSM_FACET),
mySurfaceDetail (Graphic3d_TOD_ALL),
myBackfacing (Graphic3d_TOBM_AUTOMATIC),
myBgColor (myDefaultBg),
myFog (myDefaultFog),

View File

@@ -34,7 +34,6 @@
#include <Graphic3d_GraduatedTrihedron.hxx>
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_TypeOfShadingModel.hxx>
#include <Graphic3d_TypeOfSurfaceDetail.hxx>
#include <Graphic3d_WorldViewProjState.hxx>
#include <Graphic3d_ZLayerSettings.hxx>
@@ -308,16 +307,6 @@ public:
//! Sets shading model of the view.
virtual void SetShadingModel (const Graphic3d_TypeOfShadingModel theModel) Standard_OVERRIDE { myShadingModel = theModel; }
//! Returns surface detail type of the view.
virtual Graphic3d_TypeOfSurfaceDetail SurfaceDetailType() const Standard_OVERRIDE { return mySurfaceDetail; }
//! Sets surface detail type of the view.
virtual void SetSurfaceDetailType (const Graphic3d_TypeOfSurfaceDetail theType) Standard_OVERRIDE
{
mySurfaceDetail = theType;
myToUpdateEnvironmentMap = Standard_True;
}
//! Return backfacing model used for the view.
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const Standard_OVERRIDE { return myBackfacing; }
@@ -562,7 +551,6 @@ protected:
Standard_Boolean myAntiAliasing;
Standard_Boolean myCulling;
Graphic3d_TypeOfShadingModel myShadingModel;
Graphic3d_TypeOfSurfaceDetail mySurfaceDetail;
Graphic3d_TypeOfBackfacingModel myBackfacing;
TEL_COLOUR myBgColor;
OPENGL_FOG myFog;

View File

@@ -2257,7 +2257,7 @@ Standard_Boolean OpenGl_View::updateRaytraceEnvironmentMap (const Handle(OpenGl_
{
aResult &= theGlContext->BindProgram (aProgram);
if (!myTextureEnv.IsNull() && mySurfaceDetail != Graphic3d_TOD_NONE)
if (!myTextureEnv.IsNull())
{
myTextureEnv->Bind (theGlContext,
GL_TEXTURE0 + OpenGl_RT_EnvironmentMapTexture);

View File

@@ -1137,7 +1137,15 @@ void OpenGl_View::renderTrihedron (const Handle(OpenGl_Workspace) &theWorkspace)
// display global trihedron
if (myToShowTrihedron)
{
// disable environment texture
Handle(OpenGl_Texture) anEnvironmentTexture = theWorkspace->EnvironmentTexture();
Handle(OpenGl_Texture) anEmptyTexture;
theWorkspace->SetEnvironmentTexture (anEmptyTexture);
myTrihedron.Render (theWorkspace);
// restore environment texture
theWorkspace->SetEnvironmentTexture (anEnvironmentTexture);
}
if (myToShowGradTrihedron)
{
@@ -1284,84 +1292,50 @@ void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
// Clear status bitfields
myWorkspace->NamedStatus &= ~(OPENGL_NS_2NDPASSNEED | OPENGL_NS_2NDPASSDO);
// Update state of surface detail level
myWorkspace->GetGlContext()->ShaderManager()->UpdateSurfaceDetailStateTo (mySurfaceDetail);
// First pass
myWorkspace->SetEnvironmentTexture (myTextureEnv);
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
// Added PCT for handling of textures
switch (mySurfaceDetail)
// Second pass
if (myWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED)
{
case Graphic3d_TOD_NONE:
myWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
myWorkspace->DisableTexture();
// Render the view
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
break;
myWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO;
case Graphic3d_TOD_ENVIRONMENT:
myWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
if (myRenderParams.Method != Graphic3d_RM_RAYTRACING)
{
myWorkspace->EnableTexture (myTextureEnv);
}
// Render the view
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
break;
// 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);
case Graphic3d_TOD_ALL:
// First pass
myWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX;
// Render the view
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
// Change the properties for second rendering pass
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
// Second pass
if (myWorkspace->NamedStatus & OPENGL_NS_2NDPASSNEED)
{
myWorkspace->NamedStatus |= OPENGL_NS_2NDPASSDO;
if (myRenderParams.Method != Graphic3d_RM_RAYTRACING)
{
myWorkspace->EnableTexture (myTextureEnv);
}
glDepthFunc (GL_EQUAL);
glDepthMask (GL_FALSE);
glEnable (GL_DEPTH_TEST);
// 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);
// Render the view
renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
// Change the properties for second rendering pass
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
// Restore properties back
glBlendFunc (aSaveBlendSrc, aSaveBlendDst);
if (!wasBlendEnabled)
glDisable (GL_BLEND);
glDepthFunc (GL_EQUAL);
glDepthMask (GL_FALSE);
glEnable (GL_DEPTH_TEST);
myWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
// 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);
}
break;
glDepthFunc (aSaveZbuffFunc);
glDepthMask (aSaveZbuffWrite);
if (!wasZbuffEnabled)
glDisable (GL_DEPTH_FUNC);
}
// Apply restored view matrix.

View File

@@ -970,12 +970,17 @@ const OpenGl_AspectFace* OpenGl_Workspace::AspectFace (const Standard_Boolean th
updateMaterial (TEL_BACK_MATERIAL);
}
if ((NamedStatus & OPENGL_NS_FORBIDSETTEX) == 0)
if (AspectFace_set->DoTextureMap())
{
if (AspectFace_set->DoTextureMap())
EnableTexture (AspectFace_set->TextureRes (myGlContext),
AspectFace_set->TextureParams());
}
else
{
if (!myEnvironmentTexture.IsNull())
{
EnableTexture (AspectFace_set->TextureRes (myGlContext),
AspectFace_set->TextureParams());
EnableTexture (myEnvironmentTexture,
myEnvironmentTexture->GetParams());
}
else
{

View File

@@ -236,6 +236,18 @@ public:
return myFrontCulling;
}
//! Sets a new environment texture.
void SetEnvironmentTexture (const Handle(OpenGl_Texture)& theTexture)
{
myEnvironmentTexture = theTexture;
}
//! Returns environment texture.
const Handle(OpenGl_Texture)& EnvironmentTexture() const
{
return myEnvironmentTexture;
}
protected:
void updateMaterial (const int theFlag);
@@ -281,6 +293,8 @@ protected: //! @name fields related to status
OpenGl_AspectFace myAspectFaceHl; //!< Hiddenline aspect
Handle(OpenGl_Texture) myEnvironmentTexture;
public: //! @name type definition
DEFINE_STANDARD_RTTIEXT(OpenGl_Workspace,Standard_Transient)

View File

@@ -546,10 +546,6 @@ static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, con
TCollection_AsciiString anOldName = ViewerTest::GetCurrentViewName();
Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
if (Draw::Atoi (argv[2]))
{
aViewer->SetDefaultSurfaceDetail (V3d_TEX_ALL);
}
aViewer->SetDefaultTypeOfView (V3d_PERSPECTIVE);
Handle(Aspect_Window) asp = ViewerTest::CurrentView()->Window();
Handle(V3d_View) aNewView = aViewer->CreateView();

View File

@@ -31,7 +31,6 @@ V3d_TypeOfPickCamera.hxx
V3d_TypeOfPickLight.hxx
V3d_TypeOfRepresentation.hxx
V3d_TypeOfShadingModel.hxx
V3d_TypeOfSurfaceDetail.hxx
V3d_TypeOfUpdate.hxx
V3d_TypeOfView.hxx
V3d_TypeOfVisualization.hxx

View File

@@ -1,31 +0,0 @@
// Created on: 1992-11-13
// Created by: GG
// Copyright (c) 1992-1999 Matra Datavision
// Copyright (c) 1999-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 _V3d_TypeOfSurfaceDetail_HeaderFile
#define _V3d_TypeOfSurfaceDetail_HeaderFile
//! Modes of visualization for objects in a view
//! - V3d_TEX_NONE: no texture mapping,
//! - V3d_TEX_ENVIRONMENT: environment mapping only,
//! - V3d_TEX_ALL: environment and texture mapping.
enum V3d_TypeOfSurfaceDetail
{
V3d_TEX_NONE,
V3d_TEX_ENVIRONMENT,
V3d_TEX_ALL
};
#endif // _V3d_TypeOfSurfaceDetail_HeaderFile

View File

@@ -159,7 +159,6 @@ V3d_View::V3d_View (const Handle(V3d_Viewer)& theViewer, const V3d_TypeOfView th
SetAxis (0.,0.,0.,1.,1.,1.);
SetVisualization (theViewer->DefaultVisualization());
SetShadingModel (theViewer->DefaultShadingModel());
SetSurfaceDetail (theViewer->DefaultSurfaceDetail());
SetTwist (0.);
SetAt (0.,0.,0.);
SetProj (theViewer->DefaultViewProj());
@@ -625,15 +624,6 @@ void V3d_View::SetShadingModel (const V3d_TypeOfShadingModel theShadingModel)
myView->SetShadingModel (static_cast<Graphic3d_TypeOfShadingModel> (theShadingModel));
}
//=============================================================================
//function : SetSurfaceDetail
//purpose :
//=============================================================================
void V3d_View::SetSurfaceDetail (const V3d_TypeOfSurfaceDetail theSurfaceDetail)
{
myView->SetSurfaceDetailType (static_cast<Graphic3d_TypeOfSurfaceDetail> (theSurfaceDetail));
}
//=============================================================================
//function : SetTextureEnv
//purpose :
@@ -2421,15 +2411,6 @@ V3d_TypeOfShadingModel V3d_View::ShadingModel() const
return static_cast<V3d_TypeOfShadingModel> (myView->ShadingModel());
}
//=============================================================================
//function : SurfaceDetail
//purpose :
//=============================================================================
V3d_TypeOfSurfaceDetail V3d_View::SurfaceDetail() const
{
return static_cast<V3d_TypeOfSurfaceDetail> (myView->SurfaceDetailType());
}
//=============================================================================
//function : TextureEnv
//purpose :

View File

@@ -75,7 +75,6 @@
#include <V3d_TypeOfBackfacingModel.hxx>
#include <V3d_TypeOfOrientation.hxx>
#include <V3d_TypeOfShadingModel.hxx>
#include <V3d_TypeOfSurfaceDetail.hxx>
#include <V3d_TypeOfView.hxx>
#include <V3d_TypeOfVisualization.hxx>
#include <V3d_TypeOfZclipping.hxx>
@@ -260,9 +259,6 @@ public:
//! Defines the shading model for the visualization. Various models are available.
Standard_EXPORT void SetShadingModel (const V3d_TypeOfShadingModel theShadingModel);
//! Selects the kind of rendering for texture mapping. No texture mapping by default.
Standard_EXPORT void SetSurfaceDetail (const V3d_TypeOfSurfaceDetail theSurfaceDetail);
//! Sets the environment texture to use. No environment texture by default.
Standard_EXPORT void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTexture);
@@ -721,8 +717,6 @@ public:
//! Returns the current shading model.
Standard_EXPORT V3d_TypeOfShadingModel ShadingModel() const;
Standard_EXPORT V3d_TypeOfSurfaceDetail SurfaceDetail() const;
Standard_EXPORT Handle(Graphic3d_TextureEnv) TextureEnv() const;
//! Returns the current visualisation mode.

View File

@@ -48,8 +48,7 @@ V3d_Viewer::V3d_Viewer (const Handle(Graphic3d_GraphicDriver)& theDriver,
const V3d_TypeOfShadingModel theShadingModel,
const V3d_TypeOfUpdate theUpdateMode,
const Standard_Boolean theComputedMode,
const Standard_Boolean theDefaultComputedMode,
const V3d_TypeOfSurfaceDetail theSurfaceDetail)
const Standard_Boolean theDefaultComputedMode)
:myNextCount (-1),
myDriver (theDriver),
myName (TCollection_ExtendedString (theName)),
@@ -78,7 +77,6 @@ myZLayerGenId (1, IntegerLast())
SetDefaultBackgroundColor (theViewBackground);
SetDefaultVisualization (theVisualization);
SetDefaultShadingModel (theShadingModel);
SetDefaultSurfaceDetail (theSurfaceDetail);
SetDefaultAngle (M_PI / 2.);
SetDefaultTypeOfView (V3d_ORTHOGRAPHIC);
@@ -319,11 +317,6 @@ void V3d_Viewer::SetDefaultShadingModel(const V3d_TypeOfShadingModel Type) {
MyShadingModel = Type ;
}
void V3d_Viewer::SetDefaultSurfaceDetail(const V3d_TypeOfSurfaceDetail Type) {
MySurfaceDetail = Type ;
}
void V3d_Viewer::SetDefaultAngle(const Quantity_PlaneAngle Angle) {
MyDefaultAngle = Angle;
}
@@ -372,10 +365,6 @@ V3d_TypeOfShadingModel V3d_Viewer::DefaultShadingModel() const {
return MyShadingModel ;
}
V3d_TypeOfSurfaceDetail V3d_Viewer::DefaultSurfaceDetail() const {
return MySurfaceDetail ;
}
Quantity_PlaneAngle V3d_Viewer::DefaultAngle() const {
return MyDefaultAngle;
}

View File

@@ -48,7 +48,6 @@
#include <V3d_ListOfTransient.hxx>
#include <V3d_TypeOfOrientation.hxx>
#include <V3d_TypeOfShadingModel.hxx>
#include <V3d_TypeOfSurfaceDetail.hxx>
#include <V3d_TypeOfUpdate.hxx>
#include <V3d_TypeOfView.hxx>
#include <V3d_TypeOfVisualization.hxx>
@@ -91,7 +90,7 @@ public:
//! This limitation might be addressed in some future OCCT releases.
//! If the size of the view is <= 0
//! Warning: Client must creates a graphic driver
Standard_EXPORT V3d_Viewer(const Handle(Graphic3d_GraphicDriver)& theDriver, const Standard_ExtString theName, const Standard_CString theDomain = "", const Quantity_Length theViewSize = 1000.0, const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos, const Quantity_NameOfColor theViewBackground = Quantity_NOC_GRAY30, const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER, const V3d_TypeOfShadingModel theShadingModel = V3d_GOURAUD, const V3d_TypeOfUpdate theUpdateMode = V3d_WAIT, const Standard_Boolean theComputedMode = Standard_True, const Standard_Boolean theDefaultComputedMode = Standard_True, const V3d_TypeOfSurfaceDetail theSurfaceDetail = V3d_TEX_NONE);
Standard_EXPORT V3d_Viewer(const Handle(Graphic3d_GraphicDriver)& theDriver, const Standard_ExtString theName, const Standard_CString theDomain = "", const Quantity_Length theViewSize = 1000.0, const V3d_TypeOfOrientation theViewProj = V3d_XposYnegZpos, const Quantity_NameOfColor theViewBackground = Quantity_NOC_GRAY30, const V3d_TypeOfVisualization theVisualization = V3d_ZBUFFER, const V3d_TypeOfShadingModel theShadingModel = V3d_GOURAUD, const V3d_TypeOfUpdate theUpdateMode = V3d_WAIT, const Standard_Boolean theComputedMode = Standard_True, const Standard_Boolean theDefaultComputedMode = Standard_True);
//! creates a view in the viewer according to its
//! default parameters.
@@ -179,9 +178,6 @@ public:
//! Gives the default type of SHADING.
Standard_EXPORT void SetDefaultShadingModel (const V3d_TypeOfShadingModel Type);
//! Gives the default type of texture mapping.
Standard_EXPORT void SetDefaultSurfaceDetail (const V3d_TypeOfSurfaceDetail Type);
Standard_EXPORT void SetDefaultAngle (const Quantity_PlaneAngle Angle);
//! Defines the mode of regenerating the views making
@@ -240,9 +236,6 @@ public:
//! Returns the default type of Shading
Standard_EXPORT V3d_TypeOfShadingModel DefaultShadingModel() const;
//! Returns the default type of texture mapping
Standard_EXPORT V3d_TypeOfSurfaceDetail DefaultSurfaceDetail() const;
Standard_EXPORT Quantity_PlaneAngle DefaultAngle() const;
//! Returns the regeneration mode of views in the viewer.
@@ -489,7 +482,6 @@ private:
V3d_TypeOfOrientation MyViewProj;
V3d_TypeOfVisualization MyVisualization;
V3d_TypeOfShadingModel MyShadingModel;
V3d_TypeOfSurfaceDetail MySurfaceDetail;
Quantity_PlaneAngle MyDefaultAngle;
V3d_TypeOfView MyDefaultTypeOfView;
Graphic3d_RenderingParams myDefaultRenderingParams;

View File

@@ -3201,8 +3201,6 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
Standard_Integer aPreviousMode = 0;
ViewerTest::CurrentView()->SetSurfaceDetail (V3d_TEX_ALL);
TCollection_AsciiString aShapeName (theArgv[1]);
Handle(AIS_InteractiveObject) anIO;

View File

@@ -4473,21 +4473,7 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar
}
else if (argc < 2)
{
di << "Use: vzlayer ";
di << " add/del/get/settings/enable/disable [id]\n";
di << " add - add new z layer to viewer and print its id\n";
di << " del - del z layer by its id\n";
di << " get - print sequence of z layers in increasing order of their overlay level\n";
di << " settings - print status of z layer settings\n";
di << " enable ([depth]test/[depth]write/[depth]clear/[depth]offset) \n enables given setting for the z layer\n";
di << " enable (p[ositive]offset/n[egative]offset) \n enables given setting for the z layer\n";
di << " disable ([depth]test/[depth]write/[depth]clear/[depth]offset) \n disables given setting for the z layer\n";
di << "\nWhere id is the layer identificator\n";
di << "\nExamples:\n";
di << " vzlayer add\n";
di << " vzlayer enable poffset 1\n";
di << " vzlayer disable depthtest 1\n";
di << " vzlayer del 1\n";
di << di.PrintHelp (argv[0]);
return 1;
}
@@ -4625,6 +4611,10 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar
{
aSettings.SetDepthOffsetNegative();
}
else if (aSubOp == "textureenv")
{
aSettings.UseEnvironmentTexture = true;
}
aViewer->SetZLayerSettings (anId, aSettings);
}
@@ -4662,6 +4652,10 @@ static int VZLayer (Draw_Interpretor& di, Standard_Integer argc, const char** ar
{
aSettings.DisableSetting (Graphic3d_ZLayerDepthOffset);
}
else if (aSubOp == "textureenv")
{
aSettings.UseEnvironmentTexture = false;
}
aViewer->SetZLayerSettings (anId, aSettings);
}
@@ -6572,11 +6566,9 @@ static int VTextureEnv (Draw_Interpretor& /*theDI*/, Standard_Integer theArgNb,
);
}
aView->SetTextureEnv(aTexEnv);
aView->SetSurfaceDetail(V3d_TEX_ENVIRONMENT);
}
else // Disabling environment mapping
{
aView->SetSurfaceDetail(V3d_TEX_NONE);
Handle(Graphic3d_TextureEnv) aTexture;
aView->SetTextureEnv(aTexture); // Passing null handle to clear the texture data
}
@@ -6980,40 +6972,6 @@ static int VClipPlane (Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
return 1;
}
//===============================================================================================
//function : VSetTextureMode
//purpose :
//===============================================================================================
static int VSetTextureMode (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const char** theArgVec)
{
if (theArgsNb < 3)
{
theDi << theArgVec[0] << ": insufficient command arguments. Type help for more information.\n";
return 1;
}
TCollection_AsciiString aViewName (theArgVec[1]);
if (!ViewerTest_myViews.IsBound1 (aViewName))
{
theDi << theArgVec[0] << ": view is not found.\n";
return 1;
}
const Handle(V3d_View)& aView = ViewerTest_myViews.Find1 (aViewName);
switch (atoi (theArgVec[2]))
{
case 0: aView->SetSurfaceDetail (V3d_TEX_NONE); break;
case 1: aView->SetSurfaceDetail (V3d_TEX_ENVIRONMENT); break;
case 2: aView->SetSurfaceDetail (V3d_TEX_ALL); break;
default:
theDi << theArgVec[0] << ": invalid mode.\n";
return 1;
}
aView->Redraw();
return 0;
}
//===============================================================================================
//function : VZRange
//purpose :
@@ -9023,7 +8981,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
" settings - print status of z layer settings\n"
" enable ([depth]test/[depth]write/[depth]clear/[depth]offset) \n enables given setting for the z layer\n"
" enable (p[ositive]offset/n[egative]offset) \n enables given setting for the z layer\n"
" enable textureenv \n enables environment texture mapping\n"
" disable ([depth]test/[depth]write/[depth]clear/[depth]offset) \n disables given setting for the z layer\n"
" disable textureenv \n disables environment texture mapping\n"
"\nWhere id is the layer identificator\n"
"\nExamples:\n"
" vzlayer add\n"
@@ -9278,13 +9238,6 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
" change <plane_name> capping hatch on/off/<id> - set hatching mask.\n"
" please use VSetTextureMode command to enable texture rendering in view.\n"
, __FILE__, VClipPlane, group);
theCommands.Add("vsettexturemode", "vsettexturemode view_name mode \n"
" mode can be:\n"
" 0 - no textures enabled in view.\n"
" 1 - only environment textures enabled.\n"
" 2 - all textures enabled.\n"
" this command sets texture details mode for the specified view.\n"
, __FILE__, VSetTextureMode, group);
theCommands.Add("vdefaults",
"vdefaults [-absDefl value]"
"\n\t\t: [-devCoeff value]"

View File

@@ -839,11 +839,6 @@ static Standard_Integer meshcolors( Draw_Interpretor& di,
aBuilder->SetInvalidColor(Quantity_NOC_BLACK);
aBuilder->SetTextureCoords(aScaleMap);
aMesh->AddBuilder(aBuilder, Standard_True);
//set viewer to display texures
const Handle(V3d_Viewer)& aViewer = anIC->CurrentViewer();
for (aViewer->InitActiveViews(); aViewer->MoreActiveViews(); aViewer->NextActiveViews())
aViewer->ActiveView()->SetSurfaceDetail(V3d_TEX_ALL);
}
aMesh->GetDrawer()->SetBoolean ( MeshVS_DA_ColorReflection, Standard_Boolean(aReflection) );

36
tests/bugs/vis/bug26434 Normal file
View File

@@ -0,0 +1,36 @@
puts "============"
puts "CR26434"
puts "============"
puts ""
##########################################################################################
puts "Visualization - Textured objects should have priority over the environment mapping"
##########################################################################################
pload MODELING VISUALIZATION
vclear
vclose all
vinit View1
vsetdispmode 1
box b0 -1 -1 -1 1 2 3
box b1 1 1 1 1 2 3
vdisplay b0 b1
vzbufftrihedron
vfit
vdump $imagedir/${casename}_0.png
vtexture b1 0
vdump $imagedir/${casename}_1.png
puts "Checking that texture have priority over the environment mapping"
vtextureenv on 0
vdump $imagedir/${casename}_2.png