Panda3D
 All Classes Functions Variables Enumerations
modelLoadRequest.h
1 // Filename: modelLoadRequest.h
2 // Created by: drose (29Aug06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MODELLOADREQUEST
16 #define MODELLOADREQUEST
17 
18 #include "pandabase.h"
19 
20 #include "asyncTask.h"
21 #include "filename.h"
22 #include "loaderOptions.h"
23 #include "pandaNode.h"
24 #include "pointerTo.h"
25 #include "loader.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : ModelLoadRequest
29 // Description : A class object that manages a single asynchronous
30 // model load request. Create a new ModelLoadRequest,
31 // and add it to the loader via load_async(), to begin
32 // an asynchronous load.
33 ////////////////////////////////////////////////////////////////////
34 class EXPCL_PANDA_PGRAPH ModelLoadRequest : public AsyncTask {
35 public:
36  ALLOC_DELETED_CHAIN(ModelLoadRequest);
37 
38 PUBLISHED:
39  ModelLoadRequest(const string &name,
40  const Filename &filename,
41  const LoaderOptions &options,
42  Loader *loader);
43 
44  INLINE const Filename &get_filename() const;
45  INLINE const LoaderOptions &get_options() const;
46  INLINE Loader *get_loader() const;
47 
48  INLINE bool is_ready() const;
49  INLINE PandaNode *get_model() const;
50 
51 protected:
52  virtual DoneStatus do_task();
53 
54 private:
55  Filename _filename;
56  LoaderOptions _options;
57  PT(Loader) _loader;
58  bool _is_ready;
59  PT(PandaNode) _model;
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  AsyncTask::init_type();
67  register_type(_type_handle, "ModelLoadRequest",
68  AsyncTask::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74 
75 private:
76  static TypeHandle _type_handle;
77 };
78 
79 #include "modelLoadRequest.I"
80 
81 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:26
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:47
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:43
A class object that manages a single asynchronous model load request.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85