MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031704Open CASCADE[OCCT] OCCT:Visualizationpublic2020-08-11 09:392020-10-29 15:49
Reporterkgv 
Assigned Toosa 
PrioritynormalSeverityfeature 
StatusresolvedResolutionopen 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.6.0*Fixed in Version 
Summary0031704: Visualization - add an interactive object AIS_LightSource representing a light source
DescriptionIt is desired providing an interactive object representing a light source.
Minimal requirements to the object:
- Should be bound to Graphic3d_CLight;
- Represent the basic properties of light source:
   * Position via icon of positional light sources (point, spot),
   * Vector of directional light sources,
   * Spot light source cone shape,
   * Name,
   * Light color,
   * Light intensity,
   * On/off state,
   * Headlight mark,
   * Cut-off range (distasnce);
- Assigning Local Transformation to interactive object should move corresponding light source;
- Headlight flag should define transformation-persistence mode.
- Advanced selection modes:
   * Ability to turn light on/off.

Testing:
- vlight should be extended with an option creating/removing presentation of defined light sources.
- A representable scene should be defined for playing with multiple light sources of different type.
Steps To Reproduce
pload MODELING VISUALIZATION
vclear
vinit View1 -width 1280 -height 720
vviewcube vc
box r -2500 -2000 0 5000 4000 3000
explode r FACE
vdisplay -noupdate -dispMode 1 r_1 r_2 r_4 r_5 r_6
vsetmaterial -noupdate r_1 STONE
vsetmaterial -noupdate r_2 STONE
vsetmaterial -noupdate r_4 STONE
vsetmaterial -noupdate r_5 STONE
vsetmaterial -noupdate r_6 STONE
vfit
vtrihedron t 0 0 0

box b1 0 0 0 1000 1000 1000
psphere s1 500
vdisplay -noupdate -dispMode 1 b1 s1
vsetmaterial -noupdate b1 PLASTIC
vsetmaterial -noupdate s1 GOLD
vlocation b1 -location -2000 0   0
vlocation s1 -location  1500 500 500

vrenderparams -shadingModel PBR
#vrenderparams -shadingModel PHONG
vlight -clear
vlight -add AMBIENT -intensity 0.1

set pg {-1500 500 1500}
vlight -add POSITIONAL -intensity 1000000 -pos {*}$pg -color GREEN -constAtten 1 -linearAtten 0.01
#vlight -add POSITIONAL -intensity 1000000 -pos {*}$pg -color GREEN -range 1000 # KO range for Phong

vpoint pgp {*}$pg; vsetcolor pgp GREEN
psphere pgs 100; vdisplay -noupdate -dispMode 0 pgs; vlocation pgs -location {*}$pg; vsetcolor pgs GREEN


set sr {0 0 500}
vlight -add SPOT -intensity 100000000 -pos {*}$sr -dir 1 0 0 -color RED
vpoint srp {*}$sr; vsetcolor srp RED
vpoint srp2 [expr [lindex $sr 0] + 100] [lindex $sr 1] [lindex $sr 2]; vsegment srd srp srp2; vsetcolor 
srd RED; verase srp2

vlight -add SPOT -intensity 100000000 -pos 0 0 0 -dir 0 0.2 -1 -color WHITE -head 1
vlight -change 1 -name POSITIONAL_LIGHT 1
vlight -display
vmanipulator manipulator -attach Graphic3d_CLight_pos5
TagsNo tags attached.
Test case number
Attached Filespng file icon presentation of light with headlight mark.png (243,793 bytes) 2020-10-28 15:35
png file icon different light sources.png (23,407 bytes) 2020-10-28 15:35
png file icon manipulator.png (16,508 bytes) 2020-10-28 15:35

- Relationships
related to 0031705assignedmkrylova Open CASCADE Visualization - move out construction of predefined markers from OpenGl_AspectsSprite to Graphic3d_MarkerImage 

-  Notes
(0095600)
git (administrator)
2020-10-02 18:26

Branch CR31704 has been created by mkrylova.

SHA-1: 449cb897fd43a804147007dceb93e3ee22622cfa


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 17:50:28 2020 +0300

    0031704: Visualization - add an interactive object AIS_LightSource representing a light source
    
    - Added new class AIS_LightSource - object representing a light source
    - Represented position, name, direction, Cut-off range and spot light source cone shape
    - Assigned Local Transformation to interactive object
    - Added an alternative function vlight, that manage the light by AIS_LightSource tools
(0095879)
git (administrator)
2020-10-09 19:03

Branch CR31704 has been updated forcibly by mkrylova.

