DiscussionsIssue archiveOCCT:Visualization

Archived issue #0032183

Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light

Open CASCADEOCCT:Visualizationclosed68 public notes

Search issues

Description

It is proposed implementing AIS_LightSource::ProcessDragging() interface for rotating directional light source.

This could be done like this:
- Add sphere sensitive for a light (#0032182).
- Dynamically draw a point (cross of two lines on sphere) via HilightWithColor() method implemented for a custom Owner object. Implement IsForcedHilight() to ensure cross is updated on mouse move.
- Calculate AIS_LightSource::ProcessDragging() interface to apply rotation as a delta between points on a sensitive sphere.

Steps to reproduce

v3d light_source dyn_highlight

Public activity

68 archived notes

Participants are labeled by their role within this record.

01Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Wed Mar 17 17:38:00 2021 +0300

    0032182: Visualization - add Select3D_SensitiveSphere
    
    - created Select3D_SensitiveSphere class
    - implemented interfaces for intersection methods
    - added tests

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
02Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
03Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
04Commenter 4
Solution Implementation, Testing
05Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
06Commenter 6
Testing
07Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
08Commenter 8
Solution Evaluation
09Commenter 9
Solution Evaluation
10Commenter 10
Solution implementation, Testing
11Commenter 11
Solution implementation
12Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
13Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
14Commenter 14
15Commenter 15
Patch is ready to review:
  - OCCT: CR32183_1
16Commenter 16
Solution Implementation
17Commenter 17
Solution Implementation
18Commenter 18
Solution Implementation
19Commenter 19
Solution Implementation
20Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
21Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
22Commenter 22
23Commenter 23
Patch is ready to review:
- OCCT: CR32183_2
24Commenter 24
Solution Implementation, Testing
25Commenter 25
Solution Implementation, Testing
26Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Wed Jun 30 18:14:34 2021 +0300

    # osa remarks
    - added highlighting
    - fixed default arc size

27Commenter 27
Solution Implementation, Testing
28Commenter 28
Solution Implementation, Testing
29Commenter 29
Solution Implementation, Testing
30Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 5 10:33:17 2021 +0300

    # kgv remarks

31Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
32Commenter 32
Analysis, Solution Implementation
33Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
34Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
35Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
36Commenter 36
Testing, Integration

37Commenter 37
38Commenter 38
Patch is ready to review:
- OCCT: CR32183_4
39Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Jul 16 14:19:42 2021 +0300

    # fixed constructor and added test

40Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
    - Added test
41Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
42Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 19 11:16:24 2021 +0300

    # fixed constructor

43Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
    - Added test
    
    # fixed constructor
44Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
45Commenter 45
46Commenter 46
Patch is ready to review:
- OCCT: CR32183_6
47Commenter 3
Branch [archived branch] has been updated by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Tue Jul 20 09:32:45 2021 +0300

    # cosmetics

48Author
Cosmetic remarks have been pushed to CR32183_6.

+Standard_Boolean AIS_LightSourceOwner::IsForcedHilight() const
+{
+  return true;

Is there a reason to force highlight for non-draggable light source types?

@@ -53,7 +54,7 @@ Standard_Boolean Select3D_SensitiveSphere::Matches (SelectBasics_SelectingVolume
...
+  myLastDetectedPoint = theMgr.DetectedPoint (thePickResult.Depth());

Why not using thePickResult.PickedPoint() here?
In addition, normally ::Matches() is expected to reset last detected result on failure.

+void AIS_LightSourceOwner::HilightWithColor()
...
+      aPrs->Display();

White highlighting is not reset when dragging another object - only after clicking on no object.
I don't think that white highlighting is necessary at all.

The following scripts leads to unhandled exception and application crash:
pload MODELING VISUALIZATION

# create simple scene
box b 1 2 3
box bb -5 -5 0 10 10 0 -preview
vclear
vinit View1
vcamera -persp
vdisplay -dispMode 1 b bb
vaspects bb -material STONE
vfit

# setup light sources
set aPrsSize 75
vlight -clear
vlight -add AMBIENT -color WHITE -display amb -prsSize $aPrsSize

# add WHITE directional light source
vlight -add DIRECTIONAL -color WHITE -direction 1.0  1.0 -1.0 -head 0 -display dir1 -prsSize $aPrsSize
vlight -change 1 -castShadows 1

# add RED directional light source in disabled state
vlight -add DIRECTIONAL -color RED   -direction 1.0 -1.0 -0.5 -head 0 -display dir2 -prsSize $aPrsSize
vselect 300 85
vlight -change 2 -castShadows 1

vrenderparams -shadowMapBias 0.01


Result:
An exception was caught [revision removed] : Standard_ConstructionError: gp_Dir::Crossed() - result vector has zero norm

and then crash.
49Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
50Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
    - Added test
51Commenter 51
Testing, Solution Implementation
52Commenter 3
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Wed Jul 21 15:53:15 2021 +0300

    # kgv remarks
    - added possibility to turn on/off light source dragging

53Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: mkrylova
Date: Fri Mar 26 12:31:22 2021 +0300

    0032183: Visualization - implement AIS_LightSource::ProcessDragging() for rotating directional light
    
    - Added sensitive sphere for a light source
    - Implemented AIS_LightSource::ProcessDragging() interface for rotating directional light source
    - Added possibility to turn on/off directional light source dragging
    - Added test
54Commenter 54
Testing, Solution Implementation
55Commenter 55
56Commenter 56
Patch is ready to review:
- OCCT: CR32183_8
57Commenter 57
Solution Implementation
58Commenter 1
Combination -
OCCT branch : [archived branch]
master SHA - [revision removed]
[revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17248.180000000266 / 17229.680000000302 [+0.11%]
Products
Total CPU difference: 11453.40000000009 / 11477.160000000118 [-0.21%]
Windows-64-VC14:
OCCT
Total CPU difference: 19038.78125 / 19020.171875 [+0.10%]
Products
Total CPU difference: 12762.65625 / 12734.125 [+0.22%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
59Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
60Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
61Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
62Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
63Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
64Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
65Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
66Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
67Commenter 3
Branch [archived branch] has been deleted by Participant.

[revision removed]
68Commenter 68
Solution elaboration

Related records