Panda3D
|
00001 // Filename: cardMaker.h 00002 // Created by: drose (16Mar02) 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 CARDMAKER_H 00016 #define CARDMAKER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "luse.h" 00021 #include "pandaNode.h" 00022 #include "pointerTo.h" 00023 #include "namable.h" 00024 #include "texture.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : CardMaker 00028 // Description : This class generates 2-d "cards", that is, 00029 // rectangular polygons, particularly useful for showing 00030 // textures etc. in the 2-d scene graph. 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDA_GRUTIL CardMaker : public Namable { 00033 PUBLISHED: 00034 INLINE CardMaker(const string &name); 00035 INLINE ~CardMaker(); 00036 00037 void reset(); 00038 void set_uv_range(const LTexCoord &ll, const LTexCoord &ur); 00039 void set_uv_range(const LTexCoord &ll, const LTexCoord &lr, const LTexCoord &ur, const LTexCoord &ul); 00040 void set_uv_range(const LTexCoord3 &ll, const LTexCoord3 &lr, const LTexCoord3 &ur, const LTexCoord3 &ul); 00041 void set_uv_range(const LVector4 &x, const LVector4 &y, const LVector4 &z); 00042 void set_uv_range_cube(int face); 00043 void set_uv_range(const Texture *tex); 00044 00045 INLINE void set_has_uvs(bool flag); 00046 INLINE void set_has_3d_uvs(bool flag); 00047 00048 INLINE void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top); 00049 INLINE void set_frame(const LVecBase4 &frame); 00050 INLINE void set_frame(const LVertex &ll, const LVertex &lr, const LVertex &ur, const LVertex &ul); 00051 INLINE void set_frame_fullscreen_quad(); 00052 00053 INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a); 00054 INLINE void set_color(const LColor &color); 00055 00056 INLINE void set_has_normals(bool flag); 00057 00058 INLINE void set_source_geometry(PandaNode *node, const LVecBase4 &frame); 00059 INLINE void clear_source_geometry(); 00060 00061 PT(PandaNode) generate(); 00062 00063 private: 00064 PT(PandaNode) rescale_source_geometry(); 00065 00066 bool _has_uvs, _has_3d_uvs; 00067 LVertex _ul_tex, _ll_tex, _lr_tex, _ur_tex; 00068 LTexCoord3 _ul_pos, _ll_pos, _lr_pos, _ur_pos; 00069 00070 bool _has_color; 00071 LColor _color; 00072 00073 bool _has_normals; 00074 00075 PT(PandaNode) _source_geometry; 00076 LVecBase4 _source_frame; 00077 }; 00078 00079 #include "cardMaker.I" 00080 00081 #endif 00082