SHA-1: cec6ad406877f31bc45292c94fc5307e12457774
(0095880)
git (administrator)
2020-10-09 19:06

Branch CR31704_1 has been created by mkrylova.

SHA-1: 43f03af5b8e1517a7dc485129b90fae304ae82da


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 17:50:28 2020 +0300

    0031704: Visualization - add an interactive object AIS_LightSource representing a light source
    
    - Added new class AIS_LightSource - object representing a light source
    - Represented position, name, direction, Cut-off range and spot light source cone shape
    - Assigned Local Transformation to interactive object
    - Added an alternative function vlight, that manage the light by AIS_LightSource tools
    - Added ability to turn on/off light interactively
    - Extended vlight_lightsource by opportunity to display light attributes
(0095885)
nds (developer)
2020-10-12 12:34

Dear Maria,

desired presentation!
But, how can you use class from AIS package in low-level V3d?

Best regards, Natalia
(0095980)
git (administrator)
2020-10-14 18:33

Branch CR31704_1 has been updated by mkrylova.

SHA-1: 72b0666c5e2712df930500993cf28fa96d803b2d


Detailed log of new commits:

Author: mkrylova
Date: Wed Oct 14 17:41:34 2020 +0300

    krv remarks:
    - delete mentions of AIS_LightSource in V3d_View
    - delete a clone method of vlight
    - update method vlight with possibilities of presentation via AIS_LightSource tools
    - move all presentation to method Compute

(0095981)
git (administrator)
2020-10-14 18:38

Branch CR31704_2 has been created by mkrylova.

SHA-1: 5ad480ce0af5a44b1570235dbe39c1f7ddd3f56a


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 17:50:28 2020 +0300

    0031704: Visualization - add an interactive object AIS_LightSource representing a light source
    
    - Added new class AIS_LightSource - object representing a light source
    - Represented position, name, direction, Cut-off range and spot light source cone shape
    - Assigned Local Transformation to interactive object
    - Updated function vlight with opportunities of presentation via AIS_LightSource tools
    - Added ability to turn on/off light intera
(0095982)
kgv (developer)
2020-10-14 19:15

+void AIS_LightSource::SetName (const TCollection_AsciiString& theName, Standard_Boolean theIsDisplay)

