Ejemplo n.º 1
0
      # Append to all collected verts/faces/values.
      if all_verts is None:
        all_verts = verts
        all_faces = faces
        all_strikes = strikes
      else:
        faces += all_verts.shape[0]
        all_verts = np.concatenate((all_verts, verts))
        all_faces = np.concatenate((all_faces, faces))
        all_strikes = np.concatenate((all_strikes, strikes))

  fault_surface = Mesh(all_verts, all_faces,
    vertex_values=all_strikes, shading='smooth')
  fault_surface.cmap = fault_cmap
  fault_surface.clim = fault_range
  fault_surface.shininess = 0.01
  fault_surface.ambient_light_color = Color([.2, .2, .2, 1])
  fault_surface.light_dir = (5, -10, 5)

  visual_nodes = volume_slices(seismic_vol,
    cmaps=seismic_cmap,
    clims=seismic_range,
    interpolation='bilinear', **slicing)
  xyz_axis = XYZAxis()
  colorbar = Colorbar(cmap=fault_cmap, clim=fault_range,
                      label_str='Fault Strike Angle', size=colorbar_size)

  visual_nodes.append(fault_surface)
  canvas5 = SeismicCanvas(title='Fault Surfaces',
                          visual_nodes=visual_nodes,
                          xyz_axis=xyz_axis,
Ejemplo n.º 2
0
texture_path = load_data_file('spot/spot.png')
vertices, faces, normals, texcoords = read_mesh(mesh_path)
texture = np.flipud(imread(texture_path))

canvas = scene.SceneCanvas(keys='interactive',
                           bgcolor='white',
                           size=(800, 600))
view = canvas.central_widget.add_view()

view.camera = 'arcball'
# Adapt the depth to the scale of the mesh to avoid rendering artefacts.
view.camera.depth_value = 10 * (vertices.max() - vertices.min())

shading = None if args.shading == 'none' else args.shading
mesh = Mesh(vertices, faces, shading=shading, color='white')
mesh.shininess = 1e-3
view.add(mesh)

texture_filter = TextureFilter(texture, texcoords)
mesh.attach(texture_filter)


@canvas.events.key_press.connect
def on_key_press(event):
    if event.key == "t":
        texture_filter.enabled = not texture_filter.enabled
        mesh.update()


def attach_headlight(mesh, view, canvas):
    light_dir = (0, -1, 0, 0)