Skip to content

Commit

Permalink
Add ZOffset property to EnvironmentConfig
Browse files Browse the repository at this point in the history
The ZOffset makes it possible to move the environment up and down the Z
Axis. This is useful to have the ground displayed below your geometry so
it does not overlap.

By default it is set to -1mm so it is below all the geometry on the
origin.
  • Loading branch information
furti committed Nov 16, 2018
1 parent 3248076 commit 16b8b32
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ You might notice, that event though the object is visible, nothing is shown in t
![Settings](./Resources/Documentation/Environment_Config.png)

### Ground Image
This is the image that should be displayed on the ground plane. This should be a quadratic image as the ground plane is also quadratic.
This is the image that should be displayed on the ground plane. This should be a quadratic image as the ground plane is also quadratic. The size of the ground plane is calculated according to the radius and length properties.

### Panorama Image
This image is displayed behind your geometry. You can define the length and hight of this plane with the properties of the same name.
This image is displayed behind your geometry. You can define the length and height of this plane with the properties of the same name.

### Sky Image
This is the image that is displayed above the panorama image as the sky. The length is the same as for the panorama Image. The height is calculated according to the sky overlap, radius and length properties.
Expand All @@ -142,6 +142,10 @@ This property defines the distance, the sky plane should run down behind the pan
### Rotation
The image above displays the default placement of the environment textures. The rotation can be used to rotate the whole environment around the Z axis. You can use this to orient the environment to face your camera.

### ZOffset
This property can be used to move the environment up and down the Z-Axis. This is useful to have the ground plane displayed below your geometry.
By default this property is set to -1mm so that it is below all geometry on the origin plane.

</details>

## Technical details
Expand Down
7 changes: 6 additions & 1 deletion environment_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import arch_texture_utils.py2_utils as py2_utils

GEOMETRY_COORDINATES = ['Radius', 'Length', 'Height']
TRANSFORM_PARAMETERS = ['ZOffset', 'Rotation']
ROTATION_VECTOR = coin.SbVec3f(0, 0, -1)

def noTexture(image):
Expand Down Expand Up @@ -36,6 +37,7 @@ def __init__(self, obj):
obj.addProperty("App::PropertyLength", "Height", "Geometry", "The overall Height of the environment panorama texture").Height = 50000
obj.addProperty("App::PropertyLength", "SkyOverlap", "Geometry", "The distance the sky overlaps with the panorama texture").SkyOverlap = 25000
obj.addProperty("App::PropertyAngle", "Rotation", "Geometry", "The rotation for the environment").Rotation = 0
obj.addProperty("App::PropertyDistance", "ZOffset", "Geometry", "The offset of the environment on the Z-Axis").ZOffset = -1

obj.addProperty("App::PropertyFile", "PanoramaImage", "Texture", "The image of the panorama to show as environment texture").PanoramaImage = ''
obj.addProperty("App::PropertyFile", "SkyImage", "Texture", "The image of the sky to show as environment texture").SkyImage = ''
Expand Down Expand Up @@ -88,8 +90,11 @@ def updateNodeVisibility(self):

def updateTransformNode(self):
rotation = math.radians(self.Object.Rotation.Value)
translation = coin.SoSFVec3f()
translation.setValue(coin.SbVec3f(0, 0, self.Object.ZOffset.Value))

self.transformNode.rotation.setValue(ROTATION_VECTOR, rotation)
self.transformNode.translation.setValue(translation)

def setupPanoramaNode(self):
panoramaNode = coin.SoSeparator()
Expand Down Expand Up @@ -367,7 +372,7 @@ def updateData(self, fp, prop):
self.updatePanoramaCoordinates()
self.updateSkyCoordinates()
self.updateGroundCoordinates()
elif prop == 'Rotation':
elif prop in TRANSFORM_PARAMETERS:
self.updateTransformNode()
elif prop == 'PanoramaImage':
self.panoramaTexture.filename = py2_utils.textureFileString(self.Object.PanoramaImage)
Expand Down

0 comments on commit 16b8b32

Please sign in to comment.