Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/testbed/loader_test.cxx

Go to the documentation of this file.
00001 // Filename: loader_test.cxx
00002 // Created by:  
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include <eventHandler.h>
00020 #include <chancfg.h>
00021 #include <get_rel_pos.h>
00022 #include <loader.h>
00023 #include <pt_NamedNode.h>
00024 #include <framework.h>
00025 
00026 uint model_id;
00027 const int MAX_LOOPS = 100;
00028 
00029 void event_p(CPT_Event) {
00030   //model_id = loader.request_load("jafar-statue.egg");
00031   //model_id = loader.request_load("camera.egg");
00032   //model_id = loader.request_load("box.egg");
00033   //model_id = loader.request_load("yup-axis.egg");
00034   //model_id = loader.request_load("hand.egg");
00035 
00036   //model_id = loader.request_load("frowney.egg", "");
00037   //model_id = loader.request_load("trolley.bam", "");
00038   //model_id = loader.request_load("smiley.egg", "");
00039   //model_id = loader.request_load("jack.bam", "");
00040   model_id = loader.request_load("herc-6000.egg", "");
00041 }
00042 
00043 void event_c(CPT_Event) {
00044   if (loader.check_load(model_id))
00045     cerr << "load is complete" << endl;
00046   else
00047     cerr << "loading not finished yet" << endl;
00048 }
00049 
00050 void event_s(CPT_Event) {
00051   PT_Node model = loader.fetch_load(model_id);
00052   if (model != (NamedNode*)0L)
00053     new RenderRelation(render, model);
00054   else
00055     cerr << "null model!" << endl;
00056 }
00057 
00058 void loader_keys(EventHandler& eh) {
00059   eh.add_hook("p", event_p);
00060   eh.add_hook("c", event_c);
00061   eh.add_hook("s", event_s);
00062 }
00063 
00064 int main(int argc, char *argv[]) {
00065   define_keys = &loader_keys;
00066 //  loader.fork_asynchronous_thread();
00067   return framework_main(argc, argv);
00068 }

Generated on Fri May 2 00:44:08 2003 for Panda by doxygen1.3