Panda3D
modelLoadRequest.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file modelLoadRequest.h
10  * @author drose
11  * @date 2006-08-29
12  */
13 
14 #ifndef MODELLOADREQUEST_H
15 #define MODELLOADREQUEST_H
16 
17 #include "pandabase.h"
18 
19 #include "asyncTask.h"
20 #include "filename.h"
21 #include "loaderOptions.h"
22 #include "pandaNode.h"
23 #include "pointerTo.h"
24 #include "loader.h"
25 #include "nodePath.h"
26 
27 /**
28  * A class object that manages a single asynchronous model load request.
29  * Create a new ModelLoadRequest, and add it to the loader via load_async(),
30  * to begin an asynchronous load.
31  */
32 class EXPCL_PANDA_PGRAPH ModelLoadRequest : public AsyncTask {
33 public:
34  ALLOC_DELETED_CHAIN(ModelLoadRequest);
35 
36 PUBLISHED:
37  explicit ModelLoadRequest(const std::string &name,
38  const Filename &filename,
39  const LoaderOptions &options,
40  Loader *loader);
41 
42  INLINE const Filename &get_filename() const;
43  INLINE const LoaderOptions &get_options() const;
44  INLINE Loader *get_loader() const;
45 
46  INLINE bool is_ready() const;
47  INLINE PandaNode *get_model() const;
48 
49  MAKE_PROPERTY(filename, get_filename);
50  MAKE_PROPERTY(options, get_options);
51  MAKE_PROPERTY(loader, get_loader);
52 
53 protected:
54  virtual DoneStatus do_task();
55 
56 private:
57  Filename _filename;
58  LoaderOptions _options;
59  PT(Loader) _loader;
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
Specifies parameters that may be passed to the loader.
Definition: loaderOptions.h:23
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class represents a concrete task performed by an AsyncManager.
Definition: asyncTask.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class object that manages a single asynchronous model load request.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81