Beispiel #1
0
    def render(self, dst):
        t = clock()
        
        sx, sy = self.grid_size
        center = np.array([0.5*sx, 0.5*sy, 0.0])
        phi = pi/3 + sin(t*3)*pi/8
        c, s = cos(phi), sin(phi)
        ofs = np.array([sin(1.2*t), cos(1.8*t), 0]) * sx * 0.2
        eye_pos = center + np.array([cos(t)*c, sin(t)*c, s]) * 15.0 + ofs
        target_pos = center + ofs

        R, self.tvec = common.lookat(eye_pos, target_pos)
        self.rvec = common.mtx2rvec(R)

        self.draw_quads(dst, self.white_quads, (245, 245, 245))
        self.draw_quads(dst, self.black_quads, (10, 10, 10))
Beispiel #2
0
    def render(self, dst):
        t = clock()

        sx, sy = self.grid_size
        center = np.array([0.5 * sx, 0.5 * sy, 0.0])
        phi = pi / 3 + sin(t * 3) * pi / 8
        c, s = cos(phi), sin(phi)
        ofs = np.array([sin(1.2 * t), cos(1.8 * t), 0]) * sx * 0.2
        eye_pos = center + np.array([cos(t) * c, sin(t) * c, s]) * 15.0 + ofs
        target_pos = center + ofs

        R, self.tvec = common.lookat(eye_pos, target_pos)
        self.rvec = common.mtx2rvec(R)

        self.draw_quads(dst, self.white_quads, (245, 245, 245))
        self.draw_quads(dst, self.black_quads, (10, 10, 10))
Beispiel #3
0
    def render(self, dst):
        """render the video"""
        angle_t = self.angle_t
        self.angle_t += 1.0/30.0

        x_size, y_size = self.grid_size
        center = np.array([0.5*x_size, 0.5*y_size, 0.0])
        phi = pi/3 + sin(angle_t*3)*pi/8
        cos_phi, sin_phi = cos(phi), sin(phi)
        ofs = np.array([sin(1.2*angle_t), cos(1.8*angle_t), 0]) * x_size * 0.2
        eye_pos = center + np.array([cos(angle_t)*cos_phi,
                                     sin(angle_t)*cos_phi, sin_phi]) * 15.0 + ofs
        target_pos = center + ofs

        mtx, self.tvec = common.lookat(eye_pos, target_pos)
        self.rvec = common.mtx2rvec(mtx)

        self.draw_quads(dst, self.white_quads, (245, 245, 245))
        self.draw_quads(dst, self.black_quads, (10, 10, 10))