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

0024393: Visualization - objects position with enchanced precision

Graphic3d_ZLayerSettings - public fields have been replaced by methods.
Added new property Origin defining local coordinate system for all Layer objects.

Syntax of Draw Harness command VZLayer has been redesigned.

Graphic3d_CStructure now stores bounding box with double precision floats.
OpenGl_BVHTreeSelector - frustum culling now works with double precision floats.
This commit is contained in:
kgv
2016-10-02 19:36:14 +03:00
committed by apn
parent ebc369da1d
commit 7c3ef2f752
42 changed files with 1341 additions and 845 deletions

View File

@@ -56,6 +56,16 @@ public:
//! Release all resources.
Standard_EXPORT void clear();
//! Return local camera transformation.
const gp_XYZ& LocalOrigin() const { return myLocalOrigin; }
//! Setup local camera transformation for compensating float precision issues.
void SetLocalOrigin (const gp_XYZ& theOrigin)
{
myLocalOrigin = theOrigin;
myHasLocalOrigin = !theOrigin.IsEqual (gp_XYZ(0.0, 0.0, 0.0), gp::Resolution());
}
//! Creates new shader program or re-use shared instance.
//! @param theProxy [IN] program definition
//! @param theShareKey [OUT] sharing key
@@ -186,6 +196,9 @@ public:
//! Updates state of OCCT light sources.
Standard_EXPORT void UpdateLightSourceStateTo (const OpenGl_ListOfLight* theLights);
//! Invalidate state of OCCT light sources.
Standard_EXPORT void UpdateLightSourceState();
//! Pushes current state of OCCT light sources to specified program.
Standard_EXPORT void PushLightSourceState (const Handle(OpenGl_ShaderProgram)& theProgram) const;
@@ -379,6 +392,32 @@ protected:
Standard_EXPORT Standard_Boolean prepareStdProgramStereo (Handle(OpenGl_ShaderProgram)& theProgram,
const Graphic3d_StereoMode theStereoMode);
protected:
//! Packed properties of light source
struct OpenGl_ShaderLightParameters
{
OpenGl_Vec4 Color;
OpenGl_Vec4 Position;
OpenGl_Vec4 Direction;
OpenGl_Vec4 Parameters;
//! Returns packed (serialized) representation of light source properties
const OpenGl_Vec4* Packed() const { return reinterpret_cast<const OpenGl_Vec4*> (this); }
static Standard_Integer NbOfVec4() { return 4; }
};
//! Packed light source type information
struct OpenGl_ShaderLightType
{
Standard_Integer Type;
Standard_Integer IsHeadlight;
//! Returns packed (serialized) representation of light source type
const OpenGl_Vec2i* Packed() const { return reinterpret_cast<const OpenGl_Vec2i*> (this); }
static Standard_Integer NbOfVec2i() { return 1; }
};
protected:
Graphic3d_TypeOfShadingModel myShadingModel; //!< lighting shading model
@@ -400,6 +439,11 @@ 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
gp_XYZ myLocalOrigin; //!< local camera transformation
Standard_Boolean myHasLocalOrigin; //!< flag indicating that local camera transformation has been set
mutable OpenGl_ShaderLightType myLightTypeArray [OpenGLMaxLights];
mutable OpenGl_ShaderLightParameters myLightParamsArray[OpenGLMaxLights];
private: