Salome HOME
0023124: EDF 11219 GEOM: Ray tracing in the OCC viewer
authormpa <mpa@opencascade.com>
Mon, 26 Oct 2015 12:06:06 +0000 (15:06 +0300)
committervsr <vsr@opencascade.com>
Wed, 25 Nov 2015 15:27:05 +0000 (18:27 +0300)
35 files changed:
doc/salome/gui/images/doc_dir_light_source.png [new file with mode: 0644]
doc/salome/gui/images/doc_env_texture.png [new file with mode: 0644]
doc/salome/gui/images/doc_pos_light_source.png [new file with mode: 0644]
doc/salome/gui/images/doc_ray_tracing.png [new file with mode: 0644]
doc/salome/gui/images/occviewer_toolbar.png
doc/salome/gui/input/occ_3d_viewer.doc
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.ts
src/LightApp/resources/LightApp_msg_fr.ts
src/LightApp/resources/LightApp_msg_ja.ts
src/OCCViewer/CMakeLists.txt
src/OCCViewer/OCCViewer_EnvTextureDlg.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_EnvTextureDlg.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_LightSourceDlg.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_LightSourceDlg.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_RayTracingDlg.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_RayTracingDlg.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_Utilities.cxx
src/OCCViewer/OCCViewer_Utilities.h
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewPort3d.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/OCCViewer/resources/OCCViewer_images.ts
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/OCCViewer_msg_fr.ts
src/OCCViewer/resources/OCCViewer_msg_ja.ts
src/OCCViewer/resources/occ_view_env_texture.png [new file with mode: 0644]
src/OCCViewer/resources/occ_view_light_source.png [new file with mode: 0644]
src/OCCViewer/resources/occ_view_ray_tracing.png [new file with mode: 0644]

diff --git a/doc/salome/gui/images/doc_dir_light_source.png b/doc/salome/gui/images/doc_dir_light_source.png
new file mode 100644 (file)
index 0000000..b6e08ce
Binary files /dev/null and b/doc/salome/gui/images/doc_dir_light_source.png differ
diff --git a/doc/salome/gui/images/doc_env_texture.png b/doc/salome/gui/images/doc_env_texture.png
new file mode 100644 (file)
index 0000000..133dc10
Binary files /dev/null and b/doc/salome/gui/images/doc_env_texture.png differ
diff --git a/doc/salome/gui/images/doc_pos_light_source.png b/doc/salome/gui/images/doc_pos_light_source.png
new file mode 100644 (file)
index 0000000..4732de7
Binary files /dev/null and b/doc/salome/gui/images/doc_pos_light_source.png differ
diff --git a/doc/salome/gui/images/doc_ray_tracing.png b/doc/salome/gui/images/doc_ray_tracing.png
new file mode 100644 (file)
index 0000000..4965257
Binary files /dev/null and b/doc/salome/gui/images/doc_ray_tracing.png differ
index c8eefa245bcc920a9ad472db4801c3da6b28be16..d4b293757cf7577d743962d21ed1ee810255250b 100644 (file)
Binary files a/doc/salome/gui/images/occviewer_toolbar.png and b/doc/salome/gui/images/occviewer_toolbar.png differ
index 09e821b48e64c976ae88e0493bfcad589ce37772..7f79605ac69ccea8a81486728eed1811a9e9a9f1 100644 (file)
@@ -295,5 +295,76 @@ or other view operation done in one view is automatically applied to
 the other view.
 <hr>
 
+\image html occ_view_ray_tracing.png
 
+\anchor ray_tracing
+
+<b>Ray tracing</b> - allows to switch between rendering methods in run-time 
+in the current OCCT 3D view. It can be used to produce images with photorealistic quality.
+
+\image html doc_ray_tracing.png
+
+- <b>Ray tracing</b> - specifies rendering mode: OpenGL rasterization (by default) or GPU ray-tracing.
+
+  - <b>Depth</b> - defines maximum ray-tracing depth.
+  
+  - <b>Specular reflections</b> - enables/disables specular reflections.
+  
+  - <b>Adaptive anti-aliasing</b> - enables/disables adaptive anti-aliasing.
+    
+  - <b>Shadows rendering</b> - enables/disables shadows rendering.
+  
+  - <b>Transparent shadow</b> - enables/disables light propagation through transparent media.
+  
+<hr>
+
+\image html occ_view_env_texture.png
+
+\anchor env_texture
+
+<b>Environment texture</b> - allows to set parameters for environment texture.
+This is a special mode of texture mapping when specular reflection of environment texture 
+is simulated by OpenGL using a special texture coordinates generation algorithm (a sphere map).
+
+\image html doc_env_texture.png
+
+- <b>Environment texture</b> - enables/disables environment texture in the current OCCT 3D view.
+
+User can select one of 7 predefined environment texture from the list or define its texture from file by 
+choosing item <b>"Custom..."</b> in a combo box.
+
+\note Note that the environment texture file should normally satisfy the following requirements 
+in order to produce good visual result:
+- The image file should have 2:1 width-to-height ratio.
+- It should constitute a 360-degrees panoramic image created using a fish-eye lens. 
+
+<hr>
+
+\image html occ_view_light_source.png
+
+\anchor light_source
+
+<b>Light source</b> - allows to set parameters for light source.
+
+It's possible to choose a type of light source between directional and positional light.
+
+\image html doc_dir_light_source.png
+
+<b>Directional</b> light - creates a directional light source in the viewer.
+It is defined by direction coordinates, color and headlight parameter.
+
+\image html doc_pos_light_source.png
+
+<b>Positional</b> light - creates an isolated light source X,Y,Z in the viewer. 
+It is also defined by the color and headlight parameter.
+
+Click:
+
+- <b>Apply and Close</b> to apply defined light source to the OCC 3D Viewer.
+
+- <b>Default</b> to restore default values of light source.
+
+- <b>Close</b> to return parameters of light source on initial values.
+
+<hr>
 */
index f50576ea8d68e4be8a404d2945d9a90dcf2dbc87..3093f12fca6760f089daac4080e26e01de75965e 100644 (file)
@@ -2515,6 +2515,61 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   pref->setItemProperty( "step", 0.1, scaleFactor );
   // ... "Clipping" group <<end>>
 
+  // ... "Ray tracing" group <<start>>
+  int occRayTracingGroup = pref->addPreference( tr( "PREF_GROUP_RAY_TRACING" ), occGroup );
+  int rtPref = pref->addPreference( "", occRayTracingGroup, LightApp_Preferences::Frame );
+  pref->setItemProperty( "columns", 2, rtPref );
+  // .... -> depth
+  int rt_depth = pref->addPreference( tr( "PREF_RAY_TRACING_DEPTH" ), rtPref,
+               LightApp_Preferences::IntSpin, "OCCViewer", "rt_depth" );
+  pref->setItemProperty( "min", 1, rt_depth );
+  pref->setItemProperty( "max", 10, rt_depth );
+  pref->setItemProperty( "step", 1, rt_depth );
+  pref->addPreference( "", rtPref, LightApp_Preferences::Frame );
+  // .... -> specular reflections
+  pref->addPreference( tr( "PREF_RAY_TRACING_REFLECTION" ), rtPref,
+               LightApp_Preferences::Bool, "OCCViewer", "rt_reflection" );
+  // .... -> adaptive anti-aliasing
+  pref->addPreference( tr( "PREF_RAY_TRACING_ANTIALIASING" ), rtPref,
+               LightApp_Preferences::Bool, "OCCViewer", "rt_antialiasing" );
+  // .... -> shadows rendering
+  pref->addPreference( tr( "PREF_RAY_TRACING_SHADOW" ), rtPref,
+               LightApp_Preferences::Bool, "OCCViewer", "rt_shadow" );
+  // .... -> transparent shadow
+  pref->addPreference( tr( "PREF_RAY_TRACING_TRANS_SHADOW" ), rtPref,
+               LightApp_Preferences::Bool, "OCCViewer", "rt_trans_shadow" );
+  // ... "Ray tracing" group <<end>>
+
+  // ... "Light source" group <<start>>
+  int occLightGroup = pref->addPreference( tr( "PREF_GROUP_LIGHT" ), occGroup );
+  // .... -> light color
+  pref->addPreference( tr( "PREF_LIGHT_COLOR" ), occLightGroup,
+               LightApp_Preferences::Color, "OCCViewer", "light_color" );
+  int directionPref = pref->addPreference( "", occLightGroup, LightApp_Preferences::Frame );
+  pref->setItemProperty( "columns", 3, directionPref );
+  // .... -> light direction (dx component)
+  int light_dx = pref->addPreference( tr( "Dx" ), directionPref,
+               LightApp_Preferences::DblSpin, "OCCViewer", "light_dx" );
+  pref->setItemProperty( "precision", 2, light_dx );
+  pref->setItemProperty( "min", -1.0E03, light_dx );
+  pref->setItemProperty( "max", 1.0E03, light_dx );
+  pref->setItemProperty( "step", 0.1, light_dx );
+  // .... -> light direction (dy component)
+  int light_dy = pref->addPreference( tr( "Dy" ), directionPref,
+               LightApp_Preferences::DblSpin, "OCCViewer", "light_dy" );
+  pref->setItemProperty( "precision", 2, light_dy );
+  pref->setItemProperty( "min", -1.0E03, light_dy );
+  pref->setItemProperty( "max", 1.0E03, light_dy );
+  pref->setItemProperty( "step", 0.1, light_dy );
+  // .... -> light direction (dz component)
+  int light_dz = pref->addPreference( tr( "Dz" ), directionPref,
+               LightApp_Preferences::DblSpin, "OCCViewer", "light_dz" );
+  pref->setItemProperty( "precision", 2, light_dz );
+  pref->setItemProperty( "min", -1.0E03, light_dz );
+  pref->setItemProperty( "max", 1.0E03, light_dz );
+  pref->setItemProperty( "step", 0.1, light_dz );
+  // ... "Light source" group <<end>>
+
   // ... -> empty frame (for layout) <<start>>
   int occGen = pref->addPreference( "", occGroup, LightApp_Preferences::Frame );
   pref->setItemProperty( "margin",  0, occGen );
index e8a0858e162a231fca81dced744f059a9ebdd555..befb3b4e2ea593233c5cbbe5fb26a0c14c8c51e2 100644 (file)
     <parameter name="clipping_use_default_texture" value="true"/>
     <parameter name="clipping_modulate"   value="true"/>
     <parameter name="clipping_scale"      value="1.0"/>
+    <parameter name="rt_depth"            value="3"/>
+    <parameter name="rt_reflection"       value="true"/>
+    <parameter name="rt_antialiasing"     value="false"/>
+    <parameter name="rt_shadow"           value="true"/>
+    <parameter name="rt_trans_shadow"     value="false"/>                     
+    <parameter name="light_color"         value="255, 255, 255"/>
+    <parameter name="light_dx"            value="0.0"/>
+    <parameter name="light_dy"            value="0.0"/>
+    <parameter name="light_dz"            value="-1.0"/>
     <parameter name="background"      value="bt=2;fn=;tm=0;ts=false;c1=#cddbff;c2=#698fff;gt=1;gr=" />
     <parameter name="xz_background"   value="bt=2;fn=;tm=0;ts=false;c1=#cddbff;c2=#698fff;gt=1;gr=" />
     <parameter name="yz_background"   value="bt=2;fn=;tm=0;ts=false;c1=#cddbff;c2=#698fff;gt=1;gr=" />
index 9876572466807af52a3c7475865ce77ffb80aee1..8fca4a6048dcf2e50de153356d7fe030bc3d0056 100644 (file)
@@ -851,6 +851,38 @@ The changes will be applied on the next application session.</translation>
         <source>PREF_CLIPPING_SCALE</source>
         <translation>Scale factor</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_RAY_TRACING</source>
+        <translation>Ray tracing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_DEPTH</source>
+        <translation>Depth</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_REFLECTION</source>
+        <translation>Specular reflections</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_ANTIALIASING</source>
+        <translation>Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_SHADOW</source>
+        <translation>Shadows rendering</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_TRANS_SHADOW</source>
+        <translation>Transparent shadow</translation>
+    </message>
+    <message>
+        <source>PREF_GROUP_LIGHT</source>
+        <translation>Light source</translation>
+    </message>
+    <message>
+        <source>PREF_LIGHT_COLOR</source>
+        <translation>Color</translation>
+    </message>
     <message>
         <source>TOT_CLOSE</source>
         <translation>Close</translation>
index 526ecd7d27362cce15c0e28db3b06d94943c863d..63b93ab94dee8c675cc1406bc2f4b9e5053dfe3a 100755 (executable)
@@ -851,6 +851,38 @@ Les modifications seront appliquées à la prochaine session.</translation>
         <source>PREF_CLIPPING_SCALE</source>
         <translation>Facteur d&apos;échelle</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_DEPTH</source>
+        <translation type="unfinished">Depth</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_REFLECTION</source>
+        <translation type="unfinished">Specular reflections</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_ANTIALIASING</source>
+        <translation type="unfinished">Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_SHADOW</source>
+        <translation type="unfinished">Shadows rendering</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_TRANS_SHADOW</source>
+        <translation type="unfinished">Transparent shadow</translation>
+    </message>
+    <message>
+        <source>PREF_GROUP_LIGHT</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>PREF_LIGHT_COLOR</source>
+        <translation type="unfinished">Color</translation>
+    </message>
     <message>
         <source>TOT_CLOSE</source>
         <translation>Fermer</translation>
index 29a70c646d8dd8b8e4957b2eb89a2504175c4285..084e385be48ac50f81400fd7c6193428dfdaba52 100644 (file)
@@ -851,6 +851,38 @@ CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</translatio
       <source>PREF_CLIPPING_SCALE</source>
       <translation>スケールファクタ</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_DEPTH</source>
+        <translation type="unfinished">Depth</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_REFLECTION</source>
+        <translation type="unfinished">Specular reflections</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_ANTIALIASING</source>
+        <translation type="unfinished">Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_SHADOW</source>
+        <translation type="unfinished">Shadows rendering</translation>
+    </message>
+    <message>
+        <source>PREF_RAY_TRACING_TRANS_SHADOW</source>
+        <translation type="unfinished">Transparent shadow</translation>
+    </message>
+    <message>
+        <source>PREF_GROUP_LIGHT</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>PREF_LIGHT_COLOR</source>
+        <translation type="unfinished">Color</translation>
+    </message>
     <message>
       <source>TOT_CLOSE</source>
       <translation>閉じる</translation>
index 01e7473bb8ec32a09450f3fd6294de2792f88500..8c4159c850274bf3be17f139f13de2d3b5fbb073 100755 (executable)
@@ -36,6 +36,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/ViewerData
   ${PROJECT_SOURCE_DIR}/src/ViewerTools
   ${PROJECT_SOURCE_DIR}/src/OpenGLUtils
+  ${PROJECT_SOURCE_DIR}/src/CAF
 )
 
 # additional preprocessor / compiler flags
@@ -45,7 +46,7 @@ ADD_DEFINITIONS(${QT_DEFINITIONS} ${CAS_DEFINITIONS} ${OGL_DEFINITIONS})
 SET(_link_LIBRARIES
   ${OPENGL_LIBRARIES} ${QT_LIBRARIES} ${CAS_KERNEL} ${CAS_VIEWER} ${CAS_TKGeomAlgo}
   ${CAS_TKTopAlgo} ${CAS_TKG2d} ${CAS_TKOpenGl}
-  CASCatch qtx suit ViewerTools ViewerData OpenGLUtils
+  CASCatch qtx suit ViewerTools ViewerData OpenGLUtils caf
 )
 
 # --- headers ---
@@ -55,6 +56,9 @@ SET(_moc_HEADERS
   OCCViewer_AISSelector.h
   OCCViewer_AxialScaleDlg.h
   OCCViewer_ClippingDlg.h
+  OCCViewer_RayTracingDlg.h
+  OCCViewer_EnvTextureDlg.h
+  OCCViewer_LightSourceDlg.h
   OCCViewer_CreateRestoreViewDlg.h
   OCCViewer_CubeAxesDlg.h
   OCCViewer_FontWidget.h
@@ -141,6 +145,9 @@ SET(_other_RESOURCES
   resources/occ_view_triedre.png
   resources/occ_view_zoom.png
   resources/occ_view_zooming_style_switch.png
+  resources/occ_view_ray_tracing.png
+  resources/occ_view_env_texture.png
+  resources/occ_view_light_source.png
 )
 
 # --- sources ---
@@ -156,6 +163,9 @@ SET(_other_SOURCES
   OCCViewer_AISSelector.cxx
   OCCViewer_AxialScaleDlg.cxx
   OCCViewer_ClippingDlg.cxx
+  OCCViewer_RayTracingDlg.cxx
+  OCCViewer_EnvTextureDlg.cxx
+  OCCViewer_LightSourceDlg.cxx
   OCCViewer_ClipPlane.cxx
   OCCViewer_CreateRestoreViewDlg.cxx
   OCCViewer_CubeAxesDlg.cxx
diff --git a/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx b/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx
new file mode 100644 (file)
index 0000000..d1b0b35
--- /dev/null
@@ -0,0 +1,237 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// internal includes
+#include "OCCViewer_EnvTextureDlg.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_ViewFrame.h"
+
+// GUI includes
+#include <SUIT_Session.h>
+
+// OCCT includes
+#include <Graphic3d_TextureEnv.hxx>
+
+// QT Includes
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QComboBox>
+#include <QFileDialog>
+#include <QLineEdit>
+
+/*!
+  \class OCCViewer_EnvTextureDlg
+  \brief Dialog allowing to assign parameters of environment texture
+*/
+
+/*!
+  \brief Constructor
+  \param view - parent widget
+*/
+OCCViewer_EnvTextureDlg::OCCViewer_EnvTextureDlg( OCCViewer_ViewWindow* view )
+  :QDialog( view )
+{
+
+  // get current view frame (OCCViewer_ViewWindow->QFrame->OCCViewer_ViewFrame)
+  myViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( view->parent()->parent() );
+  myView3d = view->getViewPort()->getView();
+
+  setObjectName( "OCCViewer_EnvTextureDlg" );
+  setWindowTitle( tr( "ENV_TEXTURE" ) );
+  setModal( false );
+
+  setAttribute( Qt::WA_DeleteOnClose, true );
+
+  // Create layout for this dialog
+  QVBoxLayout* dlglayout = new QVBoxLayout( this );
+  dlglayout->setSpacing( 6 );
+  dlglayout->setMargin( 11 );
+
+  // Create "Environment texture" group
+
+  myEnvTextureGroup = new QGroupBox( tr( "ENV_TEXTURE" ) );
+  myEnvTextureGroup->setCheckable( true );
+
+  QGridLayout* envTextureLayout = new QGridLayout( myEnvTextureGroup );
+  envTextureLayout->setSpacing( 6 );
+  envTextureLayout->setMargin( 11 );
+
+  myEnvTextureId = new QComboBox();
+  myEnvTextureId->addItem( tr( "ENV_CLOUDS" ) );
+  myEnvTextureId->addItem( tr( "ENV_CV" ) );
+  myEnvTextureId->addItem( tr( "ENV_MEDIT" ) );
+  myEnvTextureId->addItem( tr( "ENV_PEARL" ) );
+  myEnvTextureId->addItem( tr( "ENV_SKY1" ) );
+  myEnvTextureId->addItem( tr( "ENV_SKY2" ) );
+  myEnvTextureId->addItem( tr( "ENV_LINES" ) );
+  myEnvTextureId->addItem( tr( "ENV_ROAD" ) );
+  myEnvTextureId->addItem( tr( "ENV_CUSTOM" ) );
+  myEnvTextureId->setMinimumWidth( 300 );
+
+  myEnvTextureName = new QLineEdit();
+  myEnvTextureName->setVisible( false );
+  myFileButton = new QPushButton();
+  myFileButton->setText("...");
+  myFileButton->setVisible( false );
+
+  envTextureLayout->addWidget( myEnvTextureId,   0, 0, 1, 2 );
+  envTextureLayout->addWidget( myEnvTextureName, 1, 0 );
+  envTextureLayout->addWidget( myFileButton,     1, 1 );
+
+  // Create "Buttons" group
+
+  QGroupBox* groupButtons = new QGroupBox( this );
+  QHBoxLayout* groupButtonsLayout = new QHBoxLayout( groupButtons );
+  groupButtonsLayout->setSpacing( 6 );
+  groupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonClose = new QPushButton( tr( "BUT_CLOSE" ) );
+  buttonClose->setDefault( true );
+
+  QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ) );
+
+  groupButtonsLayout->addStretch();
+  groupButtonsLayout->addWidget( buttonClose );
+  groupButtonsLayout->addWidget( buttonHelp );
+
+  dlglayout->addWidget( myEnvTextureGroup );
+  dlglayout->addWidget( groupButtons );
+
+  // Initializations
+  initParam();
+
+  // Signals and slots connections
+  connect( myEnvTextureGroup,    SIGNAL( toggled(bool) ),            this, SLOT( onEnvTexture(bool) ) );
+  connect( myEnvTextureId,       SIGNAL( currentIndexChanged(int) ), this, SLOT( onTextureChanged() ) );
+  connect( myFileButton,         SIGNAL( clicked() ),                this, SLOT( onFileSelectionClicked() ) );
+  connect( buttonClose,          SIGNAL( clicked() ),                this, SLOT( close() ) );
+  connect( buttonHelp,           SIGNAL( clicked() ),                this, SLOT( ClickOnHelp() ) );
+}
+
+/*!
+  \brief Destructor
+*/
+OCCViewer_EnvTextureDlg::~OCCViewer_EnvTextureDlg()
+{
+}
+
+QString OCCViewer_EnvTextureDlg::getName()
+{
+  // return the name of object
+  return QString( "OCCViewer_EnvTextureDlg" );
+}
+
+/*!
+  Initialization of initial values of widgets
+*/
+void OCCViewer_EnvTextureDlg::initParam()
+{
+  Handle(Graphic3d_TextureEnv) aTexture = myView3d->TextureEnv();
+  bool anIsTexture = !aTexture.IsNull();
+  myEnvTextureGroup->setChecked( anIsTexture );
+  if ( anIsTexture ) {
+    int aTextureId = myView3d->TextureEnv()->Name();
+    myEnvTextureId->setCurrentIndex( aTextureId );
+    if ( aTextureId == myEnvTextureId->count() - 1 ) {
+      TCollection_AsciiString aFileName;
+      aTexture->Path().SystemName( aFileName );
+      myEnvTextureName->setText( QString( aFileName.ToCString() ) );
+      myFileButton->setVisible( true );
+      myEnvTextureName->setVisible( true );
+    }
+  }
+}
+
+/*!
+  SLOT on "Environment texture" group click
+*/
+void OCCViewer_EnvTextureDlg::onEnvTexture( bool theIsChecked )
+{
+  if ( theIsChecked )
+    onTextureChanged();
+  else {
+    Handle(Graphic3d_TextureEnv) aTexture;
+    setEnvTexture( aTexture, V3d_TEX_ALL );
+  }
+}
+
+/*!
+  SLOT on when user changed the texture
+*/
+void OCCViewer_EnvTextureDlg::onTextureChanged()
+{
+  Handle(Graphic3d_TextureEnv) aTexture;
+  bool isCustom = myEnvTextureId->currentIndex() == myEnvTextureId->count()-1;
+  myEnvTextureName->setVisible( isCustom );
+  myFileButton->setVisible( isCustom );
+  if( isCustom ) {
+    if( myEnvTextureName->text().isEmpty() )
+      onFileSelectionClicked();
+    aTexture = new Graphic3d_TextureEnv( TCollection_AsciiString( myEnvTextureName->text().toStdString().c_str() ) );
+  }
+  else {
+    myEnvTextureName->setText("");
+    Graphic3d_NameOfTextureEnv aStandardTexture;
+    QList<Graphic3d_NameOfTextureEnv> aTextures;
+    aTextures << Graphic3d_NOT_ENV_CLOUDS << Graphic3d_NOT_ENV_CV   << Graphic3d_NOT_ENV_MEDIT
+                 << Graphic3d_NOT_ENV_PEARL  << Graphic3d_NOT_ENV_SKY1 << Graphic3d_NOT_ENV_SKY2
+                 << Graphic3d_NOT_ENV_LINES  << Graphic3d_NOT_ENV_ROAD;
+    aTexture = new Graphic3d_TextureEnv( aTextures.at( myEnvTextureId->currentIndex() ) );
+  }
+  setEnvTexture( aTexture, V3d_TEX_ENVIRONMENT );
+}
+
+/*!
+  SLOT on file selection button click
+*/
+void OCCViewer_EnvTextureDlg::onFileSelectionClicked()
+{
+  QString selFile = QFileDialog::getOpenFileName( this,tr( "GEOM_SELECT_IMAGE" ),QString(), tr( "OCC_TEXTURE_FILES" ) );
+  if ( !selFile.isEmpty() ) {
+    myEnvTextureName->setText( selFile );
+    onTextureChanged();
+  }
+}
+
+/*!
+  SLOT on help button click: opens a help page
+*/
+void OCCViewer_EnvTextureDlg::ClickOnHelp()
+{
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( app )
+    app->onHelpContextModule( "GUI", "occ_3d_viewer_page.html", "env_texture" );
+}
+
+/*!
+  Sets current texture environment for all view in the viewer
+*/
+void OCCViewer_EnvTextureDlg::setEnvTexture( Handle(Graphic3d_TextureEnv) theTexture, V3d_TypeOfSurfaceDetail theMode )
+{
+  for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) {
+    if ( OCCViewer_ViewWindow* aViewWindow = myViewFrame->getView(i) ) {
+      Handle(V3d_View) aView = aViewWindow->getViewPort()->getView();
+      aView->SetTextureEnv( theTexture );
+      aView->SetSurfaceDetail( theMode );
+      aView->Redraw();
+    }
+  }
+}
diff --git a/src/OCCViewer/OCCViewer_EnvTextureDlg.h b/src/OCCViewer/OCCViewer_EnvTextureDlg.h
new file mode 100644 (file)
index 0000000..0d172ff
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_ENVTEXTUREDLG_H
+#define OCCVIEWER_ENVTEXTUREDLG_H
+
+#include "OCCViewer.h"
+#include <QDialog>
+#include <V3d_View.hxx>
+
+class OCCViewer_ViewWindow;
+class OCCViewer_ViewFrame;
+class QGroupBox;
+class QComboBox;
+class QLineEdit;
+
+class OCCVIEWER_EXPORT OCCViewer_EnvTextureDlg : public QDialog
+{
+  Q_OBJECT
+
+  public:
+  OCCViewer_EnvTextureDlg( OCCViewer_ViewWindow* );
+  ~OCCViewer_EnvTextureDlg();
+
+  static QString getName();
+
+private slots:
+
+  void onEnvTexture( bool );
+  void onTextureChanged();
+  void onFileSelectionClicked();
+
+  void ClickOnHelp();
+
+private:
+  void initParam();
+  void setEnvTexture( Handle(Graphic3d_TextureEnv), V3d_TypeOfSurfaceDetail );
+
+  OCCViewer_ViewFrame* myViewFrame;
+  Handle(V3d_View) myView3d;
+
+  QGroupBox*   myEnvTextureGroup;
+  QComboBox*   myEnvTextureId;
+  QLineEdit*   myEnvTextureName;
+  QPushButton* myFileButton;
+};
+
+#endif // OCCVIEWER_ENVTEXTUREDLG_H
diff --git a/src/OCCViewer/OCCViewer_LightSourceDlg.cxx b/src/OCCViewer/OCCViewer_LightSourceDlg.cxx
new file mode 100644 (file)
index 0000000..ead1b69
--- /dev/null
@@ -0,0 +1,431 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// internal includes
+#include "OCCViewer_LightSourceDlg.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+// GUI includes
+#include <SUIT_Session.h>
+#include <CAF_Tools.h>
+#include <QtxDoubleSpinBox.h>
+#include <QtxColorButton.h>
+
+// Qt includes
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QCheckBox>
+#include <QStackedLayout>
+#include <QRadioButton>
+
+/*!
+  \class OCCViewer_LightSourceDlg
+  \brief Dialog allowing to assign parameters of light source
+*/
+
+/*!
+  \brief Constructor
+  \param view - parent widget
+  \param model - viewer
+*/
+OCCViewer_LightSourceDlg::OCCViewer_LightSourceDlg( OCCViewer_ViewWindow* view, OCCViewer_Viewer* model )
+  :QDialog( view ),
+  myModel( model )
+{
+  setObjectName( "OCCViewer_LightSourceDlg" );
+  setWindowTitle( tr( "LIGHT_SOURCE" ) );
+  setModal( false );
+
+  setAttribute( Qt::WA_DeleteOnClose, true );
+
+  // Create layout for this dialog
+  QVBoxLayout* dlglayout = new QVBoxLayout( this );
+  dlglayout->setSpacing( 6 ); dlglayout->setMargin( 11 );
+
+  QGroupBox* typeGroup = new QGroupBox( tr( "TYPE" ), this );
+  QHBoxLayout* typeLayout = new QHBoxLayout( typeGroup );
+  typeLayout->setSpacing( 6 ); typeLayout->setMargin( 11 );
+
+  myDirType = new QRadioButton( tr( "DIRECTIONAL" ), typeGroup );
+  myPosType = new QRadioButton( tr( "POSITIONAL" ), typeGroup );
+
+  typeLayout->addWidget( myDirType );
+  typeLayout->addWidget( myPosType );
+
+  myStackedLayout = new QStackedLayout();
+
+  const double min = -RealLast();
+  const double max = RealLast();
+  const int precision = 3;
+
+  /**********************   Directional light   **********************/
+  /* Controls for directional light:
+     Dx, Dy, Dz - direction
+     Headlight - headlight flag
+     Color - the color of a light source
+  */
+
+  QWidget* dirWidget = new QWidget( this );
+  QVBoxLayout* dirLayout = new QVBoxLayout( dirWidget );
+  dirLayout->setSpacing( 6 ); dirLayout->setMargin( 11 );
+
+  // Create "Direction" group
+
+  const double dir_step = 0.1;
+
+  QGroupBox* dirCoordGroup = new QGroupBox( tr( "DIRECTION" ), this );
+  QHBoxLayout* dirCoordLayout = new QHBoxLayout( dirCoordGroup );
+  dirCoordLayout->setSpacing( 6 ); dirCoordLayout->setMargin( 11 );
+
+  QLabel* dxLabel = new QLabel( tr("Dx:"), dirCoordGroup );
+  myDx = new QtxDoubleSpinBox( min, max, dir_step, dirCoordGroup );
+  myDx->setValue( 0.0 );
+  myDx->setMinimumWidth( 80 );
+
+  QLabel* dyLabel = new QLabel( tr("Dy:"), dirCoordGroup );
+  myDy = new QtxDoubleSpinBox( min, max, dir_step, dirCoordGroup );
+  myDy->setValue( 0.0 );
+  myDy->setMinimumWidth( 80 );
+
+  QLabel* dzLabel = new QLabel( tr("Dz:"), dirCoordGroup );
+  myDz = new QtxDoubleSpinBox( min, max, dir_step, dirCoordGroup );
+  myDz->setValue( -1.0 );
+  myDz->setMinimumWidth( 80 );
+
+  dirCoordLayout->addWidget( dxLabel );
+  dirCoordLayout->addWidget( myDx );
+  dirCoordLayout->addWidget( dyLabel );
+  dirCoordLayout->addWidget( myDy );
+  dirCoordLayout->addWidget( dzLabel );
+  dirCoordLayout->addWidget( myDz );
+
+  // Create "Parameters" group
+
+  QGroupBox* dirParamGroup = new QGroupBox( dirWidget );
+  QHBoxLayout* dirParamLayout = new QHBoxLayout( dirParamGroup );
+  dirParamLayout->setSpacing( 6 ); dirParamLayout->setMargin( 11 );
+
+  myDirHeadLight = new QCheckBox( tr("HEADLIGHT"), dirParamGroup );
+  myDirHeadLight->setChecked( false );
+
+  QLabel* aColorLabel = new QLabel( tr( "COLOR" ), dirParamGroup );
+  myDirColor = new QtxColorButton( dirParamGroup );
+  myDirColor->setColor( Qt::white );
+
+  dirParamLayout->addWidget( myDirHeadLight );
+  dirParamLayout->addWidget( aColorLabel );
+  dirParamLayout->addWidget( myDirColor );
+  dirParamLayout->addStretch();
+
+  dirLayout->addWidget( dirCoordGroup );
+  dirLayout->addWidget( dirParamGroup );
+
+  /**********************   Positional light   **********************/
+  /* Controls for positional light:
+     X, Y, Z - position
+     Headlight - headlight flag
+     Color - the color of a light source
+  */
+
+  QWidget* posWidget = new QWidget( this );
+  QVBoxLayout* posLayout = new QVBoxLayout( posWidget );
+  posLayout->setSpacing( 6 ); posLayout->setMargin( 11 );
+
+  // Create "Position" group
+
+  const double pos_step = 1.0;
+
+  QGroupBox* posCoordGroup = new QGroupBox( tr( "POSITION" ), posWidget );
+  QHBoxLayout* posCoordLayout = new QHBoxLayout( posCoordGroup );
+  posCoordLayout->setSpacing( 6 ); posCoordLayout->setMargin( 11 );
+
+  QLabel* xLabel = new QLabel( tr("X:"), posCoordGroup );
+  myX = new QtxDoubleSpinBox( min, max, pos_step, posCoordGroup );
+  myX->setValue( 0.0 );
+  myX->setMinimumWidth( 80 );
+
+  QLabel* yLabel = new QLabel( tr("Y:"), posCoordGroup );
+  myY = new QtxDoubleSpinBox( min, max, pos_step, posCoordGroup );
+  myY->setValue( 0.0 );
+  myY->setMinimumWidth( 80 );
+
+  QLabel* zLabel = new QLabel( tr("Z:"), posCoordGroup );
+  myZ = new QtxDoubleSpinBox( min, max, pos_step, posCoordGroup );
+  myZ->setValue( 0.0 );
+  myZ->setMinimumWidth( 80 );
+
+  posCoordLayout->addWidget( xLabel );
+  posCoordLayout->addWidget( myX );
+  posCoordLayout->addWidget( yLabel );
+  posCoordLayout->addWidget( myY );
+  posCoordLayout->addWidget( zLabel );
+  posCoordLayout->addWidget( myZ );
+
+  // Create "Parameters" group
+
+  QGroupBox* posParamGroup = new QGroupBox( posWidget );
+  QHBoxLayout* posParamLayout = new QHBoxLayout( posParamGroup );
+  posParamLayout->setSpacing( 6 ); posParamLayout->setMargin( 11 );
+
+  myPosHeadLight = new QCheckBox( tr("HEADLIGHT"), posParamGroup );
+  myPosHeadLight->setChecked( false );
+
+  aColorLabel = new QLabel( tr( "COLOR" ), posParamGroup );
+  myPosColor = new QtxColorButton( posParamGroup );
+  myPosColor->setColor( Qt::white );
+
+  posParamLayout->addWidget( myPosHeadLight );
+  posParamLayout->addWidget( aColorLabel );
+  posParamLayout->addWidget( myPosColor );
+  posParamLayout->addStretch();
+
+  posLayout->addWidget( posCoordGroup );
+  posLayout->addWidget( posParamGroup );
+
+  // add widgets in the stacked layout
+  myStackedLayout->addWidget( dirWidget );
+  myStackedLayout->addWidget( posWidget );
+
+  // Create "Buttons" group
+
+  QGroupBox* buttonGroup = new QGroupBox( this );
+  QHBoxLayout* buttonLayout = new QHBoxLayout( buttonGroup );
+  buttonLayout->setSpacing( 6 );
+  buttonLayout->setMargin( 11 );
+
+  QPushButton* okButton = new QPushButton( tr( "BUT_APPLY_AND_CLOSE" ), buttonGroup );
+  okButton->setDefault( true );
+  QPushButton* defaultButton = new QPushButton( tr( "BUT_DEFAULT" ), buttonGroup );
+  QPushButton* closeButton = new QPushButton( tr( "BUT_CLOSE" ), buttonGroup );
+  QPushButton* helpButton = new QPushButton( tr( "GEOM_BUT_HELP" ), buttonGroup );
+
+  buttonLayout->addWidget( okButton );
+  buttonLayout->addWidget( defaultButton );
+  buttonLayout->addStretch();
+  buttonLayout->addWidget( closeButton );
+  buttonLayout->addWidget( helpButton );
+
+  dlglayout->addWidget( typeGroup );
+  dlglayout->addLayout( myStackedLayout );
+  dlglayout->addWidget( buttonGroup );
+
+  this->setLayout( dlglayout );
+
+  // Initializations
+  initParam();
+  isBusy = false;
+
+  // Signals and slots connections
+  connect( myDirType,      SIGNAL( clicked( bool ) ),        this, SLOT( onTypeChanged() ) );
+  connect( myPosType,      SIGNAL( clicked( bool ) ),        this, SLOT( onTypeChanged() ) );
+
+  connect( myDx,           SIGNAL( valueChanged( double ) ), this, SLOT( onDirChanged() ) );
+  connect( myDy,           SIGNAL( valueChanged( double ) ), this, SLOT( onDirChanged() ) );
+  connect( myDz,           SIGNAL( valueChanged( double ) ), this, SLOT( onDirChanged() ) );
+  connect( myDirHeadLight, SIGNAL( clicked( bool ) ),        this, SLOT( onDirChanged() ) );
+  connect( myDirColor,     SIGNAL( changed( QColor ) ),      this, SLOT( onDirChanged() ) );
+
+  connect( myX,            SIGNAL( valueChanged( double ) ), this, SLOT( onPosChanged() ) );
+  connect( myY,            SIGNAL( valueChanged( double ) ), this, SLOT( onPosChanged() ) );
+  connect( myZ,            SIGNAL( valueChanged( double ) ), this, SLOT( onPosChanged() ) );
+  connect( myPosHeadLight, SIGNAL( clicked( bool ) ),        this, SLOT( onPosChanged() ) );
+  connect( myPosColor,     SIGNAL( changed( QColor ) ),      this, SLOT( onPosChanged() ) );
+
+  connect( okButton,       SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+  connect( defaultButton,  SIGNAL( clicked() ), this, SLOT( ClickOnDefault() ) );
+  connect( closeButton,    SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) );
+  connect( helpButton,     SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) );
+
+  resize( minimumSizeHint() );
+}
+
+/*!
+  \brief Destructor
+*/
+OCCViewer_LightSourceDlg::~OCCViewer_LightSourceDlg()
+{
+  ( myInType == V3d_DIRECTIONAL ) ? myModel->getViewer3d()->DelLight( myPosLight ) :
+                                           myModel->getViewer3d()->DelLight( myDirLight );
+}
+
+QString OCCViewer_LightSourceDlg::getName()
+{
+  // return the name of object
+  return QString( "OCCViewer_LightSourceDlg" );
+}
+
+/*!
+  Initialization of initial values of widgets
+*/
+void OCCViewer_LightSourceDlg::initParam( bool theIsDefault )
+{
+  Handle(V3d_Light) aLight;
+  myModel->getViewer3d()->InitDefinedLights();
+  while ( myModel->getViewer3d()->MoreDefinedLights() )
+  {
+    aLight = myModel->getViewer3d()->DefinedLight();
+    if ( aLight->Type() == V3d_DIRECTIONAL ) {
+      myDirLight = Handle(V3d_DirectionalLight)::DownCast( aLight );
+      myPosLight = new V3d_PositionalLight( myModel->getViewer3d(), 0, 0, 0 );
+      myDirType->setChecked( true );
+      myStackedLayout->setCurrentIndex(0);
+      break;
+    }
+    if ( aLight->Type() == V3d_POSITIONAL ) {
+      myPosLight = Handle(V3d_PositionalLight)::DownCast( aLight );
+      myDirLight = new V3d_DirectionalLight( myModel->getViewer3d() );
+      myPosType->setChecked( true );
+      myStackedLayout->setCurrentIndex(1);
+      break;
+    }
+    myModel->getViewer3d()->NextDefinedLights();
+  }
+
+  double aX, aY, aZ;
+  Quantity_Color aColor = aLight->Color();
+  if( myDirType->isChecked() ) {
+    myDirColor->setColor( CAF_Tools::color( aColor ) );
+    myDirLight->Direction( aX, aY, aZ );
+    myDx->setValue( aX );
+    myDy->setValue( aY );
+    myDz->setValue( aZ );
+    myDirHeadLight->setChecked( myDirLight->Headlight() );
+  }
+  else if( myPosType->isChecked() ) {
+    myPosColor->setColor( CAF_Tools::color( aColor ) );
+    myPosLight->Position( aX, aY, aZ );
+    myX->setValue( aX );
+    myY->setValue( aY );
+    myZ->setValue( aZ );
+    myPosHeadLight->setChecked( myPosLight->Headlight() );
+  }
+
+  if ( !theIsDefault ) {
+    myInX = aX; myInY = aY; myInZ = aZ;
+    myInColor = aColor;
+    myInHeadLight = aLight->Headlight();
+    myInType = aLight->Type();
+  }
+}
+
+/*!
+  SLOT: called on type of light source changed
+*/
+void OCCViewer_LightSourceDlg::onTypeChanged()
+{
+  if( isBusy )
+    return;
+  myStackedLayout->setCurrentIndex( myPosType->isChecked() );
+  if( myPosType->isChecked() ) {
+    myModel->getViewer3d()->SetLightOff( myDirLight );
+    onPosChanged();
+  }
+  else if( myDirType->isChecked() ) {
+    myModel->getViewer3d()->SetLightOff( myPosLight );
+    onDirChanged();
+  }
+}
+
+/*!
+  SLOT: called on value of directional light source changed
+*/
+void OCCViewer_LightSourceDlg::onDirChanged()
+{
+  if( isBusy )
+    return;
+  myModel->getViewer3d()->SetLightOff( myDirLight );
+  if ( !( myDx->value() == 0 && myDy->value() == 0 && myDz->value() == 0 ) ) {
+    myDirLight->SetDirection( myDx->value(), myDy->value(), myDz->value() );
+    myDirLight->SetColor( CAF_Tools::color( myDirColor->color() ) );
+    myDirLight->SetHeadlight( myDirHeadLight->isChecked() );
+    myModel->getViewer3d()->SetLightOn( myDirLight );
+  }
+  myModel->getViewer3d()->UpdateLights();
+}
+
+/*!
+  SLOT: called on value of positional light source changed
+*/
+void OCCViewer_LightSourceDlg::onPosChanged()
+{
+  if( isBusy )
+    return;
+  myModel->getViewer3d()->SetLightOff( myPosLight );
+  myPosLight->SetPosition( myX->value(), myY->value(), myZ->value() );
+  myPosLight->SetColor( CAF_Tools::color( myPosColor->color() ) );
+  myPosLight->SetHeadlight( myPosHeadLight->isChecked() );
+  myModel->getViewer3d()->SetLightOn( myPosLight );
+  myModel->getViewer3d()->UpdateLights();
+}
+
+/*!
+  \brief SLOT on "Apply and Close" button click: sets current light source and closes dialog
+*/
+void OCCViewer_LightSourceDlg::ClickOnOk()
+{
+  // need save a current type for deleting other light when dialog will be closed
+  myInType = myDirType->isChecked() ? V3d_DIRECTIONAL : V3d_POSITIONAL;
+  close();
+}
+
+/*!
+  \brief SLOT on "Default" button click: sets default light source
+*/
+void OCCViewer_LightSourceDlg::ClickOnDefault()
+{
+  isBusy = true;
+  myModel->setDefaultLights();
+  initParam( true );
+  myModel->getViewer3d()->UpdateLights();
+  isBusy = false;
+}
+
+/*!
+  \brief SLOT on "Close" button click: sets initial light source and closes dialog
+*/
+void OCCViewer_LightSourceDlg::ClickOnClose()
+{
+  if( myInType == V3d_DIRECTIONAL ) {
+    myDirLight->SetDirection( myInX, myInY, myInZ );
+    myDirLight->SetColor( myInColor );
+    myDirLight->SetHeadlight( myInHeadLight );
+    myModel->getViewer3d()->SetLightOn( myDirLight );
+  }
+  else {
+    myPosLight->SetPosition( myInX, myInY, myInZ );
+    myPosLight->SetColor( myInColor );
+    myPosLight->SetHeadlight( myInHeadLight );
+    myModel->getViewer3d()->SetLightOn( myPosLight );
+  }
+  close();
+}
+
+/*!
+  \brief SLOT on help button click: opens a help page
+*/
+void OCCViewer_LightSourceDlg::ClickOnHelp()
+{
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( app )
+    app->onHelpContextModule( "GUI", "occ_3d_viewer_page.html", "light_source" );
+}
diff --git a/src/OCCViewer/OCCViewer_LightSourceDlg.h b/src/OCCViewer/OCCViewer_LightSourceDlg.h
new file mode 100644 (file)
index 0000000..7cf62ff
--- /dev/null
@@ -0,0 +1,93 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_LIGHTSOURCEDLG_H
+#define OCCVIEWER_LIGHTSOURCEDLG_H
+
+#include "OCCViewer.h"
+#include <QDialog>
+#include <V3d_DirectionalLight.hxx>
+#include <V3d_PositionalLight.hxx>
+#include <V3d_TypeOfLight.hxx>
+
+class OCCViewer_ViewWindow;
+class OCCViewer_Viewer;
+class QtxDoubleSpinBox;
+class QtxColorButton;
+class QPushButton;
+class QCheckBox;
+class QRadioButton;
+class QStackedLayout;
+
+class OCCVIEWER_EXPORT OCCViewer_LightSourceDlg: public QDialog
+{
+  Q_OBJECT
+
+public:
+  OCCViewer_LightSourceDlg( OCCViewer_ViewWindow*, OCCViewer_Viewer* );
+  ~OCCViewer_LightSourceDlg();
+
+  static QString getName();
+
+protected slots:
+
+private slots:
+  void onTypeChanged();
+  void onDirChanged();
+  void onPosChanged();
+
+  void ClickOnOk();
+  void ClickOnDefault();
+  void ClickOnClose();
+  void ClickOnHelp();
+
+private:
+  void initParam( bool theIsDefault = false );
+
+  OCCViewer_Viewer* myModel;
+
+  Handle(V3d_DirectionalLight) myDirLight;
+  Handle(V3d_PositionalLight) myPosLight;
+
+  QRadioButton* myDirType;
+  QRadioButton* myPosType;
+
+  QStackedLayout* myStackedLayout;
+
+  QtxDoubleSpinBox* myDx;
+  QtxDoubleSpinBox* myDy;
+  QtxDoubleSpinBox* myDz;
+  QCheckBox* myDirHeadLight;
+  QtxColorButton* myDirColor;
+
+  QtxDoubleSpinBox* myX;
+  QtxDoubleSpinBox* myY;
+  QtxDoubleSpinBox* myZ;
+  QCheckBox* myPosHeadLight;
+  QtxColorButton* myPosColor;
+
+  double myInX, myInY, myInZ;
+  bool myInHeadLight;
+  Quantity_Color myInColor;
+  V3d_TypeOfLight myInType;
+
+  bool isBusy;
+};
+
+#endif // OCCVIEWER_LIGHTSOURCEDLG_H
diff --git a/src/OCCViewer/OCCViewer_RayTracingDlg.cxx b/src/OCCViewer/OCCViewer_RayTracingDlg.cxx
new file mode 100644 (file)
index 0000000..11a6d01
--- /dev/null
@@ -0,0 +1,188 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// internal includes
+#include "OCCViewer_RayTracingDlg.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_ViewFrame.h"
+
+// GUI includes
+#include <SUIT_Session.h>
+#include <QtxIntSpinBox.h>
+
+// QT Includes
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QCheckBox>
+
+/*!
+  \class OCCViewer_RayTracingDlg
+  \brief Dialog allowing to assign parameters of ray tracing
+*/
+
+/*!
+  \brief Constructor
+  \param view - parent widget
+*/
+OCCViewer_RayTracingDlg::OCCViewer_RayTracingDlg( OCCViewer_ViewWindow* view )
+  :QDialog( view )
+{
+  // get current view frame (OCCViewer_ViewWindow->QFrame->OCCViewer_ViewFrame)
+  myViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( view->parent()->parent() );
+  myView3d = view->getViewPort()->getView();
+  setObjectName( "OCCViewer_RayTracingDlg" );
+  setWindowTitle( tr( "RAY_TRACING" ) );
+  setModal( false );
+
+  setAttribute( Qt::WA_DeleteOnClose, true );
+
+  // Create layout for this dialog
+  QVBoxLayout* dlglayout = new QVBoxLayout( this );
+  dlglayout->setSpacing( 6 );
+  dlglayout->setMargin( 11 );
+
+  // Create "Ray tracing" group
+
+  myRayTracingGroup = new QGroupBox( tr( "RAY_TRACING" ) );
+  myRayTracingGroup->setCheckable( true );
+  
+  QGridLayout* rayTracingLayout = new QGridLayout( myRayTracingGroup );
+  rayTracingLayout->setSpacing( 6 );
+  rayTracingLayout->setMargin( 11 );
+
+  myShadow = new QCheckBox( tr("SHADOW") );
+  myReflection = new QCheckBox( tr("REFLECTION") );
+  myAntialiasing = new QCheckBox( tr("ANTIALIASING") );
+  myTransparentShadow = new QCheckBox( tr("TRANSPARENT_SHADOW") );
+  QLabel* depthLabel = new QLabel( tr( "DEPTH" ) );
+  myDepth = new QtxIntSpinBox( 1, 10 );
+
+  rayTracingLayout->addWidget( depthLabel,          0, 0 );
+  rayTracingLayout->addWidget( myDepth,             0, 1 );
+  rayTracingLayout->addWidget( myReflection,        1, 0 );
+  rayTracingLayout->addWidget( myAntialiasing,      1, 1 );
+  rayTracingLayout->addWidget( myShadow,            2, 0 );
+  rayTracingLayout->addWidget( myTransparentShadow, 2, 1 );
+
+  // Create "Buttons" group
+
+  QGroupBox* groupButtons = new QGroupBox( this );
+  QHBoxLayout* groupButtonsLayout = new QHBoxLayout( groupButtons );
+  groupButtonsLayout->setSpacing( 6 );
+  groupButtonsLayout->setMargin( 11 );
+
+  QPushButton* buttonClose = new QPushButton( tr( "BUT_CLOSE" ) );
+  buttonClose->setDefault( true );
+
+  QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ) );
+
+  groupButtonsLayout->addStretch();
+  groupButtonsLayout->addWidget( buttonClose );
+  groupButtonsLayout->addWidget( buttonHelp );
+
+  dlglayout->addWidget( myRayTracingGroup );
+  dlglayout->addWidget( groupButtons );
+
+  // Initializations
+  initParam();
+
+  // Signals and slots connections
+  connect( myRayTracingGroup,    SIGNAL( toggled(bool) ),            this, SLOT( onRayTracing(bool) ) );
+  connect( myShadow,             SIGNAL( toggled(bool) ),            this, SLOT( onValueChanged() ) );
+  connect( myReflection,         SIGNAL( toggled(bool) ),            this, SLOT( onValueChanged() ) );
+  connect( myAntialiasing,       SIGNAL( toggled(bool) ),            this, SLOT( onValueChanged() ) );
+  connect( myTransparentShadow,  SIGNAL( toggled(bool) ),            this, SLOT( onValueChanged() ) );
+  connect( myDepth,              SIGNAL( valueChanged(int) ),        this, SLOT( onValueChanged() ) );
+  connect( buttonClose,          SIGNAL( clicked() ),                this, SLOT( close() ) ) ;
+  connect( buttonHelp,           SIGNAL( clicked() ),                this, SLOT( ClickOnHelp() ) );
+}
+
+/*!
+  \brief Destructor
+*/
+OCCViewer_RayTracingDlg::~OCCViewer_RayTracingDlg()
+{
+}
+
+QString OCCViewer_RayTracingDlg::getName()
+{
+  // return the name of object
+  return QString( "OCCViewer_RayTracingDlg" );
+}
+
+/*!
+  Initialization of initial values of widgets
+*/
+void OCCViewer_RayTracingDlg::initParam()
+{
+  Graphic3d_RenderingParams aParams = myView3d->RenderingParams();
+  myRayTracingGroup->setChecked( aParams.Method == Graphic3d_RM_RAYTRACING );
+  myDepth->setValue( aParams.RaytracingDepth );
+  myReflection->setChecked( aParams.IsReflectionEnabled );
+  myAntialiasing->setChecked( aParams.IsAntialiasingEnabled );
+  myShadow->setChecked( aParams.IsShadowEnabled );
+  myTransparentShadow->setChecked( aParams.IsTransparentShadowEnabled );
+}
+
+/*!
+  SLOT: called on value of ray tracing changed
+*/
+void OCCViewer_RayTracingDlg::onValueChanged()
+{
+  for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) {
+    if ( OCCViewer_ViewWindow* aViewWindow = myViewFrame->getView(i) ) {
+      Handle(V3d_View) aView = aViewWindow->getViewPort()->getView();
+      Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
+      aParams.IsShadowEnabled = myShadow->isChecked();
+      aParams.IsReflectionEnabled = myReflection->isChecked();
+      aParams.IsAntialiasingEnabled = myAntialiasing->isChecked();
+      aParams.IsTransparentShadowEnabled = myTransparentShadow->isChecked();
+      aParams.RaytracingDepth = myDepth->value();
+      aView->Redraw();
+    }
+  }
+}
+
+/*!
+  SLOT on "Ray tracing" group click
+*/
+void OCCViewer_RayTracingDlg::onRayTracing( bool theIsChecked )
+{
+  for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) {
+    if ( OCCViewer_ViewWindow* aViewWindow = myViewFrame->getView(i) ) {
+      Handle(V3d_View) aView = aViewWindow->getViewPort()->getView();
+      Graphic3d_RenderingParams& aParams = aView->ChangeRenderingParams();
+      theIsChecked ? aParams.Method = Graphic3d_RM_RAYTRACING : aParams.Method = Graphic3d_RM_RASTERIZATION;
+      aView->Redraw();
+    }
+  }
+}
+
+/*!
+  SLOT on help button click: opens a help page
+*/
+void OCCViewer_RayTracingDlg::ClickOnHelp()
+{
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( app )
+    app->onHelpContextModule( "GUI", "occ_3d_viewer_page.html", "ray_tracing" );
+}
diff --git a/src/OCCViewer/OCCViewer_RayTracingDlg.h b/src/OCCViewer/OCCViewer_RayTracingDlg.h
new file mode 100644 (file)
index 0000000..9a7ba49
--- /dev/null
@@ -0,0 +1,65 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_RAYTRACINGDLG_H
+#define OCCVIEWER_RAYTRACINGDLG_H
+
+#include "OCCViewer.h"
+#include <QDialog>
+#include <V3d_View.hxx>
+
+class OCCViewer_ViewWindow;
+class OCCViewer_ViewFrame;
+class QCheckBox;
+class QtxIntSpinBox;
+class QGroupBox;
+
+
+class OCCVIEWER_EXPORT OCCViewer_RayTracingDlg : public QDialog
+{
+  Q_OBJECT
+
+  public:
+  OCCViewer_RayTracingDlg( OCCViewer_ViewWindow* );
+  ~OCCViewer_RayTracingDlg();
+
+  static QString getName();
+
+private slots:
+
+  void onValueChanged();
+  void onRayTracing(bool);
+
+  void ClickOnHelp();
+
+private:
+  void initParam();
+
+  OCCViewer_ViewFrame* myViewFrame;
+  Handle(V3d_View)     myView3d;
+
+  QGroupBox*     myRayTracingGroup;
+  QtxIntSpinBox* myDepth;
+  QCheckBox*     myReflection;
+  QCheckBox*     myAntialiasing;
+  QCheckBox*     myShadow;
+  QCheckBox*     myTransparentShadow;
+};
+
+#endif // OCCVIEWER_RAYTRACINGDLG_H
index 2818884c390688c02d33a285450d2a4f21c6545c..18e9096bc70809adffcabdb08f136ca2d6f5e2c7 100755 (executable)
@@ -36,6 +36,7 @@
 // QT includes
 #include <QImage>
 #include <QAction>
+#include <QDialog>
 
 Handle(Image_PixMap) OCCViewer_Utilities::imageToPixmap( const QImage& anImage )
 {
@@ -135,3 +136,14 @@ OCCViewer_ViewWindow::Mode2dType OCCViewer_Utilities::setViewer2DMode
 
   return anOldMode;
 }
+
+bool OCCViewer_Utilities::isDialogOpened( OCCViewer_ViewWindow* theView, const QString& theName )
+{
+  bool isFound = false;
+  OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theView->parent()->parent() );
+  QList<QDialog*> allDialogs = qFindChildren<QDialog*>( aViewFrame );
+  foreach ( QDialog* d, allDialogs )
+    if ( d->objectName() == theName )
+      isFound = true;
+  return isFound;
+}
index 125c0c4587970fc6ba0ac870fae741ec5d8c9dcc..484494543a2c828449a8cab5504ecd4da83d95ad 100755 (executable)
@@ -55,6 +55,14 @@ public:
               setViewer2DMode( OCCViewer_Viewer* theViewer,
                                const OCCViewer_ViewWindow::Mode2dType& theMode );
 
+  /*!
+   * Find dialog in the current view frame by name
+   * \param theView an OCC view
+   * \param theName name of dialog
+   * \return true/false if dialog is opened/isn't opened
+   */
+  static bool isDialogOpened( OCCViewer_ViewWindow* theView, const QString& theName );
+
 };
 
 #endif // OCCVIEWER_UTILITIES_H
index e4c3ec9047d76d5e10570266e01cc3908f7b5b6e..e3313a8b046aa236fe644dc6e0b14bed4c6d7a84 100644 (file)
@@ -23,6 +23,7 @@
 #include "OCCViewer_ViewFrame.h"
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewModel.h"
+#include "OCCViewer_ViewPort3d.h"
 
 #include <SUIT_ViewManager.h>
 #include <SUIT_Session.h>
@@ -169,10 +170,25 @@ void OCCViewer_ViewFrame::createSubViews()
       view->setDropDownButtons( dropDownButtons() );
       connectViewSignals(view);
       view->setBackground(aModel->background(i));
+      setSubViewParams( view );
     }
   }
 }
 
+//**************************************************************************************
+void OCCViewer_ViewFrame::setSubViewParams( OCCViewer_ViewWindow* theView )
+{
+  Handle(V3d_View) aView = theView->getViewPort()->getView();
+  Handle(V3d_View) aMainView = myViews.at( MAIN_VIEW )->getViewPort()->getView();
+
+  // set ray tracing parameters
+  aView->ChangeRenderingParams() = aMainView->RenderingParams();
+
+  // set environment texture parameters
+  aView->SetTextureEnv( aMainView->TextureEnv() );
+  aView->SetSurfaceDetail( aMainView->SurfaceDetail() );
+}
+
 void OCCViewer_ViewFrame::splitSubViews()
 {
        if( mySplitMode == -1 )
index e7bb37726c5303a5a0261baec16c0900620c490a..ec4cfc773cc1b2bee6f6ff57b93b9b128a9a5f5d 100644 (file)
@@ -172,6 +172,7 @@ private:
   void updateWindowTitle( OCCViewer_ViewWindow* theView );
   void createSubViews();
   void splitSubViews();
+  void setSubViewParams( OCCViewer_ViewWindow* theView );
 
   QList<OCCViewer_ViewWindow*> myViews;
   QGridLayout* myLayout;
index 282cc5721933e52ccead81b2d65fc2e56e55b4e9..fe2546853b34f478998ed0d9bc92dc90c2f2e64d 100755 (executable)
@@ -36,6 +36,8 @@
 
 #include "ViewerData_AISShape.hxx"
 
+#include "CAF_Tools.h"
+
 #include <Basics_OCCTVersion.hxx>
 
 #include "QtxActionToolMgr.h"
@@ -73,6 +75,9 @@
 
 #include <Visual3d_View.hxx>
 
+#include <V3d_DirectionalLight.hxx>
+#include <V3d_AmbientLight.hxx>
+
 /*!
   Get data for supported background modes: gradient types, identifiers and supported image formats
 */
@@ -120,7 +125,7 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
   // init CasCade viewers
   myV3dViewer = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Viewer3d").ToExtString() );
   //myV3dViewer->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
-  myV3dViewer->SetDefaultLights();
+  setDefaultLights();
 
   // init selector
   myAISContext = new AIS_InteractiveContext( myV3dViewer );
@@ -1083,6 +1088,33 @@ void OCCViewer_Viewer::performSelectionChanged()
     emit selectionChanged();
 }
 
