Panda3D

pgFrameStyle.h

00001 // Filename: pgFrameStyle.h
00002 // Created by:  drose (03Jul01)
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 PGFRAMESTYLE_H
00016 #define PGFRAMESTYLE_H
00017 
00018 #include "pandabase.h"
00019 
00020 #include "luse.h"
00021 #include "texture.h"
00022 #include "pointerTo.h"
00023 
00024 class PandaNode;
00025 class NodePath;
00026 
00027 ////////////////////////////////////////////////////////////////////
00028 //       Class : PGFrameStyle
00029 // Description : 
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDA_PGUI PGFrameStyle {
00032 PUBLISHED:
00033   INLINE PGFrameStyle();
00034   INLINE PGFrameStyle(const PGFrameStyle &copy);
00035   INLINE void operator = (const PGFrameStyle &copy);
00036 
00037   INLINE ~PGFrameStyle();
00038 
00039   enum Type {
00040     T_none,
00041     T_flat,
00042     T_bevel_out,
00043     T_bevel_in,
00044     T_groove,
00045     T_ridge,
00046     T_texture_border
00047   };
00048 
00049   INLINE void set_type(Type type);
00050   INLINE Type get_type() const;
00051 
00052   INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
00053   INLINE void set_color(const LColor &color);
00054   INLINE LColor get_color() const;
00055 
00056   INLINE void set_texture(Texture *texture);
00057   INLINE bool has_texture() const;
00058   INLINE Texture *get_texture() const;
00059   INLINE void clear_texture();
00060 
00061   INLINE void set_width(PN_stdfloat x, PN_stdfloat y);
00062   INLINE void set_width(const LVecBase2 &width);
00063   INLINE const LVecBase2 &get_width() const;
00064 
00065   INLINE void set_uv_width(PN_stdfloat u, PN_stdfloat v);
00066   INLINE void set_uv_width(const LVecBase2 &uv_width);
00067   INLINE const LVecBase2 &get_uv_width() const;
00068 
00069   INLINE void set_visible_scale(PN_stdfloat x, PN_stdfloat y);
00070   INLINE void set_visible_scale(const LVecBase2 &visible_scale);
00071   INLINE const LVecBase2 &get_visible_scale() const;
00072 
00073   LVecBase4 get_internal_frame(const LVecBase4 &frame) const;
00074 
00075   void output(ostream &out) const;
00076 
00077 public:
00078   bool xform(const LMatrix4 &mat);
00079   NodePath generate_into(const NodePath &parent, const LVecBase4 &frame,
00080                          int sort = 0);
00081 
00082 private:
00083   PT(PandaNode) generate_flat_geom(const LVecBase4 &frame);
00084   PT(PandaNode) generate_bevel_geom(const LVecBase4 &frame, bool in);
00085   PT(PandaNode) generate_groove_geom(const LVecBase4 &frame, bool in);
00086   PT(PandaNode) generate_texture_border_geom(const LVecBase4 &frame);
00087 
00088 private:
00089   Type _type;
00090   UnalignedLVecBase4 _color;
00091   PT(Texture) _texture;
00092   LVecBase2 _width;
00093   LVecBase2 _uv_width;
00094   LVecBase2 _visible_scale;
00095 };
00096 
00097 INLINE ostream &operator << (ostream &out, const PGFrameStyle &pfs);
00098 ostream &operator << (ostream &out, PGFrameStyle::Type type);
00099 
00100 #include "pgFrameStyle.I"
00101 
00102 #endif
 All Classes Functions Variables Enumerations