예제 #1
0
int maoni_main(int argc, char* argv[], RenderAlgorithm* algorithm_stack)
{
	boost::mpi::environment env(argc, argv);
	QApplication app(argc, argv);
	Q_INIT_RESOURCE( Resources);

	QPixmap pixmap(":/Maoni/Splashscreen.jpg");
	QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint);

	FrameDataIceT framedata(algorithm_stack);

	RenderWidgetIceT* icet_widget = new RenderWidgetIceT(framedata);

	QWidget* main_window;
	if (framedata.master())
	{
		MainWindow* mw = new MainWindow(framedata, icet_widget);

		TilesWidget* tiles_widget = new TilesWidget(framedata);
		mw->connect(mw, SIGNAL(data_updated()), tiles_widget, SLOT(
				update_browser()));

		mw->add_dock("Tile Config", Qt::LeftDockWidgetArea, //
				tiles_widget);
		main_window = mw;
		splash.show();
	}
	else
	{
		main_window = icet_widget;
	}

	QString window_title("Maoni using IceT Parallel Rendering; Rank %1");
	main_window->setWindowTitle(window_title.arg(framedata.myrank()));

	QTimer::singleShot(1000, main_window, SLOT(show()));
	QTimer::singleShot(1337, &splash, SLOT(close()));

	env.abort(app.exec());
	return 0;
}
예제 #2
0
파일: Maoni.cpp 프로젝트: shutter/libMaoni
int maoni_main(int argc, char* argv[], //
		RenderAlgorithm* algorithm_stack, MeshLoader* mesh_loader_stack)
{
	QApplication app(argc, argv);
	Q_INIT_RESOURCE(Resources);

	QPixmap pixmap(":/Maoni/Splashscreen.jpg");
	QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint);
	splash.show();
	splash.showMessage("Loading Widgets...");

	FrameData framedata(algorithm_stack, mesh_loader_stack);

	MainWindow main_window(framedata, new RenderWidget(framedata));
	main_window.setWindowTitle("Maoni");

	QTimer::singleShot(1000, &main_window, SLOT(show()));
	QTimer::singleShot(1337, &splash, SLOT(close()));

	return app.exec();
}
예제 #3
0
std::list<animation>
load_anims (const std::vector<char>& buf)
{
    std::list<animation> result;
    const header& hdr (*(header*)&buf[0]);

    const char* str   {(char*)&buf[hdr.ofs_text]};
    const anim* anims {(anim*)&buf[hdr.ofs_anims]};
    const pose* poses {(pose*)&buf[hdr.ofs_poses]};

    //std::vector<matrix3x4<float>> frames (hdr.num_frames * hdr.num_poses);
    uint16_t* framedata ((uint16_t*)&buf[hdr.ofs_frames]);

    for(size_t i {0}; i < hdr.num_anims; ++i)
    {
        const anim& a (anims[i]);
        animation new_anim;

        new_anim.name = &str[a.name];


    }

    for(size_t i {0}; i < hdr.num_frames; ++i)
    {
        for(size_t j {0}; j < hdr.num_poses; ++j)
        {
            const pose& p (poses[j]);

            vector3<float>    translate (p.channeloffset);
            quaternion<float> rotate    (p.channeloffset + 3);
            vector3<float>    scale     (p.channeloffset + 7);

            if (p.mask&0x01) translate.x += *framedata++ * p.channelscale[0];
            if (p.mask&0x02) translate.y += *framedata++ * p.channelscale[1];
            if (p.mask&0x04) translate.z += *framedata++ * p.channelscale[2];

            if (p.mask&0x08) rotate.x += *framedata++ * p.channelscale[3];
            if (p.mask&0x10) rotate.y += *framedata++ * p.channelscale[4];
            if (p.mask&0x20) rotate.z += *framedata++ * p.channelscale[5];
            if (p.mask&0x40) rotate.w += *framedata++ * p.channelscale[6];

            if (p.mask&0x80)  scale.x += *framedata++ * p.channelscale[7];
            if (p.mask&0x100) scale.y += *framedata++ * p.channelscale[8];
            if (p.mask&0x200) scale.z += *framedata++ * p.channelscale[9];

            // Concatenate each pose with the inverse base pose to avoid doing this at animation time.
            // If the joint has a parent, then it needs to be pre-concatenated with its parent's base pose.
            // Thus it all negates at animation time like so:
            //   (parentPose * parentInverseBasePose) * (parentBasePose * childPose * childInverseBasePose) =>
            //   parentPose * (parentInverseBasePose * parentBasePose) * childPose * childInverseBasePose =>
            //   parentPose * childPose * childInverseBasePose

            matrix3x4<float> m (rotation_matrix(normalize(rotate)) * matrix3<float>::diagonal(scale), translate);
//            m *= inversebaseframe[j];

//            if(p.parent >= 0)
//                frames[i*hdr.num_poses + j] = baseframe[p.parent] * m ;
//            else
//                frames[i*hdr.num_poses + j] = m;
        }
    }

    return result;
}