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 TexCoordf &ll, const TexCoordf &ur); 00039 void set_uv_range(const TexCoordf &ll, const TexCoordf &lr, const TexCoordf &ur, const TexCoordf &ul); 00040 void set_uv_range(const TexCoord3f &ll, const TexCoord3f &lr, const TexCoord3f &ur, const TexCoord3f &ul); 00041 void set_uv_range(const LVector4f &x, const LVector4f &y, const LVector4f &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(float left, float right, float bottom, float top); 00049 INLINE void set_frame(const LVecBase4f &frame); 00050 INLINE void set_frame(const Vertexf &ll, const Vertexf &lr, const Vertexf &ur, const Vertexf &ul); 00051 INLINE void set_frame_fullscreen_quad(); 00052 00053 INLINE void set_color(float r, float g, float b, float a); 00054 INLINE void set_color(const Colorf &color); 00055 00056 INLINE void set_has_normals(bool flag); 00057 00058 INLINE void set_source_geometry(PandaNode *node, const LVecBase4f &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 Vertexf _ul_tex, _ll_tex, _lr_tex, _ur_tex; 00068 TexCoord3f _ul_pos, _ll_pos, _lr_pos, _ur_pos; 00069 00070 bool _has_color; 00071 Colorf _color; 00072 00073 bool _has_normals; 00074 00075 PT(PandaNode) _source_geometry; 00076 LVecBase4f _source_frame; 00077 }; 00078 00079 #include "cardMaker.I" 00080 00081 #endif 00082