Esempio n. 1
0
            O = float(args[idx + 2 + x + 0])
            opacities.append([O])
    if a == "-res":
        W = int(args[idx + 1])
        H = int(args[idx + 2])
    if a == "-numFrames":
        numFrames = int(args[idx + 1])

#figure out what vtk file to open and what it is like
filename = args[len(args) - 1]
volumename = filename.split("/")[-1]
extps = volumename.rfind(".")
filetype = volumename[extps:]
volumename = volumename[0:extps]

window_size = vec2i(W, H)
aspect = Any(float(W) / H)

frame = sg.Frame()
frame.immediatelyWait = True
frame.createChild("windowSize", "vec2i", Any(window_size))

renderer = sg.Renderer("scivis")
frame.createChildAs("renderer", "renderer_scivis")

world = frame.child("world")

lightsMan = frame.child("lights")
baseMaterialRegistry = frame.child("baseMaterialRegistry")

importer = sg.getImporter(world, FileName(filename))
Esempio n. 2
0
import sys, numpy
import pysg as sg
from pysg import Any, vec3f, Data, vec2i

sg.init(sys.argv)

# specific rkcommon::math types needed for SG
pos = Any(vec3f(0.0, 0.0, 10.0))
dir = Any(vec3f(0.0, 0.0, -1.0))
up = Any(vec3f(0.0, 1.0, 0.0))

W = 1024
H = 768

window_size = Any(vec2i(W, H))
aspect = Any(float(W) / H)

vertex = numpy.array(
    [[-1.0, -1.0, 3.0], [-1.0, 1.0, 3.0], [1.0, -1.0, 3.0], [0.1, 0.1, 0.3]],
    dtype=numpy.float32)

color = numpy.array([[0.9, 0.5, 0.5, 1.0], [0.8, 0.8, 0.8, 1.0],
                     [0.8, 0.8, 0.8, 1.0], [0.5, 0.9, 0.5, 1.0]],
                    dtype=numpy.float32)

index = numpy.array([[0, 1, 2], [1, 2, 3]], dtype=numpy.uint32)

mat = numpy.array([0], dtype=numpy.uint32)

frame = sg.Frame()