0024739: TKOpenGl - port ray-tracing from OpenCL to GLSL for better integration and...
[occt.git] / src / OpenGl / OpenGl_View.cxx
index 0291ea4..d3c006b 100644 (file)
@@ -4,8 +4,8 @@
 //
 // 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 version 2.1 as published
+// 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.
 
-#ifdef HAVE_CONFIG_H
-  #include <config.h>
-#endif
-
 #include <NCollection_Mat4.hxx>
 
 #include <OpenGl_Context.hxx>
@@ -32,6 +28,7 @@
 #include <OpenGl_Workspace.hxx>
 
 #include <Graphic3d_TextureEnv.hxx>
+#include <Graphic3d_Mat4d.hxx>
 
 IMPLEMENT_STANDARD_HANDLE(OpenGl_View,MMgt_TShared)
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_View,MMgt_TShared)
@@ -96,9 +93,7 @@ OpenGl_View::OpenGl_View (const CALL_DEF_VIEWCONTEXT &AContext,
 
   myCurrLightSourceState = myStateCounter->Increment();
 
-#ifdef HAVE_OPENCL
   myModificationState = 1; // initial state
-#endif
 }
 
 /*----------------------------------------------------------------------*/
@@ -144,18 +139,14 @@ void OpenGl_View::SetTextureEnv (const Handle(OpenGl_Context)&       theCtx,
   if (!anImage.IsNull())
     myTextureEnv->Init (theCtx, *anImage.operator->(), theTexture->Type());
 
-#ifdef HAVE_OPENCL
   myModificationState++;
-#endif
 }
 
 void OpenGl_View::SetSurfaceDetail (const Visual3d_TypeOfSurfaceDetail theMode)
 {
   mySurfaceDetail = theMode;
 
-#ifdef HAVE_OPENCL
   myModificationState++;
-#endif
 }
 
 // =======================================================================
@@ -470,16 +461,15 @@ const TEL_TRANSFORM_PERSISTENCE* OpenGl_View::BeginTransformPersistence (const H
 void OpenGl_View::GetMatrices (TColStd_Array2OfReal&  theMatOrient,
                                TColStd_Array2OfReal&  theMatMapping) const
 {
-  const OpenGl_Matrix* aProj =   (const OpenGl_Matrix*) &myCamera->ProjectionMatrix();
-  const OpenGl_Matrix* aOrient = (const OpenGl_Matrix*) &myCamera->OrientationMatrix();
+  const Graphic3d_Mat4d& aProj   = myCamera->ProjectionMatrix();
+  const Graphic3d_Mat4d& aOrient = myCamera->OrientationMatrix();
 
-  int i, j;
-  for (i = 0; i < 4; ++i)
+  for (Standard_Integer aRow = 0; aRow < 4; ++aRow)
   {
-    for (j = 0; j < 4; ++j)
+    for (Standard_Integer aCol = 0; aCol < 4; ++aCol)
     {
-      theMatOrient  (i, j) = aOrient->mat[j][i];
-      theMatMapping (i, j) = aProj->  mat[j][i];
+      theMatOrient  (aRow, aCol) = aOrient.GetValue (aRow, aCol);
+      theMatMapping (aRow, aCol) = aProj  .GetValue (aRow, aCol);
     }
   }
 }