+/*
+ * Defines default lights
+ */
+void OCCViewer_Viewer::setDefaultLights()
+{
+  // clear all light sources
+  myV3dViewer->InitDefinedLights();
+  while ( myV3dViewer->MoreDefinedLights() )
+  {
+    myV3dViewer->DelLight( myV3dViewer->DefinedLight() );
+    myV3dViewer->InitDefinedLights();
+  }
+
+  // get light source parameters from preferences
+  QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "OCCViewer", "light_color", QColor( 0, 0, 0 ) );
+  double aDx = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dx", 0.0 );
+  double aDy = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dy", 0.0 );
+  double aDz = SUIT_Session::session()->resourceMgr()->doubleValue( "OCCViewer", "light_dz", -1.0 );
+
+  Handle(V3d_DirectionalLight) aLight =
+    new V3d_DirectionalLight( myV3dViewer, V3d_Zneg, CAF_Tools::color( aColor ).Name(), Standard_True );
+  if( !( aDx == 0 && aDy == 0 && aDz == 0 ) )
+    aLight->SetDirection( aDx, aDy, aDz );
+  myV3dViewer->SetLightOn( aLight );
+  myV3dViewer->SetLightOn( new V3d_AmbientLight( myV3dViewer ) );
+}
+
 /*!
   Hilights/unhilights object in viewer
   \param obj - object to be updated
index a8eba563e43e1f423cc71ca321830cfd53a96c2c..09d071fce75f280777233cc700f44bd9d07f0b1c 100755 (executable)
@@ -100,6 +100,8 @@ public:
   void                            performSelectionChanged();
   // emit signal selectionChanged
 
+  void                            setDefaultLights();
+
   QColor                          backgroundColor() const;                              // obsolete
   void                            setBackgroundColor( const QColor& );                  // obsolete
   Qtx::BackgroundData             background() const;
index cc6d7bf5a496d68a28ce9401c1e20304d940803b..5e927fbb3eda784eef72f747ab9e65b2e29dd368 100755 (executable)
@@ -28,6 +28,8 @@
 
 #include <SUIT_ViewManager.h>
 #include <SUIT_ViewModel.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
 
 #include <QColor>
 #include <QFileInfo>
@@ -88,7 +90,7 @@ OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_V
   }
 #endif
 
-  setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
+  setDefaultParams();
 
   myCursor = NULL;
 }
@@ -803,3 +805,26 @@ QCursor* OCCViewer_ViewPort3d::getDefaultCursor() const
 {
   return myCursor;
 }
+
+/*
+ * Set default parameters from preferences
+ */
+void OCCViewer_ViewPort3d::setDefaultParams()
+{
+  setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
+
+  // get ray tracing parameters from preferences
+  int aDepth = SUIT_Session::session()->resourceMgr()->integerValue( "OCCViewer", "rt_depth", 3 );
+  bool aReflection = SUIT_Session::session()->resourceMgr()->booleanValue( "OCCViewer", "rt_reflection", true );
+  bool anAntialiasing = SUIT_Session::session()->resourceMgr()->booleanValue( "OCCViewer", "rt_antialiasing", false );
+  bool aShadow = SUIT_Session::session()->resourceMgr()->booleanValue( "OCCViewer", "rt_shadow", true );
+  bool aTransparentShadow = SUIT_Session::session()->resourceMgr()->booleanValue( "OCCViewer", "rt_trans_shadow", true );
+
+  Graphic3d_RenderingParams& aParams = myActiveView->ChangeRenderingParams();
+  aParams.RaytracingDepth = aDepth;
+  aParams.IsReflectionEnabled = aReflection;
+  aParams.IsAntialiasingEnabled = anAntialiasing;
+  aParams.IsShadowEnabled = aShadow;
+  aParams.IsTransparentShadowEnabled = aTransparentShadow;
+  myActiveView->Redraw();
+}
index 7f8841a25e2523ca88716d8f86f00d4af86dc1eb..1413b76e9eb1363d20ed3a0b47ea71d022ad4f5e 100755 (executable)
@@ -122,6 +122,7 @@ private:
   bool                  setWindow( const Handle(V3d_View)& );
   bool                  mapped( const Handle(V3d_View)& ) const;
   void                  updateBackground();
+  void                  setDefaultParams();
   
 private:
   Handle(V3d_View)      myActiveView;
index a0e96792bba525452df09cffa38363629dd3dc4c..d8c9de76b9038ed1903af7e307cb775b3c36bb33 100755 (executable)
 #include "OCCViewer_AxialScaleDlg.h"
 #include "OCCViewer_CubeAxesDlg.h"
 #include "OCCViewer_ClippingDlg.h"
+#include "OCCViewer_RayTracingDlg.h"
+#include "OCCViewer_EnvTextureDlg.h"
+#include "OCCViewer_LightSourceDlg.h"
+#include "OCCViewer_Utilities.h"
 
 #include <SUIT_Desktop.h>
 #include <SUIT_Session.h>
@@ -116,6 +120,9 @@ static QEvent* l_mbPressEvent = 0;
 #undef KeyPress
 #endif
 
