Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pandaFramework.h"
- #include "pandaSystem.h"
- #include "antialiasAttrib.h"
- #include "load_prc_file.h"
- #include "genericAsyncTask.h"
- #include "asyncTaskManager.h"
- PandaFramework framework;
- PT(AsyncTaskManager) taskMgr = AsyncTaskManager::get_global_ptr();
- PT(ClockObject) globalClock = ClockObject::get_global_clock();
- NodePath camera;
- AsyncTask::DoneStatus SpinCameraTask(GenericAsyncTask* task, void* data) {
- // Calculate the new position and orientation (inefficient - change me!)
- double time = globalClock->get_real_time();
- double angledegrees = time * 6.0;
- double angleradians = angledegrees * (3.14 / 180.0);
- camera.set_pos(20*sin(angleradians),-20.0*cos(angleradians),3);
- camera.set_hpr(angledegrees, 0, 0);
- // Tell the task manager to continue this task the next frame.
- return AsyncTask::DS_cont;
- }
- int main(int argc, char *argv[]) {
- //config file line
- load_prc_file_data("", "multisamples 1");
- framework.open_framework(argc, argv);
- framework.set_window_title("My Panda3D Window");
- WindowFramework *window = framework.open_window();
- camera = window->get_camera_group();
- //Antialiasing enabled
- window->get_render().set_antialias(AntialiasAttrib::M_auto);
- // Model is in "D:\cuboid.egg"
- NodePath m = window->load_model(framework.get_models(), "/d/cuboid.egg");
- m.set_scale(0.05);
- m.reparent_to(window->get_render());
- taskMgr->add(new GenericAsyncTask("Spins the camera", &SpinCameraTask, (void*) NULL));
- framework.main_loop();
- framework.close_framework();
- return (0);
- }
Add Comment
Please, Sign In to add comment