+{
+  myLightSource->SetName (theName);
+  isNameDisplayed = theIsDisplay;
+  // redisplay presentation
+  myCTXPtr->Display(this, Standard_True);
+  myCTXPtr->Redisplay(this, Standard_True);

This logic contradicts to AIS design - presentation itself is not supposed to redisplay itself on assigning some properties.

Use SetToUpdate() method to invalidate presentation and (re)display object outside (e.g. within vlight command, if needed).
(0095983)
kgv (developer)
2020-10-14 19:17

+  //! Alias for IsHeadlight().
+  Standard_Boolean Headlight() const { return myLightSource->Headlight(); }
+
+  //! Setup headlight flag.
+  void SetHeadlight (Standard_Boolean theValue) 
+  { 
+    myLightSource->SetHeadlight (theValue);
+  }

These is no point duplicating all Light properties within Interactive Object - it would be enough providing a getter to Light source itself.
(0095984)
kgv (developer)
2020-10-14 19:19

+      if (++anArgIt < theArgsNb)
+        if (Atof (theArgVec[anArgIt]) == 1)

Please never omit brackets within if statement.
(0096305)
git (administrator)
2020-10-27 17:32

Branch CR31704_3 has been created by mkrylova.

SHA-1: c91df6ae54a18b45278e151f8a87bff72e249b0f


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 17:50:28 2020 +0300

    0031704: Visualization - add an interactive object AIS_LightSource representing a light source
    
    - Added new class AIS_LightSource - object representing a light source
    - Represented position, name, direction, Cut-off range and spot light source cone shape
    - Assigned Local Transformation to interactive object
    - Updated function vlight with opportunities of presentation via AIS_LightSource tools
    - Added ability to turn on/off light
    - Added Transformation-persistence mode
(0096323)
kgv (developer)
2020-10-28 08:13

Maria, could you please put a detailed textual description (as well as a couple of screenshors) of the current patch as a comment to this bug?
- Presentation aspects of each light source type;
- Implemented interaction mechanisms.

Please also put test cases for testing new functionality.
(0096336)
mkrylova (developer)
2020-10-28 15:33

This patch provides the opportunity for presentation of light sources. Presentation of directional light source consists of the name of light and a line that is co-directed with the light direction.
Presentation of positional light source is made of the name of light, position and three circles radius of which is equal to range of light.
Presentation of spot light consists of the name and position of light source, direction like in directional light presentation, 2 segments starting at the light source’s position, the length of which is equal to the range of light source. The angle between these segments is equal to the angle of the light source. The ends of these segments are connected by a third segment, which is the diameter of the circle, indicating the spot from the light source.
Similar presentation is used in light sources presentation with head light mark that activates transformation-persistence mode.
In addition, this patch extended function vlight. First, two new commands were added, they are –display and –del_pres, these commands add and delete presentations of light sources respectively. These commands without any arguments are applied to all the light sources, but the user can specify the light to which he wants to display/delete the presentation by adding the number of light as an argument to –display/-del_pres. Also, to show/hide a specific presentation element, new arguments were added to -name, -range, -pos, -dir, -angle commands. Now the user can put 1 or 0 after all the arguments describing the light source characteristic, if the user wants to display or hide this element accordingly. By default, the item is not displayed.
One more feature that is provided in this patch is the ability to turn on/off the specific light source interactively in Viewer3d by clicking on its position.
To manage the light source interactively a user can use vmanipulator command. To attach light source to manipulator use the light source id that is specified in the vlight command.
(0096339)
git (administrator)
2020-10-28 16:46

Branch CR31704_3 has been updated by mkrylova.

SHA-1: 14f3ac93de797bcff084ca9f750d8aa9cde9e1fb


Detailed log of new commits:

Author: mkrylova
Date: Wed Oct 28 16:51:09 2020 +0300

    - fix code style mistakes
    - fix transformation for directional light sources

(0096372)
git (administrator)
2020-10-29 15:47

Branch CR31704_3 has been updated by mkrylova.

SHA-1: ccb542c25a688aa9e7875b019d98379c62ab005c


Detailed log of new commits:

Author: mkrylova
Date: Thu Oct 29 15:51:58 2020 +0300

    - added comments
    - fixed displaying mistakes
    - fixed code style

(0096375)
git (administrator)
2020-10-29 15:48

Branch CR31704_4 has been created by mkrylova.

SHA-1: 05aef6c35868126415104ff8fec707e37afae5a1


Detailed log of new commits:

Author: mkrylova
Date: Tue Sep 8 17:50:28 2020 +0300

    0031704: Visualization - add an interactive object AIS_LightSource representing a light source
    
    - Added new class AIS_LightSource - object representing a light source
    - Represented position, name, direction, Cut-off range and spot light source cone shape
    - Assigned Local Transformation to interactive object
    - Updated function vlight with opportunities of presentation via AIS_LightSource tools
    - Added ability to turn on/off light
    - Added Transformation-persistence mode

- Issue History
Date Modified Username Field Change
2020-08-11 09:39 kgv New Issue
2020-08-11 09:39 kgv Assigned To => kgv
2020-08-11 09:39 kgv Assigned To kgv => mkrylova
2020-08-11 09:39 kgv Status new => assigned
2020-08-11 09:42 kgv Relationship added related to 0031705
2020-09-21 17:42 kgv Target Version 7.5.0 => 7.6.0*
2020-10-02 18:26 git Note Added: 0095600
2020-10-09 19:03 git Note Added: 0095879
2020-10-09 19:06 git Note Added: 0095880
2020-10-12 12:34 nds Note Added: 0095885
2020-10-12 14:41 kgv Relationship added child of 0029290
2020-10-14 18:33 git Note Added: 0095980
2020-10-14 18:38 git Note Added: 0095981
2020-10-14 19:15 kgv Note Added: 0095982
2020-10-14 19:17 kgv Note Added: 0095983
2020-10-14 19:19 kgv Note Added: 0095984
2020-10-26 11:33 kgv Steps to Reproduce Updated View Revisions
2020-10-26 11:46 kgv Steps to Reproduce Updated View Revisions
2020-10-27 17:32 git Note Added: 0096305
2020-10-28 08:13 kgv Note Added: 0096323
2020-10-28 15:33 mkrylova Note Added: 0096336
2020-10-28 15:35 mkrylova File Added: presentation of light with headlight mark.png
2020-10-28 15:35 mkrylova File Added: different light sources.png
2020-10-28 15:35 mkrylova File Added: manipulator.png
2020-10-28 16:46 git Note Added: 0096339
2020-10-29 13:42 mkrylova Steps to Reproduce Updated View Revisions
2020-10-29 15:47 git Note Added: 0096372
2020-10-29 15:48 git Note Added: 0096375
2020-10-29 15:49 mkrylova Assigned To mkrylova => osa
2020-10-29 15:49 mkrylova Status assigned => resolved


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker