Last active
October 28, 2024 17:15
-
-
Save kwahoo2/92fde23a56e9787a0cf820429fbddee7 to your computer and use it in GitHub Desktop.
SoEnvironment usage in FreeCAD scene
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SoEnvironment usage in FreeCAD scene | |
# https://www.coin3d.org/coin/classSoEnvironment.html | |
# https://forum.freecad.org/viewtopic.php?p=785643#p785643 | |
from pivy.coin import SoEnvironment | |
se = SoEnvironment() # create a new node | |
sg = Gui.ActiveDocument.ActiveView.getSceneGraph() | |
sg.insertChild(se, 1) # add the node at the beginning of our scene | |
se.ambientIntensity.getValue() # read value for current ambient light eg.: 0.2 | |
se.ambientIntensity.setValue(0.8) # set a new value for ambient light, can be higher than 1 too, since it is multiplied by AmbientColor property of a material | |
# add fog | |
se.fogType = SoEnvironment.HAZE | |
# different type of fog | |
se.fogType = SoEnvironment.SMOKE | |
# make the fog red | |
from pivy.coin import SbColor | |
se.fogColor = SbColor(1, 0, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment