Beispiel #1
0
    def render(self, camposx=None, camposy=None, camposz=None, camang=None):
#, camortx=None, camorty=None, camortz=None, camortw=None):
        cament = naali.getCamera()
        p = cament.placeable

        if camposx is not None:
            pos = Vec(*(float(v) for v in [camposx, camposy, camposz]))
            p.Position = pos

        if camang is not None:
            ort = p.Orientation
            start = Quat(0, 0, -0.707, -0.707)
            rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -float(camang))
            new = start * rot
            p.Orientation = new

        #if camortx is not None:
        #    ort = Quat(*(float(v) for v in [camortw, camortx, camorty, camortz]))
        #    p.Orientation = ort

        #return str(p.Position), str(p.Orientation) #self.render1()
        baseurl, imgname = save_screenshot()
        imgurl = baseurl + imgname

        pos = p.Position
        ort = p.Orientation
        #vec, ang = toAngleAxis(p.Orientation)
        #print vec, ang
        euler = quat_to_euler([ort.scalar(), ort.x(), ort.y(), ort.z()])
        ang = euler[0]
        if ang < 0:
            ang = 360 + ang

        return abshtml % (imgurl,
                          ang,
                          pos.x(), pos.y(), pos.z()
                          #ort.scalar(), ort.x(), ort.y(), ort.z(),
                          )
Beispiel #2
0
    def render(self, camposx=None, camposy=None, camposz=None, camang=None):
#, camortx=None, camorty=None, camortz=None, camortw=None):
        cament = naali.getCamera()
        p = cament.placeable

        if camposx is not None:
            pos = Vec(*(float(v) for v in [camposx, camposy, camposz]))
            p.position = pos

        if camang is not None:
            ort = p.orientation
            start = Quat(0, 0, -0.707, -0.707)
            rot = Quat.fromAxisAndAngle(Vec(0, 1, 0), -float(camang))
            new = start * rot
            p.orientation = new

        #if camortx is not None:
        #    ort = Quat(*(float(v) for v in [camortw, camortx, camorty, camortz]))
        #    p.orientation = ort

        #return str(p.position), str(p.orientation) #self.render1()
        baseurl, imgname = save_screenshot()
        imgurl = baseurl + imgname

        pos = p.position
        ort = p.orientation
        #vec, ang = toAngleAxis(p.orientation)
        #print vec, ang
        euler = mu.quat_to_euler(ort)
        ang = euler[0]
        if ang < 0:
            ang = 360 + ang

        return abshtml % (imgurl,
                          ang,
                          pos.x(), pos.y(), pos.z()
                          #ort.scalar(), ort.x(), ort.y(), ort.z(),
                          )