+// Enable ray tracing features
+#define ENABLE_RAY_TRACING
+
 const char* imageZoomCursor[] = {
 "32 32 3 1",
 ". c None",
@@ -1446,6 +1453,28 @@ void OCCViewer_ViewWindow::createActions()
 
   // Synchronize View
   toolMgr()->registerAction( synchronizeAction(), SynchronizeId );
+#ifdef ENABLE_RAY_TRACING
+  // Ray tracing
+  aAction = new QtxAction( tr("MNU_RAY_TRACING"), aResMgr->loadPixmap( "OCCViewer", tr("ICON_OCCVIEWER_RAY_TRACING") ),
+                           tr("MNU_RAY_TRACING"), 0, this );
+  aAction->setStatusTip( tr("DSC_RAY_TRACING") );
+  connect( aAction, SIGNAL( triggered() ), this, SLOT( onRayTracing() ) );
+  toolMgr()->registerAction( aAction, RayTracingId );
+
+  // Environment texture
+  aAction = new QtxAction( tr("MNU_ENV_TEXTURE"), aResMgr->loadPixmap( "OCCViewer", tr("ICON_OCCVIEWER_ENV_TEXTURE") ),
+                           tr("MNU_ENV_TEXTURE"), 0, this );
+  aAction->setStatusTip( tr("DSC_ENV_TEXTURE") );
+  connect( aAction, SIGNAL( triggered() ), this, SLOT( onEnvTexture() ) );
+  toolMgr()->registerAction( aAction, EnvTextureId );
+
+  // Light source
+  aAction = new QtxAction( tr("MNU_LIGHT_SOURCE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_LIGHT_SOURCE" ) ),
+                           tr( "MNU_LIGHT_SOURCE" ), 0, this );
+  aAction->setStatusTip( tr("DSC_LIGHT_SOURCE") );
+  connect( aAction, SIGNAL( triggered() ), this, SLOT( onLightSource() ) );
+  toolMgr()->registerAction( aAction, LightSourceId );
+#endif
 }
 
 /*!
@@ -1535,6 +1564,11 @@ void OCCViewer_ViewWindow::createToolBar()
 
   toolMgr()->append( MaximizedId, tid );
   toolMgr()->append( SynchronizeId, tid );
+#ifdef ENABLE_RAY_TRACING
+  toolMgr()->append( RayTracingId, tid );
+  toolMgr()->append( EnvTextureId, tid );
+  toolMgr()->append( LightSourceId, tid );
+#endif
 }
 
 /*!
@@ -2232,17 +2266,20 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img,
                                              const QString& fileName,
                                              const QString& format )
 {
+  bool res = false;
+  QApplication::setOverrideCursor( Qt::WaitCursor );
   if ( format != "PS" && format != "EPS")
-    return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
+   res = myViewPort->getView()->Dump( fileName.toStdString().c_str() );
 
   Handle(Visual3d_View) a3dView = myViewPort->getView()->View();
 
   if (format == "PS")
-    a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript);
+    res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript);
   else if (format == "EPS")
-    a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript);
+    res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript);
 
-  return true;
+  QApplication::restoreOverrideCursor();
+  return res;
 }
 
 
@@ -2540,6 +2577,58 @@ QString OCCViewer_ViewWindow::getVisualParameters()
   data << QString( "gtTickmarkLengthX=%1" ).arg( params.gtTickmarkLengthX );
   data << QString( "gtTickmarkLengthY=%1" ).arg( params.gtTickmarkLengthY );
   data << QString( "gtTickmarkLengthZ=%1" ).arg( params.gtTickmarkLengthZ );
+
+  // ray tracing parameters
+  Graphic3d_RenderingParams rendParams = this->getViewPort()->getView()->RenderingParams();
+  if ( rendParams.Method == Graphic3d_RM_RAYTRACING ) {
+    QString RayTracing = "rayTracing=";
+    RayTracing += QString( "rtDepth~%1;" ).arg( rendParams.RaytracingDepth );
+    RayTracing += QString( "rtReflection~%1;" ).arg( rendParams.IsReflectionEnabled );
+    RayTracing += QString( "rtAntialiasing~%1;" ).arg( rendParams.IsAntialiasingEnabled );
+    RayTracing += QString( "rtShadow~%1;" ).arg( rendParams.IsShadowEnabled );
+    RayTracing += QString( "rtTransShadow~%1;" ).arg( rendParams.IsTransparentShadowEnabled );
+    data << RayTracing;
+  }
+
+  // environment texture parameters
+  Handle(Graphic3d_TextureEnv) aTexture = this->getViewPort()->getView()->TextureEnv();
+  if ( !aTexture.IsNull() ) {
+    QString EnvTexture = "envTexture=";
+    if ( aTexture->Name() == Graphic3d_NOT_ENV_UNKNOWN ) {
+      TCollection_AsciiString aFileName;
+      aTexture->Path().SystemName( aFileName );
+      EnvTexture += QString( "etFile~%1;" ).arg( aFileName.ToCString() );
+    }
+    else
+      EnvTexture += QString( "etNumber~%1;" ).arg( aTexture->Name() );
+    data << EnvTexture;
+  }
+
+  // light source parameters
+  myModel->getViewer3d()->InitDefinedLights();
+  while ( myModel->getViewer3d()->MoreDefinedLights() )
+  {
+    Handle(V3d_Light) aLight = myModel->getViewer3d()->DefinedLight();
+    if ( aLight->Type() != V3d_AMBIENT ) {
+      QString LightSource = QString( "lightSource=" );
+      LightSource += QString( "lightType~%1;" ).arg( aLight->Type() );
+      double aX, aY, aZ;
+      if ( aLight->Type() == V3d_DIRECTIONAL )
+        Handle(V3d_DirectionalLight)::DownCast( aLight )->Direction( aX, aY, aZ );
+      else if ( aLight->Type() == V3d_POSITIONAL )
+        Handle(V3d_PositionalLight)::DownCast( aLight )->Position( aX, aY, aZ );
+      LightSource += QString( "lightX~%1;" ).arg( aX );
+      LightSource += QString( "lightY~%1;" ).arg( aY );
+      LightSource += QString( "lightZ~%1;" ).arg( aZ );
+      LightSource += QString( "lightColorR~%1;" ).arg( aLight->Color().Red() );
+      LightSource += QString( "lightColorG~%1;" ).arg( aLight->Color().Green() );
+      LightSource += QString( "lightColorB~%1;" ).arg( aLight->Color().Blue() );
+      LightSource += QString( "lightHeadlight~%1;" ).arg( aLight->Headlight() );
+      data << LightSource;
+    }
+    myModel->getViewer3d()->NextDefinedLights();
+  }
+
   QString bg = Qtx::backgroundToString( background() ).replace( "=", "$" );
   data << QString( "background=%1" ).arg( bg );
 
@@ -2658,6 +2747,81 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
       else if ( paramName == "gtTickmarkLengthX" ) params.gtTickmarkLengthX = paramValue.toInt();
       else if ( paramName == "gtTickmarkLengthY" ) params.gtTickmarkLengthY = paramValue.toInt();
       else if ( paramName == "gtTickmarkLengthZ" ) params.gtTickmarkLengthZ = paramValue.toInt();
+      else if ( paramName == "rayTracing" )
+      {
+        Graphic3d_RenderingParams& rendParams = this->getViewPort()->getView()->ChangeRenderingParams();
+        rendParams.Method = Graphic3d_RM_RAYTRACING;
+        QStringList rtData = paramValue.split( ';' );
+        foreach( QString rtParam, rtData )
+        {
+          QString rt_paramName  = rtParam.section( '~', 0, 0 ).trimmed();
+          QString rt_paramValue = rtParam.section( '~', 1, 1 ).trimmed();
+          if ( rt_paramName == "rtDepth" ) rendParams.RaytracingDepth = rt_paramValue.toInt();
+          else if ( rt_paramName == "rtReflection" ) rendParams.IsReflectionEnabled = rt_paramValue.toInt();
+          else if ( rt_paramName == "rtAntialiasing" ) rendParams.IsAntialiasingEnabled = rt_paramValue.toInt();
+          else if ( rt_paramName == "rtShadow" ) rendParams.IsShadowEnabled = rt_paramValue.toInt();
+          else if ( rt_paramName == "rtTransShadow" ) rendParams.IsTransparentShadowEnabled = rt_paramValue.toInt();
+        }
+      }
+      else if ( paramName == "envTexture" )
+      {
+        Handle(Graphic3d_TextureEnv) aTexture;
+        QStringList etData = paramValue.split( ';' );
+        foreach( QString etParam, etData )
+        {
+          QString et_paramName  = etParam.section( '~', 0, 0 ).trimmed();
+          QString et_paramValue = etParam.section( '~', 1, 1 ).trimmed();
+          if ( et_paramName == "etNumber" )
+            aTexture = new Graphic3d_TextureEnv( Graphic3d_NameOfTextureEnv( et_paramValue.toInt() ) );
+          else if ( et_paramName == "etFile" )
+            aTexture = new Graphic3d_TextureEnv( TCollection_AsciiString( et_paramValue.toStdString().c_str() ) );
+          Handle(V3d_View) aView = this->getViewPort()->getView();
+          aView->SetTextureEnv( aTexture );
+          aView->SetSurfaceDetail( V3d_TEX_ENVIRONMENT );
+        }
+      }
+      else if ( paramName == "lightSource" )
+      {
+        myModel->getViewer3d()->InitDefinedLights();
+        while ( myModel->getViewer3d()->MoreDefinedLights() )
+        {
+          Handle(V3d_Light) aLight = myModel->getViewer3d()->DefinedLight();
+          if( aLight->Type() != V3d_AMBIENT )
+            myModel->getViewer3d()->DelLight( aLight );
+          myModel->getViewer3d()->NextDefinedLights();
+        }
+        double aX, aY, aZ;
+        double cR, cG, cB;
+        V3d_TypeOfLight aType;
+        bool isHeadlight;
+        QStringList lsData = paramValue.split( ';' );
+        foreach( QString lsParam, lsData )
+        {
+          QString ls_paramName  = lsParam.section( '~', 0, 0 ).trimmed();
+          QString ls_paramValue = lsParam.section( '~', 1, 1 ).trimmed();
+          if ( ls_paramName == "lightType" ) aType = V3d_TypeOfLight( ls_paramValue.toInt() );
+          else if ( ls_paramName == "lightX" ) aX = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightY" ) aY = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightZ" ) aZ = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightColorR" ) cR = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightColorG" ) cG = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightColorB" ) cB = ls_paramValue.toDouble();
+          else if ( ls_paramName == "lightHeadlight" ) isHeadlight = ls_paramValue.toInt();
+        }
+        Quantity_Color aColor = Quantity_Color( cR, cG, cB, Quantity_TOC_RGB );
+        if( aType == V3d_DIRECTIONAL ) {
+          Handle(V3d_DirectionalLight) aLight = new V3d_DirectionalLight( myModel->getViewer3d() );
+          aLight->SetDirection( aX, aY, aZ );
+          aLight->SetColor( aColor );
+          aLight->SetHeadlight( isHeadlight );
+          myModel->getViewer3d()->SetLightOn( aLight );
+        }
+        else if( aType == V3d_POSITIONAL ) {
+          Handle(V3d_PositionalLight) aLight = new V3d_PositionalLight( myModel->getViewer3d(), aX, aY, aZ, aColor.Name() );
+          aLight->SetHeadlight( isHeadlight );
+          myModel->getViewer3d()->SetLightOn( aLight );
+        }
+      }
       else if ( paramName == "background" )        {
   QString bg = paramValue.replace( "$", "=" );
   bgData = Qtx::stringToBackground( bg );
@@ -3559,3 +3723,30 @@ void OCCViewer_ViewWindow::onClipping (bool theIsOn)
     }
   }
 }
+
+void OCCViewer_ViewWindow::onRayTracing()
+{
+  if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_RayTracingDlg::getName() ) ) {
+    QDialog* aDlg = new OCCViewer_RayTracingDlg( this );
+    if ( aDlg != NULL )
+      aDlg->show();
+  }
+}
+
+void OCCViewer_ViewWindow::onEnvTexture()
+{
+  if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_EnvTextureDlg::getName() ) ) {
+    QDialog* aDlg = new OCCViewer_EnvTextureDlg( this );
+    if ( aDlg != NULL )
+      aDlg->show();
+  }
+}
+
+void OCCViewer_ViewWindow::onLightSource()
+{
+  if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_LightSourceDlg::getName() ) ) {
+    QDialog* aDlg = new OCCViewer_LightSourceDlg( this, myModel );
+    if ( aDlg != NULL )
+      aDlg->show();
+  }
+}
index 51f6b92b06e636043d5abfdaf4adbe66a7dd494b..a9f65625778f6862c1b4eb571710c4e12333fe26 100755 (executable)
@@ -151,7 +151,7 @@ public:
         SwitchInteractionStyleId, SwitchZoomingStyleId, 
         SwitchPreselectionId, SwitchSelectionId,
         MaximizedId, SynchronizeId, ReturnTo3dViewId,
-        OrthographicId, PerspectiveId, StereoId,
+        OrthographicId, PerspectiveId, StereoId, RayTracingId, EnvTextureId, LightSourceId,
         UserId };
 
   enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, 
@@ -305,6 +305,9 @@ public slots:
   virtual void onSwitchZoomingStyle( bool on );
   virtual void onSwitchPreselection( bool on );
   virtual void onSwitchSelection( bool on );
+  virtual void onRayTracing();
+  virtual void onEnvTexture();
+  virtual void onLightSource();
 
   virtual void activateSetRotationGravity();
   virtual void activateSetRotationSelected( double theX, double theY, double theZ );
index ee8fbb6a0ba19d7c6f2f55c704950bb59a671167..d91f20aafdab0fb4057d19dc1727a8572d8a2933 100644 (file)
         <source>ICON_OCCVIEWER_STEREO</source>
         <translation>occ_view_stereo.png</translation>
     </message>
+    <message>
+        <source>ICON_OCCVIEWER_RAY_TRACING</source>
+        <translation>occ_view_ray_tracing.png</translation>
+    </message>
+    <message>
+        <source>ICON_OCCVIEWER_ENV_TEXTURE</source>
+        <translation>occ_view_env_texture.png</translation>
+    </message>
+    <message>
+        <source>ICON_OCCVIEWER_LIGHT_SOURCE</source>
+        <translation>occ_view_light_source.png</translation>
+    </message>
 </context>
 </TS>
index 5c993519b32c53b3f1b022e3254f9d779cf588da..36cd063ca441dfeb9897a06cfeeb2e99380e4547 100644 (file)
         <source>DSC_RETURN_3D_VIEW</source>
         <translation>Return to 3D view</translation>
     </message>
+    <message>
+        <source>MNU_RAY_TRACING</source>
+        <translation>Ray tracing</translation>
+    </message>
+    <message>
+        <source>DSC_RAY_TRACING</source>
+        <translation>Ray tracing</translation>
+    </message>
+    <message>
+        <source>MNU_ENV_TEXTURE</source>
+        <translation>Environment texture</translation>
+    </message>
+    <message>
+        <source>DSC_ENV_TEXTURE</source>
+        <translation>Environment texture</translation>
+    </message>
+    <message>
+        <source>MNU_LIGHT_SOURCE</source>
+        <translation>Light source</translation>
+    </message>
+    <message>
+        <source>DSC_LIGHT_SOURCE</source>
+        <translation>Light source</translation>
+    </message>
     <message>
         <source>OCC_IMAGE_FILES</source>
         <translation>Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
         <translation>&amp;Help</translation>
     </message>
 </context>
+<context>
+    <name>OCCViewer_RayTracingDlg</name>
+    <message>
+        <source>RAY_TRACING</source>
+        <translation>Ray tracing</translation>
+    </message>
+    <message>
+        <source>DEPTH</source>
+        <translation>Depth</translation>
+    </message>
+    <message>
+        <source>SHADOW</source>
+        <translation>Shadows rendering</translation>
+    </message>
+    <message>
+        <source>REFLECTION</source>
+        <translation>Specular reflections</translation>
+    </message>
+    <message>
+        <source>ANTIALIASING</source>
+        <translation>Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>TRANSPARENT_SHADOW</source>
+        <translation>Transparent shadow</translation>
+    </message>
+</context>
+<context>
+    <name>OCCViewer_EnvTextureDlg</name>
+    <message>
+        <source>ENV_TEXTURE</source>
+        <translation>Environment texture</translation>
+    </message>
+    <message>
+        <source>ENV_CLOUDS</source>
+        <translation>Clouds</translation>
+    </message>
+    <message>
+        <source>ENV_CV</source>
+        <translation>Cv</translation>
+    </message>
+    <message>
+        <source>ENV_MEDIT</source>
+        <translation>Medit</translation>
+    </message>
+    <message>
+        <source>ENV_PEARL</source>
+        <translation>Pearl</translation>
+    </message>
+    <message>
+        <source>ENV_SKY1</source>
+        <translation>Sky1</translation>
+    </message>
+    <message>
+        <source>ENV_SKY2</source>
+        <translation>Sky2</translation>
+    </message>
+    <message>
+        <source>ENV_LINES</source>
+        <translation>Lines</translation>
+    </message>
+    <message>
+        <source>ENV_ROAD</source>
+        <translation>Road</translation>
+    </message>
+    <message>
+        <source>ENV_CUSTOM</source>
+        <translation>Custom...</translation>
+    </message>
+</context>
+<context>
+    <name>OCCViewer_LightSourceDlg</name>
+    <message>
+        <source>LIGHT_SOURCE</source>
+        <translation>Light source</translation>
+    </message>
+    <message>
+        <source>TYPE</source>
+        <translation>Type</translation>
+    </message>
+    <message>
+        <source>DIRECTIONAL</source>
+        <translation>Directional</translation>
+    </message>
+    <message>
+        <source>DIRECTION</source>
+        <translation>Direction</translation>
+    </message>
+    <message>
+        <source>POSITIONAL</source>
+        <translation>Positional</translation>
+    </message>
+    <message>
+        <source>POSITION</source>
+        <translation>Position</translation>
+    </message>
+    <message>
+        <source>COLOR</source>
+        <translation>Color</translation>
+    </message>
+    <message>
+        <source>HEADLIGHT</source>
+        <translation>Headlight</translation>
+    </message>
+    <message>
+        <source>BUT_DEFAULT</source>
+        <translation>Default</translation>
+    </message>
+</context>
 </TS>
index e7b680e0b216a06484d066d7d97c0ada228de4c8..b0fd983fc4c950d8eff4e65331559368f3dc22a2 100755 (executable)
         <source>DSC_RETURN_3D_VIEW</source>
         <translation>Retour à la vue 3D</translation>
     </message>
+    <message>
+        <source>MNU_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>DSC_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>MNU_ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>DSC_ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>MNU_LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>DSC_LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
     <message>
         <source>OCC_IMAGE_FILES</source>
         <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
         <translation>Ai&amp;de</translation>
     </message>
 </context>
+<context>
+    <name>OCCViewer_RayTracingDlg</name>
+    <message>
+        <source>RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>DEPTH</source>
+        <translation type="unfinished">Depth</translation>
+    </message>
+    <message>
+        <source>SHADOW</source>
+        <translation type="unfinished">Shadows rendering</translation>
+    </message>
+    <message>
+        <source>REFLECTION</source>
+        <translation type="unfinished">Specular reflections</translation>
+    </message>
+    <message>
+        <source>ANTIALIASING</source>
+        <translation type="unfinished">Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>TRANSPARENT_SHADOW</source>
+        <translation type="unfinished">Transparent shadow</translation>
+    </message>
+</context>
+<context>
+    <name>OCCViewer_EnvTextureDlg</name>
+    <message>
+        <source>ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>ENV_CLOUDS</source>
+        <translation type="unfinished">Clouds</translation>
+    </message>
+    <message>
+        <source>ENV_CV</source>
+        <translation type="unfinished">Cv</translation>
+    </message>
+    <message>
+        <source>ENV_MEDIT</source>
+        <translation type="unfinished">Medit</translation>
+    </message>
+    <message>
+        <source>ENV_PEARL</source>
+        <translation type="unfinished">Pearl</translation>
+    </message>
+    <message>
+        <source>ENV_SKY1</source>
+        <translation type="unfinished">Sky1</translation>
+    </message>
+    <message>
+        <source>ENV_SKY2</source>
+        <translation type="unfinished">Sky2</translation>
+    </message>
+    <message>
+        <source>ENV_LINES</source>
+        <translation type="unfinished">Lines</translation>
+    </message>
+    <message>
+        <source>ENV_ROAD</source>
+        <translation type="unfinished">Road</translation>
+    </message>
+    <message>
+        <source>ENV_CUSTOM</source>
+        <translation type="unfinished">Custom...</translation>
+    </message>
+</context>
+<context>
+    <name>OCCViewer_LightSourceDlg</name>
+    <message>
+        <source>LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>TYPE</source>
+        <translation type="unfinished">Type</translation>
+    </message>
+    <message>
+        <source>DIRECTIONAL</source>
+        <translation type="unfinished">Directional</translation>
+    </message>
+    <message>
+        <source>DIRECTION</source>
+        <translation type="unfinished">Direction</translation>
+    </message>
+    <message>
+        <source>POSITIONAL</source>
+        <translation type="unfinished">Positional</translation>
+    </message>
+    <message>
+        <source>POSITION</source>
+        <translation type="unfinished">Position</translation>
+    </message>
+    <message>
+        <source>COLOR</source>
+        <translation type="unfinished">Color</translation>
+    </message>
+    <message>
+        <source>HEADLIGHT</source>
+        <translation type="unfinished">Headlight</translation>
+    </message>
+    <message>
+        <source>BUT_DEFAULT</source>
+        <translation type="unfinished">Default</translation>
+    </message>
+</context>
 </TS>
index a98424954c23b6fd65b4a3bf3c12dbfba08b1d70..c45ce44c62905be5ed84820acf108f8cc49c1935 100644 (file)
       <source>MNU_RETURN_3D_VIEW</source>
       <translation>3D に戻る</translation>
     </message>
+    <message>
+        <source>MNU_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>DSC_RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>MNU_ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>DSC_ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>MNU_LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>DSC_LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
     <message>
       <source>DSC_RETURN_3D_VIEW</source>
       <translation>3D view に戻る</translation>
       <translation>ヘルプ(&amp;H)</translation>
     </message>
   </context>
+  <context>
+    <name>OCCViewer_RayTracingDlg</name>
+    <message>
+        <source>RAY_TRACING</source>
+        <translation type="unfinished">Ray tracing</translation>
+    </message>
+    <message>
+        <source>DEPTH</source>
+        <translation type="unfinished">Depth</translation>
+    </message>
+    <message>
+        <source>SHADOW</source>
+        <translation type="unfinished">Shadows rendering</translation>
+    </message>
+    <message>
+        <source>REFLECTION</source>
+        <translation type="unfinished">Specular reflections</translation>
+    </message>
+    <message>
+        <source>ANTIALIASING</source>
+        <translation type="unfinished">Adaptive anti-aliasing</translation>
+    </message>
+    <message>
+        <source>TRANSPARENT_SHADOW</source>
+        <translation type="unfinished">Transparent shadow</translation>
+    </message>
+  </context>
+  <context>
+    <name>OCCViewer_EnvTextureDlg</name>
+    <message>
+        <source>ENV_TEXTURE</source>
+        <translation type="unfinished">Environment texture</translation>
+    </message>
+    <message>
+        <source>ENV_CLOUDS</source>
+        <translation type="unfinished">Clouds</translation>
+    </message>
+    <message>
+        <source>ENV_CV</source>
+        <translation type="unfinished">Cv</translation>
+    </message>
+    <message>
+        <source>ENV_MEDIT</source>
+        <translation type="unfinished">Medit</translation>
+    </message>
+    <message>
+        <source>ENV_PEARL</source>
+        <translation type="unfinished">Pearl</translation>
+    </message>
+    <message>
+        <source>ENV_SKY1</source>
+        <translation type="unfinished">Sky1</translation>
+    </message>
+    <message>
+        <source>ENV_SKY2</source>
+        <translation type="unfinished">Sky2</translation>
+    </message>
+    <message>
+        <source>ENV_LINES</source>
+        <translation type="unfinished">Lines</translation>
+    </message>
+    <message>
+        <source>ENV_ROAD</source>
+        <translation type="unfinished">Road</translation>
+    </message>
+    <message>
+        <source>ENV_CUSTOM</source>
+        <translation>Custom...</translation>
+    </message>
+  </context>
+  <context>
+    <name>OCCViewer_LightSourceDlg</name>
+    <message>
+        <source>LIGHT_SOURCE</source>
+        <translation type="unfinished">Light source</translation>
+    </message>
+    <message>
+        <source>TYPE</source>
+        <translation type="unfinished">Type</translation>
+    </message>
+    <message>
+        <source>DIRECTIONAL</source>
+        <translation type="unfinished">Directional</translation>
+    </message>
+    <message>
+        <source>DIRECTION</source>
+        <translation type="unfinished">Direction</translation>
+    </message>
+    <message>
+        <source>POSITIONAL</source>
+        <translation type="unfinished">Positional</translation>
+    </message>
+    <message>
+        <source>POSITION</source>
+        <translation type="unfinished">Position</translation>
+    </message>
+    <message>
+        <source>COLOR</source>
+        <translation type="unfinished">Color</translation>
+    </message>
+    <message>
+        <source>HEADLIGHT</source>
+        <translation type="unfinished">Headlight</translation>
+    </message>
+    <message>
+        <source>BUT_DEFAULT</source>
+        <translation type="unfinished">Default</translation>
+    </message>
+  </context>
 </TS>
diff --git a/src/OCCViewer/resources/occ_view_env_texture.png b/src/OCCViewer/resources/occ_view_env_texture.png
new file mode 100644 (file)
index 0000000..e360a87
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_env_texture.png differ
diff --git a/src/OCCViewer/resources/occ_view_light_source.png b/src/OCCViewer/resources/occ_view_light_source.png
new file mode 100644 (file)
index 0000000..e6cbf68
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_light_source.png differ
diff --git a/src/OCCViewer/resources/occ_view_ray_tracing.png b/src/OCCViewer/resources/occ_view_ray_tracing.png
new file mode 100644 (file)
index 0000000..fc64a13
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_ray_tracing.png differ