Panda3D
|
00001 // Filename: animateVerticesRequest.h 00002 // Created by: pratt (20Nov07) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef ANIMATEVERTICESREQUEST 00016 #define ANIMATEVERTICESREQUEST 00017 00018 #include "pandabase.h" 00019 00020 #include "asyncTask.h" 00021 #include "geomVertexData.h" 00022 #include "pointerTo.h" 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Class : AnimateVerticesRequest 00026 // Description : This class object manages a single asynchronous 00027 // request to animate vertices on a GeomVertexData 00028 // object. animate_vertices will be called with 00029 // force=true (i.e. blocking) in a sub-thread (if 00030 // threading is available). No result is stored or 00031 // returned from this object. It is expected that the 00032 // result will be cached and available for immediate 00033 // use later during rendering. Thus it is important 00034 // that the main thread block while these requests 00035 // are being run (presumably on multiple CPUs/cores), 00036 // to ensure that the data has been computed by the 00037 // time it's needed. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_PANDA_PGRAPH AnimateVerticesRequest : public AsyncTask { 00040 public: 00041 ALLOC_DELETED_CHAIN(AnimateVerticesRequest); 00042 00043 PUBLISHED: 00044 INLINE AnimateVerticesRequest(GeomVertexData *geom_vertex_data); 00045 00046 INLINE bool is_ready() const; 00047 00048 protected: 00049 virtual AsyncTask::DoneStatus do_task(); 00050 00051 private: 00052 PT(GeomVertexData) _geom_vertex_data; 00053 bool _is_ready; 00054 00055 public: 00056 static TypeHandle get_class_type() { 00057 return _type_handle; 00058 } 00059 static void init_type() { 00060 AsyncTask::init_type(); 00061 register_type(_type_handle, "AnimateVerticesRequest", 00062 AsyncTask::get_class_type()); 00063 } 00064 virtual TypeHandle get_type() const { 00065 return get_class_type(); 00066 } 00067 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00068 00069 private: 00070 static TypeHandle _type_handle; 00071 }; 00072 00073 #include "animateVerticesRequest.I" 00074 00075 #endif