mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0030434: Visualization, TKV3d - add "NoUpdate" state of frustum culling optimization
Frustum culling is now managed by Graphic3d_RenderingParams::FrustumCullingState flag and can be switched into Graphic3d_RenderingParams::FrustumCulling_NoUpdate state useful for debugging the algorithm. Draw Harness command vrustumculling has been replaced by vrenderparams -frustumCulling.
This commit is contained in:
parent
30a1b24e19
commit
0e3025bc14
@ -1082,7 +1082,6 @@ void Graphic3d_CView::CopySettings (const Handle(Graphic3d_CView)& theOther)
|
|||||||
SetBackgroundImage (theOther->BackgroundImage());
|
SetBackgroundImage (theOther->BackgroundImage());
|
||||||
SetBackgroundImageStyle (theOther->BackgroundImageStyle());
|
SetBackgroundImageStyle (theOther->BackgroundImageStyle());
|
||||||
SetTextureEnv (theOther->TextureEnv());
|
SetTextureEnv (theOther->TextureEnv());
|
||||||
SetCullingEnabled (theOther->IsCullingEnabled());
|
|
||||||
SetShadingModel (theOther->ShadingModel());
|
SetShadingModel (theOther->ShadingModel());
|
||||||
SetBackfacingModel (theOther->BackfacingModel());
|
SetBackfacingModel (theOther->BackfacingModel());
|
||||||
SetCamera (new Graphic3d_Camera (theOther->Camera()));
|
SetCamera (new Graphic3d_Camera (theOther->Camera()));
|
||||||
|
@ -381,12 +381,6 @@ public:
|
|||||||
//! Sets environment texture for the view.
|
//! Sets environment texture for the view.
|
||||||
virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0;
|
virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) = 0;
|
||||||
|
|
||||||
//! Returns the state of frustum culling optimization.
|
|
||||||
virtual Standard_Boolean IsCullingEnabled() const = 0;
|
|
||||||
|
|
||||||
//! Enables or disables frustum culling optimization.
|
|
||||||
virtual void SetCullingEnabled (const Standard_Boolean theIsEnabled) = 0;
|
|
||||||
|
|
||||||
//! Return backfacing model used for the view.
|
//! Return backfacing model used for the view.
|
||||||
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;
|
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const = 0;
|
||||||
|
|
||||||
|
@ -80,6 +80,14 @@ public:
|
|||||||
| PerfCounters_FrameTimeMax,
|
| PerfCounters_FrameTimeMax,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//! State of frustum culling optimization.
|
||||||
|
enum FrustumCulling
|
||||||
|
{
|
||||||
|
FrustumCulling_Off, //!< culling is disabled
|
||||||
|
FrustumCulling_On, //!< culling is active, and the list of culled entities is automatically updated before redraw
|
||||||
|
FrustumCulling_NoUpdate //!< culling is active, but the list of culled entities is not updated
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Creates default rendering parameters.
|
//! Creates default rendering parameters.
|
||||||
@ -108,6 +116,7 @@ public:
|
|||||||
NbRayTracingTiles (16 * 16),
|
NbRayTracingTiles (16 * 16),
|
||||||
CameraApertureRadius (0.0f),
|
CameraApertureRadius (0.0f),
|
||||||
CameraFocalPlaneDist (1.0f),
|
CameraFocalPlaneDist (1.0f),
|
||||||
|
FrustumCullingState (FrustumCulling_On),
|
||||||
ToneMappingMethod (Graphic3d_ToneMappingMethod_Disabled),
|
ToneMappingMethod (Graphic3d_ToneMappingMethod_Disabled),
|
||||||
Exposure (0.f),
|
Exposure (0.f),
|
||||||
WhitePoint (1.f),
|
WhitePoint (1.f),
|
||||||
@ -181,6 +190,7 @@ public:
|
|||||||
Standard_Integer NbRayTracingTiles; //!< total number of screen tiles used in adaptive sampling mode (PT only)
|
Standard_Integer NbRayTracingTiles; //!< total number of screen tiles used in adaptive sampling mode (PT only)
|
||||||
Standard_ShortReal CameraApertureRadius; //!< aperture radius of perspective camera used for depth-of-field, 0.0 by default (no DOF) (path tracing only)
|
Standard_ShortReal CameraApertureRadius; //!< aperture radius of perspective camera used for depth-of-field, 0.0 by default (no DOF) (path tracing only)
|
||||||
Standard_ShortReal CameraFocalPlaneDist; //!< focal distance of perspective camera used for depth-of field, 1.0 by default (path tracing only)
|
Standard_ShortReal CameraFocalPlaneDist; //!< focal distance of perspective camera used for depth-of field, 1.0 by default (path tracing only)
|
||||||
|
FrustumCulling FrustumCullingState; //!< state of frustum culling optimization; FrustumCulling_On by default
|
||||||
|
|
||||||
Graphic3d_ToneMappingMethod ToneMappingMethod; //!< specifies tone mapping method for path tracing, Graphic3d_ToneMappingMethod_Disabled by default
|
Graphic3d_ToneMappingMethod ToneMappingMethod; //!< specifies tone mapping method for path tracing, Graphic3d_ToneMappingMethod_Disabled by default
|
||||||
Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default
|
Standard_ShortReal Exposure; //!< exposure value used for tone mapping (path tracing), 0.0 by default
|
||||||
|
@ -485,23 +485,28 @@ void OpenGl_Layer::updateBVH() const
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_Layer::UpdateCulling (const Standard_Integer theViewId,
|
void OpenGl_Layer::UpdateCulling (const Standard_Integer theViewId,
|
||||||
const OpenGl_BVHTreeSelector& theSelector,
|
const OpenGl_BVHTreeSelector& theSelector,
|
||||||
const Standard_Boolean theToTraverse)
|
const Graphic3d_RenderingParams::FrustumCulling theFrustumCullingState)
|
||||||
{
|
{
|
||||||
updateBVH();
|
updateBVH();
|
||||||
|
|
||||||
myNbStructuresNotCulled = myNbStructures;
|
myNbStructuresNotCulled = myNbStructures;
|
||||||
for (OpenGl_IndexedMapOfStructure::Iterator aStructIter (myBVHPrimitives.Structures()); aStructIter.More(); aStructIter.Next())
|
if (theFrustumCullingState != Graphic3d_RenderingParams::FrustumCulling_NoUpdate)
|
||||||
{
|
{
|
||||||
const OpenGl_Structure* aStruct = aStructIter.Value();
|
Standard_Boolean toTraverse =
|
||||||
aStruct->SetCulled (theToTraverse);
|
(theFrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On);
|
||||||
}
|
for (OpenGl_IndexedMapOfStructure::Iterator aStructIter (myBVHPrimitives.Structures()); aStructIter.More(); aStructIter.Next())
|
||||||
for (OpenGl_IndexedMapOfStructure::Iterator aStructIter (myBVHPrimitivesTrsfPers.Structures()); aStructIter.More(); aStructIter.Next())
|
{
|
||||||
{
|
const OpenGl_Structure* aStruct = aStructIter.Value();
|
||||||
const OpenGl_Structure* aStruct = aStructIter.Value();
|
aStruct->SetCulled (toTraverse);
|
||||||
aStruct->SetCulled (theToTraverse);
|
}
|
||||||
|
for (OpenGl_IndexedMapOfStructure::Iterator aStructIter (myBVHPrimitivesTrsfPers.Structures()); aStructIter.More(); aStructIter.Next())
|
||||||
|
{
|
||||||
|
const OpenGl_Structure* aStruct = aStructIter.Value();
|
||||||
|
aStruct->SetCulled (toTraverse);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!theToTraverse)
|
if (theFrustumCullingState != Graphic3d_RenderingParams::FrustumCulling_On)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
//! Traverses through BVH tree to determine which structures are in view volume.
|
//! Traverses through BVH tree to determine which structures are in view volume.
|
||||||
void UpdateCulling (const Standard_Integer theViewId,
|
void UpdateCulling (const Standard_Integer theViewId,
|
||||||
const OpenGl_BVHTreeSelector& theSelector,
|
const OpenGl_BVHTreeSelector& theSelector,
|
||||||
const Standard_Boolean theToTraverse);
|
const Graphic3d_RenderingParams::FrustumCulling theFrustumCullingState);
|
||||||
|
|
||||||
//! Returns TRUE if layer is empty or has been discarded entirely by culling test.
|
//! Returns TRUE if layer is empty or has been discarded entirely by culling test.
|
||||||
bool IsCulled() const { return myNbStructuresNotCulled == 0; }
|
bool IsCulled() const { return myNbStructuresNotCulled == 0; }
|
||||||
|
@ -528,7 +528,7 @@ void OpenGl_LayerList::UpdateCulling (const Handle(OpenGl_Workspace)& theWorkspa
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
aLayer.UpdateCulling (aViewId, aSelector, theWorkspace->IsCullingEnabled());
|
aLayer.UpdateCulling (aViewId, aSelector, theWorkspace->View()->RenderingParams().FrustumCullingState);
|
||||||
}
|
}
|
||||||
|
|
||||||
aTimer.Stop();
|
aTimer.Stop();
|
||||||
|
@ -50,7 +50,6 @@ OpenGl_View::OpenGl_View (const Handle(Graphic3d_StructureManager)& theMgr,
|
|||||||
myDriver (theDriver.operator->()),
|
myDriver (theDriver.operator->()),
|
||||||
myCaps (theCaps),
|
myCaps (theCaps),
|
||||||
myWasRedrawnGL (Standard_False),
|
myWasRedrawnGL (Standard_False),
|
||||||
myCulling (Standard_True),
|
|
||||||
myBackfacing (Graphic3d_TOBM_AUTOMATIC),
|
myBackfacing (Graphic3d_TOBM_AUTOMATIC),
|
||||||
myBgColor (Quantity_NOC_BLACK),
|
myBgColor (Quantity_NOC_BLACK),
|
||||||
myCamera (new Graphic3d_Camera()),
|
myCamera (new Graphic3d_Camera()),
|
||||||
|
@ -241,12 +241,6 @@ public:
|
|||||||
//! Sets environment texture for the view.
|
//! Sets environment texture for the view.
|
||||||
Standard_EXPORT virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) Standard_OVERRIDE;
|
Standard_EXPORT virtual void SetTextureEnv (const Handle(Graphic3d_TextureEnv)& theTextureEnv) Standard_OVERRIDE;
|
||||||
|
|
||||||
//! Returns the state of frustum culling optimization.
|
|
||||||
virtual Standard_Boolean IsCullingEnabled() const Standard_OVERRIDE { return myCulling; }
|
|
||||||
|
|
||||||
//! Enables or disables frustum culling optimization.
|
|
||||||
virtual void SetCullingEnabled (const Standard_Boolean theIsEnabled) Standard_OVERRIDE { myCulling = theIsEnabled; }
|
|
||||||
|
|
||||||
//! Return backfacing model used for the view.
|
//! Return backfacing model used for the view.
|
||||||
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const Standard_OVERRIDE { return myBackfacing; }
|
virtual Graphic3d_TypeOfBackfacingModel BackfacingModel() const Standard_OVERRIDE { return myBackfacing; }
|
||||||
|
|
||||||
@ -457,7 +451,6 @@ protected:
|
|||||||
Handle(OpenGl_Caps) myCaps;
|
Handle(OpenGl_Caps) myCaps;
|
||||||
Standard_Boolean myWasRedrawnGL;
|
Standard_Boolean myWasRedrawnGL;
|
||||||
|
|
||||||
Standard_Boolean myCulling;
|
|
||||||
Graphic3d_TypeOfBackfacingModel myBackfacing;
|
Graphic3d_TypeOfBackfacingModel myBackfacing;
|
||||||
Quantity_ColorRGBA myBgColor;
|
Quantity_ColorRGBA myBgColor;
|
||||||
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
|
Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
|
||||||
|
@ -429,15 +429,6 @@ Standard_Integer OpenGl_Workspace::Height() const
|
|||||||
return !myView->GlWindow().IsNull() ? myView->GlWindow()->Height() : 0;
|
return !myView->GlWindow().IsNull() ? myView->GlWindow()->Height() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : IsCullingEnabled
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Boolean OpenGl_Workspace::IsCullingEnabled() const
|
|
||||||
{
|
|
||||||
return myView->IsCullingEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : FBOCreate
|
// function : FBOCreate
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -3173,24 +3173,6 @@ void V3d_View::Translate (const Handle(Graphic3d_Camera)& theCamera,
|
|||||||
theCamera->Transform (aPanTrsf);
|
theCamera->Transform (aPanTrsf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : IsCullingEnabled
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
Standard_Boolean V3d_View::IsCullingEnabled() const
|
|
||||||
{
|
|
||||||
return myView->IsCullingEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
|
||||||
// function : SetFrustumCulling
|
|
||||||
// purpose :
|
|
||||||
// =======================================================================
|
|
||||||
void V3d_View::SetFrustumCulling (const Standard_Boolean theToClip)
|
|
||||||
{
|
|
||||||
myView->SetCullingEnabled (theToClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =======================================================================
|
// =======================================================================
|
||||||
// function : DiagnosticInformation
|
// function : DiagnosticInformation
|
||||||
// purpose :
|
// purpose :
|
||||||
|
@ -911,10 +911,10 @@ public:
|
|||||||
Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
|
Standard_EXPORT Graphic3d_RenderingParams& ChangeRenderingParams();
|
||||||
|
|
||||||
//! @return flag value of objects culling mechanism
|
//! @return flag value of objects culling mechanism
|
||||||
Standard_EXPORT Standard_Boolean IsCullingEnabled() const;
|
Standard_Boolean IsCullingEnabled() const { return RenderingParams().FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On; }
|
||||||
|
|
||||||
//! Turn on/off automatic culling of objects outside frustrum (ON by default)
|
//! Turn on/off automatic culling of objects outside frustum (ON by default)
|
||||||
Standard_EXPORT void SetFrustumCulling (const Standard_Boolean theMode);
|
void SetFrustumCulling (Standard_Boolean theMode) { ChangeRenderingParams().FrustumCullingState = theMode ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off; }
|
||||||
|
|
||||||
//! Fill in the dictionary with diagnostic info.
|
//! Fill in the dictionary with diagnostic info.
|
||||||
//! Should be called within rendering thread.
|
//! Should be called within rendering thread.
|
||||||
|
@ -10430,6 +10430,9 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
theDI << "depth pre-pass: " << (aParams.ToEnableDepthPrepass ? "on" : "off") << "\n";
|
theDI << "depth pre-pass: " << (aParams.ToEnableDepthPrepass ? "on" : "off") << "\n";
|
||||||
theDI << "alpha to coverage: " << (aParams.ToEnableAlphaToCoverage ? "on" : "off") << "\n";
|
theDI << "alpha to coverage: " << (aParams.ToEnableAlphaToCoverage ? "on" : "off") << "\n";
|
||||||
|
theDI << "frustum culling: " << (aParams.FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On ? "on" :
|
||||||
|
aParams.FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_Off ? "off" :
|
||||||
|
"noUpdate") << "\n";
|
||||||
theDI << "\n";
|
theDI << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -11103,6 +11106,39 @@ static Standard_Integer VRenderParams (Draw_Interpretor& theDI,
|
|||||||
}
|
}
|
||||||
aView->ChangeRenderingParams().StatsMaxChartTime = (Standard_ShortReal )Draw::Atof (theArgVec[anArgIter]);
|
aView->ChangeRenderingParams().StatsMaxChartTime = (Standard_ShortReal )Draw::Atof (theArgVec[anArgIter]);
|
||||||
}
|
}
|
||||||
|
else if (aFlag == "-frustumculling"
|
||||||
|
|| aFlag == "-culling")
|
||||||
|
{
|
||||||
|
if (toPrint)
|
||||||
|
{
|
||||||
|
theDI << ((aParams.FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_On) ? "on" :
|
||||||
|
(aParams.FrustumCullingState == Graphic3d_RenderingParams::FrustumCulling_Off) ? "off" :
|
||||||
|
"noUpdate") << " ";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphic3d_RenderingParams::FrustumCulling aState = Graphic3d_RenderingParams::FrustumCulling_On;
|
||||||
|
if (++anArgIter < theArgNb)
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aStateStr(theArgVec[anArgIter]);
|
||||||
|
aStateStr.LowerCase();
|
||||||
|
bool toEnable = true;
|
||||||
|
if (ViewerTest::ParseOnOff (aStateStr.ToCString(), toEnable))
|
||||||
|
{
|
||||||
|
aState = toEnable ? Graphic3d_RenderingParams::FrustumCulling_On : Graphic3d_RenderingParams::FrustumCulling_Off;
|
||||||
|
}
|
||||||
|
else if (aStateStr == "noupdate"
|
||||||
|
|| aStateStr == "freeze")
|
||||||
|
{
|
||||||
|
aState = Graphic3d_RenderingParams::FrustumCulling_NoUpdate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
--anArgIter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aParams.FrustumCullingState = aState;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Error: wrong syntax, unknown flag '" << anArg << "'\n";
|
std::cout << "Error: wrong syntax, unknown flag '" << anArg << "'\n";
|
||||||
@ -11159,53 +11195,6 @@ static Standard_Integer VProgressiveMode (Draw_Interpretor& /*theDI*/,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : VFrustumCulling
|
|
||||||
//purpose : enables/disables view volume's culling.
|
|
||||||
//=======================================================================
|
|
||||||
static int VFrustumCulling (Draw_Interpretor& theDI,
|
|
||||||
Standard_Integer theArgNb,
|
|
||||||
const char** theArgVec)
|
|
||||||
{
|
|
||||||
Handle(V3d_View) aView = ViewerTest::CurrentView();
|
|
||||||
if (aView.IsNull())
|
|
||||||
{
|
|
||||||
std::cout << theArgVec[0] << " Error: Use 'vinit' command before\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theArgNb < 2)
|
|
||||||
{
|
|
||||||
theDI << (aView->IsCullingEnabled() ? "on" : "off");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else if (theArgNb != 2)
|
|
||||||
{
|
|
||||||
std::cout << theArgVec[0] << " Syntax error: Specify the mode\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
TCollection_AsciiString aModeStr (theArgVec[1]);
|
|
||||||
aModeStr.LowerCase();
|
|
||||||
Standard_Boolean toEnable = 0;
|
|
||||||
if (aModeStr == "on")
|
|
||||||
{
|
|
||||||
toEnable = 1;
|
|
||||||
}
|
|
||||||
else if (aModeStr == "off")
|
|
||||||
{
|
|
||||||
toEnable = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toEnable = Draw::Atoi (theArgVec[1]) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
aView->SetFrustumCulling (toEnable);
|
|
||||||
aView->Redraw();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : VXRotate
|
//function : VXRotate
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -12628,13 +12617,12 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
|||||||
"\n '-perfUpdateInterval nbSeconds' Performance counters update interval"
|
"\n '-perfUpdateInterval nbSeconds' Performance counters update interval"
|
||||||
"\n '-perfChart nbFrames' Show frame timers chart limited by specified number of frames"
|
"\n '-perfChart nbFrames' Show frame timers chart limited by specified number of frames"
|
||||||
"\n '-perfChartMax seconds' Maximum time in seconds with the chart"
|
"\n '-perfChartMax seconds' Maximum time in seconds with the chart"
|
||||||
|
"\n '-frustumCulling on|off|noupdate' Enable/disable objects frustum clipping or"
|
||||||
|
"\n set state to check structures culled previously."
|
||||||
"\n Unlike vcaps, these parameters dramatically change visual properties."
|
"\n Unlike vcaps, these parameters dramatically change visual properties."
|
||||||
"\n Command is intended to control presentation quality depending on"
|
"\n Command is intended to control presentation quality depending on"
|
||||||
"\n hardware capabilities and performance.",
|
"\n hardware capabilities and performance.",
|
||||||
__FILE__, VRenderParams, group);
|
__FILE__, VRenderParams, group);
|
||||||
theCommands.Add("vfrustumculling",
|
|
||||||
"vfrustumculling [toEnable]: enables/disables objects clipping",
|
|
||||||
__FILE__,VFrustumCulling,group);
|
|
||||||
theCommands.Add ("vplace",
|
theCommands.Add ("vplace",
|
||||||
"vplace dx dy"
|
"vplace dx dy"
|
||||||
"\n\t\t: Places the point (in pixels) at the center of the window",
|
"\n\t\t: Places the point (in pixels) at the center of the window",
|
||||||
|
@ -20,7 +20,7 @@ vclear
|
|||||||
vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
|
vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
|
||||||
vactivate small_wnd
|
vactivate small_wnd
|
||||||
vrenderparams -perfUpdateInterval 0
|
vrenderparams -perfUpdateInterval 0
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
vautozfit 0
|
vautozfit 0
|
||||||
vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
|
vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
|
||||||
vzrange 1 512
|
vzrange 1 512
|
||||||
@ -67,7 +67,7 @@ puts ""
|
|||||||
verase
|
verase
|
||||||
|
|
||||||
puts "Start displaying spheres with clipping..."
|
puts "Start displaying spheres with clipping..."
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
vdisplayall
|
vdisplayall
|
||||||
puts [vfps]
|
puts [vfps]
|
||||||
vrenderparams -perfCounters none
|
vrenderparams -perfCounters none
|
||||||
|
@ -19,7 +19,7 @@ vclear
|
|||||||
vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
|
vinit name=small_wnd l=32 t=32 w=$SMALL_WIN_WIDTH h=$SMALL_WIN_HEIGHT
|
||||||
vactivate small_wnd
|
vactivate small_wnd
|
||||||
vrenderparams -perfUpdateInterval 0
|
vrenderparams -perfUpdateInterval 0
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
vautozfit 0
|
vautozfit 0
|
||||||
vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
|
vviewparams -scale 1.953125 -eye 0.57735026918962573 -0.57735026918962573 0.57735026918962573
|
||||||
vzrange 1 512
|
vzrange 1 512
|
||||||
@ -69,7 +69,7 @@ puts ""
|
|||||||
|
|
||||||
verase
|
verase
|
||||||
|
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
puts "Start displaying boxes with clipping..."
|
puts "Start displaying boxes with clipping..."
|
||||||
for {set i 0} {$i < $BOXES_NUM} {incr i} {
|
for {set i 0} {$i < $BOXES_NUM} {incr i} {
|
||||||
vdisplay -noupdate $aBoxNames($i)
|
vdisplay -noupdate $aBoxNames($i)
|
||||||
|
@ -9,7 +9,7 @@ puts ""
|
|||||||
box b 1 2 3
|
box b 1 2 3
|
||||||
vinit
|
vinit
|
||||||
vdisplay b
|
vdisplay b
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
vdump $imagedir/${casename}_default_layer.png
|
vdump $imagedir/${casename}_default_layer.png
|
||||||
|
@ -27,9 +27,9 @@ for {set i 0} {$i < $LINES_IN_ROW} {incr i} {
|
|||||||
|
|
||||||
vfit
|
vfit
|
||||||
|
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
vdump $aWithCulling
|
vdump $aWithCulling
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
vdump $aNoCulling
|
vdump $aNoCulling
|
||||||
|
|
||||||
set aDiffRes [diffimage $aWithCulling $aNoCulling 0.1 0 0 $aDiff]
|
set aDiffRes [diffimage $aWithCulling $aNoCulling 0.1 0 0 $aDiff]
|
||||||
|
@ -62,7 +62,7 @@ set tcl_precision 16
|
|||||||
# Test orthographic camera without frustum culling. #
|
# Test orthographic camera without frustum culling. #
|
||||||
####################################################################
|
####################################################################
|
||||||
vcamera -ortho
|
vcamera -ortho
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
|
|
||||||
if { [test2d] != 1 } {
|
if { [test2d] != 1 } {
|
||||||
puts "Error: 2D projection test failed: view frustum culling is OFF"
|
puts "Error: 2D projection test failed: view frustum culling is OFF"
|
||||||
@ -72,7 +72,7 @@ if { [test2d] != 1 } {
|
|||||||
# Test orthographic camera with frustum culling. #
|
# Test orthographic camera with frustum culling. #
|
||||||
####################################################################
|
####################################################################
|
||||||
vcamera -ortho
|
vcamera -ortho
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
|
|
||||||
if { [test2d] != 1 } {
|
if { [test2d] != 1 } {
|
||||||
puts "Error: 2D projection test failed: view frustum culling is ON"
|
puts "Error: 2D projection test failed: view frustum culling is ON"
|
||||||
|
@ -88,7 +88,7 @@ set tcl_precision 16
|
|||||||
####################################################################
|
####################################################################
|
||||||
vcamera -ortho
|
vcamera -ortho
|
||||||
vviewparams -scale 1e-8
|
vviewparams -scale 1e-8
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
|
|
||||||
if { [test3d 1e-7] != 1 } {
|
if { [test3d 1e-7] != 1 } {
|
||||||
puts "Error: 3D projection test failed: camera is orthographic, view frustum culling is OFF"
|
puts "Error: 3D projection test failed: camera is orthographic, view frustum culling is OFF"
|
||||||
@ -100,7 +100,7 @@ if { [test3d 1e-7] != 1 } {
|
|||||||
####################################################################
|
####################################################################
|
||||||
vcamera -ortho
|
vcamera -ortho
|
||||||
vviewparams -scale 1e-8
|
vviewparams -scale 1e-8
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
|
|
||||||
if { [test3d 1e-7] != 1 } {
|
if { [test3d 1e-7] != 1 } {
|
||||||
puts "Error: 3D projection test failed: camera is orthographic, view frustum culling is ON"
|
puts "Error: 3D projection test failed: camera is orthographic, view frustum culling is ON"
|
||||||
@ -111,7 +111,7 @@ if { [test3d 1e-7] != 1 } {
|
|||||||
# Test camera with less starting distance 1.0 to avoid jittering. #
|
# Test camera with less starting distance 1.0 to avoid jittering. #
|
||||||
####################################################################
|
####################################################################
|
||||||
vcamera -persp
|
vcamera -persp
|
||||||
vfrustumculling 0
|
vrenderparams -frustumculling off
|
||||||
|
|
||||||
if { [test3d 1.0] != 1 } {
|
if { [test3d 1.0] != 1 } {
|
||||||
puts "Error: 3D projection test failed: camera is perspective, view frustum culling is OFF"
|
puts "Error: 3D projection test failed: camera is perspective, view frustum culling is OFF"
|
||||||
@ -122,7 +122,7 @@ if { [test3d 1.0] != 1 } {
|
|||||||
# Test camera with less starting distance 1.0 to avoid jittering. #
|
# Test camera with less starting distance 1.0 to avoid jittering. #
|
||||||
####################################################################
|
####################################################################
|
||||||
vcamera -persp
|
vcamera -persp
|
||||||
vfrustumculling 1
|
vrenderparams -frustumculling on
|
||||||
|
|
||||||
if { [test3d 1.0] != 1 } {
|
if { [test3d 1.0] != 1 } {
|
||||||
puts "Error: 3D projection test failed: camera is perspective, view frustum culling is ON"
|
puts "Error: 3D projection test failed: camera is perspective, view frustum culling is ON"
|
||||||
|
43
tests/bugs/vis/bug30434
Normal file
43
tests/bugs/vis/bug30434
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
puts "============="
|
||||||
|
puts "0030434: Visualization, TKV3d - add 'NoUpdate' state of frustum culling optimization"
|
||||||
|
puts "============="
|
||||||
|
|
||||||
|
pload VISUALIZATION
|
||||||
|
vclear
|
||||||
|
vinit View1
|
||||||
|
|
||||||
|
set THE_NB_POINTS 10
|
||||||
|
puts "Creating [expr $THE_NB_POINTS * $THE_NB_POINTS * $THE_NB_POINTS] points..."
|
||||||
|
for {set i 0} {$i < $THE_NB_POINTS} {incr i} {
|
||||||
|
for {set j 0} {$j < $THE_NB_POINTS} {incr j} {
|
||||||
|
for {set k 0} {$k < $THE_NB_POINTS} {incr k} {
|
||||||
|
vpoint p$i$j$k 3.*$i 3.*$j 3.*$k
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vcamera -ortho
|
||||||
|
vfront
|
||||||
|
vfit
|
||||||
|
vzoom 2
|
||||||
|
vrenderparams -frustumculling on
|
||||||
|
vrenderparams -frustumculling noupdate
|
||||||
|
vfit
|
||||||
|
if { [vreadpixel 92 92 rgb name] == "YELLOW" } { puts "Error: point should be clipped earlier" }
|
||||||
|
vdump $::imagedir/${::casename}_ortho_culled.png
|
||||||
|
vrenderparams -frustumculling off
|
||||||
|
if { [vreadpixel 92 92 rgb name] != "YELLOW" } { puts "Error: point should NOT be clipped" }
|
||||||
|
vdump $::imagedir/${::casename}_ortho_all.png
|
||||||
|
|
||||||
|
vcamera -persp
|
||||||
|
vaxo
|
||||||
|
vfit
|
||||||
|
vzoom 3
|
||||||
|
vrenderparams -frustumculling on
|
||||||
|
vrenderparams -frustumculling noupdate
|
||||||
|
vfit
|
||||||
|
if { [vreadpixel 114 92 rgb name] == "YELLOW" } { puts "Error: point should be clipped earlier" }
|
||||||
|
vdump $::imagedir/${::casename}_persp_culled.png
|
||||||
|
vrenderparams -frustumculling off
|
||||||
|
if { [vreadpixel 114 92 rgb name] != "YELLOW" } { puts "Error: point should NOT be clipped" }
|
||||||
|
vdump $::imagedir/${::casename}_persp_all.png
|
Loading…
x
Reference in New Issue
Block a user